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.

lazy-result.js 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _mapGenerator = _interopRequireDefault(require("./map-generator"));
  5. var _stringify2 = _interopRequireDefault(require("./stringify"));
  6. var _warnOnce = _interopRequireDefault(require("./warn-once"));
  7. var _result = _interopRequireDefault(require("./result"));
  8. var _parse = _interopRequireDefault(require("./parse"));
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
  11. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  12. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  13. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  14. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  15. function isPromise(obj) {
  16. return typeof obj === 'object' && typeof obj.then === 'function';
  17. }
  18. /**
  19. * A Promise proxy for the result of PostCSS transformations.
  20. *
  21. * A `LazyResult` instance is returned by {@link Processor#process}.
  22. *
  23. * @example
  24. * const lazy = postcss([autoprefixer]).process(css)
  25. */
  26. var LazyResult = /*#__PURE__*/function () {
  27. function LazyResult(processor, css, opts) {
  28. this.stringified = false;
  29. this.processed = false;
  30. var root;
  31. if (typeof css === 'object' && css !== null && css.type === 'root') {
  32. root = css;
  33. } else if (css instanceof LazyResult || css instanceof _result.default) {
  34. root = css.root;
  35. if (css.map) {
  36. if (typeof opts.map === 'undefined') opts.map = {};
  37. if (!opts.map.inline) opts.map.inline = false;
  38. opts.map.prev = css.map;
  39. }
  40. } else {
  41. var parser = _parse.default;
  42. if (opts.syntax) parser = opts.syntax.parse;
  43. if (opts.parser) parser = opts.parser;
  44. if (parser.parse) parser = parser.parse;
  45. try {
  46. root = parser(css, opts);
  47. } catch (error) {
  48. this.error = error;
  49. }
  50. }
  51. this.result = new _result.default(processor, root, opts);
  52. }
  53. /**
  54. * Returns a {@link Processor} instance, which will be used
  55. * for CSS transformations.
  56. *
  57. * @type {Processor}
  58. */
  59. var _proto = LazyResult.prototype;
  60. /**
  61. * Processes input CSS through synchronous plugins
  62. * and calls {@link Result#warnings()}.
  63. *
  64. * @return {Warning[]} Warnings from plugins.
  65. */
  66. _proto.warnings = function warnings() {
  67. return this.sync().warnings();
  68. }
  69. /**
  70. * Alias for the {@link LazyResult#css} property.
  71. *
  72. * @example
  73. * lazy + '' === lazy.css
  74. *
  75. * @return {string} Output CSS.
  76. */
  77. ;
  78. _proto.toString = function toString() {
  79. return this.css;
  80. }
  81. /**
  82. * Processes input CSS through synchronous and asynchronous plugins
  83. * and calls `onFulfilled` with a Result instance. If a plugin throws
  84. * an error, the `onRejected` callback will be executed.
  85. *
  86. * It implements standard Promise API.
  87. *
  88. * @param {onFulfilled} onFulfilled Callback will be executed
  89. * when all plugins will finish work.
  90. * @param {onRejected} onRejected Callback will be executed on any error.
  91. *
  92. * @return {Promise} Promise API to make queue.
  93. *
  94. * @example
  95. * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
  96. * console.log(result.css)
  97. * })
  98. */
  99. ;
  100. _proto.then = function then(onFulfilled, onRejected) {
  101. if (process.env.NODE_ENV !== 'production') {
  102. if (!('from' in this.opts)) {
  103. (0, _warnOnce.default)('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.');
  104. }
  105. }
  106. return this.async().then(onFulfilled, onRejected);
  107. }
  108. /**
  109. * Processes input CSS through synchronous and asynchronous plugins
  110. * and calls onRejected for each error thrown in any plugin.
  111. *
  112. * It implements standard Promise API.
  113. *
  114. * @param {onRejected} onRejected Callback will be executed on any error.
  115. *
  116. * @return {Promise} Promise API to make queue.
  117. *
  118. * @example
  119. * postcss([autoprefixer]).process(css).then(result => {
  120. * console.log(result.css)
  121. * }).catch(error => {
  122. * console.error(error)
  123. * })
  124. */
  125. ;
  126. _proto.catch = function _catch(onRejected) {
  127. return this.async().catch(onRejected);
  128. }
  129. /**
  130. * Processes input CSS through synchronous and asynchronous plugins
  131. * and calls onFinally on any error or when all plugins will finish work.
  132. *
  133. * It implements standard Promise API.
  134. *
  135. * @param {onFinally} onFinally Callback will be executed on any error or
  136. * when all plugins will finish work.
  137. *
  138. * @return {Promise} Promise API to make queue.
  139. *
  140. * @example
  141. * postcss([autoprefixer]).process(css).finally(() => {
  142. * console.log('processing ended')
  143. * })
  144. */
  145. ;
  146. _proto.finally = function _finally(onFinally) {
  147. return this.async().then(onFinally, onFinally);
  148. };
  149. _proto.handleError = function handleError(error, plugin) {
  150. try {
  151. this.error = error;
  152. if (error.name === 'CssSyntaxError' && !error.plugin) {
  153. error.plugin = plugin.postcssPlugin;
  154. error.setMessage();
  155. } else if (plugin.postcssVersion) {
  156. if (process.env.NODE_ENV !== 'production') {
  157. var pluginName = plugin.postcssPlugin;
  158. var pluginVer = plugin.postcssVersion;
  159. var runtimeVer = this.result.processor.version;
  160. var a = pluginVer.split('.');
  161. var b = runtimeVer.split('.');
  162. if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
  163. console.error('Unknown error from PostCSS plugin. Your current PostCSS ' + 'version is ' + runtimeVer + ', but ' + pluginName + ' uses ' + pluginVer + '. Perhaps this is the source of the error below.');
  164. }
  165. }
  166. }
  167. } catch (err) {
  168. if (console && console.error) console.error(err);
  169. }
  170. };
  171. _proto.asyncTick = function asyncTick(resolve, reject) {
  172. var _this = this;
  173. if (this.plugin >= this.processor.plugins.length) {
  174. this.processed = true;
  175. return resolve();
  176. }
  177. try {
  178. var plugin = this.processor.plugins[this.plugin];
  179. var promise = this.run(plugin);
  180. this.plugin += 1;
  181. if (isPromise(promise)) {
  182. promise.then(function () {
  183. _this.asyncTick(resolve, reject);
  184. }).catch(function (error) {
  185. _this.handleError(error, plugin);
  186. _this.processed = true;
  187. reject(error);
  188. });
  189. } else {
  190. this.asyncTick(resolve, reject);
  191. }
  192. } catch (error) {
  193. this.processed = true;
  194. reject(error);
  195. }
  196. };
  197. _proto.async = function async() {
  198. var _this2 = this;
  199. if (this.processed) {
  200. return new Promise(function (resolve, reject) {
  201. if (_this2.error) {
  202. reject(_this2.error);
  203. } else {
  204. resolve(_this2.stringify());
  205. }
  206. });
  207. }
  208. if (this.processing) {
  209. return this.processing;
  210. }
  211. this.processing = new Promise(function (resolve, reject) {
  212. if (_this2.error) return reject(_this2.error);
  213. _this2.plugin = 0;
  214. _this2.asyncTick(resolve, reject);
  215. }).then(function () {
  216. _this2.processed = true;
  217. return _this2.stringify();
  218. });
  219. return this.processing;
  220. };
  221. _proto.sync = function sync() {
  222. if (this.processed) return this.result;
  223. this.processed = true;
  224. if (this.processing) {
  225. throw new Error('Use process(css).then(cb) to work with async plugins');
  226. }
  227. if (this.error) throw this.error;
  228. for (var _iterator = _createForOfIteratorHelperLoose(this.result.processor.plugins), _step; !(_step = _iterator()).done;) {
  229. var plugin = _step.value;
  230. var promise = this.run(plugin);
  231. if (isPromise(promise)) {
  232. throw new Error('Use process(css).then(cb) to work with async plugins');
  233. }
  234. }
  235. return this.result;
  236. };
  237. _proto.run = function run(plugin) {
  238. this.result.lastPlugin = plugin;
  239. try {
  240. return plugin(this.result.root, this.result);
  241. } catch (error) {
  242. this.handleError(error, plugin);
  243. throw error;
  244. }
  245. };
  246. _proto.stringify = function stringify() {
  247. if (this.stringified) return this.result;
  248. this.stringified = true;
  249. this.sync();
  250. var opts = this.result.opts;
  251. var str = _stringify2.default;
  252. if (opts.syntax) str = opts.syntax.stringify;
  253. if (opts.stringifier) str = opts.stringifier;
  254. if (str.stringify) str = str.stringify;
  255. var map = new _mapGenerator.default(str, this.result.root, this.result.opts);
  256. var data = map.generate();
  257. this.result.css = data[0];
  258. this.result.map = data[1];
  259. return this.result;
  260. };
  261. _createClass(LazyResult, [{
  262. key: "processor",
  263. get: function get() {
  264. return this.result.processor;
  265. }
  266. /**
  267. * Options from the {@link Processor#process} call.
  268. *
  269. * @type {processOptions}
  270. */
  271. }, {
  272. key: "opts",
  273. get: function get() {
  274. return this.result.opts;
  275. }
  276. /**
  277. * Processes input CSS through synchronous plugins, converts `Root`
  278. * to a CSS string and returns {@link Result#css}.
  279. *
  280. * This property will only work with synchronous plugins.
  281. * If the processor contains any asynchronous plugins
  282. * it will throw an error. This is why this method is only
  283. * for debug purpose, you should always use {@link LazyResult#then}.
  284. *
  285. * @type {string}
  286. * @see Result#css
  287. */
  288. }, {
  289. key: "css",
  290. get: function get() {
  291. return this.stringify().css;
  292. }
  293. /**
  294. * An alias for the `css` property. Use it with syntaxes
  295. * that generate non-CSS output.
  296. *
  297. * This property will only work with synchronous plugins.
  298. * If the processor contains any asynchronous plugins
  299. * it will throw an error. This is why this method is only
  300. * for debug purpose, you should always use {@link LazyResult#then}.
  301. *
  302. * @type {string}
  303. * @see Result#content
  304. */
  305. }, {
  306. key: "content",
  307. get: function get() {
  308. return this.stringify().content;
  309. }
  310. /**
  311. * Processes input CSS through synchronous plugins
  312. * and returns {@link Result#map}.
  313. *
  314. * This property will only work with synchronous plugins.
  315. * If the processor contains any asynchronous plugins
  316. * it will throw an error. This is why this method is only
  317. * for debug purpose, you should always use {@link LazyResult#then}.
  318. *
  319. * @type {SourceMapGenerator}
  320. * @see Result#map
  321. */
  322. }, {
  323. key: "map",
  324. get: function get() {
  325. return this.stringify().map;
  326. }
  327. /**
  328. * Processes input CSS through synchronous plugins
  329. * and returns {@link Result#root}.
  330. *
  331. * This property will only work with synchronous plugins. If the processor
  332. * contains any asynchronous plugins it will throw an error.
  333. *
  334. * This is why this method is only for debug purpose,
  335. * you should always use {@link LazyResult#then}.
  336. *
  337. * @type {Root}
  338. * @see Result#root
  339. */
  340. }, {
  341. key: "root",
  342. get: function get() {
  343. return this.sync().root;
  344. }
  345. /**
  346. * Processes input CSS through synchronous plugins
  347. * and returns {@link Result#messages}.
  348. *
  349. * This property will only work with synchronous plugins. If the processor
  350. * contains any asynchronous plugins it will throw an error.
  351. *
  352. * This is why this method is only for debug purpose,
  353. * you should always use {@link LazyResult#then}.
  354. *
  355. * @type {Message[]}
  356. * @see Result#messages
  357. */
  358. }, {
  359. key: "messages",
  360. get: function get() {
  361. return this.sync().messages;
  362. }
  363. }]);
  364. return LazyResult;
  365. }();
  366. var _default = LazyResult;
  367. /**
  368. * @callback onFulfilled
  369. * @param {Result} result
  370. */
  371. /**
  372. * @callback onRejected
  373. * @param {Error} error
  374. */
  375. exports.default = _default;
  376. module.exports = exports.default;
  377. //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhenktcmVzdWx0LmVzNiJdLCJuYW1lcyI6WyJpc1Byb21pc2UiLCJvYmoiLCJ0aGVuIiwiTGF6eVJlc3VsdCIsInByb2Nlc3NvciIsImNzcyIsIm9wdHMiLCJzdHJpbmdpZmllZCIsInByb2Nlc3NlZCIsInJvb3QiLCJ0eXBlIiwiUmVzdWx0IiwibWFwIiwiaW5saW5lIiwicHJldiIsInBhcnNlciIsInBhcnNlIiwic3ludGF4IiwiZXJyb3IiLCJyZXN1bHQiLCJ3YXJuaW5ncyIsInN5bmMiLCJ0b1N0cmluZyIsIm9uRnVsZmlsbGVkIiwib25SZWplY3RlZCIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsImFzeW5jIiwiY2F0Y2giLCJmaW5hbGx5Iiwib25GaW5hbGx5IiwiaGFuZGxlRXJyb3IiLCJwbHVnaW4iLCJuYW1lIiwicG9zdGNzc1BsdWdpbiIsInNldE1lc3NhZ2UiLCJwb3N0Y3NzVmVyc2lvbiIsInBsdWdpbk5hbWUiLCJwbHVnaW5WZXIiLCJydW50aW1lVmVyIiwidmVyc2lvbiIsImEiLCJzcGxpdCIsImIiLCJwYXJzZUludCIsImNvbnNvbGUiLCJlcnIiLCJhc3luY1RpY2siLCJyZXNvbHZlIiwicmVqZWN0IiwicGx1Z2lucyIsImxlbmd0aCIsInByb21pc2Ui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