UNPKG

426 BJavaScriptView Raw
1"use strict"
2
3module.exports = function applyRaws(bundle) {
4 bundle.forEach((stmt, index) => {
5 if (index === 0) return
6
7 if (stmt.parent) {
8 const { before } = stmt.parent.node.raws
9 if (stmt.type === "nodes") stmt.nodes[0].raws.before = before
10 else stmt.node.raws.before = before
11 } else if (stmt.type === "nodes") {
12 stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n"
13 }
14 })
15}