processor.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. "use strict";
  2. function _createForOfIteratorHelperLoose(o) { var i = 0; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) 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."); } i = o[Symbol.iterator](); return i.next.bind(i); }
  3. 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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  4. 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; }
  5. var parser = require('postcss-value-parser');
  6. var Value = require('./value');
  7. var insertAreas = require('./hacks/grid-utils').insertAreas;
  8. var OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i;
  9. var OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i;
  10. var IGNORE_NEXT = /(!\s*)?autoprefixer:\s*ignore\s+next/i;
  11. var GRID_REGEX = /(!\s*)?autoprefixer\s*grid:\s*(on|off|(no-)?autoplace)/i;
  12. var SIZES = ['width', 'height', 'min-width', 'max-width', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size'];
  13. function hasGridTemplate(decl) {
  14. return decl.parent.some(function (i) {
  15. return i.prop === 'grid-template' || i.prop === 'grid-template-areas';
  16. });
  17. }
  18. function hasRowsAndColumns(decl) {
  19. var hasRows = decl.parent.some(function (i) {
  20. return i.prop === 'grid-template-rows';
  21. });
  22. var hasColumns = decl.parent.some(function (i) {
  23. return i.prop === 'grid-template-columns';
  24. });
  25. return hasRows && hasColumns;
  26. }
  27. var Processor = /*#__PURE__*/function () {
  28. function Processor(prefixes) {
  29. this.prefixes = prefixes;
  30. }
  31. /**
  32. * Add necessary prefixes
  33. */
  34. var _proto = Processor.prototype;
  35. _proto.add = function add(css, result) {
  36. var _this = this;
  37. // At-rules
  38. var resolution = this.prefixes.add['@resolution'];
  39. var keyframes = this.prefixes.add['@keyframes'];
  40. var viewport = this.prefixes.add['@viewport'];
  41. var supports = this.prefixes.add['@supports'];
  42. css.walkAtRules(function (rule) {
  43. if (rule.name === 'keyframes') {
  44. if (!_this.disabled(rule, result)) {
  45. return keyframes && keyframes.process(rule);
  46. }
  47. } else if (rule.name === 'viewport') {
  48. if (!_this.disabled(rule, result)) {
  49. return viewport && viewport.process(rule);
  50. }
  51. } else if (rule.name === 'supports') {
  52. if (_this.prefixes.options.supports !== false && !_this.disabled(rule, result)) {
  53. return supports.process(rule);
  54. }
  55. } else if (rule.name === 'media' && rule.params.includes('-resolution')) {
  56. if (!_this.disabled(rule, result)) {
  57. return resolution && resolution.process(rule);
  58. }
  59. }
  60. return undefined;
  61. }); // Selectors
  62. css.walkRules(function (rule) {
  63. if (_this.disabled(rule, result)) return undefined;
  64. return _this.prefixes.add.selectors.map(function (selector) {
  65. return selector.process(rule, result);
  66. });
  67. });
  68. function insideGrid(decl) {
  69. return decl.parent.nodes.some(function (node) {
  70. if (node.type !== 'decl') return false;
  71. var displayGrid = node.prop === 'display' && /(inline-)?grid/.test(node.value);
  72. var gridTemplate = node.prop.startsWith('grid-template');
  73. var gridGap = /^grid-([A-z]+-)?gap/.test(node.prop);
  74. return displayGrid || gridTemplate || gridGap;
  75. });
  76. }
  77. function insideFlex(decl) {
  78. return decl.parent.some(function (node) {
  79. return node.prop === 'display' && /(inline-)?flex/.test(node.value);
  80. });
  81. }
  82. var gridPrefixes = this.gridStatus(css, result) && this.prefixes.add['grid-area'] && this.prefixes.add['grid-area'].prefixes;
  83. css.walkDecls(function (decl) {
  84. if (_this.disabledDecl(decl, result)) return undefined;
  85. var parent = decl.parent;
  86. var prop = decl.prop;
  87. var value = decl.value;
  88. if (prop === 'grid-row-span') {
  89. result.warn('grid-row-span is not part of final Grid Layout. Use grid-row.', {
  90. node: decl
  91. });
  92. return undefined;
  93. } else if (prop === 'grid-column-span') {
  94. result.warn('grid-column-span is not part of final Grid Layout. Use grid-column.', {
  95. node: decl
  96. });
  97. return undefined;
  98. } else if (prop === 'display' && value === 'box') {
  99. result.warn('You should write display: flex by final spec ' + 'instead of display: box', {
  100. node: decl
  101. });
  102. return undefined;
  103. } else if (prop === 'text-emphasis-position') {
  104. if (value === 'under' || value === 'over') {
  105. result.warn('You should use 2 values for text-emphasis-position ' + 'For example, `under left` instead of just `under`.', {
  106. node: decl
  107. });
  108. }
  109. } else if (/^(align|justify|place)-(items|content)$/.test(prop) && insideFlex(decl)) {
  110. if (value === 'start' || value === 'end') {
  111. result.warn(value + " value has mixed support, consider using " + ("flex-" + value + " instead"), {
  112. node: decl
  113. });
  114. }
  115. } else if (prop === 'text-decoration-skip' && value === 'ink') {
  116. result.warn('Replace text-decoration-skip: ink to ' + 'text-decoration-skip-ink: auto, because spec had been changed', {
  117. node: decl
  118. });
  119. } else {
  120. if (gridPrefixes) {
  121. if (/^(align|justify|place)-items$/.test(prop) && insideGrid(decl)) {
  122. var fixed = prop.replace('-items', '-self');
  123. result.warn("IE does not support " + prop + " on grid containers. " + ("Try using " + fixed + " on child elements instead: ") + (decl.parent.selector + " > * { " + fixed + ": " + decl.value + " }"), {
  124. node: decl
  125. });
  126. } else if (/^(align|justify|place)-content$/.test(prop) && insideGrid(decl)) {
  127. result.warn("IE does not support " + decl.prop + " on grid containers", {
  128. node: decl
  129. });
  130. } else if (prop === 'display' && decl.value === 'contents') {
  131. result.warn('Please do not use display: contents; ' + 'if you have grid setting enabled', {
  132. node: decl
  133. });
  134. return undefined;
  135. } else if (decl.prop === 'grid-gap') {
  136. var status = _this.gridStatus(decl, result);
  137. if (status === 'autoplace' && !hasRowsAndColumns(decl) && !hasGridTemplate(decl)) {
  138. result.warn('grid-gap only works if grid-template(-areas) is being ' + 'used or both rows and columns have been declared ' + 'and cells have not been manually ' + 'placed inside the explicit grid', {
  139. node: decl
  140. });
  141. } else if ((status === true || status === 'no-autoplace') && !hasGridTemplate(decl)) {
  142. result.warn('grid-gap only works if grid-template(-areas) is being used', {
  143. node: decl
  144. });
  145. }
  146. } else if (prop === 'grid-auto-columns') {
  147. result.warn('grid-auto-columns is not supported by IE', {
  148. node: decl
  149. });
  150. return undefined;
  151. } else if (prop === 'grid-auto-rows') {
  152. result.warn('grid-auto-rows is not supported by IE', {
  153. node: decl
  154. });
  155. return undefined;
  156. } else if (prop === 'grid-auto-flow') {
  157. var hasRows = parent.some(function (i) {
  158. return i.prop === 'grid-template-rows';
  159. });
  160. var hasCols = parent.some(function (i) {
  161. return i.prop === 'grid-template-columns';
  162. });
  163. if (hasGridTemplate(decl)) {
  164. result.warn('grid-auto-flow is not supported by IE', {
  165. node: decl
  166. });
  167. } else if (value.includes('dense')) {
  168. result.warn('grid-auto-flow: dense is not supported by IE', {
  169. node: decl
  170. });
  171. } else if (!hasRows && !hasCols) {
  172. result.warn('grid-auto-flow works only if grid-template-rows and ' + 'grid-template-columns are present in the same rule', {
  173. node: decl
  174. });
  175. }
  176. return undefined;
  177. } else if (value.includes('auto-fit')) {
  178. result.warn('auto-fit value is not supported by IE', {
  179. node: decl,
  180. word: 'auto-fit'
  181. });
  182. return undefined;
  183. } else if (value.includes('auto-fill')) {
  184. result.warn('auto-fill value is not supported by IE', {
  185. node: decl,
  186. word: 'auto-fill'
  187. });
  188. return undefined;
  189. } else if (prop.startsWith('grid-template') && value.includes('[')) {
  190. result.warn('Autoprefixer currently does not support line names. ' + 'Try using grid-template-areas instead.', {
  191. node: decl,
  192. word: '['
  193. });
  194. }
  195. }
  196. if (value.includes('radial-gradient')) {
  197. if (OLD_RADIAL.test(decl.value)) {
  198. result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `closest-side at 0 0` ' + 'instead of `0 0, closest-side`.', {
  199. node: decl
  200. });
  201. } else {
  202. var ast = parser(value);
  203. for (var _iterator = _createForOfIteratorHelperLoose(ast.nodes), _step; !(_step = _iterator()).done;) {
  204. var i = _step.value;
  205. if (i.type === 'function' && i.value === 'radial-gradient') {
  206. for (var _iterator2 = _createForOfIteratorHelperLoose(i.nodes), _step2; !(_step2 = _iterator2()).done;) {
  207. var word = _step2.value;
  208. if (word.type === 'word') {
  209. if (word.value === 'cover') {
  210. result.warn('Gradient has outdated direction syntax. ' + 'Replace `cover` to `farthest-corner`.', {
  211. node: decl
  212. });
  213. } else if (word.value === 'contain') {
  214. result.warn('Gradient has outdated direction syntax. ' + 'Replace `contain` to `closest-side`.', {
  215. node: decl
  216. });
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. if (value.includes('linear-gradient')) {
  225. if (OLD_LINEAR.test(value)) {
  226. result.warn('Gradient has outdated direction syntax. ' + 'New syntax is like `to left` instead of `right`.', {
  227. node: decl
  228. });
  229. }
  230. }
  231. }
  232. if (SIZES.includes(decl.prop)) {
  233. if (!decl.value.includes('-fill-available')) {
  234. if (decl.value.includes('fill-available')) {
  235. result.warn('Replace fill-available to stretch, ' + 'because spec had been changed', {
  236. node: decl
  237. });
  238. } else if (decl.value.includes('fill')) {
  239. var _ast = parser(value);
  240. if (_ast.nodes.some(function (i) {
  241. return i.type === 'word' && i.value === 'fill';
  242. })) {
  243. result.warn('Replace fill to stretch, because spec had been changed', {
  244. node: decl
  245. });
  246. }
  247. }
  248. }
  249. }
  250. var prefixer;
  251. if (decl.prop === 'transition' || decl.prop === 'transition-property') {
  252. // Transition
  253. return _this.prefixes.transition.add(decl, result);
  254. } else if (decl.prop === 'align-self') {
  255. // align-self flexbox or grid
  256. var display = _this.displayType(decl);
  257. if (display !== 'grid' && _this.prefixes.options.flexbox !== false) {
  258. prefixer = _this.prefixes.add['align-self'];
  259. if (prefixer && prefixer.prefixes) {
  260. prefixer.process(decl);
  261. }
  262. }
  263. if (display !== 'flex' && _this.gridStatus(decl, result) !== false) {
  264. prefixer = _this.prefixes.add['grid-row-align'];
  265. if (prefixer && prefixer.prefixes) {
  266. return prefixer.process(decl, result);
  267. }
  268. }
  269. } else if (decl.prop === 'justify-self') {
  270. // justify-self flexbox or grid
  271. var _display = _this.displayType(decl);
  272. if (_display !== 'flex' && _this.gridStatus(decl, result) !== false) {
  273. prefixer = _this.prefixes.add['grid-column-align'];
  274. if (prefixer && prefixer.prefixes) {
  275. return prefixer.process(decl, result);
  276. }
  277. }
  278. } else if (decl.prop === 'place-self') {
  279. prefixer = _this.prefixes.add['place-self'];
  280. if (prefixer && prefixer.prefixes && _this.gridStatus(decl, result) !== false) {
  281. return prefixer.process(decl, result);
  282. }
  283. } else {
  284. // Properties
  285. prefixer = _this.prefixes.add[decl.prop];
  286. if (prefixer && prefixer.prefixes) {
  287. return prefixer.process(decl, result);
  288. }
  289. }
  290. return undefined;
  291. }); // Insert grid-area prefixes. We need to be able to store the different
  292. // rules as a data and hack API is not enough for this
  293. if (this.gridStatus(css, result)) {
  294. insertAreas(css, this.disabled);
  295. } // Values
  296. return css.walkDecls(function (decl) {
  297. if (_this.disabledValue(decl, result)) return;
  298. var unprefixed = _this.prefixes.unprefixed(decl.prop);
  299. var list = _this.prefixes.values('add', unprefixed);
  300. if (Array.isArray(list)) {
  301. for (var _iterator3 = _createForOfIteratorHelperLoose(list), _step3; !(_step3 = _iterator3()).done;) {
  302. var value = _step3.value;
  303. if (value.process) value.process(decl, result);
  304. }
  305. }
  306. Value.save(_this.prefixes, decl);
  307. });
  308. }
  309. /**
  310. * Remove unnecessary pefixes
  311. */
  312. ;
  313. _proto.remove = function remove(css, result) {
  314. var _this2 = this;
  315. // At-rules
  316. var resolution = this.prefixes.remove['@resolution'];
  317. css.walkAtRules(function (rule, i) {
  318. if (_this2.prefixes.remove["@" + rule.name]) {
  319. if (!_this2.disabled(rule, result)) {
  320. rule.parent.removeChild(i);
  321. }
  322. } else if (rule.name === 'media' && rule.params.includes('-resolution') && resolution) {
  323. resolution.clean(rule);
  324. }
  325. }); // Selectors
  326. var _loop = function _loop() {
  327. var checker = _step4.value;
  328. css.walkRules(function (rule, i) {
  329. if (checker.check(rule)) {
  330. if (!_this2.disabled(rule, result)) {
  331. rule.parent.removeChild(i);
  332. }
  333. }
  334. });
  335. };
  336. for (var _iterator4 = _createForOfIteratorHelperLoose(this.prefixes.remove.selectors), _step4; !(_step4 = _iterator4()).done;) {
  337. _loop();
  338. }
  339. return css.walkDecls(function (decl, i) {
  340. if (_this2.disabled(decl, result)) return;
  341. var rule = decl.parent;
  342. var unprefixed = _this2.prefixes.unprefixed(decl.prop); // Transition
  343. if (decl.prop === 'transition' || decl.prop === 'transition-property') {
  344. _this2.prefixes.transition.remove(decl);
  345. } // Properties
  346. if (_this2.prefixes.remove[decl.prop] && _this2.prefixes.remove[decl.prop].remove) {
  347. var notHack = _this2.prefixes.group(decl).down(function (other) {
  348. return _this2.prefixes.normalize(other.prop) === unprefixed;
  349. });
  350. if (unprefixed === 'flex-flow') {
  351. notHack = true;
  352. }
  353. if (decl.prop === '-webkit-box-orient') {
  354. var hacks = {
  355. 'flex-direction': true,
  356. 'flex-flow': true
  357. };
  358. if (!decl.parent.some(function (j) {
  359. return hacks[j.prop];
  360. })) return;
  361. }
  362. if (notHack && !_this2.withHackValue(decl)) {
  363. if (decl.raw('before').includes('\n')) {
  364. _this2.reduceSpaces(decl);
  365. }
  366. rule.removeChild(i);
  367. return;
  368. }
  369. } // Values
  370. for (var _iterator5 = _createForOfIteratorHelperLoose(_this2.prefixes.values('remove', unprefixed)), _step5; !(_step5 = _iterator5()).done;) {
  371. var checker = _step5.value;
  372. if (!checker.check) continue;
  373. if (!checker.check(decl.value)) continue;
  374. unprefixed = checker.unprefixed;
  375. var _notHack = _this2.prefixes.group(decl).down(function (other) {
  376. return other.value.includes(unprefixed);
  377. });
  378. if (_notHack) {
  379. rule.removeChild(i);
  380. return;
  381. }
  382. }
  383. });
  384. }
  385. /**
  386. * Some rare old values, which is not in standard
  387. */
  388. ;
  389. _proto.withHackValue = function withHackValue(decl) {
  390. return decl.prop === '-webkit-background-clip' && decl.value === 'text';
  391. }
  392. /**
  393. * Check for grid/flexbox options.
  394. */
  395. ;
  396. _proto.disabledValue = function disabledValue(node, result) {
  397. if (this.gridStatus(node, result) === false && node.type === 'decl') {
  398. if (node.prop === 'display' && node.value.includes('grid')) {
  399. return true;
  400. }
  401. }
  402. if (this.prefixes.options.flexbox === false && node.type === 'decl') {
  403. if (node.prop === 'display' && node.value.includes('flex')) {
  404. return true;
  405. }
  406. }
  407. return this.disabled(node, result);
  408. }
  409. /**
  410. * Check for grid/flexbox options.
  411. */
  412. ;
  413. _proto.disabledDecl = function disabledDecl(node, result) {
  414. if (this.gridStatus(node, result) === false && node.type === 'decl') {
  415. if (node.prop.includes('grid') || node.prop === 'justify-items') {
  416. return true;
  417. }
  418. }
  419. if (this.prefixes.options.flexbox === false && node.type === 'decl') {
  420. var other = ['order', 'justify-content', 'align-items', 'align-content'];
  421. if (node.prop.includes('flex') || other.includes(node.prop)) {
  422. return true;
  423. }
  424. }
  425. return this.disabled(node, result);
  426. }
  427. /**
  428. * Check for control comment and global options
  429. */
  430. ;
  431. _proto.disabled = function disabled(node, result) {
  432. if (!node) return false;
  433. if (node._autoprefixerDisabled !== undefined) {
  434. return node._autoprefixerDisabled;
  435. }
  436. if (node.parent) {
  437. var p = node.prev();
  438. if (p && p.type === 'comment' && IGNORE_NEXT.test(p.text)) {
  439. node._autoprefixerDisabled = true;
  440. node._autoprefixerSelfDisabled = true;
  441. return true;
  442. }
  443. }
  444. var value = null;
  445. if (node.nodes) {
  446. var status;
  447. node.each(function (i) {
  448. if (i.type !== 'comment') return;
  449. if (/(!\s*)?autoprefixer:\s*(off|on)/i.test(i.text)) {
  450. if (typeof status !== 'undefined') {
  451. result.warn('Second Autoprefixer control comment ' + 'was ignored. Autoprefixer applies control ' + 'comment to whole block, not to next rules.', {
  452. node: i
  453. });
  454. } else {
  455. status = /on/i.test(i.text);
  456. }
  457. }
  458. });
  459. if (status !== undefined) {
  460. value = !status;
  461. }
  462. }
  463. if (!node.nodes || value === null) {
  464. if (node.parent) {
  465. var isParentDisabled = this.disabled(node.parent, result);
  466. if (node.parent._autoprefixerSelfDisabled === true) {
  467. value = false;
  468. } else {
  469. value = isParentDisabled;
  470. }
  471. } else {
  472. value = false;
  473. }
  474. }
  475. node._autoprefixerDisabled = value;
  476. return value;
  477. }
  478. /**
  479. * Normalize spaces in cascade declaration group
  480. */
  481. ;
  482. _proto.reduceSpaces = function reduceSpaces(decl) {
  483. var stop = false;
  484. this.prefixes.group(decl).up(function () {
  485. stop = true;
  486. return true;
  487. });
  488. if (stop) {
  489. return;
  490. }
  491. var parts = decl.raw('before').split('\n');
  492. var prevMin = parts[parts.length - 1].length;
  493. var diff = false;
  494. this.prefixes.group(decl).down(function (other) {
  495. parts = other.raw('before').split('\n');
  496. var last = parts.length - 1;
  497. if (parts[last].length > prevMin) {
  498. if (diff === false) {
  499. diff = parts[last].length - prevMin;
  500. }
  501. parts[last] = parts[last].slice(0, -diff);
  502. other.raws.before = parts.join('\n');
  503. }
  504. });
  505. }
  506. /**
  507. * Is it flebox or grid rule
  508. */
  509. ;
  510. _proto.displayType = function displayType(decl) {
  511. for (var _iterator6 = _createForOfIteratorHelperLoose(decl.parent.nodes), _step6; !(_step6 = _iterator6()).done;) {
  512. var i = _step6.value;
  513. if (i.prop !== 'display') {
  514. continue;
  515. }
  516. if (i.value.includes('flex')) {
  517. return 'flex';
  518. }
  519. if (i.value.includes('grid')) {
  520. return 'grid';
  521. }
  522. }
  523. return false;
  524. }
  525. /**
  526. * Set grid option via control comment
  527. */
  528. ;
  529. _proto.gridStatus = function gridStatus(node, result) {
  530. if (!node) return false;
  531. if (node._autoprefixerGridStatus !== undefined) {
  532. return node._autoprefixerGridStatus;
  533. }
  534. var value = null;
  535. if (node.nodes) {
  536. var status;
  537. node.each(function (i) {
  538. if (i.type !== 'comment') return;
  539. if (GRID_REGEX.test(i.text)) {
  540. var hasAutoplace = /:\s*autoplace/i.test(i.text);
  541. var noAutoplace = /no-autoplace/i.test(i.text);
  542. if (typeof status !== 'undefined') {
  543. result.warn('Second Autoprefixer grid control comment was ' + 'ignored. Autoprefixer applies control comments to the whole ' + 'block, not to the next rules.', {
  544. node: i
  545. });
  546. } else if (hasAutoplace) {
  547. status = 'autoplace';
  548. } else if (noAutoplace) {
  549. status = true;
  550. } else {
  551. status = /on/i.test(i.text);
  552. }
  553. }
  554. });
  555. if (status !== undefined) {
  556. value = status;
  557. }
  558. }
  559. if (node.type === 'atrule' && node.name === 'supports') {
  560. var params = node.params;
  561. if (params.includes('grid') && params.includes('auto')) {
  562. value = false;
  563. }
  564. }
  565. if (!node.nodes || value === null) {
  566. if (node.parent) {
  567. var isParentGrid = this.gridStatus(node.parent, result);
  568. if (node.parent._autoprefixerSelfDisabled === true) {
  569. value = false;
  570. } else {
  571. value = isParentGrid;
  572. }
  573. } else if (typeof this.prefixes.options.grid !== 'undefined') {
  574. value = this.prefixes.options.grid;
  575. } else if (typeof process.env.AUTOPREFIXER_GRID !== 'undefined') {
  576. if (process.env.AUTOPREFIXER_GRID === 'autoplace') {
  577. value = 'autoplace';
  578. } else {
  579. value = true;
  580. }
  581. } else {
  582. value = false;
  583. }
  584. }
  585. node._autoprefixerGridStatus = value;
  586. return value;
  587. };
  588. return Processor;
  589. }();
  590. module.exports = Processor;