(input, specialComments)
| 5 | import restructure from './restructure/index.js'; |
| 6 | |
| 7 | function readChunk(input, specialComments) { |
| 8 | const children = new List(); |
| 9 | let nonSpaceTokenInBuffer = false; |
| 10 | let protectedComment; |
| 11 | |
| 12 | input.nextUntil(input.head, (node, item, list) => { |
| 13 | if (node.type === 'Comment') { |
| 14 | if (!specialComments || node.value.charAt(0) !== '!') { |
| 15 | list.remove(item); |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | if (nonSpaceTokenInBuffer || protectedComment) { |
| 20 | return true; |
| 21 | } |
| 22 | |
| 23 | list.remove(item); |
| 24 | protectedComment = node; |
| 25 | |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | if (node.type !== 'WhiteSpace') { |
| 30 | nonSpaceTokenInBuffer = true; |
| 31 | } |
| 32 | |
| 33 | children.insert(list.remove(item)); |
| 34 | }); |
| 35 | |
| 36 | return { |
| 37 | comment: protectedComment, |
| 38 | stylesheet: { |
| 39 | type: 'StyleSheet', |
| 40 | loc: null, |
| 41 | children |
| 42 | } |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | function compressChunk(ast, firstAtrulesAllowed, num, options) { |
| 47 | options.logger(`Compress block #${num}`, null, true); |
no outgoing calls
no test coverage detected
searching dependent graphs…