processor.js 23 KB

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