(indentStr)
| 189 | } |
| 190 | |
| 191 | indent(indentStr) { |
| 192 | if (!arguments.length) { |
| 193 | indentStr = this.getIndentString(); |
| 194 | } |
| 195 | |
| 196 | if (indentStr === '') return this; // noop |
| 197 | |
| 198 | let trailingNewline = !this.intro || this.intro.slice(-1) === '\n'; |
| 199 | |
| 200 | this.sources.forEach((source, i) => { |
| 201 | const separator = source.separator !== undefined ? source.separator : this.separator; |
| 202 | const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator)); |
| 203 | |
| 204 | source.content.indent(indentStr, { |
| 205 | exclude: source.indentExclusionRanges, |
| 206 | indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator ) |
| 207 | }); |
| 208 | |
| 209 | trailingNewline = source.content.lastChar() === '\n'; |
| 210 | }); |
| 211 | |
| 212 | if (this.intro) { |
| 213 | this.intro = |
| 214 | indentStr + |
| 215 | this.intro.replace(/^[^\n]/gm, (match, index) => { |
| 216 | return index > 0 ? indentStr + match : match; |
| 217 | }); |
| 218 | } |
| 219 | |
| 220 | return this; |
| 221 | } |
| 222 | |
| 223 | prepend(str) { |
| 224 | this.intro = str + this.intro; |
no test coverage detected