@@ -4,20 +4,20 @@ import { snippedTagContentAttribute } from './lib/snipTagContent';
4
4
import { isBracketSameLine } from './options' ;
5
5
import { PrintFn } from './print' ;
6
6
import { isLine , removeParentheses , trimRight } from './print/doc-helpers' ;
7
- import { groupConcat , printWithPrependedAttributeLine } from './print/helpers' ;
7
+ import { printWithPrependedAttributeLine } from './print/helpers' ;
8
8
import {
9
9
getAttributeTextValue ,
10
10
getLeadingComment ,
11
11
isIgnoreDirective ,
12
12
isNodeSupportedLanguage ,
13
13
isPugTemplate ,
14
14
isTypeScript ,
15
- printRaw ,
15
+ printRaw
16
16
} from './print/node-helpers' ;
17
17
import { ElementNode , Node , ScriptNode , StyleNode } from './print/nodes' ;
18
18
19
19
const {
20
- builders : { concat , hardline, softline, indent, dedent, literalline } ,
20
+ builders : { group , hardline, softline, indent, dedent, literalline } ,
21
21
utils : { removeLines } ,
22
22
} = doc ;
23
23
@@ -123,7 +123,7 @@ function preformattedBody(str: string): Doc {
123
123
124
124
// If we do not start with a new line prettier might try to break the opening tag
125
125
// to keep it together with the string. Use a literal line to skip indentation.
126
- return concat ( [ literalline , str . replace ( firstNewline , '' ) . replace ( lastNewline , '' ) , hardline ] ) ;
126
+ return [ literalline , str . replace ( firstNewline , '' ) . replace ( lastNewline , '' ) , hardline ] ;
127
127
}
128
128
129
129
function getSnippedContent ( node : Node ) {
@@ -159,13 +159,13 @@ function formatBodyContent(
159
159
. split ( '\n' )
160
160
. map ( ( line ) => ( line ? whitespace + line : line ) )
161
161
. join ( '\n' ) ;
162
- return concat ( [ hardline , pugBody ] ) ;
162
+ return [ hardline , pugBody ] ;
163
163
}
164
164
165
165
const indentIfDesired = ( doc : Doc ) =>
166
166
options . svelteIndentScriptAndStyle ? indent ( doc ) : doc ;
167
167
trimRight ( [ body ] , isLine ) ;
168
- return concat ( [ indentIfDesired ( concat ( [ hardline , body ] ) ) , hardline ] ) ;
168
+ return [ indentIfDesired ( [ hardline , body ] ) , hardline ] ;
169
169
} catch ( error ) {
170
170
if ( process . env . PRETTIER_DEBUG ) {
171
171
throw error ;
@@ -210,27 +210,27 @@ function embedTag(
210
210
: hardline
211
211
: preformattedBody ( content ) ;
212
212
213
- const openingTag = groupConcat ( [
213
+ const openingTag = group ( [
214
214
'<' ,
215
215
tag ,
216
216
indent (
217
- groupConcat ( [
217
+ group ( [
218
218
...path . map ( printWithPrependedAttributeLine ( node , options , print ) , 'attributes' ) ,
219
219
isBracketSameLine ( options ) ? '' : dedent ( softline ) ,
220
220
] ) ,
221
221
) ,
222
222
'>' ,
223
223
] ) ;
224
- let result = groupConcat ( [ openingTag , body , '</' , tag , '>' ] ) ;
224
+ let result : Doc = group ( [ openingTag , body , '</' , tag , '>' ] ) ;
225
225
226
226
if ( isTopLevel && options . svelteSortOrder !== 'none' ) {
227
227
// top level embedded nodes have been moved from their normal position in the
228
228
// node tree. if there is a comment referring to it, it must be recreated at
229
229
// the new position.
230
230
if ( previousComment ) {
231
- result = concat ( [ '<!--' , previousComment . data , '-->' , hardline , result , hardline ] ) ;
231
+ result = [ '<!--' , previousComment . data , '-->' , hardline , result , hardline ] ;
232
232
} else {
233
- result = concat ( [ result , hardline ] ) ;
233
+ result = [ result , hardline ] ;
234
234
}
235
235
}
236
236
0 commit comments