prettier-plugin-astro 0.2.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # prettier-plugin-astro
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - babd8c3: Properly trim the class attribute on HTML elements
8
+
9
+ ## 0.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2d78f06: Fix loading workers not working when parser is used from an external module
14
+
15
+ ### Patch Changes
16
+
17
+ - 285360e: Fixed error when trying to format custom elements
18
+ - 1b6622e: Properly handle errors inside style tags
19
+
20
+ ## 0.3.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 6ebc4d4: Update error handling to give better error messages when we fail to parse an expression, fixed shorthands props not working inside expressions
25
+ - bfe22e3: Improve error handling for frontmatter and script tags
26
+
3
27
  ## 0.2.0
4
28
 
5
29
  ### Minor Changes
package/README.md CHANGED
@@ -32,7 +32,7 @@ First install the [VS Code Prettier extension](https://marketplace.visualstudio.
32
32
 
33
33
  ```json
34
34
  {
35
- "prettier.documentSelectors": "**/*.astro"
35
+ "prettier.documentSelectors": ["**/*.astro"]
36
36
  }
37
37
  ```
38
38
 
@@ -74,16 +74,6 @@ The `require.resolve` call can alternatively be changed to a direct path, like s
74
74
 
75
75
  Most [options from Prettier](https://prettier.io/docs/en/options.html) will work with the plugin and can be set in a [configuration file](https://prettier.io/docs/en/configuration.html) or through [CLI flags](https://prettier.io/docs/en/cli.html).
76
76
 
77
- ### Astro Sort Order
78
-
79
- Sort order for the markup and styles. Depending on the order, top-level `style` tags will be sorted below or on top of the rest of the template
80
-
81
- The format is a string with the words `markup` and `styles` separated by a pipe (`|`)
82
-
83
- | Default | CLI Override | API Override |
84
- | ------------------ | ----------------------------- | -------------------------- |
85
- | `markup \| styles` | `--astro-sort-order <string>` | `astroSortOrder: <string>` |
86
-
87
77
  ### Astro Allow Shorthand
88
78
 
89
79
  Set if attributes with the same name as their expression should be formatted to the short form automatically (for example, if enabled `<element name={name} />` will become simply `<element {name} />`)
@@ -98,8 +88,7 @@ Set if attributes with the same name as their expression should be formatted to
98
88
 
99
89
  ```js
100
90
  {
101
- astroSortOrder: "markup | styles",
102
- astroAllowShorthand: false
91
+ astroAllowShorthand: false;
103
92
  }
104
93
  ```
105
94
 
package/dist/index.js CHANGED
@@ -2,16 +2,52 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var node_module = require('node:module');
6
+ var synckit = require('synckit');
5
7
  var _doc = require('prettier/doc');
6
8
  var sassFormatter = require('sass-formatter');
7
- var synckit = require('synckit');
8
- var node_module = require('node:module');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
11
 
12
12
  var _doc__default = /*#__PURE__*/_interopDefaultLegacy(_doc);
13
13
 
14
- const blockElementsT = [
14
+ const options = {
15
+ astroAllowShorthand: {
16
+ since: '0.0.10',
17
+ category: 'Astro',
18
+ type: 'boolean',
19
+ default: false,
20
+ description: 'Enable/disable attribute shorthand if attribute name and expression are the same',
21
+ },
22
+ };
23
+
24
+ const selfClosingTags = [
25
+ 'area',
26
+ 'base',
27
+ 'basefont',
28
+ 'bgsound',
29
+ 'br',
30
+ 'col',
31
+ 'command',
32
+ 'embed',
33
+ 'frame',
34
+ 'hr',
35
+ 'image',
36
+ 'img',
37
+ 'input',
38
+ 'isindex',
39
+ 'keygen',
40
+ 'link',
41
+ 'menuitem',
42
+ 'meta',
43
+ 'nextid',
44
+ 'param',
45
+ 'slot',
46
+ 'source',
47
+ 'track',
48
+ 'wbr',
49
+ ];
50
+ const blockElements = [
15
51
  'address',
16
52
  'article',
17
53
  'aside',
@@ -48,39 +84,25 @@ const blockElementsT = [
48
84
  'title',
49
85
  'html',
50
86
  ];
51
- const blockElements = [...blockElementsT];
52
- const selfClosingTags = [
53
- 'area',
54
- 'base',
55
- 'br',
56
- 'col',
57
- 'embed',
58
- 'hr',
59
- 'img',
60
- 'input',
61
- 'link',
62
- 'meta',
63
- 'param',
64
- 'slot',
65
- 'source',
66
- 'track',
67
- 'wbr',
68
- ];
69
-
70
- const require$2 = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
71
- const serialize = synckit.createSyncFn(require$2.resolve('../workers/serialize-worker.js'));
72
87
  const formattableAttributes = [];
73
- const isEmptyTextNode = (node) => {
74
- return !!node && node.type === 'text' && getUnencodedText(node).trim() === '';
75
- };
76
- const isPreTagContent = (path) => {
77
- if (!path || !path.stack || !Array.isArray(path.stack))
78
- return false;
79
- return path.stack.some((node) => (node.type === 'element' && node.name.toLowerCase() === 'pre') ||
80
- (node.type === 'attribute' && !formattableAttributes.includes(node.name)));
81
- };
82
- function getUnencodedText(node) {
83
- return node.value;
88
+
89
+ const req$1 = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
90
+ let workerPath$1;
91
+ try {
92
+ workerPath$1 = req$1.resolve('../workers/serialize-worker.js');
93
+ }
94
+ catch (e) {
95
+ workerPath$1 = req$1.resolve('prettier-plugin-astro/workers/serialize-worker.js');
96
+ }
97
+ const serialize = synckit.createSyncFn(req$1.resolve(workerPath$1));
98
+ function isInlineElement(path, opts, node) {
99
+ return node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path);
100
+ }
101
+ function isBlockElement(node, opts) {
102
+ return (node &&
103
+ node.type === 'element' &&
104
+ opts.htmlWhitespaceSensitivity !== 'strict' &&
105
+ (opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name)));
84
106
  }
85
107
  function printRaw(node, stripLeadingAndTrailingNewline = false) {
86
108
  if (!isNodeWithChildren(node)) {
@@ -107,14 +129,11 @@ function printRaw(node, stripLeadingAndTrailingNewline = false) {
107
129
  function isNodeWithChildren(node) {
108
130
  return node && 'children' in node && Array.isArray(node.children);
109
131
  }
110
- function isInlineElement(path, opts, node) {
111
- return node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path);
112
- }
113
- function isBlockElement(node, opts) {
114
- return (node &&
115
- node.type === 'element' &&
116
- opts.htmlWhitespaceSensitivity !== 'strict' &&
117
- (opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name)));
132
+ const isEmptyTextNode = (node) => {
133
+ return !!node && node.type === 'text' && getUnencodedText(node).trim() === '';
134
+ };
135
+ function getUnencodedText(node) {
136
+ return node.value;
118
137
  }
119
138
  function isTextNodeStartingWithLinebreak(node, nrLines = 1) {
120
139
  return startsWithLinebreak(getUnencodedText(node), nrLines);
@@ -131,9 +150,6 @@ function isTextNodeStartingWithWhitespace(node) {
131
150
  function isTextNodeEndingWithWhitespace(node) {
132
151
  return node.type === 'text' && /\s$/.test(getUnencodedText(node));
133
152
  }
134
- function forceIntoExpression(statement) {
135
- return `<>{${statement}\n}</>`;
136
- }
137
153
  function shouldHugStart(node, opts) {
138
154
  if (isBlockElement(node, opts)) {
139
155
  return false;
@@ -182,6 +198,9 @@ function trimTextNodeLeft(node) {
182
198
  function trimTextNodeRight(node) {
183
199
  node.value = node.value && node.value.trimEnd();
184
200
  }
201
+ function printClassNames(value) {
202
+ return value.trim().split(/\s+/).join(' ');
203
+ }
185
204
  function manualDedent(input) {
186
205
  let minTabSize = Infinity;
187
206
  let result = input;
@@ -242,11 +261,14 @@ function getNextNode(path) {
242
261
  }
243
262
  return null;
244
263
  }
264
+ const isPreTagContent = (path) => {
265
+ if (!path || !path.stack || !Array.isArray(path.stack))
266
+ return false;
267
+ return path.stack.some((node) => (node.type === 'element' && node.name.toLowerCase() === 'pre') ||
268
+ (node.type === 'attribute' && !formattableAttributes.includes(node.name)));
269
+ };
245
270
 
246
- const { builders: { breakParent, dedent, fill, group, hardline, indent, join, line, literalline, softline, }, utils: { removeLines, stripTrailingHardline }, } = _doc__default["default"];
247
- function printComment(commentPath, options) {
248
- return commentPath;
249
- }
271
+ const { builders: { breakParent, dedent, fill, group: group$1, indent: indent$1, join: join$1, line: line$1, softline: softline$1, hardline: hardline$1 }, utils: { stripTrailingHardline: stripTrailingHardline$1 }, } = _doc__default["default"];
250
272
  function print(path, opts, print) {
251
273
  const node = path.getValue();
252
274
  if (!node) {
@@ -257,7 +279,7 @@ function print(path, opts, print) {
257
279
  }
258
280
  switch (node.type) {
259
281
  case 'root': {
260
- return [stripTrailingHardline(path.map(print, 'children')), hardline];
282
+ return [stripTrailingHardline$1(path.map(print, 'children')), hardline$1];
261
283
  }
262
284
  case 'text': {
263
285
  const rawText = getUnencodedText(node);
@@ -266,13 +288,13 @@ function print(path, opts, print) {
266
288
  const hasOneOrMoreNewlines = /\n/.test(getUnencodedText(node));
267
289
  const hasTwoOrMoreNewlines = /\n\r?\s*\n\r?/.test(getUnencodedText(node));
268
290
  if (hasTwoOrMoreNewlines) {
269
- return [hardline, hardline];
291
+ return [hardline$1, hardline$1];
270
292
  }
271
293
  if (hasOneOrMoreNewlines) {
272
- return hardline;
294
+ return hardline$1;
273
295
  }
274
296
  if (hasWhiteSpace) {
275
- return line;
297
+ return line$1;
276
298
  }
277
299
  return '';
278
300
  }
@@ -280,6 +302,7 @@ function print(path, opts, print) {
280
302
  }
281
303
  case 'component':
282
304
  case 'fragment':
305
+ case 'custom-element':
283
306
  case 'element': {
284
307
  let isEmpty;
285
308
  if (!node.children) {
@@ -288,18 +311,18 @@ function print(path, opts, print) {
288
311
  else {
289
312
  isEmpty = node.children.every((child) => isEmptyTextNode(child));
290
313
  }
291
- const isSelfClosingTag = isEmpty && (node.type !== 'element' || selfClosingTags.indexOf(node.name) !== -1);
314
+ const isSelfClosingTag = isEmpty && (node.type !== 'element' || selfClosingTags.includes(node.name));
292
315
  const attributeLine = opts.singleAttributePerLine && node.attributes.length > 1 ? breakParent : '';
293
- const attributes = join(attributeLine, path.map(print, 'attributes'));
316
+ const attributes = join$1(attributeLine, path.map(print, 'attributes'));
294
317
  if (isSelfClosingTag) {
295
- return group(['<', node.name, indent(group(attributes)), line, `/>`]);
318
+ return group$1(['<', node.name, indent$1(group$1(attributes)), line$1, `/>`]);
296
319
  }
297
320
  if (node.children) {
298
321
  const children = node.children;
299
322
  const firstChild = children[0];
300
323
  const lastChild = children[children.length - 1];
301
- let noHugSeparatorStart = softline;
302
- let noHugSeparatorEnd = softline;
324
+ let noHugSeparatorStart = softline$1;
325
+ let noHugSeparatorEnd = softline$1;
303
326
  const hugStart = shouldHugStart(node, opts);
304
327
  const hugEnd = shouldHugEnd(node, opts);
305
328
  let body;
@@ -309,9 +332,9 @@ function print(path, opts, print) {
309
332
  node.children.length &&
310
333
  isTextNodeStartingWithWhitespace(node.children[0]) &&
311
334
  !isPreTagContent(path)
312
- ? () => line
335
+ ? () => line$1
313
336
  :
314
- () => softline;
337
+ () => softline$1;
315
338
  }
316
339
  else if (isPreTagContent(path)) {
317
340
  body = () => printRaw(node);
@@ -325,22 +348,22 @@ function print(path, opts, print) {
325
348
  const openingTag = [
326
349
  '<',
327
350
  node.name,
328
- indent(group([
351
+ indent$1(group$1([
329
352
  attributes,
330
353
  hugStart
331
354
  ? ''
332
355
  : !isPreTagContent(path) && !opts.bracketSameLine
333
- ? dedent(softline)
356
+ ? dedent(softline$1)
334
357
  : '',
335
358
  ])),
336
359
  ];
337
360
  if (hugStart && hugEnd) {
338
- const huggedContent = [softline, group(['>', body(), `</${node.name}`])];
361
+ const huggedContent = [softline$1, group$1(['>', body(), `</${node.name}`])];
339
362
  const omitSoftlineBeforeClosingTag = isEmpty || canOmitSoftlineBeforeClosingTag(path, opts);
340
- return group([
363
+ return group$1([
341
364
  ...openingTag,
342
- isEmpty ? group(huggedContent) : group(indent(huggedContent)),
343
- omitSoftlineBeforeClosingTag ? '' : softline,
365
+ isEmpty ? group$1(huggedContent) : group$1(indent$1(huggedContent)),
366
+ omitSoftlineBeforeClosingTag ? '' : softline$1,
344
367
  '>',
345
368
  ]);
346
369
  }
@@ -354,46 +377,46 @@ function print(path, opts, print) {
354
377
  if (isTextNodeStartingWithLinebreak(firstChild) &&
355
378
  firstChild !== lastChild &&
356
379
  (!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))) {
357
- noHugSeparatorStart = hardline;
358
- noHugSeparatorEnd = hardline;
380
+ noHugSeparatorStart = hardline$1;
381
+ noHugSeparatorEnd = hardline$1;
359
382
  didSetEndSeparator = true;
360
383
  }
361
384
  else if (isInlineElement(path, opts, node)) {
362
- noHugSeparatorStart = line;
385
+ noHugSeparatorStart = line$1;
363
386
  }
364
387
  trimTextNodeLeft(firstChild);
365
388
  }
366
389
  if (!hugEnd && lastChild && isTextNode(lastChild)) {
367
390
  if (isInlineElement(path, opts, node) && !didSetEndSeparator) {
368
- noHugSeparatorEnd = softline;
391
+ noHugSeparatorEnd = softline$1;
369
392
  }
370
393
  trimTextNodeRight(lastChild);
371
394
  }
372
395
  }
373
396
  if (hugStart) {
374
- return group([
397
+ return group$1([
375
398
  ...openingTag,
376
- indent([softline, group(['>', body()])]),
399
+ indent$1([softline$1, group$1(['>', body()])]),
377
400
  noHugSeparatorEnd,
378
401
  `</${node.name}>`,
379
402
  ]);
380
403
  }
381
404
  if (hugEnd) {
382
- return group([
405
+ return group$1([
383
406
  ...openingTag,
384
407
  '>',
385
- indent([noHugSeparatorStart, group([body(), `</${node.name}`])]),
386
- canOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,
408
+ indent$1([noHugSeparatorStart, group$1([body(), `</${node.name}`])]),
409
+ canOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline$1,
387
410
  '>',
388
411
  ]);
389
412
  }
390
413
  if (isEmpty) {
391
- return group([...openingTag, '>', body(), `</${node.name}>`]);
414
+ return group$1([...openingTag, '>', body(), `</${node.name}>`]);
392
415
  }
393
- return group([
416
+ return group$1([
394
417
  ...openingTag,
395
418
  '>',
396
- indent([noHugSeparatorStart, body()]),
419
+ indent$1([noHugSeparatorStart, body()]),
397
420
  noHugSeparatorEnd,
398
421
  `</${node.name}>`,
399
422
  ]);
@@ -405,28 +428,32 @@ function print(path, opts, print) {
405
428
  const quote = opts.jsxSingleQuote ? "'" : '"';
406
429
  switch (node.kind) {
407
430
  case 'empty':
408
- return [line, name];
431
+ return [line$1, name];
409
432
  case 'expression':
410
433
  return '';
411
434
  case 'quoted':
412
- return [line, name, '=', quote, node.value, quote];
435
+ let value = node.value;
436
+ if (node.name === 'class') {
437
+ value = printClassNames(value);
438
+ }
439
+ return [line$1, name, '=', quote, value, quote];
413
440
  case 'shorthand':
414
- return [line, '{', name, '}'];
441
+ return [line$1, '{', name, '}'];
415
442
  case 'spread':
416
- return [line, '{...', name, '}'];
443
+ return [line$1, '{...', name, '}'];
417
444
  case 'template-literal':
418
- return [line, name, '=', '`', node.value, '`'];
445
+ return [line$1, name, '=', '`', node.value, '`'];
419
446
  }
420
447
  return '';
421
448
  }
422
449
  case 'doctype': {
423
- return ['<!DOCTYPE html>', hardline];
450
+ return ['<!DOCTYPE html>', hardline$1];
424
451
  }
425
452
  case 'comment':
426
453
  const nextNode = getNextNode(path);
427
454
  let trailingLine = '';
428
455
  if (nextNode && isTagLikeNode(nextNode)) {
429
- trailingLine = hardline;
456
+ trailingLine = hardline$1;
430
457
  }
431
458
  return ['<!--', getUnencodedText(node), '-->', trailingLine];
432
459
  default: {
@@ -437,52 +464,48 @@ function print(path, opts, print) {
437
464
  function splitTextToDocs(node) {
438
465
  const text = getUnencodedText(node);
439
466
  const textLines = text.split(/[\t\n\f\r ]+/);
440
- let docs = join(line, textLines).parts.filter((s) => s !== '');
467
+ let docs = join$1(line$1, textLines).parts.filter((s) => s !== '');
441
468
  if (startsWithLinebreak(text)) {
442
- docs[0] = hardline;
469
+ docs[0] = hardline$1;
443
470
  }
444
471
  if (startsWithLinebreak(text, 2)) {
445
- docs = [hardline, ...docs];
472
+ docs = [hardline$1, ...docs];
446
473
  }
447
474
  if (endsWithLinebreak(text)) {
448
- docs[docs.length - 1] = hardline;
475
+ docs[docs.length - 1] = hardline$1;
449
476
  }
450
477
  if (endsWithLinebreak(text, 2)) {
451
- docs = [...docs, hardline];
478
+ docs = [...docs, hardline$1];
452
479
  }
453
480
  return docs;
454
481
  }
455
- function expressionParser(text, parsers, opts) {
456
- const ast = parsers.babel(text, opts);
457
- return {
458
- ...ast,
459
- program: ast.program.body[0].expression.children[0].expression,
460
- };
461
- }
482
+
483
+ const { builders: { group, indent, join, line, softline, hardline }, utils: { stripTrailingHardline, mapDoc }, } = _doc__default["default"];
462
484
  function embed(path, print, textToDoc, opts) {
463
- if (!opts.__astro)
464
- opts.__astro = {};
465
485
  const node = path.getValue();
466
486
  if (!node)
467
487
  return null;
468
488
  if (node.type === 'expression') {
469
- const textContent = printRaw(node);
489
+ const jsxNode = makeNodeJSXCompatible(node);
490
+ const textContent = printRaw(jsxNode);
470
491
  let content;
471
- content = textToDoc(forceIntoExpression(textContent), {
492
+ content = textToDoc(textContent, {
472
493
  ...opts,
473
494
  parser: expressionParser,
474
495
  });
475
496
  content = stripTrailingHardline(content);
476
- return [
477
- '{',
478
- content,
479
- '}',
480
- ];
497
+ const astroDoc = mapDoc(content, (doc) => {
498
+ if (typeof doc === 'string' && doc.startsWith('__PRETTIER_SNIP__')) {
499
+ return '';
500
+ }
501
+ return doc;
502
+ });
503
+ return ['{', astroDoc, '}'];
481
504
  }
482
505
  if (node.type === 'attribute' && node.kind === 'expression') {
483
506
  const value = node.value.trim();
484
507
  const name = node.name.trim();
485
- let attrNodeValue = textToDoc(forceIntoExpression(value), {
508
+ let attrNodeValue = textToDoc(value, {
486
509
  ...opts,
487
510
  parser: expressionParser,
488
511
  });
@@ -497,7 +520,7 @@ function embed(path, print, textToDoc, opts) {
497
520
  group([
498
521
  '---',
499
522
  hardline,
500
- textToDoc(node.value, { ...opts, parser: 'typescript' }),
523
+ textToDoc(node.value, { ...opts, parser: typescriptParser }),
501
524
  '---',
502
525
  hardline,
503
526
  ]),
@@ -508,7 +531,7 @@ function embed(path, print, textToDoc, opts) {
508
531
  const scriptContent = printRaw(node);
509
532
  let formatttedScript = textToDoc(scriptContent, {
510
533
  ...opts,
511
- parser: 'typescript',
534
+ parser: typescriptParser,
512
535
  });
513
536
  formatttedScript = stripTrailingHardline(formatttedScript);
514
537
  const attributes = path.map(print, 'attributes');
@@ -516,7 +539,7 @@ function embed(path, print, textToDoc, opts) {
516
539
  return [openingTag, indent([hardline, formatttedScript]), hardline, '</script>'];
517
540
  }
518
541
  if (node.type === 'element' && node.name === 'style') {
519
- const styleTagContent = printRaw(node);
542
+ const content = printRaw(node);
520
543
  const supportedStyleLangValues = ['css', 'scss', 'sass'];
521
544
  let parserLang = 'css';
522
545
  if (node.attributes) {
@@ -527,75 +550,99 @@ function embed(path, print, textToDoc, opts) {
527
550
  parserLang = styleLang;
528
551
  }
529
552
  }
530
- switch (parserLang) {
531
- case 'css':
532
- case 'scss': {
533
- let formattedStyles = textToDoc(styleTagContent, {
534
- ...opts,
535
- parser: parserLang,
553
+ return embedStyle(parserLang, content, path, print, textToDoc, opts);
554
+ }
555
+ return null;
556
+ }
557
+ function expressionParser(text, parsers, opts) {
558
+ const expressionContent = forceIntoExpression(text);
559
+ const parsingResult = wrapParserTryCatch(parsers.babel, expressionContent, opts);
560
+ return {
561
+ ...parsingResult,
562
+ program: parsingResult.program.body[0].expression.children[0].expression,
563
+ };
564
+ }
565
+ function typescriptParser(text, parsers, opts) {
566
+ return wrapParserTryCatch(parsers.typescript, text, opts);
567
+ }
568
+ function wrapParserTryCatch(parser, text, opts) {
569
+ try {
570
+ return parser(text, opts);
571
+ }
572
+ catch (e) {
573
+ process.env.PRETTIER_DEBUG = 'true';
574
+ throw e;
575
+ }
576
+ }
577
+ function makeNodeJSXCompatible(node) {
578
+ const newNode = { ...node };
579
+ if (isNodeWithChildren(newNode)) {
580
+ newNode.children.forEach((child) => {
581
+ if (isTagLikeNode(child)) {
582
+ child.attributes.forEach((attr) => {
583
+ if (attr.kind === 'shorthand') {
584
+ attr.kind = 'expression';
585
+ attr.value = attr.name;
586
+ attr.name = '__PRETTIER_SNIP__' + attr.name;
587
+ }
536
588
  });
537
- formattedStyles = stripTrailingHardline(formattedStyles);
538
- const attributes = path.map(print, 'attributes');
539
- const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
540
- return [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];
589
+ if (isNodeWithChildren(child)) {
590
+ child = makeNodeJSXCompatible(child);
591
+ }
541
592
  }
542
- case 'sass': {
543
- const lineEnding = opts.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';
544
- const sassOptions = {
545
- tabSize: opts.tabWidth,
546
- insertSpaces: !opts.useTabs,
547
- lineEnding,
548
- };
549
- const { result: raw } = manualDedent(styleTagContent);
550
- const formattedSassIndented = sassFormatter.SassFormatter.Format(raw, sassOptions).trim();
551
- const formattedSass = join(hardline, formattedSassIndented.split('\n'));
552
- const attributes = path.map(print, 'attributes');
553
- const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
554
- return [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];
593
+ });
594
+ }
595
+ return newNode;
596
+ }
597
+ function forceIntoExpression(statement) {
598
+ return `<>{${statement}\n}</>`;
599
+ }
600
+ function embedStyle(lang, content, path, print, textToDoc, options) {
601
+ switch (lang) {
602
+ case 'css':
603
+ case 'scss': {
604
+ let formattedStyles;
605
+ try {
606
+ formattedStyles = textToDoc(content, {
607
+ ...options,
608
+ parser: lang,
609
+ });
555
610
  }
611
+ catch (e) {
612
+ process.env.PRETTIER_DEBUG = 'true';
613
+ throw e;
614
+ }
615
+ formattedStyles = stripTrailingHardline(formattedStyles);
616
+ const attributes = path.map(print, 'attributes');
617
+ const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
618
+ return [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];
619
+ }
620
+ case 'sass': {
621
+ const lineEnding = options.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';
622
+ const sassOptions = {
623
+ tabSize: options.tabWidth,
624
+ insertSpaces: !options.useTabs,
625
+ lineEnding,
626
+ };
627
+ const { result: raw } = manualDedent(content);
628
+ const formattedSassIndented = sassFormatter.SassFormatter.Format(raw, sassOptions).trim();
629
+ const formattedSass = join(hardline, formattedSassIndented.split('\n'));
630
+ const attributes = path.map(print, 'attributes');
631
+ const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
632
+ return [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];
556
633
  }
557
634
  }
558
- return null;
559
635
  }
560
- function hasPrettierIgnore(path) {
561
- return false;
562
- }
563
- const printer = {
564
- print,
565
- printComment,
566
- embed,
567
- hasPrettierIgnore,
568
- };
569
-
570
- const options = {
571
- astroSortOrder: {
572
- since: '0.0.1',
573
- category: 'Astro',
574
- type: 'choice',
575
- default: 'markup | styles',
576
- description: 'Sort order for markup, scripts, and styles',
577
- choices: [
578
- {
579
- value: 'markup | styles',
580
- description: 'markup | styles',
581
- },
582
- {
583
- value: 'styles | markup',
584
- description: 'styles | markup',
585
- },
586
- ],
587
- },
588
- astroAllowShorthand: {
589
- since: '0.0.10',
590
- category: 'Astro',
591
- type: 'boolean',
592
- default: false,
593
- description: 'Enable/disable attribute shorthand if attribute name and expression are the same',
594
- },
595
- };
596
636
 
597
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
598
- const parse = synckit.createSyncFn(require$1.resolve('../workers/parse-worker.js'));
637
+ const req = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
638
+ let workerPath;
639
+ try {
640
+ workerPath = req.resolve('../workers/parse-worker.js');
641
+ }
642
+ catch (e) {
643
+ workerPath = req.resolve('prettier-plugin-astro/workers/parse-worker.js');
644
+ }
645
+ const parse = synckit.createSyncFn(req.resolve(workerPath));
599
646
  const languages = [
600
647
  {
601
648
  name: 'astro',
@@ -613,7 +660,10 @@ const parsers = {
613
660
  },
614
661
  };
615
662
  const printers = {
616
- astro: printer,
663
+ astro: {
664
+ print,
665
+ embed,
666
+ },
617
667
  };
618
668
  const defaultOptions = {
619
669
  tabWidth: 2,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/nodes.ts","../src/utils.ts","../src/printer.ts","../src/options.ts","../src/index.ts"],"sourcesContent":["import {\n\tNode,\n\tAttributeNode,\n\tRootNode,\n\tElementNode,\n\tComponentNode,\n\tCustomElementNode,\n\tExpressionNode,\n\tTextNode,\n\tFrontmatterNode,\n\tDoctypeNode,\n\tCommentNode,\n\tFragmentNode,\n} from '@astrojs/compiler/types';\n\n// MISSING ATTRIBUTE NODE FROM THE NODE TYPE\n\nexport interface NodeWithText {\n\tvalue: string;\n}\n\n// export interface Ast {\n// html: anyNode;\n// css: StyleNode[];\n// module: ScriptNode;\n// meta: {\n// features: number;\n// };\n// }\n\n// export interface BaseNode {\n// start: number;\n// end: number;\n// type: string;\n// children?: anyNode[];\n// // TODO: ADD BETTER TYPE\n// [prop_name: string]: any;\n// }\n\n// export type attributeValue = TextNode[] | AttributeShorthandNode[] | MustacheTagNode[] | true;\n\nexport interface NodeWithChildren {\n\t// children: anyNode[];\n\tchildren: Node[];\n}\n\n// export interface NodeWithText {\n// data: string;\n// raw?: string;\n// }\n\n// export interface FragmentNode extends BaseNode {\n// type: 'Fragment';\n// children: anyNode[];\n// }\n\n// export interface TextNode extends BaseNode {\n// type: 'Text';\n// data: string;\n// raw: string;\n// }\n\n// export interface CodeFenceNode extends BaseNode {\n// type: 'CodeFence';\n// metadata: string;\n// data: string;\n// raw: string;\n// }\n\n// export interface CodeSpanNode extends BaseNode {\n// type: 'CodeSpan';\n// metadata: string;\n// data: string;\n// raw: string;\n// }\n\n// export interface SpreadNode extends BaseNode {\n// type: 'Spread';\n// expression: ExpressionNode;\n// }\n\n// export interface ExpressionNode {\n// type: 'Expression';\n// start: number;\n// end: number;\n// codeChunks: string[];\n// children: anyNode[];\n// }\n\n// export interface ScriptNode extends BaseNode {\n// type: 'Script';\n// context: 'runtime' | 'setup';\n// content: string;\n// }\n\n// export interface StyleNode extends BaseNode {\n// type: 'Style';\n// // TODO: ADD BETTER TYPE\n// attributes: any[];\n// content: {\n// start: number;\n// end: number;\n// styles: string;\n// };\n// }\n\n// export interface AttributeNode extends BaseNode {\n// type: 'Attribute';\n// name: string;\n// value: attributeValue;\n// }\n\n// export interface AttributeShorthandNode extends BaseNode {\n// type: 'AttributeShorthand';\n// expression: IdentifierNode;\n// }\n\n// export interface IdentifierNode extends BaseNode {\n// type: 'Identifier';\n// name: string;\n// }\n\n// export interface MustacheTagNode extends BaseNode {\n// type: 'MustacheTag';\n// expression: ExpressionNode;\n// }\n\n// export interface SlotNode extends BaseNode {\n// type: 'Slot';\n// name: string;\n// attributes: AttributeNode[];\n// }\n\n// export interface CommentNode extends BaseNode {\n// type: 'Comment';\n// data: string;\n// name?: string;\n// leading?: boolean;\n// trailing?: boolean;\n// printed?: boolean;\n// nodeDescription?: string;\n// }\n\n// export interface ElementNode extends BaseNode {\n// type: 'Element';\n// name: string;\n// attributes: AttributeNode[];\n// }\n\n// export interface InlineComponentNode extends BaseNode {\n// type: 'InlineComponent';\n// name: string;\n// attributes: AttributeNode[];\n// }\n\nexport interface BlockElementNode extends ElementNode {\n\tname: typeof blockElementsT[number];\n}\n\nexport interface InlineElementNode extends ElementNode {\n\tname: typeof inlineElementsT[number];\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements\nconst blockElementsT = [\n\t'address',\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'details',\n\t'dialog',\n\t'dd',\n\t'div',\n\t'dl',\n\t'dt',\n\t'fieldset',\n\t'figcaption',\n\t'figure',\n\t'footer',\n\t'form',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'hgroup',\n\t'hr',\n\t'li',\n\t'main',\n\t'nav',\n\t'ol',\n\t'p',\n\t'pre',\n\t'section',\n\t'table',\n\t'ul',\n\t// TODO: WIP\n\t'title',\n\t'html',\n] as const;\n// https://github.com/microsoft/TypeScript/issues/31018\nexport const blockElements: string[] = [...blockElementsT];\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements\nconst inlineElementsT = [\n\t'a',\n\t'abbr',\n\t'acronym',\n\t'audio',\n\t'b',\n\t'bdi',\n\t'bdo',\n\t'big',\n\t'br',\n\t'button',\n\t'canvas',\n\t'cite',\n\t'code',\n\t'data',\n\t'datalist',\n\t'del',\n\t'dfn',\n\t'em',\n\t'embed',\n\t'i',\n\t'iframe',\n\t'img',\n\t'input',\n\t'ins',\n\t'kbd',\n\t'label',\n\t'map',\n\t'mark',\n\t'meter',\n\t'noscript',\n\t'object',\n\t'output',\n\t'picture',\n\t'progress',\n\t'q',\n\t'ruby',\n\t's',\n\t'samp',\n\t'script',\n\t'select',\n\t'slot',\n\t'small',\n\t'span',\n\t'strong',\n\t'sub',\n\t'sup',\n\t'svg',\n\t'template',\n\t'textarea',\n\t'time',\n\t'u',\n\t'tt',\n\t'var',\n\t'video',\n\t'wbr',\n] as const;\n// https://github.com/microsoft/TypeScript/issues/31018\nexport const inlineElements: string[] = [...inlineElementsT];\n\n// @see http://xahlee.info/js/html5_non-closing_tag.html\nexport const selfClosingTags = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'link',\n\t'meta',\n\t'param',\n\t'slot',\n\t'source',\n\t'track',\n\t'wbr',\n];\n\nexport type anyNode =\n\t| RootNode\n\t| AttributeNode\n\t| ElementNode\n\t| ComponentNode\n\t| CustomElementNode\n\t| ExpressionNode\n\t| TextNode\n\t| DoctypeNode\n\t| CommentNode\n\t| FragmentNode\n\t| FrontmatterNode;\n\nexport type {\n\tAttributeNode,\n\tNode,\n\tRootNode,\n\tElementNode,\n\tComponentNode,\n\tCustomElementNode,\n\tExpressionNode,\n\tTextNode,\n\tFrontmatterNode,\n\tDoctypeNode,\n\tCommentNode,\n\tFragmentNode,\n\tTagLikeNode,\n} from '@astrojs/compiler/types';\n","import { AstPath as AstP, doc, Doc, ParserOptions as ParserOpts, util } from 'prettier';\n\nimport {\n\tanyNode,\n\tNode,\n\tRootNode,\n\tAttributeNode,\n\tElementNode,\n\tComponentNode,\n\tCustomElementNode,\n\tExpressionNode,\n\tTextNode,\n\tFrontmatterNode,\n\tDoctypeNode,\n\tCommentNode,\n\tNodeWithText,\n\tblockElements,\n\t// attributeValue,\n\tBlockElementNode,\n\tInlineElementNode,\n\t// MustacheTagNode,\n\tNodeWithChildren,\n\tTagLikeNode,\n\t// NodeWithText,\n\t// TextNode,\n} from './nodes';\n\nimport { createSyncFn } from 'synckit';\nimport { createRequire } from 'node:module';\nconst require = createRequire(import.meta.url);\n\n// the worker path must be absolute\nconst serialize = createSyncFn(require.resolve('../workers/serialize-worker.js'));\n\ntype ParserOptions = ParserOpts<anyNode>;\ntype AstPath = AstP<anyNode>;\n\n/**\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\n */\nexport const formattableAttributes: string[] = [\n\t// None at the moment\n\t// Prettier HTML does not format attributes at all\n\t// and to be consistent we leave this array empty for now\n];\n\n// const rootNodeKeys = new Set(['html', 'css', 'module']);\n\n// const isSync = makeSynchronous(async (node: anyNode) => {\n// const dynamicImport = new Function('file', 'return import(file)');\n// const { is } = await dynamicImport('@astrojs/compiler/utils');\n// try {\n// return await is(node);\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n// export const is = (node: anyNode) => isSync(node);\n\nexport const isRootNode = (node: anyNode): node is RootNode => node.type === 'root';\n\nexport const isEmptyTextNode = (node: Node): boolean => {\n\treturn !!node && node.type === 'text' && getUnencodedText(node).trim() === '';\n};\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n\tif (!path || !path.stack || !Array.isArray(path.stack)) return false;\n\treturn path.stack.some(\n\t\t(node: anyNode) =>\n\t\t\t(node.type === 'element' && node.name.toLowerCase() === 'pre') ||\n\t\t\t(node.type === 'attribute' && !formattableAttributes.includes(node.name))\n\t);\n};\n\nexport function isLoneMustacheTag(node: AttributeNode): boolean {\n\t// export function isLoneMustacheTag(node: AttributeNode): node is [MustacheTagNode] {\n\treturn node.kind === 'expression';\n\t// return node !== true && node.length === 1 && node[0].type === 'MustacheTag';\n}\n\n// function isAttributeShorthand(node: attributeValue): node is [AttributeShorthandNode] {\n// return node !== true && node.length === 1 && node[0].type === 'AttributeShorthand';\n// }\n\n/**\n * True if node is of type `{a}` or `a={a}`\n */\nexport function isOrCanBeConvertedToShorthand(node: AttributeNode, opts: ParserOptions): boolean {\n\tif (!opts.astroAllowShorthand) return false;\n\tif (node.kind === 'shorthand') {\n\t\treturn true;\n\t}\n\t// if (isAttributeShorthand(node.value)) {\n\t// return true;\n\t// }\n\n\tif (node.value.trim() === node.name.trim()) {\n\t\treturn true;\n\t}\n\n\t// if (isLoneMustacheTag(node.value)) {\n\t// const expression = node.value[0].expression;\n\t// return expression.codeChunks[0].trim() === node.name;\n\t// // return (expression.type === 'Identifier' && expression.name === node.name) || (expression.type === 'Expression' && expression.codeChunks[0] === node.name);\n\t// }\n\n\treturn false;\n}\n\n/**\n * True if node is of type `{a}` and astroAllowShorthand is false\n */\nexport function isShorthandAndMustBeConvertedToBinaryExpression(\n\tnode: AttributeNode,\n\topts: ParserOptions\n): boolean {\n\tif (opts.astroAllowShorthand) return false;\n\tif (node.type === 'attribute' && node.kind === 'shorthand') {\n\t\treturn true;\n\t}\n\t// if (isAttributeShorthand(node.value)) {\n\t// return true;\n\t// }\n\treturn false;\n}\n\n// export function flatten<T>(arrays: T[][]): T[] {\n// return ([] as T[]).concat.apply([], arrays);\n// }\n\n// TODO: TEST IF IT'S GETTING THE CORRECT TEXT\nexport function getText(node: anyNode, opts: ParserOptions): string {\n\tif (!node.position) return '';\n\treturn opts.originalText.slice(node.position.start.offset + 1, node.position.end?.offset);\n\t// return opts.originalText.slice(opts.locStart(node), opts.locEnd(node));\n}\n\nexport function getUnencodedText(node: NodeWithText): string {\n\treturn node.value;\n}\n\n// export function replaceEndOfLineWith(text: string, replacement: doc.builders.DocCommand): Doc[] {\n// const parts = [];\n// for (const part of text.split('\\n')) {\n// if (parts.length > 0) {\n// parts.push(replacement);\n// }\n// if (part.endsWith('\\r')) {\n// parts.push(part.slice(0, -1));\n// } else {\n// parts.push(part);\n// }\n// }\n// return parts;\n// }\n\n/**\n * Returns the content of the node\n */\nexport function printRaw(node: anyNode, stripLeadingAndTrailingNewline = false): string {\n\tif (!isNodeWithChildren(node)) {\n\t\treturn '';\n\t}\n\n\tif (node.children.length === 0) {\n\t\treturn '';\n\t}\n\n\tlet raw = node.children.reduce((prev: string, curr: Node) => prev + serialize(curr), '');\n\n\tif (!stripLeadingAndTrailingNewline) {\n\t\treturn raw;\n\t}\n\n\tif (startsWithLinebreak(raw)) {\n\t\traw = raw.substring(raw.indexOf('\\n') + 1);\n\t}\n\tif (endsWithLinebreak(raw)) {\n\t\traw = raw.substring(0, raw.lastIndexOf('\\n'));\n\t\tif (raw.charAt(raw.length - 1) === '\\r') {\n\t\t\traw = raw.substring(0, raw.length - 1);\n\t\t}\n\t}\n\n\treturn raw;\n}\n\nexport function isNodeWithChildren(node: anyNode): node is anyNode & NodeWithChildren {\n\treturn node && 'children' in node && Array.isArray(node.children);\n}\n\nexport function isInlineElement(\n\tpath: AstPath,\n\topts: ParserOptions,\n\tnode: anyNode\n): node is InlineElementNode {\n\treturn node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path);\n}\n\nexport function isBlockElement(node: anyNode, opts: ParserOptions): node is BlockElementNode {\n\treturn (\n\t\tnode &&\n\t\tnode.type === 'element' &&\n\t\topts.htmlWhitespaceSensitivity !== 'strict' &&\n\t\t(opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name))\n\t);\n}\n\nexport function isTextNodeStartingWithLinebreak(node: TextNode, nrLines = 1): node is TextNode {\n\treturn startsWithLinebreak(getUnencodedText(node), nrLines);\n\t// return node.type === 'Text' && startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\n}\n\n// export function isTextNodeEndingWithLinebreak(node: TextNode, nrLines: number = 1) {\n// return node.type === 'text' && endsWithLinebreak(getUnencodedText(node), nrLines);\n// }\n\nexport function endsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\n\treturn node.type === 'text' && /^\\s/.test(getUnencodedText(node));\n}\n\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\n\treturn node.type === 'text' && /\\s$/.test(getUnencodedText(node));\n}\n\nexport function forceIntoExpression(statement: string): string {\n\t// note the trailing newline: if the statement ends in a // comment,\n\t// we can't add the closing bracket right afterwards\n\treturn `<>{${statement}\\n}</>`;\n}\n\n/**\n * Check if given node's starg tag should hug its first child. This is the case for inline elements when there's\n * no whitespace between the `>` and the first child.\n */\nexport function shouldHugStart(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst firstChild = children[0];\n\treturn !isTextNodeStartingWithWhitespace(firstChild);\n}\n\n/**\n * Check if given node's end tag should hug its last child. This is the case for inline elements when there's\n * no whitespace between the last child and the `</`.\n */\nexport function shouldHugEnd(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\treturn false;\n\n\t// TODO: WIP\n\t// const lastChild = children[children.length - 1];\n\t// return !isTextNodeEndingWithWhitespace(lastChild);\n}\n\n/**\n * Returns true if the softline between `</tagName` and `>` can be omitted.\n */\nexport function canOmitSoftlineBeforeClosingTag(path: AstPath, opts: ParserOptions): boolean {\n\treturn isLastChildWithinParentBlockElement(path, opts);\n\t// return !hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options);\n\t// return !options.svelteBracketNewLine && (!hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options));\n}\n\n/**\n * Return true if given node does not hug the next node, meaning there's whitespace\n * or the end of the doc afterwards.\n */\n// function hugsStartOfNextNode(node: anyNode, opts: ParserOptions): boolean {\n// if (node.end === opts.originalText.length) {\n// // end of document\n// return false;\n// }\n\n// return !opts.originalText.substring(node.end).match(/^\\s/);\n// }\n\nfunction getChildren(node: anyNode): Node[] {\n\treturn isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(path: AstPath, opts: ParserOptions): boolean {\n\tconst parent = path.getParentNode();\n\tif (!parent || !isBlockElement(parent, opts)) {\n\t\treturn false;\n\t}\n\n\tconst children = getChildren(parent);\n\tconst lastChild = children[children.length - 1];\n\treturn lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n\tnode.value = node.value && node.value.trimStart();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n\tnode.value = node.value && node.value.trimEnd();\n}\n\n// export function findLastIndex<T>(isMatch: (item: T, idx: number) => boolean, items: T[]) {\n// for (let i = items.length - 1; i >= 0; i--) {\n// if (isMatch(items[i], i)) {\n// return i;\n// }\n// }\n\n// return -1;\n// }\n\n/**\n * Remove all leading whitespace up until the first non-empty text node,\n * and all trailing whitepsace from the last non-empty text node onwards.\n */\n// export function trimChildren(children: anyNode[]) {\n// // export function trimChildren(children: anyNode[], path: AstPath<anyNode>) {\n// let firstNonEmptyNode = children.findIndex((n) => !isEmptyTextNode(n));\n// // let firstNonEmptyNode = children.findIndex((n) => !isEmptyTextNode(n) && !doesEmbedStartAfterNode(n, path));\n// firstNonEmptyNode = firstNonEmptyNode === -1 ? children.length - 1 : firstNonEmptyNode;\n\n// let lastNonEmptyNode = findLastIndex((n, idx) => {\n// // Last node is ok to end at the start of an embedded region,\n// // if it's not a comment (which should stick to the region)\n// return !isEmptyTextNode(n);\n// // return !isEmptyTextNode(n) && ((idx === children.length - 1 && n.type !== 'Comment') || !doesEmbedStartAfterNode(n, path));\n// }, children);\n// lastNonEmptyNode = lastNonEmptyNode === -1 ? 0 : lastNonEmptyNode;\n\n// for (let i = 0; i <= firstNonEmptyNode; i++) {\n// const n = children[i];\n// if (isTextNode(n)) {\n// trimTextNodeLeft(n);\n// }\n// }\n\n// for (let i = children.length - 1; i >= lastNonEmptyNode; i--) {\n// const n = children[i];\n// if (isTextNode(n)) {\n// trimTextNodeRight(n);\n// }\n// }\n// }\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\n// export function getSiblings(path: AstPath): anyNode[] {\n// let parent = path.getParentNode();\n// if (!parent) return [];\n\n// if (isRootNode(parent)) {\n// parent = parent.html;\n// }\n\n// return getChildren(parent);\n// }\n\n/**\n * Did there use to be any embedded object (that has been snipped out of the AST to be moved)\n * at the specified position?\n */\n// function doesEmbedStartAfterNode(node: anyNode, path: AstPath<anyNode>, siblings = getSiblings(path)): boolean {\n// // If node is not at the top level of html, an embed cannot start after it,\n// // because embeds are only at the top level\n// if (!isNodeTopLevelHTML(node, path)) {\n// return false;\n// }\n\n// const position = node.end;\n// const root = path.stack[0];\n\n// const embeds = [root.module, root.html, root.css];\n\n// const nextNode = siblings[siblings.indexOf(node) + 1];\n// return embeds.find((n) => n && n.start >= position && (!nextNode || n.end <= nextNode.start));\n// }\n\n// function isNodeTopLevelHTML(node: anyNode, path: AstPath<anyNode>) {\n// const root = path.stack[0];\n// return !!root.html && !!root.html.children && root.html.children.includes(node);\n// }\n\n/**\n * Check if doc is a hardline.\n * We can't just rely on a simple equality check because the doc could be created with another\n * runtime version of prettier than what we import, making a reference check fail.\n */\n\n// function isHardline(docToCheck: Doc): boolean {\n// return docToCheck === doc.builders.hardline || deepEqual(docToCheck, doc.builders.hardline);\n// }\n\n/**\n * Simple deep equal function which suits our needs. Only works properly on POJOs without cyclic deps.\n */\n// function deepEqual(x: any, y: any): boolean {\n// if (x === y) {\n// return true;\n// } else if (typeof x == 'object' && x != null && typeof y == 'object' && y != null) {\n// if (Object.keys(x).length != Object.keys(y).length) return false;\n\n// for (var prop in x) {\n// if (Object.prototype.hasOwnProperty.call(y, prop)) {\n// if (!deepEqual(x[prop], y[prop])) return false;\n// } else {\n// return false;\n// }\n// }\n\n// return true;\n// } else {\n// return false;\n// }\n// }\n\n// export function isLine(docToCheck: Doc): boolean {\n// return (\n// isHardline(docToCheck) ||\n// (typeof docToCheck === 'object' && isDocCommand(docToCheck) && docToCheck.type === 'line') ||\n// (typeof docToCheck === 'object' && isDocCommand(docToCheck) && docToCheck.type === 'concat' && docToCheck.parts.every(isLine))\n// );\n// }\n\n/**\n * Check if the doc is empty, i.e. consists of nothing more than empty strings (possibly nested).\n */\n// export function isEmptyDoc(doc: Doc): boolean {\n// if (typeof doc === 'string') {\n// return doc.length === 0;\n// }\n\n// // if (doc.type === 'line') {\n// // return !doc.keepIfLonely;\n// // }\n\n// // Since Prettier 2.3.0, concats are represented as flat arrays\n// if (Array.isArray(doc)) {\n// return doc.length === 0;\n// }\n\n// // const { contents } = doc;\n\n// // if (contents) {\n// // return isEmptyDoc(contents);\n// // }\n\n// // const { parts } = doc;\n\n// // if (parts) {\n// // return isEmptyGroup(parts);\n// // }\n\n// return false;\n// }\n\n// function isEmptyGroup(group: any) {\n// return !group.find((doc: any) => !isEmptyDoc(doc));\n// }\n\n/**\n * Trims both leading and trailing nodes matching `isWhitespace` independent of nesting level\n * (though all trimmed adjacent nodes need to be a the same level). Modifies the `docs` array.\n */\n// export function trim(docs: Doc[], isWhitespace: (doc: Doc) => boolean): Doc[] {\n// trimLeft(docs, isWhitespace);\n// trimRight(docs, isWhitespace);\n\n// return docs;\n// }\n\n/**\n * Trims the leading nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\n * If there are empty docs before the first whitespace, they are removed, too.\n */\n// function trimLeft(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\n// let firstNonWhitespace = group.findIndex((doc) => !isEmptyDoc(doc) && !isWhitespace(doc));\n\n// if (firstNonWhitespace < 0 && group.length) {\n// firstNonWhitespace = group.length;\n// }\n\n// if (firstNonWhitespace > 0) {\n// const removed = group.splice(0, firstNonWhitespace);\n// if (removed.every(isEmptyDoc)) {\n// return trimLeft(group, isWhitespace);\n// }\n// } else {\n// const parts = getParts(group[0]);\n\n// if (parts) {\n// return trimLeft(parts, isWhitespace);\n// }\n// }\n// }\n\n/**\n * Trims the trailing nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\n * If there are empty docs after the last whitespace, they are removed, too.\n */\n// function trimRight(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\n// let lastNonWhitespace = group.length ? findLastIndex((doc: any) => !isEmptyDoc(doc) && !isWhitespace(doc), group) : 0;\n\n// if (lastNonWhitespace < group.length - 1) {\n// const removed = group.splice(lastNonWhitespace + 1);\n// if (removed.every(isEmptyDoc)) {\n// return trimRight(group, isWhitespace);\n// }\n// } else {\n// const parts = getParts(group[group.length - 1]);\n\n// if (parts) {\n// return trimRight(parts, isWhitespace);\n// }\n// }\n// }\n\n// function getParts(doc: Doc): Doc[] | undefined {\n// if (typeof doc === 'object') {\n// // Since Prettier 2.3.0, concats are represented as flat arrays\n// if (Array.isArray(doc)) {\n// return doc;\n// }\n// if (doc.type === 'fill' || doc.type === 'concat') {\n// return doc.parts;\n// }\n// if (doc.type === 'group') {\n// return getParts(doc.contents);\n// }\n// }\n// }\n\n// export const isObjEmpty = (obj: object): boolean => {\n// for (let i in obj) return false;\n// return true;\n// };\n\n/** Shallowly attach comments to children */\n// export function attachCommentsHTML(node: anyNode): void {\n// if (!isNodeWithChildren(node) || !node.children.some(({ type }) => type === 'Comment')) return;\n\n// const nodesToRemove = [];\n\n// // note: the .length - 1 is because we don’t need to read the last node\n// for (let n = 0; n < node.children.length - 1; n++) {\n// if (!node.children[n]) continue;\n\n// // attach comment to the next non-whitespace node\n// if (node.children[n].type === 'Comment') {\n// let next = n + 1;\n// while (isEmptyTextNode(node.children[next])) {\n// nodesToRemove.push(next); // if arbitrary whitespace between comment and node, remove\n// next++; // skip to the next non-whitespace node\n// }\n// const commentNode = node.children[next];\n// if (commentNode) {\n// const comment = node.children[n];\n// util.addLeadingComment(commentNode, comment);\n// }\n// }\n// }\n\n// // remove arbitrary whitespace nodes\n// nodesToRemove.reverse(); // start at back so we aren’t changing indices\n// nodesToRemove.forEach((index) => {\n// node.children.splice(index, 1);\n// });\n// }\n\n/** dedent string & return tabSize (the last part is what we need) */\nexport function manualDedent(input: string): {\n\ttabSize: number;\n\tchar: string;\n\tresult: string;\n} {\n\tlet minTabSize = Infinity;\n\tlet result = input;\n\t// 1. normalize\n\tresult = result.replace(/\\r\\n/g, '\\n');\n\n\t// 2. count tabSize\n\tlet char = '';\n\tfor (const line of result.split('\\n')) {\n\t\tif (!line) continue;\n\t\t// if any line begins with a non-whitespace char, minTabSize is 0\n\t\tif (line[0] && /^[^\\s]/.test(line[0])) {\n\t\t\tminTabSize = 0;\n\t\t\tbreak;\n\t\t}\n\t\tconst match = line.match(/^(\\s+)\\S+/); // \\S ensures we don’t count lines of pure whitespace\n\t\tif (match) {\n\t\t\tif (match[1] && !char) char = match[1][0];\n\t\t\tif (match[1].length < minTabSize) minTabSize = match[1].length;\n\t\t}\n\t}\n\n\t// 3. reformat string\n\tif (minTabSize > 0 && Number.isFinite(minTabSize)) {\n\t\tresult = result.replace(new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'), '');\n\t}\n\n\treturn {\n\t\ttabSize: minTabSize === Infinity ? 0 : minTabSize,\n\t\tchar,\n\t\tresult,\n\t};\n}\n\n/** re-indent string by chars */\n// export function indent(input: string, char: string = ' '): string {\n// return input.replace(/^(.)/gm, `${char}$1`);\n// }\n\n// TODO: USE THE COMPILER\n/** True if the node is of type text */\nexport function isTextNode(node: anyNode): node is TextNode {\n\treturn node.type === 'text';\n}\n\n// export function isMustacheNode(node: anyNode): node is MustacheTagNode {\n// return node.type === 'MustacheTag';\n// }\n\n// export function isDocCommand(doc: Doc): doc is doc.builders.DocCommand {\n// if (typeof doc === 'string') return false;\n// if (Array.isArray(doc)) return false;\n// return true;\n// }\n\nexport function isInsideQuotedAttribute(path: AstPath): boolean {\n\tconst stack = path.stack as anyNode[];\n\treturn stack.some((node) => node.type === 'attribute' && !isLoneMustacheTag(node));\n}\n\n/** True if the node is TagLikeNode:\n *\n * ElementNode | ComponentNode | CustomElementNode | FragmentNode */\nexport function isTagLikeNode(node: anyNode): node is TagLikeNode {\n\treturn (\n\t\tnode.type === 'element' ||\n\t\tnode.type === 'component' ||\n\t\tnode.type === 'custom-element' ||\n\t\tnode.type === 'fragment'\n\t);\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n\tconst parent = path.getParentNode();\n\tif (!parent) return [];\n\n\treturn getChildren(parent);\n}\n\nexport function getNextNode(path: AstPath): anyNode | null {\n\tconst node = path.getNode();\n\tif (node) {\n\t\tconst siblings = getSiblings(path);\n\t\tif (node.position?.start === siblings[siblings.length - 1].position?.start) return null;\n\t\tfor (let i = 0; i < siblings.length; i++) {\n\t\t\tconst sibling = siblings[i];\n\t\t\tif (sibling.position?.start === node.position?.start && i !== siblings.length - 1) {\n\t\t\t\treturn siblings[i + 1];\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n","import {\n\tAstPath as AstP,\n\tBuiltInParsers,\n\tDoc,\n\tParserOptions as ParserOpts,\n\tPrinter,\n} from 'prettier';\nimport _doc from 'prettier/doc';\nconst {\n\tbuilders: {\n\t\tbreakParent,\n\t\tdedent,\n\t\tfill,\n\t\tgroup,\n\t\thardline,\n\t\tindent,\n\t\tjoin,\n\t\tline,\n\t\tliteralline,\n\t\tsoftline,\n\t},\n\tutils: { removeLines, stripTrailingHardline },\n} = _doc;\nimport { SassFormatter, SassFormatterConfig } from 'sass-formatter';\n\nimport { parseSortOrder } from './options';\n\nimport {\n\tRootNode,\n\tNode,\n\tAttributeNode,\n\tCommentNode,\n\tNodeWithText,\n\tselfClosingTags,\n\tTextNode,\n\tanyNode,\n} from './nodes';\n\ntype ParserOptions = ParserOpts<anyNode>;\ntype AstPath = AstP<anyNode>;\n\nimport {\n\t// attachCommentsHTML,\n\tcanOmitSoftlineBeforeClosingTag,\n\tmanualDedent,\n\tendsWithLinebreak,\n\tforceIntoExpression,\n\tformattableAttributes,\n\tgetText,\n\tgetUnencodedText,\n\tisRootNode,\n\t// isDocCommand,\n\t// isEmptyDoc,\n\tisEmptyTextNode,\n\tisInlineElement,\n\tisInsideQuotedAttribute,\n\t// isLine,\n\tisLoneMustacheTag,\n\t// isNodeWithChildren,\n\tisOrCanBeConvertedToShorthand,\n\tisPreTagContent,\n\tisShorthandAndMustBeConvertedToBinaryExpression,\n\tisTextNode,\n\tisTextNodeEndingWithWhitespace,\n\tisTextNodeStartingWithLinebreak,\n\tisTextNodeStartingWithWhitespace,\n\tprintRaw,\n\t// replaceEndOfLineWith,\n\tshouldHugEnd,\n\tshouldHugStart,\n\tstartsWithLinebreak,\n\t// trim,\n\t// trimChildren,\n\ttrimTextNodeLeft,\n\ttrimTextNodeRight,\n\tgetNextNode,\n\tisTagLikeNode,\n} from './utils';\n\n// function printTopLevelParts(node: RootNode, path: AstPath, opts: ParserOptions, print: printFn): Doc {\n// let docs = [];\n\n// const normalize = (doc: Doc) => [stripTrailingHardline(doc), hardline];\n\n// // frontmatter always comes first\n// if (node.module) {\n// const subDoc = normalize(path.call(print, 'module'));\n// docs.push(subDoc);\n// }\n\n// // markup and styles follow, whichever the user prefers (default: markup, styles)\n// for (const section of parseSortOrder(opts.astroSortOrder)) {\n// switch (section) {\n// case 'markup': {\n// const subDoc = path.call(print, 'html');\n// if (!isEmptyDoc(subDoc)) docs.push(normalize(subDoc));\n// break;\n// }\n// case 'styles': {\n// const subDoc = path.call(print, 'css');\n// if (!isEmptyDoc(subDoc)) docs.push(normalize(subDoc));\n// break;\n// }\n// }\n// }\n\n// return join(softline, docs);\n// }\n\n// function printAttributeNodeValue(path: AstPath, print: printFn, quotes: boolean, node: AttributeNode): Doc[] | _doc.builders.Indent {\n// const valueDocs = path.map((childPath) => childPath.call(print), 'value');\n\n// if (!quotes || !formattableAttributes.includes(node.name)) {\n// return valueDocs;\n// } else {\n// return indent(group(trim(valueDocs, isLine)));\n// }\n// }\n\n// TODO: USE ASTPATH GENERIC\n// function printJS(path: AstP, print: printFn, name: string, { forceSingleQuote, forceSingleLine }: { forceSingleQuote: boolean; forceSingleLine: boolean }) {\n// path.getValue()[name].isJS = true;\n// path.getValue()[name].forceSingleQuote = forceSingleQuote;\n// path.getValue()[name].forceSingleLine = forceSingleLine;\n// return path.call(print, name);\n// }\n\n// TODO: MAYBE USE THIS TO HANDLE COMMENTS\nfunction printComment(commentPath: AstPath, options: ParserOptions): Doc {\n\t// note(drew): this isn’t doing anything currently, but Prettier requires it anyway\n\t// @ts-ignore\n\treturn commentPath;\n}\n\nexport type printFn = (path: AstPath) => Doc;\n\n// eslint-disable-next-line @typescript-eslint/no-shadow\nfunction print(path: AstPath, opts: ParserOptions, print: printFn): Doc {\n\tconst node = path.getValue();\n\t// const isMarkdownSubDoc = opts.parentParser === 'markdown'; // is this a code block within .md?\n\n\t// 1. handle special node types\n\tif (!node) {\n\t\treturn '';\n\t}\n\n\tif (typeof node === 'string') {\n\t\treturn node;\n\t}\n\n\t// if (Array.isArray(node)) {\n\t// return path.map((childPath) => childPath.call(print));\n\t// }\n\n\t// if (isASTNode(node)) {\n\t// return printTopLevelParts(node, path, opts, print);\n\t// }\n\n\t// 2. attach comments shallowly to children, if any (https://prettier.io/docs/en/plugins.html#manually-attaching-a-comment)\n\t// if (!isPreTagContent(path) && !isMarkdownSubDoc && node.type === 'Fragment') {\n\t// attachCommentsHTML(node);\n\t// }\n\n\t// 3. handle printing\n\tswitch (node.type) {\n\t\tcase 'root': {\n\t\t\treturn [stripTrailingHardline(path.map(print, 'children')), hardline];\n\t\t}\n\n\t\t// case 'Fragment': {\n\t\t// const text = getText(node, opts);\n\t\t// if (text.length === 0) {\n\t\t// return '';\n\t\t// }\n\n\t\t// if (!isNodeWithChildren(node) || node.children.every(isEmptyTextNode)) return '';\n\n\t\t// if (!isPreTagContent(path)) {\n\t\t// trimChildren(node.children);\n\t\t// const output = trim(\n\t\t// [path.map(print, 'children')],\n\t\t// (n) =>\n\t\t// isLine(n) ||\n\t\t// (typeof n === 'string' && n.trim() === '') ||\n\t\t// // Because printChildren may append this at the end and\n\t\t// // may hide other lines before it\n\t\t// n === breakParent\n\t\t// );\n\t\t// if (output.every((doc) => isEmptyDoc(doc))) {\n\t\t// return '';\n\t\t// }\n\t\t// return group([...output, hardline]);\n\t\t// } else {\n\t\t// return group(path.map(print, 'children'));\n\t\t// }\n\t\t// }\n\t\tcase 'text': {\n\t\t\tconst rawText = getUnencodedText(node);\n\n\t\t\t// TODO: TEST PRE TAGS\n\t\t\t// if (isPreTagContent(path)) {\n\t\t\t// if (path.getParentNode()?.type === 'Attribute') {\n\t\t\t// // Direct child of attribute value -> add literallines at end of lines\n\t\t\t// // so that other things don't break in unexpected places\n\t\t\t// return replaceEndOfLineWith(rawText, literalline);\n\t\t\t// }\n\t\t\t// return rawText;\n\t\t\t// }\n\n\t\t\tif (isEmptyTextNode(node)) {\n\t\t\t\tconst hasWhiteSpace = rawText.trim().length < getUnencodedText(node).length;\n\t\t\t\tconst hasOneOrMoreNewlines = /\\n/.test(getUnencodedText(node));\n\t\t\t\tconst hasTwoOrMoreNewlines = /\\n\\r?\\s*\\n\\r?/.test(getUnencodedText(node));\n\t\t\t\tif (hasTwoOrMoreNewlines) {\n\t\t\t\t\treturn [hardline, hardline];\n\t\t\t\t}\n\t\t\t\tif (hasOneOrMoreNewlines) {\n\t\t\t\t\treturn hardline;\n\t\t\t\t}\n\t\t\t\tif (hasWhiteSpace) {\n\t\t\t\t\treturn line;\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n\t\t\t * each \"word\") is joined by a single `line`, which will be rendered as a single space\n\t\t\t * until this node's current line is out of room, at which `fill` will break at the\n\t\t\t * most convenient instance of `line`.\n\t\t\t */\n\t\t\treturn fill(splitTextToDocs(node));\n\t\t}\n\n\t\t// case 'InlineComponent':\n\t\t// case 'Slot':\n\t\tcase 'component':\n\t\tcase 'fragment':\n\t\tcase 'element': {\n\t\t\t// const isEmpty = node.children?.every((child) => isEmptyTextNode(child));\n\t\t\tlet isEmpty: boolean;\n\t\t\tif (!node.children) {\n\t\t\t\tisEmpty = true;\n\t\t\t} else {\n\t\t\t\tisEmpty = node.children.every((child) => isEmptyTextNode(child));\n\t\t\t}\n\t\t\tconst isSelfClosingTag =\n\t\t\t\tisEmpty && (node.type !== 'element' || selfClosingTags.indexOf(node.name) !== -1);\n\n\t\t\tconst attributeLine =\n\t\t\t\topts.singleAttributePerLine && node.attributes.length > 1 ? breakParent : '';\n\t\t\tconst attributes = join(attributeLine, path.map(print, 'attributes'));\n\n\t\t\tif (isSelfClosingTag) {\n\t\t\t\treturn group(['<', node.name, indent(group(attributes)), line, `/>`]);\n\t\t\t\t// return group(['<', node.name, indent(group([...attributes, opts.jsxBracketNewLine ? dedent(line) : ''])), ...[opts.jsxBracketNewLine ? '' : ' ', `/>`]]);\n\t\t\t}\n\n\t\t\tif (node.children) {\n\t\t\t\tconst children = node.children;\n\t\t\t\tconst firstChild = children[0];\n\t\t\t\tconst lastChild = children[children.length - 1];\n\n\t\t\t\t// No hugging of content means it's either a block element and/or there's whitespace at the start/end\n\t\t\t\tlet noHugSeparatorStart:\n\t\t\t\t\t| _doc.builders.Concat\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| string = softline;\n\t\t\t\tlet noHugSeparatorEnd:\n\t\t\t\t\t| _doc.builders.Concat\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| string = softline;\n\t\t\t\tconst hugStart = shouldHugStart(node, opts);\n\t\t\t\tconst hugEnd = shouldHugEnd(node, opts);\n\n\t\t\t\tlet body;\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\tbody =\n\t\t\t\t\t\tisInlineElement(path, opts, node) &&\n\t\t\t\t\t\tnode.children.length &&\n\t\t\t\t\t\tisTextNodeStartingWithWhitespace(node.children[0]) &&\n\t\t\t\t\t\t!isPreTagContent(path)\n\t\t\t\t\t\t\t? () => line\n\t\t\t\t\t\t\t: // () => (opts.jsxBracketNewLine ? '' : softline);\n\t\t\t\t\t\t\t () => softline;\n\t\t\t\t} else if (isPreTagContent(path)) {\n\t\t\t\t\tbody = () => printRaw(node);\n\t\t\t\t} else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t} else {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t}\n\n\t\t\t\tconst openingTag = [\n\t\t\t\t\t'<',\n\t\t\t\t\tnode.name,\n\t\t\t\t\tindent(\n\t\t\t\t\t\tgroup([\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\thugStart\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: !isPreTagContent(path) && !opts.bracketSameLine\n\t\t\t\t\t\t\t\t? dedent(softline)\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t])\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\t\t// const openingTag = ['<', node.name, indent(group([...attributes, hugStart ? '' : opts.jsxBracketNewLine && !isPreTagContent(path) ? dedent(softline) : '']))];\n\n\t\t\t\tif (hugStart && hugEnd) {\n\t\t\t\t\tconst huggedContent = [softline, group(['>', body(), `</${node.name}`])];\n\n\t\t\t\t\tconst omitSoftlineBeforeClosingTag =\n\t\t\t\t\t\tisEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n\t\t\t\t\t// const omitSoftlineBeforeClosingTag = (isEmpty && opts.jsxBracketNewLine) || canOmitSoftlineBeforeClosingTag(node, path, opts);\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tisEmpty ? group(huggedContent) : group(indent(huggedContent)),\n\t\t\t\t\t\tomitSoftlineBeforeClosingTag ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isPreTagContent(path)) {\n\t\t\t\t\tnoHugSeparatorStart = '';\n\t\t\t\t\tnoHugSeparatorEnd = '';\n\t\t\t\t} else {\n\t\t\t\t\tlet didSetEndSeparator = false;\n\n\t\t\t\t\tif (!hugStart && firstChild && isTextNode(firstChild)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tisTextNodeStartingWithLinebreak(firstChild) &&\n\t\t\t\t\t\t\tfirstChild !== lastChild &&\n\t\t\t\t\t\t\t(!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = hardline;\n\t\t\t\t\t\t\tnoHugSeparatorEnd = hardline;\n\t\t\t\t\t\t\tdidSetEndSeparator = true;\n\t\t\t\t\t\t} else if (isInlineElement(path, opts, node)) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = line;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeLeft(firstChild);\n\t\t\t\t\t}\n\t\t\t\t\tif (!hugEnd && lastChild && isTextNode(lastChild)) {\n\t\t\t\t\t\tif (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n\t\t\t\t\t\t\tnoHugSeparatorEnd = softline;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeRight(lastChild);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (hugStart) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tindent([softline, group(['>', body()])]),\n\t\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (hugEnd) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t\tindent([noHugSeparatorStart, group([body(), `</${node.name}`])]),\n\t\t\t\t\t\tcanOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\treturn group([...openingTag, '>', body(), `</${node.name}>`]);\n\t\t\t\t}\n\n\t\t\t\treturn group([\n\t\t\t\t\t...openingTag,\n\t\t\t\t\t'>',\n\t\t\t\t\tindent([noHugSeparatorStart, body()]),\n\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t]);\n\t\t\t}\n\t\t\t// TODO: WIP\n\t\t\treturn '';\n\t\t}\n\t\t// case 'AttributeShorthand': {\n\t\t// return node.expression.name;\n\t\t// }\n\t\tcase 'attribute': {\n\t\t\tconst name = node.name.trim();\n\t\t\tconst quote = opts.jsxSingleQuote ? \"'\" : '\"';\n\t\t\tswitch (node.kind) {\n\t\t\t\tcase 'empty':\n\t\t\t\t\treturn [line, name];\n\t\t\t\tcase 'expression':\n\t\t\t\t\t// HANDLED IN EMBED FUNCION\n\t\t\t\t\treturn '';\n\t\t\t\tcase 'quoted':\n\t\t\t\t\treturn [line, name, '=', quote, node.value, quote];\n\t\t\t\tcase 'shorthand':\n\t\t\t\t\treturn [line, '{', name, '}'];\n\t\t\t\tcase 'spread':\n\t\t\t\t\treturn [line, '{...', name, '}'];\n\t\t\t\tcase 'template-literal':\n\t\t\t\t\treturn [line, name, '=', '`', node.value, '`'];\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'doctype': {\n\t\t\t// https://www.w3.org/wiki/Doctypes_and_markup_styles\n\t\t\treturn ['<!DOCTYPE html>', hardline];\n\t\t}\n\t\t// case 'Expression':\n\t\t// // missing test ?\n\t\t// return [];\n\t\t// case 'MustacheTag':\n\t\t// return [\n\t\t// '{',\n\t\t// printJS(path, print, 'expression', {\n\t\t// forceSingleLine: isInsideQuotedAttribute(path),\n\t\t// forceSingleQuote: opts.jsxSingleQuote,\n\t\t// }),\n\t\t// '}',\n\t\t// ];\n\t\t// case 'Spread':\n\t\t// return [\n\t\t// line,\n\t\t// '{...',\n\t\t// printJS(path, print, 'expression', {\n\t\t// forceSingleQuote: true,\n\t\t// forceSingleLine: false,\n\t\t// }),\n\t\t// '}',\n\t\t// ];\n\t\tcase 'comment':\n\t\t\tconst nextNode = getNextNode(path);\n\t\t\tlet trailingLine: _doc.builders.Concat | string = '';\n\t\t\tif (nextNode && isTagLikeNode(nextNode)) {\n\t\t\t\ttrailingLine = hardline;\n\t\t\t}\n\t\t\treturn ['<!--', getUnencodedText(node), '-->', trailingLine];\n\t\t// case 'CodeSpan':\n\t\t// return getUnencodedText(node);\n\t\t// case 'CodeFence': {\n\t\t// console.debug(node);\n\t\t// // const lang = node.metadata.slice(3);\n\t\t// return [node.metadata, hardline, /** somehow call textToDoc(lang), */ node.data, hardline, '```', hardline];\n\n\t\t// // We should use `node.metadata` to select a parser to embed with... something like return [node.metadata, hardline textToDoc(node.getMetadataLanguage()), hardline, `\\`\\`\\``];\n\t\t// }\n\t\tdefault: {\n\t\t\tthrow new Error(`Unhandled node type \"${node.type}\"!`);\n\t\t}\n\t}\n}\n\n/**\n * Split the text into words separated by whitespace. Replace the whitespaces by lines,\n * collapsing multiple whitespaces into a single line.\n *\n * If the text starts or ends with multiple newlines, two of those should be kept.\n */\nfunction splitTextToDocs(node: NodeWithText): Doc[] {\n\tconst text = getUnencodedText(node);\n\n\tconst textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n\tlet docs = join(line, textLines).parts.filter((s) => s !== '');\n\n\tif (startsWithLinebreak(text)) {\n\t\tdocs[0] = hardline;\n\t}\n\tif (startsWithLinebreak(text, 2)) {\n\t\tdocs = [hardline, ...docs];\n\t}\n\n\tif (endsWithLinebreak(text)) {\n\t\tdocs[docs.length - 1] = hardline;\n\t}\n\tif (endsWithLinebreak(text, 2)) {\n\t\tdocs = [...docs, hardline];\n\t}\n\n\treturn docs;\n}\n\nfunction expressionParser(text: string, parsers: BuiltInParsers, opts: ParserOptions) {\n\tconst ast = parsers.babel(text, opts);\n\t// const ast = parsers.babel(text, parsers, opts);\n\n\treturn {\n\t\t...ast,\n\t\tprogram: ast.program.body[0].expression.children[0].expression,\n\t};\n}\n\nfunction embed(\n\tpath: AstPath,\n\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\tprint: printFn,\n\ttextToDoc: (text: string, options: object) => Doc,\n\topts: ParserOptions\n) {\n\t// TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n\t// @ts-ignore\n\tif (!opts.__astro) opts.__astro = {};\n\n\tconst node = path.getValue();\n\n\tif (!node) return null;\n\n\tif (node.type === 'expression') {\n\t\tconst textContent = printRaw(node);\n\n\t\tlet content: Doc;\n\n\t\tcontent = textToDoc(forceIntoExpression(textContent), {\n\t\t\t...opts,\n\t\t\tparser: expressionParser,\n\t\t});\n\t\tcontent = stripTrailingHardline(content);\n\n\t\t// if (node.children[0].value) {\n\t\t// content = textToDoc(forceIntoExpression(textContent), { parser: expressionParser });\n\t\t// } else {\n\t\t// content = textToDoc(forceIntoExpression(node.children[0].value), { parser: expressionParser });\n\t\t// }\n\t\treturn [\n\t\t\t'{',\n\t\t\t// printJS(path, print, 'expression', {\n\t\t\t// forceSingleLine: isInsideQuotedAttribute(path),\n\t\t\t// forceSingleQuote: opts.jsxSingleQuote,\n\t\t\t// }),\n\t\t\tcontent,\n\t\t\t'}',\n\t\t];\n\t}\n\n\t// ATTRIBUTE WITH EXPRESSION AS VALUE\n\tif (node.type === 'attribute' && node.kind === 'expression') {\n\t\tconst value = node.value.trim();\n\t\tconst name = node.name.trim();\n\t\tlet attrNodeValue = textToDoc(forceIntoExpression(value), {\n\t\t\t...opts,\n\t\t\tparser: expressionParser,\n\t\t});\n\t\tattrNodeValue = stripTrailingHardline(attrNodeValue);\n\t\t// if (Array.isArray(attrNodeValue) && attrNodeValue[0] === ';') {\n\t\t// attrNodeValue = attrNodeValue.slice(1);\n\t\t// }\n\t\tif (name === value && opts.astroAllowShorthand) {\n\t\t\treturn [line, '{', attrNodeValue, '}'];\n\t\t}\n\t\treturn [line, name, '=', '{', attrNodeValue, '}'];\n\t}\n\n\t// TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n\t// @ts-ignore\n\t// if (node.isJS) {\n\t// try {\n\t// const embeddedopts = {\n\t// parser: expressionParser,\n\t// };\n\t// // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n\t// // @ts-ignore\n\t// if (node.forceSingleQuote) {\n\t// // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n\t// // @ts-ignore\n\t// embeddedopts.singleQuote = true;\n\t// }\n\n\t// const docs = textToDoc(forceIntoExpression(getText(node, opts)), embeddedopts);\n\t// // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n\t// // @ts-ignore\n\t// return node.forceSingleLine ? removeLines(docs) : docs;\n\t// } catch (e) {\n\t// return getText(node, opts);\n\t// }\n\t// }\n\n\tif (node.type === 'frontmatter') {\n\t\treturn [\n\t\t\tgroup([\n\t\t\t\t'---',\n\t\t\t\thardline,\n\t\t\t\ttextToDoc(node.value, { ...opts, parser: 'typescript' }),\n\t\t\t\t'---',\n\t\t\t\thardline,\n\t\t\t]),\n\t\t\thardline,\n\t\t];\n\t}\n\n\t// format script element\n\tif (node.type === 'element' && node.name === 'script') {\n\t\tconst scriptContent = printRaw(node);\n\t\tlet formatttedScript = textToDoc(scriptContent, {\n\t\t\t...opts,\n\t\t\tparser: 'typescript',\n\t\t});\n\t\tformatttedScript = stripTrailingHardline(formatttedScript);\n\n\t\t// print\n\t\tconst attributes = path.map(print, 'attributes');\n\t\tconst openingTag = group(['<script', indent(group(attributes)), softline, '>']);\n\t\treturn [openingTag, indent([hardline, formatttedScript]), hardline, '</script>'];\n\t}\n\t// if (isTextNode(node)) {\n\t// const parent = path.getParentNode();\n\n\t// if (parent && parent.type === 'Element' && parent.name === 'script') {\n\t// const formatttedScript = textToDoc(node.data, { ...opts, parser: 'typescript' });\n\t// return stripTrailingHardline(formatttedScript);\n\t// }\n\t// }\n\n\t// format style element\n\tif (node.type === 'element' && node.name === 'style') {\n\t\tconst styleTagContent = printRaw(node);\n\n\t\tconst supportedStyleLangValues = ['css', 'scss', 'sass'];\n\t\tlet parserLang = 'css';\n\n\t\tif (node.attributes) {\n\t\t\tconst langAttribute = node.attributes.filter((x) => x.name === 'lang');\n\t\t\tif (langAttribute.length) {\n\t\t\t\tconst styleLang = langAttribute[0].value.toLowerCase();\n\t\t\t\tif (supportedStyleLangValues.includes(styleLang)) parserLang = styleLang;\n\t\t\t}\n\t\t}\n\n\t\tswitch (parserLang) {\n\t\t\tcase 'css':\n\t\t\tcase 'scss': {\n\t\t\t\t// the css parser appends an extra indented hardline, which we want outside of the `indent()`,\n\t\t\t\t// so we remove the last element of the array\n\t\t\t\tlet formattedStyles = textToDoc(styleTagContent, {\n\t\t\t\t\t...opts,\n\t\t\t\t\tparser: parserLang,\n\t\t\t\t});\n\n\t\t\t\tformattedStyles = stripTrailingHardline(formattedStyles);\n\n\t\t\t\t// print\n\t\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\t\treturn [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];\n\t\t\t}\n\t\t\tcase 'sass': {\n\t\t\t\tconst lineEnding = opts.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\t\ttabSize: opts.tabWidth,\n\t\t\t\t\tinsertSpaces: !opts.useTabs,\n\t\t\t\t\tlineEnding,\n\t\t\t\t};\n\n\t\t\t\t// dedent the .sass, otherwise SassFormatter gets indentation wrong\n\t\t\t\tconst { result: raw } = manualDedent(styleTagContent);\n\n\t\t\t\t// format\n\t\t\t\tconst formattedSassIndented = SassFormatter.Format(raw, sassOptions).trim();\n\n\t\t\t\t// print\n\t\t\t\tconst formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n\t\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\t\treturn [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction hasPrettierIgnore(path: AstP<CommentNode>) {\n\t// const node = path.getNode();\n\n\t// if (!node || !Array.isArray(node.comments)) return false;\n\n\t// const hasIgnore = node.comments.some(\n\t// (comment: any) => comment.data.includes('prettier-ignore') && !comment.data.includes('prettier-ignore-start') && !comment.data.includes('prettier-ignore-end')\n\t// );\n\t// return hasIgnore;\n\treturn false;\n}\n\nconst printer: Printer = {\n\tprint,\n\tprintComment,\n\tembed,\n\thasPrettierIgnore,\n};\n\nexport default printer;\n","import { SupportOption } from 'prettier';\n\ndeclare module 'prettier' {\n\t// eslint-disable-next-line @typescript-eslint/no-empty-interface\n\tinterface RequiredOptions extends PluginOptions {}\n}\n\nexport interface PluginOptions {\n\tastroSortOrder: SortOrder;\n\tastroAllowShorthand: boolean;\n}\n\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n\tastroSortOrder: {\n\t\tsince: '0.0.1',\n\t\tcategory: 'Astro',\n\t\ttype: 'choice',\n\t\tdefault: 'markup | styles',\n\t\tdescription: 'Sort order for markup, scripts, and styles',\n\t\tchoices: [\n\t\t\t{\n\t\t\t\tvalue: 'markup | styles',\n\t\t\t\tdescription: 'markup | styles',\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'styles | markup',\n\t\t\t\tdescription: 'styles | markup',\n\t\t\t},\n\t\t],\n\t},\n\tastroAllowShorthand: {\n\t\tsince: '0.0.10',\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Enable/disable attribute shorthand if attribute name and expression are the same',\n\t},\n};\n\nexport const parseSortOrder = (sortOrder: SortOrder): SortOrderPart[] =>\n\tsortOrder.split(' | ') as SortOrderPart[];\n\nexport type SortOrder = 'markup | styles' | 'styles | markup';\n\nexport type SortOrderPart = 'markup' | 'styles';\n","import printer from './printer';\nimport { options } from './options';\nimport { Parser, Printer, SupportLanguage } from 'prettier';\nimport { createSyncFn } from 'synckit';\nimport { createRequire } from 'node:module';\nconst require = createRequire(import.meta.url);\n\n// the worker path must be absolute\nconst parse = createSyncFn(require.resolve('../workers/parse-worker.js'));\n\nexport const languages: Partial<SupportLanguage>[] = [\n\t{\n\t\tname: 'astro',\n\t\tparsers: ['astro'],\n\t\textensions: ['.astro'],\n\t\tvscodeLanguageIds: ['astro'],\n\t},\n];\n\nexport const parsers: Record<string, Parser> = {\n\tastro: {\n\t\tparse: (source) => parse(source),\n\t\tastFormat: 'astro',\n\t\tlocStart: (node) => node.start,\n\t\tlocEnd: (node) => node.end,\n\t},\n};\n\nexport const printers: Record<string, Printer> = {\n\tastro: printer,\n};\n\nconst defaultOptions = {\n\ttabWidth: 2,\n};\n\nexport { options, defaultOptions };\n"],"names":["require","createRequire","createSyncFn","_doc","SassFormatter"],"mappings":";;;;;;;;;;;;;AAoKA,MAAM,cAAc,GAAG;IACtB,SAAS;IACT,SAAS;IACT,OAAO;IACP,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,GAAG;IACH,KAAK;IACL,SAAS;IACT,OAAO;IACP,IAAI;IAEJ,OAAO;IACP,MAAM;CACG,CAAC;AAEJ,MAAM,aAAa,GAAa,CAAC,GAAG,cAAc,CAAC,CAAC;AAgEpD,MAAM,eAAe,GAAG;IAC9B,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,KAAK;CACL;;AC9PD,MAAMA,SAAO,GAAGC,yBAAa,CAAC,mMAAe,CAAC,CAAC;AAG/C,MAAM,SAAS,GAAGC,oBAAY,CAACF,SAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAQ3E,MAAM,qBAAqB,GAAa,EAI9C,CAAC;AAkBK,MAAM,eAAe,GAAG,CAAC,IAAU,KAAa;AACtD,IAAA,OAAO,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEK,MAAM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AO;QACb,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,QAAQ,CAAC;QACtB,iBAAiB,EAAE,CAAC,OAAO,CAAC;AAC5B,KAAA;EACA;AAEW,MAAA,OAAO,GAA2B;AAC9C,IAAA,KAAK,EAAE;QACN,KAAK,EAAE,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC;AAChC,QAAA,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;QAC9B,MAAM,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG;AAC1B,KAAA;EACA;AAEW,MAAA,QAAQ,GAA4B;AAChD,IAAA,KAAK,EAAE,OAAO;EACb;AAEF,MAAM,cAAc,GAAG;AACtB,IAAA,QAAQ,EAAE,CAAC;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/options.ts","../src/printer/elements.ts","../src/printer/utils.ts","../src/printer/index.ts","../src/printer/embed.ts","../src/index.ts"],"sourcesContent":["import { SupportOption } from 'prettier';\n\ninterface PluginOptions {\n\tastroAllowShorthand: boolean;\n}\n\ndeclare module 'prettier' {\n\t// eslint-disable-next-line @typescript-eslint/no-empty-interface\n\tinterface RequiredOptions extends PluginOptions {}\n}\n\n// https://prettier.io/docs/en/plugins.html#options\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n\tastroAllowShorthand: {\n\t\tsince: '0.0.10',\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Enable/disable attribute shorthand if attribute name and expression are the same',\n\t},\n};\n","export type TagName = keyof HTMLElementTagNameMap | 'svg';\n\n// https://github.com/prettier/prettier/blob/main/vendors/html-void-elements.json\nexport const selfClosingTags = [\n\t'area',\n\t'base',\n\t'basefont',\n\t'bgsound',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'frame',\n\t'hr',\n\t'image',\n\t'img',\n\t'input',\n\t'isindex',\n\t'keygen',\n\t'link',\n\t'menuitem',\n\t'meta',\n\t'nextid',\n\t'param',\n\t'slot',\n\t'source',\n\t'track',\n\t'wbr',\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements\nexport const blockElements: TagName[] = [\n\t'address',\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'details',\n\t'dialog',\n\t'dd',\n\t'div',\n\t'dl',\n\t'dt',\n\t'fieldset',\n\t'figcaption',\n\t'figure',\n\t'footer',\n\t'form',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'hgroup',\n\t'hr',\n\t'li',\n\t'main',\n\t'nav',\n\t'ol',\n\t'p',\n\t'pre',\n\t'section',\n\t'table',\n\t'ul',\n\t// TODO: WIP\n\t'title',\n\t'html',\n];\n\n/**\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\n */\nexport const formattableAttributes: string[] = [\n\t// None at the moment\n\t// Prettier HTML does not format attributes at all\n\t// and to be consistent we leave this array empty for now\n];\n","import { createRequire } from 'node:module';\nimport { AstPath as AstP, Doc, ParserOptions as ParserOpts } from 'prettier';\nimport { createSyncFn } from 'synckit';\nimport { blockElements, formattableAttributes, TagName } from './elements';\nimport { anyNode, CommentNode, Node, ParentLikeNode, TagLikeNode, TextNode } from './nodes';\n\nexport type printFn = (path: AstPath) => Doc;\nexport type ParserOptions = ParserOpts<anyNode>;\nexport type AstPath = AstP<anyNode>;\n\nconst req = createRequire(import.meta.url);\nlet workerPath;\ntry {\n\tworkerPath = req.resolve('../workers/serialize-worker.js');\n} catch (e) {\n\tworkerPath = req.resolve('prettier-plugin-astro/workers/serialize-worker.js');\n}\nconst serialize = createSyncFn(req.resolve(workerPath));\n\nexport function isInlineElement(path: AstPath, opts: ParserOptions, node: anyNode): boolean {\n\treturn node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path);\n}\n\nexport function isBlockElement(node: anyNode, opts: ParserOptions): boolean {\n\treturn (\n\t\tnode &&\n\t\tnode.type === 'element' &&\n\t\topts.htmlWhitespaceSensitivity !== 'strict' &&\n\t\t(opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name as TagName))\n\t);\n}\n\n/**\n * Returns the content of the node\n */\nexport function printRaw(node: anyNode, stripLeadingAndTrailingNewline = false): string {\n\tif (!isNodeWithChildren(node)) {\n\t\treturn '';\n\t}\n\n\tif (node.children.length === 0) {\n\t\treturn '';\n\t}\n\n\tlet raw = node.children.reduce((prev: string, curr: Node) => prev + serialize(curr), '');\n\n\tif (!stripLeadingAndTrailingNewline) {\n\t\treturn raw;\n\t}\n\n\tif (startsWithLinebreak(raw)) {\n\t\traw = raw.substring(raw.indexOf('\\n') + 1);\n\t}\n\tif (endsWithLinebreak(raw)) {\n\t\traw = raw.substring(0, raw.lastIndexOf('\\n'));\n\t\tif (raw.charAt(raw.length - 1) === '\\r') {\n\t\t\traw = raw.substring(0, raw.length - 1);\n\t\t}\n\t}\n\n\treturn raw;\n}\n\nexport function isNodeWithChildren(node: anyNode): node is anyNode & ParentLikeNode {\n\treturn node && 'children' in node && Array.isArray(node.children);\n}\n\nexport const isEmptyTextNode = (node: Node): boolean => {\n\treturn !!node && node.type === 'text' && getUnencodedText(node).trim() === '';\n};\n\nexport function getUnencodedText(node: TextNode | CommentNode): string {\n\treturn node.value;\n}\n\nexport function isTextNodeStartingWithLinebreak(node: TextNode, nrLines = 1): node is TextNode {\n\treturn startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\n}\n\nexport function endsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\n\treturn node.type === 'text' && /^\\s/.test(getUnencodedText(node));\n}\n\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\n\treturn node.type === 'text' && /\\s$/.test(getUnencodedText(node));\n}\n\n/**\n * Check if given node's start tag should hug its first child. This is the case for inline elements when there's\n * no whitespace between the `>` and the first child.\n */\nexport function shouldHugStart(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst firstChild = children[0];\n\treturn !isTextNodeStartingWithWhitespace(firstChild);\n}\n\n/**\n * Check if given node's end tag should hug its last child. This is the case for inline elements when there's\n * no whitespace between the last child and the `</`.\n */\nexport function shouldHugEnd(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\treturn false;\n\n\t// TODO: WIP\n\t// const lastChild = children[children.length - 1];\n\t// return !isTextNodeEndingWithWhitespace(lastChild);\n}\n\n/**\n * Returns true if the softline between `</tagName` and `>` can be omitted.\n */\nexport function canOmitSoftlineBeforeClosingTag(path: AstPath, opts: ParserOptions): boolean {\n\treturn isLastChildWithinParentBlockElement(path, opts);\n}\n\nfunction getChildren(node: anyNode): Node[] {\n\treturn isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(path: AstPath, opts: ParserOptions): boolean {\n\tconst parent = path.getParentNode();\n\tif (!parent || !isBlockElement(parent, opts)) {\n\t\treturn false;\n\t}\n\n\tconst children = getChildren(parent);\n\tconst lastChild = children[children.length - 1];\n\treturn lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n\tnode.value = node.value && node.value.trimStart();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n\tnode.value = node.value && node.value.trimEnd();\n}\n\nexport function printClassNames(value: string) {\n\treturn value.trim().split(/\\s+/).join(' ');\n}\n\n/** dedent string & return tabSize (the last part is what we need) */\nexport function manualDedent(input: string): {\n\ttabSize: number;\n\tchar: string;\n\tresult: string;\n} {\n\tlet minTabSize = Infinity;\n\tlet result = input;\n\t// 1. normalize\n\tresult = result.replace(/\\r\\n/g, '\\n');\n\n\t// 2. count tabSize\n\tlet char = '';\n\tfor (const line of result.split('\\n')) {\n\t\tif (!line) continue;\n\t\t// if any line begins with a non-whitespace char, minTabSize is 0\n\t\tif (line[0] && /^[^\\s]/.test(line[0])) {\n\t\t\tminTabSize = 0;\n\t\t\tbreak;\n\t\t}\n\t\tconst match = line.match(/^(\\s+)\\S+/); // \\S ensures we don’t count lines of pure whitespace\n\t\tif (match) {\n\t\t\tif (match[1] && !char) char = match[1][0];\n\t\t\tif (match[1].length < minTabSize) minTabSize = match[1].length;\n\t\t}\n\t}\n\n\t// 3. reformat string\n\tif (minTabSize > 0 && Number.isFinite(minTabSize)) {\n\t\tresult = result.replace(new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'), '');\n\t}\n\n\treturn {\n\t\ttabSize: minTabSize === Infinity ? 0 : minTabSize,\n\t\tchar,\n\t\tresult,\n\t};\n}\n\n/** True if the node is of type text */\nexport function isTextNode(node: anyNode): node is TextNode {\n\treturn node.type === 'text';\n}\n\n/** True if the node is TagLikeNode:\n *\n * ElementNode | ComponentNode | CustomElementNode | FragmentNode */\nexport function isTagLikeNode(node: anyNode): node is TagLikeNode {\n\treturn (\n\t\tnode.type === 'element' ||\n\t\tnode.type === 'component' ||\n\t\tnode.type === 'custom-element' ||\n\t\tnode.type === 'fragment'\n\t);\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n\tconst parent = path.getParentNode();\n\tif (!parent) return [];\n\n\treturn getChildren(parent);\n}\n\nexport function getNextNode(path: AstPath): anyNode | null {\n\tconst node = path.getNode();\n\tif (node) {\n\t\tconst siblings = getSiblings(path);\n\t\tif (node.position?.start === siblings[siblings.length - 1].position?.start) return null;\n\t\tfor (let i = 0; i < siblings.length; i++) {\n\t\t\tconst sibling = siblings[i];\n\t\t\tif (sibling.position?.start === node.position?.start && i !== siblings.length - 1) {\n\t\t\t\treturn siblings[i + 1];\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n\tif (!path || !path.stack || !Array.isArray(path.stack)) return false;\n\treturn path.stack.some(\n\t\t(node: anyNode) =>\n\t\t\t(node.type === 'element' && node.name.toLowerCase() === 'pre') ||\n\t\t\t(node.type === 'attribute' && !formattableAttributes.includes(node.name))\n\t);\n};\n","import { Doc } from 'prettier';\nimport { selfClosingTags } from './elements';\nimport {\n\tAstPath,\n\tcanOmitSoftlineBeforeClosingTag,\n\tendsWithLinebreak,\n\tgetNextNode,\n\tgetUnencodedText,\n\tisEmptyTextNode,\n\tisInlineElement,\n\tisPreTagContent,\n\tisTagLikeNode,\n\tisTextNode,\n\tisTextNodeEndingWithWhitespace,\n\tisTextNodeStartingWithLinebreak,\n\tisTextNodeStartingWithWhitespace,\n\tParserOptions,\n\tprintClassNames,\n\tprintFn,\n\tprintRaw,\n\tshouldHugEnd,\n\tshouldHugStart,\n\tstartsWithLinebreak,\n\ttrimTextNodeLeft,\n\ttrimTextNodeRight,\n} from './utils';\nimport { TextNode } from './nodes';\n\nimport _doc from 'prettier/doc';\nconst {\n\tbuilders: { breakParent, dedent, fill, group, indent, join, line, softline, hardline },\n\tutils: { stripTrailingHardline },\n} = _doc;\n\n// https://prettier.io/docs/en/plugins.html#print\n// eslint-disable-next-line @typescript-eslint/no-shadow\nexport function print(path: AstPath, opts: ParserOptions, print: printFn): Doc {\n\tconst node = path.getValue();\n\n\t// 1. handle special node types\n\tif (!node) {\n\t\treturn '';\n\t}\n\n\tif (typeof node === 'string') {\n\t\treturn node;\n\t}\n\n\t// 2. handle printing\n\tswitch (node.type) {\n\t\tcase 'root': {\n\t\t\treturn [stripTrailingHardline(path.map(print, 'children')), hardline];\n\t\t}\n\n\t\tcase 'text': {\n\t\t\tconst rawText = getUnencodedText(node);\n\n\t\t\t// TODO: TEST PRE TAGS\n\t\t\t// if (isPreTagContent(path)) {\n\t\t\t// if (path.getParentNode()?.type === 'Attribute') {\n\t\t\t// // Direct child of attribute value -> add literallines at end of lines\n\t\t\t// // so that other things don't break in unexpected places\n\t\t\t// return replaceEndOfLineWith(rawText, literalline);\n\t\t\t// }\n\t\t\t// return rawText;\n\t\t\t// }\n\n\t\t\tif (isEmptyTextNode(node)) {\n\t\t\t\tconst hasWhiteSpace = rawText.trim().length < getUnencodedText(node).length;\n\t\t\t\tconst hasOneOrMoreNewlines = /\\n/.test(getUnencodedText(node));\n\t\t\t\tconst hasTwoOrMoreNewlines = /\\n\\r?\\s*\\n\\r?/.test(getUnencodedText(node));\n\t\t\t\tif (hasTwoOrMoreNewlines) {\n\t\t\t\t\treturn [hardline, hardline];\n\t\t\t\t}\n\t\t\t\tif (hasOneOrMoreNewlines) {\n\t\t\t\t\treturn hardline;\n\t\t\t\t}\n\t\t\t\tif (hasWhiteSpace) {\n\t\t\t\t\treturn line;\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n\t\t\t * each \"word\") is joined by a single `line`, which will be rendered as a single space\n\t\t\t * until this node's current line is out of room, at which `fill` will break at the\n\t\t\t * most convenient instance of `line`.\n\t\t\t */\n\t\t\treturn fill(splitTextToDocs(node));\n\t\t}\n\n\t\tcase 'component':\n\t\tcase 'fragment':\n\t\tcase 'custom-element':\n\t\tcase 'element': {\n\t\t\tlet isEmpty: boolean;\n\t\t\tif (!node.children) {\n\t\t\t\tisEmpty = true;\n\t\t\t} else {\n\t\t\t\tisEmpty = node.children.every((child) => isEmptyTextNode(child));\n\t\t\t}\n\t\t\tconst isSelfClosingTag =\n\t\t\t\tisEmpty && (node.type !== 'element' || selfClosingTags.includes(node.name));\n\n\t\t\tconst attributeLine =\n\t\t\t\topts.singleAttributePerLine && node.attributes.length > 1 ? breakParent : '';\n\t\t\tconst attributes = join(attributeLine, path.map(print, 'attributes'));\n\n\t\t\tif (isSelfClosingTag) {\n\t\t\t\treturn group(['<', node.name, indent(group(attributes)), line, `/>`]);\n\t\t\t}\n\n\t\t\tif (node.children) {\n\t\t\t\tconst children = node.children;\n\t\t\t\tconst firstChild = children[0];\n\t\t\t\tconst lastChild = children[children.length - 1];\n\n\t\t\t\t// No hugging of content means it's either a block element and/or there's whitespace at the start/end\n\t\t\t\tlet noHugSeparatorStart:\n\t\t\t\t\t| _doc.builders.Concat\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| string = softline;\n\t\t\t\tlet noHugSeparatorEnd:\n\t\t\t\t\t| _doc.builders.Concat\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| string = softline;\n\t\t\t\tconst hugStart = shouldHugStart(node, opts);\n\t\t\t\tconst hugEnd = shouldHugEnd(node, opts);\n\n\t\t\t\tlet body;\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\tbody =\n\t\t\t\t\t\tisInlineElement(path, opts, node) &&\n\t\t\t\t\t\tnode.children.length &&\n\t\t\t\t\t\tisTextNodeStartingWithWhitespace(node.children[0]) &&\n\t\t\t\t\t\t!isPreTagContent(path)\n\t\t\t\t\t\t\t? () => line\n\t\t\t\t\t\t\t: // () => (opts.jsxBracketNewLine ? '' : softline);\n\t\t\t\t\t\t\t () => softline;\n\t\t\t\t} else if (isPreTagContent(path)) {\n\t\t\t\t\tbody = () => printRaw(node);\n\t\t\t\t} else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t} else {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t}\n\n\t\t\t\tconst openingTag = [\n\t\t\t\t\t'<',\n\t\t\t\t\tnode.name,\n\t\t\t\t\tindent(\n\t\t\t\t\t\tgroup([\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\thugStart\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: !isPreTagContent(path) && !opts.bracketSameLine\n\t\t\t\t\t\t\t\t? dedent(softline)\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t])\n\t\t\t\t\t),\n\t\t\t\t];\n\n\t\t\t\tif (hugStart && hugEnd) {\n\t\t\t\t\tconst huggedContent = [softline, group(['>', body(), `</${node.name}`])];\n\n\t\t\t\t\tconst omitSoftlineBeforeClosingTag =\n\t\t\t\t\t\tisEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tisEmpty ? group(huggedContent) : group(indent(huggedContent)),\n\t\t\t\t\t\tomitSoftlineBeforeClosingTag ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isPreTagContent(path)) {\n\t\t\t\t\tnoHugSeparatorStart = '';\n\t\t\t\t\tnoHugSeparatorEnd = '';\n\t\t\t\t} else {\n\t\t\t\t\tlet didSetEndSeparator = false;\n\n\t\t\t\t\tif (!hugStart && firstChild && isTextNode(firstChild)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tisTextNodeStartingWithLinebreak(firstChild) &&\n\t\t\t\t\t\t\tfirstChild !== lastChild &&\n\t\t\t\t\t\t\t(!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = hardline;\n\t\t\t\t\t\t\tnoHugSeparatorEnd = hardline;\n\t\t\t\t\t\t\tdidSetEndSeparator = true;\n\t\t\t\t\t\t} else if (isInlineElement(path, opts, node)) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = line;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeLeft(firstChild);\n\t\t\t\t\t}\n\t\t\t\t\tif (!hugEnd && lastChild && isTextNode(lastChild)) {\n\t\t\t\t\t\tif (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n\t\t\t\t\t\t\tnoHugSeparatorEnd = softline;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeRight(lastChild);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (hugStart) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tindent([softline, group(['>', body()])]),\n\t\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (hugEnd) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t\tindent([noHugSeparatorStart, group([body(), `</${node.name}`])]),\n\t\t\t\t\t\tcanOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\treturn group([...openingTag, '>', body(), `</${node.name}>`]);\n\t\t\t\t}\n\n\t\t\t\treturn group([\n\t\t\t\t\t...openingTag,\n\t\t\t\t\t'>',\n\t\t\t\t\tindent([noHugSeparatorStart, body()]),\n\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\t// TODO: WIP\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'attribute': {\n\t\t\tconst name = node.name.trim();\n\t\t\tconst quote = opts.jsxSingleQuote ? \"'\" : '\"';\n\t\t\tswitch (node.kind) {\n\t\t\t\tcase 'empty':\n\t\t\t\t\treturn [line, name];\n\t\t\t\tcase 'expression':\n\t\t\t\t\t// Handled in the `embed` function\n\t\t\t\t\t// See embed.ts\n\t\t\t\t\treturn '';\n\t\t\t\tcase 'quoted':\n\t\t\t\t\tlet value = node.value;\n\n\t\t\t\t\tif (node.name === 'class') {\n\t\t\t\t\t\tvalue = printClassNames(value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [line, name, '=', quote, value, quote];\n\t\t\t\tcase 'shorthand':\n\t\t\t\t\treturn [line, '{', name, '}'];\n\t\t\t\tcase 'spread':\n\t\t\t\t\treturn [line, '{...', name, '}'];\n\t\t\t\tcase 'template-literal':\n\t\t\t\t\treturn [line, name, '=', '`', node.value, '`'];\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'doctype': {\n\t\t\t// https://www.w3.org/wiki/Doctypes_and_markup_styles\n\t\t\treturn ['<!DOCTYPE html>', hardline];\n\t\t}\n\n\t\tcase 'comment':\n\t\t\tconst nextNode = getNextNode(path);\n\t\t\tlet trailingLine: _doc.builders.Concat | string = '';\n\t\t\tif (nextNode && isTagLikeNode(nextNode)) {\n\t\t\t\ttrailingLine = hardline;\n\t\t\t}\n\t\t\treturn ['<!--', getUnencodedText(node), '-->', trailingLine];\n\n\t\tdefault: {\n\t\t\tthrow new Error(`Unhandled node type \"${node.type}\"!`);\n\t\t}\n\t}\n}\n\n/**\n * Split the text into words separated by whitespace. Replace the whitespaces by lines,\n * collapsing multiple whitespaces into a single line.\n *\n * If the text starts or ends with multiple newlines, two of those should be kept.\n */\nfunction splitTextToDocs(node: TextNode): Doc[] {\n\tconst text = getUnencodedText(node);\n\n\tconst textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n\tlet docs = join(line, textLines).parts.filter((s) => s !== '');\n\n\tif (startsWithLinebreak(text)) {\n\t\tdocs[0] = hardline;\n\t}\n\tif (startsWithLinebreak(text, 2)) {\n\t\tdocs = [hardline, ...docs];\n\t}\n\n\tif (endsWithLinebreak(text)) {\n\t\tdocs[docs.length - 1] = hardline;\n\t}\n\tif (endsWithLinebreak(text, 2)) {\n\t\tdocs = [...docs, hardline];\n\t}\n\n\treturn docs;\n}\n","import { BuiltInParser, BuiltInParsers, Doc, ParserOptions } from 'prettier';\nimport _doc from 'prettier/doc';\nimport { SassFormatter, SassFormatterConfig } from 'sass-formatter';\nimport { ExpressionNode } from './nodes';\nimport {\n\tAstPath,\n\tisNodeWithChildren,\n\tisTagLikeNode,\n\tmanualDedent,\n\tprintFn,\n\tprintRaw,\n} from './utils';\n\nconst {\n\tbuilders: { group, indent, join, line, softline, hardline },\n\tutils: { stripTrailingHardline, mapDoc },\n} = _doc;\n\ntype supportedStyleLang = 'css' | 'scss' | 'sass';\n\n// https://prettier.io/docs/en/plugins.html#optional-embed\nexport function embed(\n\tpath: AstPath,\n\tprint: printFn,\n\ttextToDoc: (text: string, options: object) => Doc,\n\topts: ParserOptions\n) {\n\tconst node = path.getValue();\n\n\tif (!node) return null;\n\n\tif (node.type === 'expression') {\n\t\tconst jsxNode = makeNodeJSXCompatible<ExpressionNode>(node);\n\t\tconst textContent = printRaw(jsxNode);\n\n\t\tlet content: Doc;\n\t\tcontent = textToDoc(textContent, {\n\t\t\t...opts,\n\t\t\tparser: expressionParser,\n\t\t});\n\n\t\tcontent = stripTrailingHardline(content);\n\n\t\t// Create a Doc without the things we had to add to make the expression compatible with Babel\n\t\tconst astroDoc = mapDoc(content, (doc) => {\n\t\t\tif (typeof doc === 'string' && doc.startsWith('__PRETTIER_SNIP__')) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\treturn doc;\n\t\t});\n\n\t\treturn ['{', astroDoc, '}'];\n\t}\n\n\t// Attribute using an expression as value\n\tif (node.type === 'attribute' && node.kind === 'expression') {\n\t\tconst value = node.value.trim();\n\t\tconst name = node.name.trim();\n\n\t\tlet attrNodeValue = textToDoc(value, {\n\t\t\t...opts,\n\t\t\tparser: expressionParser,\n\t\t});\n\n\t\tattrNodeValue = stripTrailingHardline(attrNodeValue);\n\n\t\tif (name === value && opts.astroAllowShorthand) {\n\t\t\treturn [line, '{', attrNodeValue, '}'];\n\t\t}\n\n\t\treturn [line, name, '=', '{', attrNodeValue, '}'];\n\t}\n\n\t// Frontmatter\n\tif (node.type === 'frontmatter') {\n\t\treturn [\n\t\t\tgroup([\n\t\t\t\t'---',\n\t\t\t\thardline,\n\t\t\t\ttextToDoc(node.value, { ...opts, parser: typescriptParser }),\n\t\t\t\t'---',\n\t\t\t\thardline,\n\t\t\t]),\n\t\t\thardline,\n\t\t];\n\t}\n\n\t// Script tags\n\tif (node.type === 'element' && node.name === 'script') {\n\t\tconst scriptContent = printRaw(node);\n\t\tlet formatttedScript = textToDoc(scriptContent, {\n\t\t\t...opts,\n\t\t\tparser: typescriptParser,\n\t\t});\n\t\tformatttedScript = stripTrailingHardline(formatttedScript);\n\n\t\t// print\n\t\tconst attributes = path.map(print, 'attributes');\n\t\tconst openingTag = group(['<script', indent(group(attributes)), softline, '>']);\n\t\treturn [openingTag, indent([hardline, formatttedScript]), hardline, '</script>'];\n\t}\n\n\t// Style tags\n\tif (node.type === 'element' && node.name === 'style') {\n\t\tconst content = printRaw(node);\n\t\tconst supportedStyleLangValues = ['css', 'scss', 'sass'];\n\t\tlet parserLang: supportedStyleLang = 'css';\n\n\t\tif (node.attributes) {\n\t\t\tconst langAttribute = node.attributes.filter((x) => x.name === 'lang');\n\t\t\tif (langAttribute.length) {\n\t\t\t\tconst styleLang = langAttribute[0].value.toLowerCase();\n\t\t\t\tif (supportedStyleLangValues.includes(styleLang))\n\t\t\t\t\tparserLang = styleLang as supportedStyleLang;\n\t\t\t}\n\t\t}\n\n\t\treturn embedStyle(parserLang, content, path, print, textToDoc, opts);\n\t}\n\n\treturn null;\n}\n\nfunction expressionParser(text: string, parsers: BuiltInParsers, opts: ParserOptions) {\n\tconst expressionContent = forceIntoExpression(text);\n\tconst parsingResult = wrapParserTryCatch(parsers.babel, expressionContent, opts);\n\n\treturn {\n\t\t...parsingResult,\n\t\tprogram: parsingResult.program.body[0].expression.children[0].expression,\n\t};\n}\n\nfunction typescriptParser(text: string, parsers: BuiltInParsers, opts: ParserOptions) {\n\treturn wrapParserTryCatch(parsers.typescript, text, opts);\n}\n\nfunction wrapParserTryCatch(parser: BuiltInParser, text: string, opts: ParserOptions) {\n\ttry {\n\t\treturn parser(text, opts);\n\t} catch (e) {\n\t\t// If we couldn't parse the expression (ex: syntax error) and we throw here, Prettier fallback to `print` and we'll\n\t\t// get a totally useless error message (ex: unhandled node type). An undocumented way to work around this is to set\n\t\t// `PRETTIER_DEBUG=1`, but nobody know that exists / want to do that just to get useful error messages. So we force it on\n\t\tprocess.env.PRETTIER_DEBUG = 'true';\n\t\tthrow e;\n\t}\n}\n\n/**\n * Due to the differences between Astro and JSX, Prettier's TypeScript parsers (be it `typescript`, `babel` or `babel-ts`)\n * are not able to parse all expressions. A list of the difference that matters here:\n * - Astro allows a shorthand syntax for props. ex: `<Component {props} />`\n * - Astro allows multiple root elements. ex: `<div></div><div></div>`\n */\nfunction makeNodeJSXCompatible<T>(node: any): T {\n\tconst newNode = { ...node };\n\n\tif (isNodeWithChildren(newNode)) {\n\t\tnewNode.children.forEach((child) => {\n\t\t\tif (isTagLikeNode(child)) {\n\t\t\t\tchild.attributes.forEach((attr) => {\n\t\t\t\t\t// Transform shorthand attributes into their full format with a prefix so we can find them back\n\t\t\t\t\tif (attr.kind === 'shorthand') {\n\t\t\t\t\t\tattr.kind = 'expression';\n\t\t\t\t\t\tattr.value = attr.name;\n\t\t\t\t\t\tattr.name = '__PRETTIER_SNIP__' + attr.name;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (isNodeWithChildren(child)) {\n\t\t\t\t\tchild = makeNodeJSXCompatible(child);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\treturn newNode;\n}\n\nfunction forceIntoExpression(statement: string): string {\n\t// note the trailing newline: if the statement ends in a // comment,\n\t// we can't add the closing bracket right afterwards\n\treturn `<>{${statement}\\n}</>`;\n}\n\n/**\n * Format the content of a style tag and print the entire element\n */\nfunction embedStyle(\n\tlang: supportedStyleLang,\n\tcontent: string,\n\tpath: AstPath,\n\tprint: printFn,\n\ttextToDoc: (text: string, options: object) => Doc,\n\toptions: ParserOptions\n) {\n\tswitch (lang) {\n\t\tcase 'css':\n\t\tcase 'scss': {\n\t\t\tlet formattedStyles;\n\n\t\t\t// NOTE: Due to a bug in Prettier, we can't use our wrapParserTryCatch function here or parsing will silently fail\n\t\t\ttry {\n\t\t\t\tformattedStyles = textToDoc(content, {\n\t\t\t\t\t...options,\n\t\t\t\t\tparser: lang,\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tprocess.env.PRETTIER_DEBUG = 'true';\n\t\t\t\tthrow e;\n\t\t\t}\n\n\t\t\t// The css parser appends an extra indented hardline, which we want outside of the `indent()`,\n\t\t\t// so we remove the last element of the array\n\t\t\tformattedStyles = stripTrailingHardline(formattedStyles);\n\n\t\t\t// print\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];\n\t\t}\n\t\tcase 'sass': {\n\t\t\tconst lineEnding = options.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\ttabSize: options.tabWidth,\n\t\t\t\tinsertSpaces: !options.useTabs,\n\t\t\t\tlineEnding,\n\t\t\t};\n\n\t\t\t// dedent the .sass, otherwise SassFormatter gets indentation wrong\n\t\t\tconst { result: raw } = manualDedent(content);\n\n\t\t\t// format\n\t\t\tconst formattedSassIndented = SassFormatter.Format(raw, sassOptions).trim();\n\n\t\t\t// print\n\t\t\tconst formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];\n\t\t}\n\t}\n}\n","import { createRequire } from 'node:module';\nimport { Parser, Printer, SupportLanguage } from 'prettier';\nimport { createSyncFn } from 'synckit';\nimport { options } from './options';\nimport { print } from './printer';\nimport { embed } from './printer/embed';\n\nconst req = createRequire(import.meta.url);\nlet workerPath;\ntry {\n\tworkerPath = req.resolve('../workers/parse-worker.js');\n} catch (e) {\n\tworkerPath = req.resolve('prettier-plugin-astro/workers/parse-worker.js');\n}\nconst parse = createSyncFn(req.resolve(workerPath));\n\n// https://prettier.io/docs/en/plugins.html#languages\nexport const languages: Partial<SupportLanguage>[] = [\n\t{\n\t\tname: 'astro',\n\t\tparsers: ['astro'],\n\t\textensions: ['.astro'],\n\t\tvscodeLanguageIds: ['astro'],\n\t},\n];\n\n// https://prettier.io/docs/en/plugins.html#parsers\nexport const parsers: Record<string, Parser> = {\n\tastro: {\n\t\tparse: (source) => parse(source),\n\t\tastFormat: 'astro',\n\t\tlocStart: (node) => node.start,\n\t\tlocEnd: (node) => node.end,\n\t},\n};\n\n// https://prettier.io/docs/en/plugins.html#printers\nexport const printers: Record<string, Printer> = {\n\tastro: {\n\t\tprint,\n\t\tembed,\n\t},\n};\n\nconst defaultOptions = {\n\ttabWidth: 2,\n};\n\nexport { options, defaultOptions };\n"],"names":["req","createRequire","workerPath","createSyncFn","group","indent","join","line","softline","hardline","stripTrailingHardline","_doc","SassFormatter"],"mappings":";;;;;;;;;;;;;AAYa,MAAA,OAAO,GAA+C;AAClE,IAAA,mBAAmB,EAAE;AACpB,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,QAAQ,EAAE,OAAO;AACjB,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,WAAW,EAAE,kFAAkF;AAC/F,KAAA;;;AChBK,MAAM,eAAe,GAAG;IAC9B,MAAM;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;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-astro",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "type": "commonjs",
5
5
  "description": "A Prettier Plugin for formatting Astro files",
6
6
  "main": "dist/index.js",