(indentStr)
| 971 | ); |
| 972 | } |
| 973 | indent(indentStr) { |
| 974 | if (!arguments.length) { |
| 975 | indentStr = this.getIndentString(); |
| 976 | } |
| 977 | if (indentStr === '') return this; |
| 978 | let trailingNewline = !this.intro || this.intro.slice(-1) === '\n'; |
| 979 | this.sources.forEach((source, i) => { |
| 980 | const separator = source.separator !== void 0 ? source.separator : this.separator; |
| 981 | const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator)); |
| 982 | source.content.indent(indentStr, { |
| 983 | exclude: source.indentExclusionRanges, |
| 984 | indentStart, |
| 985 | }); |
| 986 | trailingNewline = source.content.lastChar() === '\n'; |
| 987 | }); |
| 988 | if (this.intro) { |
| 989 | this.intro = |
| 990 | indentStr + |
| 991 | this.intro.replace(/^[^\n]/gm, (match, index) => { |
| 992 | return index > 0 ? indentStr + match : match; |
| 993 | }); |
| 994 | } |
| 995 | return this; |
| 996 | } |
| 997 | prepend(str) { |
| 998 | this.intro = str + this.intro; |
| 999 | return this; |
nothing calls this directly
no test coverage detected