| 48 | } |
| 49 | |
| 50 | function updateSource(astNode: postcss.ChildNode, loc: SourceLocation | undefined) { |
| 51 | let source = toSource(loc) |
| 52 | |
| 53 | // The `source` property on PostCSS nodes must be defined if present because |
| 54 | // `toJSON()` reads each property and tries to read from source.input if it |
| 55 | // sees a `source` property. This means for a missing or otherwise absent |
| 56 | // source it must be *missing* from the object rather than just `undefined` |
| 57 | if (source) { |
| 58 | astNode.source = source |
| 59 | } else { |
| 60 | delete astNode.source |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | function transform(node: AstNode, parent: postcss.Container) { |
| 65 | // Declaration |