prettier-plugin-astro 0.1.0-next.5 → 0.1.2
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 +9 -34
- package/README.md +124 -37
- package/dist/index.js +28 -99
- package/dist/index.js.map +1 -1
- package/package.json +24 -25
- package/workers/parse-worker.js +4 -4
- package/workers/serialize-worker.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,50 +1,25 @@
|
|
|
1
1
|
# prettier-plugin-astro
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- 8a8b3e9: Update @astrojs/compiler and fix for spread in expression
|
|
12
|
-
- f5fcc1b: Disable vitest multi-threading
|
|
13
|
-
- da0fe36: Add new line after comments
|
|
7
|
+
- 410dfb4: Use prettier option 'semi' for jsx semi colons
|
|
8
|
+
- 410dfb4: HTML attribute quotes now depend on `jsxSingleQuote` option
|
|
9
|
+
- 410dfb4: Self-close slots
|
|
10
|
+
- 410dfb4: Remove dedup utility
|
|
14
11
|
|
|
15
|
-
## 0.1.
|
|
12
|
+
## 0.1.1
|
|
16
13
|
|
|
17
14
|
### Patch Changes
|
|
18
15
|
|
|
19
|
-
-
|
|
16
|
+
- d8b666b: fix for jsx empty expression
|
|
20
17
|
|
|
21
|
-
## 0.1.0
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 73e81bd: Set astroAllowShorthand default option to false
|
|
26
|
-
|
|
27
|
-
## 0.1.0-next.2
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- f244f83: Move from ava to vitest
|
|
32
|
-
- 67341e7: Format directives
|
|
33
|
-
- 0ed661a: Fix: Format expression
|
|
34
|
-
- 87b0508: Change prettier width from 180 to 80
|
|
35
|
-
- ace9861: Remove node 12 from ci
|
|
36
|
-
|
|
37
|
-
## 0.1.0-next.1
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- dcc909a: Skip handling comments
|
|
42
|
-
|
|
43
|
-
## 0.1.0-next.0
|
|
18
|
+
## 0.1.0
|
|
44
19
|
|
|
45
20
|
### Minor Changes
|
|
46
21
|
|
|
47
|
-
- 054d055: Migrate to new compiler
|
|
22
|
+
- 054d055: Migrate to new compiler. This took months of work, and some things might be broken for the time being. However, it should be a major improvement in most cases over the previous version. We hope you'll like it!
|
|
48
23
|
|
|
49
24
|
## 0.0.12
|
|
50
25
|
|
package/README.md
CHANGED
|
@@ -1,77 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# [Prettier](https://prettier.io/) Plugin for [Astro](https://astro.build/)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official Prettier plugin adding support for formatting `.astro` files
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
1. Install the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
8
|
-
1. Install the plugin as a dev dependency:
|
|
9
|
-
|
|
10
|
-
With yarn:
|
|
5
|
+
## Installation
|
|
11
6
|
|
|
12
7
|
```shell
|
|
13
|
-
|
|
8
|
+
npm i --save-dev prettier-plugin-astro prettier
|
|
14
9
|
```
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
To customize formatting behavior, see the [Configuration](#configuration) section below
|
|
12
|
+
|
|
13
|
+
## Using with the Prettier CLI
|
|
14
|
+
|
|
15
|
+
When using the CLI, Prettier will automatically pick up the plugin
|
|
17
16
|
|
|
18
17
|
```shell
|
|
19
|
-
|
|
18
|
+
prettier -w .
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
1. Install Prettier and the plugin as a dev dependency:
|
|
21
|
+
### pnpm support
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
Due to [an upstream issue in Prettier](https://github.com/prettier/prettier/issues/8056), the `plugin-search-dir` parameter should be set to the current directory when using pnpm or Prettier won't be able to find the plugin automatically
|
|
27
24
|
|
|
28
25
|
```shell
|
|
29
|
-
|
|
26
|
+
prettier -w --plugin-search-dir=. .
|
|
30
27
|
```
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
## Using in VS Code
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
First install the [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and add the following settings to your VS Code configuration so VS Code is aware that Prettier can be used for Astro files:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"prettier.documentSelectors": "**/*.astro"
|
|
36
|
+
}
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
3. Add
|
|
39
|
+
Additionally, you should set Prettier as the default formatter for Astro files or VS Code will ask you to choose a formatter everytime you format since the Astro VS Code extension also includes a formatter for Astro files:
|
|
40
40
|
|
|
41
41
|
```json
|
|
42
|
-
|
|
42
|
+
{
|
|
43
|
+
"[astro]": {
|
|
44
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
When submitting issues about formatting in VS Code, first make sure you're actually using Prettier to format your files and not the Astro VS Code extension included formatter
|
|
50
|
+
|
|
51
|
+
### pnpm support
|
|
52
|
+
|
|
53
|
+
Due to an upstream issue, Prettier inside VS Code isn't able to automatically infer the right parser to use for Astro files when using pnpm
|
|
54
|
+
|
|
55
|
+
As such, add the following settings to your `.prettierrc.js` config file:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
module.exports = {
|
|
59
|
+
plugins: [require.resolve('prettier-plugin-astro')],
|
|
60
|
+
overrides: [
|
|
61
|
+
{
|
|
62
|
+
files: '*.astro',
|
|
63
|
+
options: {
|
|
64
|
+
parser: 'astro',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
43
69
|
```
|
|
44
70
|
|
|
45
|
-
to
|
|
71
|
+
The `require.resolve` call can alternatively be changed to a direct path, like such: `plugins: ["./node_modules/prettier-plugin-astro"]` for usage inside a non-JS config file
|
|
46
72
|
|
|
47
|
-
##
|
|
73
|
+
## Configuration
|
|
48
74
|
|
|
49
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).
|
|
50
76
|
|
|
51
77
|
### Astro Sort Order
|
|
52
78
|
|
|
53
|
-
Sort order for markup and styles.
|
|
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
|
|
54
80
|
|
|
55
|
-
|
|
81
|
+
The format is a string with the words `markup` and `styles` separated by a pipe (`|`)
|
|
56
82
|
|
|
57
|
-
| Default
|
|
58
|
-
|
|
|
59
|
-
|
|
|
83
|
+
| Default | CLI Override | API Override |
|
|
84
|
+
| ------------------ | ----------------------------- | -------------------------- |
|
|
85
|
+
| `markup \| styles` | `--astro-sort-order <string>` | `astroSortOrder: <string>` |
|
|
60
86
|
|
|
61
87
|
### Astro Allow Shorthand
|
|
62
88
|
|
|
63
|
-
|
|
89
|
+
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} />`)
|
|
90
|
+
|
|
91
|
+
> Please note that at the time of writing, [the shorthand form is not currently supported inside the Astro VS Code extension](https://github.com/withastro/language-tools/issues/225)
|
|
64
92
|
|
|
65
93
|
| Default | CLI Override | API Override |
|
|
66
94
|
| ------- | -------------------------------- | ----------------------------- |
|
|
67
95
|
| `false` | `--astro-allow-shorthand <bool>` | `astroAllowShorthand: <bool>` |
|
|
68
96
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
See [comment](https://github.com/withastro/prettier-plugin-astro/issues/97)
|
|
97
|
+
### Example `.prettierrc.js`
|
|
72
98
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
```js
|
|
100
|
+
{
|
|
101
|
+
astroSortOrder: "markup | styles",
|
|
102
|
+
astroAllowShorthand: false
|
|
103
|
+
}
|
|
104
|
+
```
|
|
76
105
|
|
|
77
|
-
##
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Pull requests of any size and any skill level are welcome, no contribution is too small. Changes to the Astro Prettier Plugin are subject to [Astro Governance](https://github.com/withastro/.github/blob/main/GOVERNANCE.md) and should adhere to the [Astro Style Guide](https://github.com/withastro/astro/blob/main/STYLE_GUIDE.md)
|
|
109
|
+
|
|
110
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to setup your development environnement
|
|
111
|
+
|
|
112
|
+
## Sponsors
|
|
113
|
+
|
|
114
|
+
Astro is generously supported by Netlify, Vercel, and several other amazing organizations.
|
|
115
|
+
|
|
116
|
+
[❤️ Sponsor Astro! ❤️](https://github.com/withastro/.github/blob/main/FUNDING.md)
|
|
117
|
+
|
|
118
|
+
### Platinum Sponsors
|
|
119
|
+
|
|
120
|
+
<table>
|
|
121
|
+
<tbody>
|
|
122
|
+
<tr>
|
|
123
|
+
<td align="center"><a href="https://www.netlify.com/#gh-light-mode-only" target="_blank"><img width="147" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/netlify.svg#gh-light-mode-only" alt="Netlify" /></a><a href="https://www.netlify.com/#gh-dark-mode-only" target="_blank"><img width="147" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/netlify-dark.svg#gh-dark-mode-only" alt="Netlify" />
|
|
124
|
+
</a></td>
|
|
125
|
+
<td align="center"><a href="https://www.vercel.com/#gh-light-mode-only" target="_blank"><img width="150" height="34" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/vercel.svg#gh-light-mode-only" alt="Vercel" /></a><a href="https://www.vercel.com/#gh-dark-mode-only"><img width="150" height="34" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/vercel-dark.svg#gh-dark-mode-only" alt="Vercel" />
|
|
126
|
+
</a></td>
|
|
127
|
+
</tr>
|
|
128
|
+
</tbody>
|
|
129
|
+
</table>
|
|
130
|
+
|
|
131
|
+
### Gold Sponsors
|
|
132
|
+
|
|
133
|
+
<table>
|
|
134
|
+
<tbody>
|
|
135
|
+
<tr>
|
|
136
|
+
<td align="center">
|
|
137
|
+
<a href="https://divRIOTS.com#gh-light-mode-only" target="_blank">
|
|
138
|
+
<img width="150" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/divriots.svg#gh-light-mode-only" alt="‹div›RIOTS" />
|
|
139
|
+
</a>
|
|
140
|
+
<a href="https://divRIOTS.com#gh-dark-mode-only" target="_blank">
|
|
141
|
+
<img width="150" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/divriots-dark.svg#gh-dark-mode-only" alt="‹div›RIOTS" />
|
|
142
|
+
</a>
|
|
143
|
+
</td>
|
|
144
|
+
<td align="center">
|
|
145
|
+
<a href="https://stackupdigital.co.uk/#gh-light-mode-only" target="_blank">
|
|
146
|
+
<img width="162" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/stackup.svg#gh-light-mode-only" alt="StackUp Digital" />
|
|
147
|
+
</a>
|
|
148
|
+
<a href="https://stackupdigital.co.uk/#gh-dark-mode-only" target="_blank">
|
|
149
|
+
<img width="130" height="32" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/stackup-dark.svg#gh-dark-mode-only" alt="StackUp Digital" />
|
|
150
|
+
</a>
|
|
151
|
+
</td>
|
|
152
|
+
</tr>
|
|
153
|
+
</tbody>
|
|
154
|
+
</table>
|
|
155
|
+
|
|
156
|
+
### Sponsors
|
|
157
|
+
|
|
158
|
+
<table>
|
|
159
|
+
<tbody>
|
|
160
|
+
<tr>
|
|
161
|
+
<td align="center"><a href="https://sentry.io" target="_blank"><img width="147" height="40" src="https://raw.githubusercontent.com/withastro/astro/main/.github/assets/sentry.svg" alt="Sentry" /></a></td><td align="center"><a href="https://qoddi.com" target="_blank"><img width="147" height="40" src="https://devcenter.qoddi.com/wp-content/uploads/2021/11/blog-transparent-logo-1.png" alt="Qoddi App Platform" /></a></td>
|
|
162
|
+
</tr>
|
|
163
|
+
</tbody>
|
|
164
|
+
</table>
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _doc = require('prettier/doc');
|
|
6
6
|
var sassFormatter = require('sass-formatter');
|
|
7
7
|
var synckit = require('synckit');
|
|
8
|
-
var
|
|
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
|
|
|
@@ -61,12 +61,13 @@ const selfClosingTags = [
|
|
|
61
61
|
'link',
|
|
62
62
|
'meta',
|
|
63
63
|
'param',
|
|
64
|
+
'slot',
|
|
64
65
|
'source',
|
|
65
66
|
'track',
|
|
66
67
|
'wbr',
|
|
67
68
|
];
|
|
68
69
|
|
|
69
|
-
const require$2 =
|
|
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)));
|
|
70
71
|
const serialize = synckit.createSyncFn(require$2.resolve('../workers/serialize-worker.js'));
|
|
71
72
|
const formattableAttributes = [];
|
|
72
73
|
const isEmptyTextNode = (node) => {
|
|
@@ -107,17 +108,13 @@ function isNodeWithChildren(node) {
|
|
|
107
108
|
return node && 'children' in node && Array.isArray(node.children);
|
|
108
109
|
}
|
|
109
110
|
function isInlineElement(path, opts, node) {
|
|
110
|
-
return (node &&
|
|
111
|
-
node.type === 'element' &&
|
|
112
|
-
!isBlockElement(node, opts) &&
|
|
113
|
-
!isPreTagContent(path));
|
|
111
|
+
return node && node.type === 'element' && !isBlockElement(node, opts) && !isPreTagContent(path);
|
|
114
112
|
}
|
|
115
113
|
function isBlockElement(node, opts) {
|
|
116
114
|
return (node &&
|
|
117
115
|
node.type === 'element' &&
|
|
118
116
|
opts.htmlWhitespaceSensitivity !== 'strict' &&
|
|
119
|
-
(opts.htmlWhitespaceSensitivity === 'ignore' ||
|
|
120
|
-
blockElements.includes(node.name)));
|
|
117
|
+
(opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name)));
|
|
121
118
|
}
|
|
122
119
|
function isTextNodeStartingWithLinebreak(node, nrLines = 1) {
|
|
123
120
|
return startsWithLinebreak(getUnencodedText(node), nrLines);
|
|
@@ -135,7 +132,7 @@ function isTextNodeEndingWithWhitespace(node) {
|
|
|
135
132
|
return node.type === 'text' && /\s$/.test(getUnencodedText(node));
|
|
136
133
|
}
|
|
137
134
|
function forceIntoExpression(statement) {
|
|
138
|
-
return
|
|
135
|
+
return `<>{${statement}\n}</>`;
|
|
139
136
|
}
|
|
140
137
|
function shouldHugStart(node, opts) {
|
|
141
138
|
if (isBlockElement(node, opts)) {
|
|
@@ -216,21 +213,15 @@ function manualDedent(input) {
|
|
|
216
213
|
}
|
|
217
214
|
function getMarkdownName(script) {
|
|
218
215
|
let defaultMatch;
|
|
219
|
-
while ((defaultMatch =
|
|
220
|
-
/import\s+([^\s]+)\s+from\s+['|"|`]astro\/components\/Markdown\.astro/g.exec(script))) {
|
|
216
|
+
while ((defaultMatch = /import\s+([^\s]+)\s+from\s+['|"|`]astro\/components\/Markdown\.astro/g.exec(script))) {
|
|
221
217
|
if (defaultMatch[1])
|
|
222
218
|
return new Set([defaultMatch[1].trim()]);
|
|
223
219
|
}
|
|
224
220
|
let namedMatch;
|
|
225
|
-
while ((namedMatch =
|
|
226
|
-
/import\s+\{\s*([^}]+)\}\s+from\s+['|"|`]astro\/components/g.exec(script))) {
|
|
221
|
+
while ((namedMatch = /import\s+\{\s*([^}]+)\}\s+from\s+['|"|`]astro\/components/g.exec(script))) {
|
|
227
222
|
if (namedMatch[1] && !namedMatch[1].includes('Markdown'))
|
|
228
223
|
continue;
|
|
229
|
-
const rawImports = namedMatch[1]
|
|
230
|
-
.trim()
|
|
231
|
-
.replace(/^\{/, '')
|
|
232
|
-
.replace(/\}$/, '')
|
|
233
|
-
.trim();
|
|
224
|
+
const rawImports = namedMatch[1].trim().replace(/^\{/, '').replace(/\}$/, '').trim();
|
|
234
225
|
let importName = 'Markdown';
|
|
235
226
|
for (const spec of rawImports.split(',')) {
|
|
236
227
|
const [original, renamed] = spec.split(' as ').map((s) => s.trim());
|
|
@@ -246,21 +237,6 @@ function getMarkdownName(script) {
|
|
|
246
237
|
function isTextNode(node) {
|
|
247
238
|
return node.type === 'text';
|
|
248
239
|
}
|
|
249
|
-
function removeDuplicates(root) {
|
|
250
|
-
root.children = root.children.filter((node, i, rootChildren) => {
|
|
251
|
-
if (node.type !== 'text')
|
|
252
|
-
return true;
|
|
253
|
-
return (i ===
|
|
254
|
-
rootChildren.findIndex((t) => {
|
|
255
|
-
if (t.position && node.position) {
|
|
256
|
-
return (node.type === 'text' &&
|
|
257
|
-
t.position.start.offset === node.position.start.offset &&
|
|
258
|
-
t.position.start.line === node.position.start.line &&
|
|
259
|
-
t.position.start.column === node.position.start.column);
|
|
260
|
-
}
|
|
261
|
-
}));
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
240
|
function isTagLikeNode(node) {
|
|
265
241
|
return (node.type === 'element' ||
|
|
266
242
|
node.type === 'component' ||
|
|
@@ -282,8 +258,7 @@ function getNextNode(path) {
|
|
|
282
258
|
return null;
|
|
283
259
|
for (let i = 0; i < siblings.length; i++) {
|
|
284
260
|
const sibling = siblings[i];
|
|
285
|
-
if (((_c = sibling.position) === null || _c === void 0 ? void 0 : _c.start) === ((_d = node.position) === null || _d === void 0 ? void 0 : _d.start) &&
|
|
286
|
-
i !== siblings.length - 1) {
|
|
261
|
+
if (((_c = sibling.position) === null || _c === void 0 ? void 0 : _c.start) === ((_d = node.position) === null || _d === void 0 ? void 0 : _d.start) && i !== siblings.length - 1) {
|
|
287
262
|
return siblings[i + 1];
|
|
288
263
|
}
|
|
289
264
|
}
|
|
@@ -305,7 +280,6 @@ function print(path, opts, print) {
|
|
|
305
280
|
}
|
|
306
281
|
switch (node.type) {
|
|
307
282
|
case 'root': {
|
|
308
|
-
removeDuplicates(node);
|
|
309
283
|
return [stripTrailingHardline(path.map(print, 'children')), hardline];
|
|
310
284
|
}
|
|
311
285
|
case 'text': {
|
|
@@ -337,8 +311,7 @@ function print(path, opts, print) {
|
|
|
337
311
|
else {
|
|
338
312
|
isEmpty = node.children.every((child) => isEmptyTextNode(child));
|
|
339
313
|
}
|
|
340
|
-
const isSelfClosingTag = isEmpty &&
|
|
341
|
-
(node.type !== 'element' || selfClosingTags.indexOf(node.name) !== -1);
|
|
314
|
+
const isSelfClosingTag = isEmpty && (node.type !== 'element' || selfClosingTags.indexOf(node.name) !== -1);
|
|
342
315
|
const attributes = path.map(print, 'attributes');
|
|
343
316
|
if (isSelfClosingTag) {
|
|
344
317
|
return group(['<', node.name, indent(group(attributes)), line, `/>`]);
|
|
@@ -365,8 +338,7 @@ function print(path, opts, print) {
|
|
|
365
338
|
else if (isPreTagContent(path)) {
|
|
366
339
|
body = () => printRaw(node);
|
|
367
340
|
}
|
|
368
|
-
else if (isInlineElement(path, opts, node) &&
|
|
369
|
-
!isPreTagContent(path)) {
|
|
341
|
+
else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {
|
|
370
342
|
body = () => path.map(print, 'children');
|
|
371
343
|
}
|
|
372
344
|
else {
|
|
@@ -385,10 +357,7 @@ function print(path, opts, print) {
|
|
|
385
357
|
])),
|
|
386
358
|
];
|
|
387
359
|
if (hugStart && hugEnd) {
|
|
388
|
-
const huggedContent = [
|
|
389
|
-
softline,
|
|
390
|
-
group(['>', body(), `</${node.name}`]),
|
|
391
|
-
];
|
|
360
|
+
const huggedContent = [softline, group(['>', body(), `</${node.name}`])];
|
|
392
361
|
const omitSoftlineBeforeClosingTag = isEmpty || canOmitSoftlineBeforeClosingTag(path, opts);
|
|
393
362
|
return group([
|
|
394
363
|
...openingTag,
|
|
@@ -406,8 +375,7 @@ function print(path, opts, print) {
|
|
|
406
375
|
if (!hugStart && firstChild && isTextNode(firstChild)) {
|
|
407
376
|
if (isTextNodeStartingWithLinebreak(firstChild) &&
|
|
408
377
|
firstChild !== lastChild &&
|
|
409
|
-
(!isInlineElement(path, opts, node) ||
|
|
410
|
-
isTextNodeEndingWithWhitespace(lastChild))) {
|
|
378
|
+
(!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))) {
|
|
411
379
|
noHugSeparatorStart = hardline;
|
|
412
380
|
noHugSeparatorEnd = hardline;
|
|
413
381
|
didSetEndSeparator = true;
|
|
@@ -456,7 +424,7 @@ function print(path, opts, print) {
|
|
|
456
424
|
}
|
|
457
425
|
case 'attribute': {
|
|
458
426
|
const name = node.name.trim();
|
|
459
|
-
const quote = opts.
|
|
427
|
+
const quote = opts.jsxSingleQuote ? "'" : '"';
|
|
460
428
|
switch (node.kind) {
|
|
461
429
|
case 'empty':
|
|
462
430
|
return [line, name];
|
|
@@ -508,7 +476,10 @@ function splitTextToDocs(node) {
|
|
|
508
476
|
}
|
|
509
477
|
function expressionParser(text, parsers, opts) {
|
|
510
478
|
const ast = parsers.babel(text, opts);
|
|
511
|
-
return {
|
|
479
|
+
return {
|
|
480
|
+
...ast,
|
|
481
|
+
program: ast.program.body[0].expression.children[0].expression,
|
|
482
|
+
};
|
|
512
483
|
}
|
|
513
484
|
let markdownComponentName = new Set();
|
|
514
485
|
function embed(path, print, textToDoc, opts) {
|
|
@@ -523,7 +494,6 @@ function embed(path, print, textToDoc, opts) {
|
|
|
523
494
|
content = textToDoc(forceIntoExpression(textContent), {
|
|
524
495
|
...opts,
|
|
525
496
|
parser: expressionParser,
|
|
526
|
-
semi: false,
|
|
527
497
|
});
|
|
528
498
|
content = stripTrailingHardline(content);
|
|
529
499
|
return [
|
|
@@ -538,7 +508,6 @@ function embed(path, print, textToDoc, opts) {
|
|
|
538
508
|
let attrNodeValue = textToDoc(forceIntoExpression(value), {
|
|
539
509
|
...opts,
|
|
540
510
|
parser: expressionParser,
|
|
541
|
-
semi: false,
|
|
542
511
|
});
|
|
543
512
|
attrNodeValue = stripTrailingHardline(attrNodeValue);
|
|
544
513
|
if (name === value && opts.astroAllowShorthand) {
|
|
@@ -567,18 +536,8 @@ function embed(path, print, textToDoc, opts) {
|
|
|
567
536
|
});
|
|
568
537
|
formatttedScript = stripTrailingHardline(formatttedScript);
|
|
569
538
|
const attributes = path.map(print, 'attributes');
|
|
570
|
-
const openingTag = group([
|
|
571
|
-
|
|
572
|
-
indent(group(attributes)),
|
|
573
|
-
softline,
|
|
574
|
-
'>',
|
|
575
|
-
]);
|
|
576
|
-
return [
|
|
577
|
-
openingTag,
|
|
578
|
-
indent([hardline, formatttedScript]),
|
|
579
|
-
hardline,
|
|
580
|
-
'</script>',
|
|
581
|
-
];
|
|
539
|
+
const openingTag = group(['<script', indent(group(attributes)), softline, '>']);
|
|
540
|
+
return [openingTag, indent([hardline, formatttedScript]), hardline, '</script>'];
|
|
582
541
|
}
|
|
583
542
|
if (node.type === 'element' && node.name === 'style') {
|
|
584
543
|
const styleTagContent = printRaw(node);
|
|
@@ -601,18 +560,8 @@ function embed(path, print, textToDoc, opts) {
|
|
|
601
560
|
});
|
|
602
561
|
formattedStyles = stripTrailingHardline(formattedStyles);
|
|
603
562
|
const attributes = path.map(print, 'attributes');
|
|
604
|
-
const openingTag = group([
|
|
605
|
-
|
|
606
|
-
indent(group(attributes)),
|
|
607
|
-
softline,
|
|
608
|
-
'>',
|
|
609
|
-
]);
|
|
610
|
-
return [
|
|
611
|
-
openingTag,
|
|
612
|
-
indent([hardline, formattedStyles]),
|
|
613
|
-
hardline,
|
|
614
|
-
'</style>',
|
|
615
|
-
];
|
|
563
|
+
const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
|
|
564
|
+
return [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];
|
|
616
565
|
}
|
|
617
566
|
case 'sass': {
|
|
618
567
|
const lineEnding = opts.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';
|
|
@@ -625,18 +574,8 @@ function embed(path, print, textToDoc, opts) {
|
|
|
625
574
|
const formattedSassIndented = sassFormatter.SassFormatter.Format(raw, sassOptions).trim();
|
|
626
575
|
const formattedSass = join(hardline, formattedSassIndented.split('\n'));
|
|
627
576
|
const attributes = path.map(print, 'attributes');
|
|
628
|
-
const openingTag = group([
|
|
629
|
-
|
|
630
|
-
indent(group(attributes)),
|
|
631
|
-
softline,
|
|
632
|
-
'>',
|
|
633
|
-
]);
|
|
634
|
-
return [
|
|
635
|
-
openingTag,
|
|
636
|
-
indent(group([hardline, formattedSass])),
|
|
637
|
-
hardline,
|
|
638
|
-
'</style>',
|
|
639
|
-
];
|
|
577
|
+
const openingTag = group(['<style', indent(group(attributes)), softline, '>']);
|
|
578
|
+
return [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];
|
|
640
579
|
}
|
|
641
580
|
}
|
|
642
581
|
}
|
|
@@ -651,18 +590,8 @@ function embed(path, print, textToDoc, opts) {
|
|
|
651
590
|
});
|
|
652
591
|
formatttedMarkdown = stripTrailingHardline(formatttedMarkdown);
|
|
653
592
|
const attributes = path.map(print, 'attributes');
|
|
654
|
-
const openingTag = group([
|
|
655
|
-
|
|
656
|
-
indent(group(attributes)),
|
|
657
|
-
softline,
|
|
658
|
-
'>',
|
|
659
|
-
]);
|
|
660
|
-
return [
|
|
661
|
-
openingTag,
|
|
662
|
-
indent(group([hardline, formatttedMarkdown])),
|
|
663
|
-
hardline,
|
|
664
|
-
`</${node.name}>`,
|
|
665
|
-
];
|
|
593
|
+
const openingTag = group([`<${node.name}`, indent(group(attributes)), softline, '>']);
|
|
594
|
+
return [openingTag, indent(group([hardline, formatttedMarkdown])), hardline, `</${node.name}>`];
|
|
666
595
|
}
|
|
667
596
|
return null;
|
|
668
597
|
}
|
|
@@ -703,7 +632,7 @@ const options = {
|
|
|
703
632
|
},
|
|
704
633
|
};
|
|
705
634
|
|
|
706
|
-
const require$1 =
|
|
635
|
+
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)));
|
|
707
636
|
const parse = synckit.createSyncFn(require$1.resolve('../workers/parse-worker.js'));
|
|
708
637
|
const languages = [
|
|
709
638
|
{
|
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 Node,\n AttributeNode,\n RootNode,\n ElementNode,\n ComponentNode,\n CustomElementNode,\n ExpressionNode,\n TextNode,\n FrontmatterNode,\n DoctypeNode,\n CommentNode,\n FragmentNode,\n} from '@astrojs/compiler/types';\n\n// MISSING ATTRIBUTE NODE FROM THE NODE TYPE\n\nexport interface NodeWithText {\n value: 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 // children: anyNode[];\n children: 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 name: typeof blockElementsT[number];\n}\n\nexport interface InlineElementNode extends ElementNode {\n name: typeof inlineElementsT[number];\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements\nconst blockElementsT = [\n 'address',\n 'article',\n 'aside',\n 'blockquote',\n 'details',\n 'dialog',\n 'dd',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hgroup',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'ol',\n 'p',\n 'pre',\n 'section',\n 'table',\n 'ul',\n // TODO: WIP\n 'title',\n '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 'a',\n 'abbr',\n 'acronym',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'br',\n 'button',\n 'canvas',\n 'cite',\n 'code',\n 'data',\n 'datalist',\n 'del',\n 'dfn',\n 'em',\n 'embed',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'map',\n 'mark',\n 'meter',\n 'noscript',\n 'object',\n 'output',\n 'picture',\n 'progress',\n 'q',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'select',\n 'slot',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'sup',\n 'svg',\n 'template',\n 'textarea',\n 'time',\n 'u',\n 'tt',\n 'var',\n 'video',\n '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 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\n\nexport type anyNode =\n | RootNode\n | AttributeNode\n | ElementNode\n | ComponentNode\n | CustomElementNode\n | ExpressionNode\n | TextNode\n | DoctypeNode\n | CommentNode\n | FragmentNode\n | FrontmatterNode;\n\nexport type {\n AttributeNode,\n Node,\n RootNode,\n ElementNode,\n ComponentNode,\n CustomElementNode,\n ExpressionNode,\n TextNode,\n FrontmatterNode,\n DoctypeNode,\n CommentNode,\n FragmentNode,\n TagLikeNode,\n} from '@astrojs/compiler/types';\n","import {\n AstPath as AstP,\n doc,\n Doc,\n ParserOptions as ParserOpts,\n util,\n} from 'prettier';\n\nimport {\n anyNode,\n Node,\n RootNode,\n AttributeNode,\n ElementNode,\n ComponentNode,\n CustomElementNode,\n ExpressionNode,\n TextNode,\n FrontmatterNode,\n DoctypeNode,\n CommentNode,\n NodeWithText,\n blockElements,\n // attributeValue,\n BlockElementNode,\n InlineElementNode,\n // MustacheTagNode,\n NodeWithChildren,\n TagLikeNode,\n // NodeWithText,\n // TextNode,\n} from './nodes';\n\nimport { createSyncFn } from 'synckit';\nimport { createRequire } from 'module';\nconst require = createRequire(import.meta.url);\n\n// the worker path must be absolute\nconst serialize = createSyncFn(\n require.resolve('../workers/serialize-worker.js')\n);\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 // None at the moment\n // Prettier HTML does not format attributes at all\n // 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 =>\n node.type === 'root';\n\nexport const isEmptyTextNode = (node: Node): boolean => {\n return !!node && node.type === 'text' && getUnencodedText(node).trim() === '';\n};\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n if (!path || !path.stack || !Array.isArray(path.stack)) return false;\n return path.stack.some(\n (node: anyNode) =>\n (node.type === 'element' && node.name.toLowerCase() === 'pre') ||\n (node.type === 'attribute' && !formattableAttributes.includes(node.name))\n );\n};\n\nexport function isLoneMustacheTag(node: AttributeNode): boolean {\n // export function isLoneMustacheTag(node: AttributeNode): node is [MustacheTagNode] {\n return node.kind === 'expression';\n // 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(\n node: AttributeNode,\n opts: ParserOptions\n): boolean {\n if (!opts.astroAllowShorthand) return false;\n if (node.kind === 'shorthand') {\n return true;\n }\n // if (isAttributeShorthand(node.value)) {\n // return true;\n // }\n\n if (node.value.trim() === node.name.trim()) {\n return true;\n }\n\n // if (isLoneMustacheTag(node.value)) {\n // const expression = node.value[0].expression;\n // return expression.codeChunks[0].trim() === node.name;\n // // return (expression.type === 'Identifier' && expression.name === node.name) || (expression.type === 'Expression' && expression.codeChunks[0] === node.name);\n // }\n\n return false;\n}\n\n/**\n * True if node is of type `{a}` and astroAllowShorthand is false\n */\nexport function isShorthandAndMustBeConvertedToBinaryExpression(\n node: AttributeNode,\n opts: ParserOptions\n): boolean {\n if (opts.astroAllowShorthand) return false;\n if (node.type === 'attribute' && node.kind === 'shorthand') {\n return true;\n }\n // if (isAttributeShorthand(node.value)) {\n // return true;\n // }\n return 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 if (!node.position) return '';\n return opts.originalText.slice(\n node.position.start.offset + 1,\n node.position.end?.offset\n );\n // return opts.originalText.slice(opts.locStart(node), opts.locEnd(node));\n}\n\nexport function getUnencodedText(node: NodeWithText): string {\n return 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(\n node: anyNode,\n stripLeadingAndTrailingNewline = false\n): string {\n if (!isNodeWithChildren(node)) {\n return '';\n }\n\n if (node.children.length === 0) {\n return '';\n }\n\n let raw = node.children.reduce(\n (prev: string, curr: Node) => prev + serialize(curr),\n ''\n );\n\n if (!stripLeadingAndTrailingNewline) {\n return raw;\n }\n\n if (startsWithLinebreak(raw)) {\n raw = raw.substring(raw.indexOf('\\n') + 1);\n }\n if (endsWithLinebreak(raw)) {\n raw = raw.substring(0, raw.lastIndexOf('\\n'));\n if (raw.charAt(raw.length - 1) === '\\r') {\n raw = raw.substring(0, raw.length - 1);\n }\n }\n\n return raw;\n}\n\nexport function isNodeWithChildren(\n node: anyNode\n): node is anyNode & NodeWithChildren {\n return node && 'children' in node && Array.isArray(node.children);\n}\n\nexport function isInlineElement(\n path: AstPath,\n opts: ParserOptions,\n node: anyNode\n): node is InlineElementNode {\n return (\n node &&\n node.type === 'element' &&\n !isBlockElement(node, opts) &&\n !isPreTagContent(path)\n );\n}\n\nexport function isBlockElement(\n node: anyNode,\n opts: ParserOptions\n): node is BlockElementNode {\n return (\n node &&\n node.type === 'element' &&\n opts.htmlWhitespaceSensitivity !== 'strict' &&\n (opts.htmlWhitespaceSensitivity === 'ignore' ||\n blockElements.includes(node.name))\n );\n}\n\nexport function isTextNodeStartingWithLinebreak(\n node: TextNode,\n nrLines = 1\n): node is TextNode {\n return startsWithLinebreak(getUnencodedText(node), nrLines);\n // return node.type === 'Text' && startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\n return 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 return new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\n return node.type === 'text' && /^\\s/.test(getUnencodedText(node));\n}\n\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\n return node.type === 'text' && /\\s$/.test(getUnencodedText(node));\n}\n\nexport function forceIntoExpression(statement: string): string {\n // note the trailing newline: if the statement ends in a // comment,\n // we can't add the closing bracket right afterwards\n return `(${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 if (isBlockElement(node, opts)) {\n return false;\n }\n\n if (!isNodeWithChildren(node)) {\n return false;\n }\n\n const children = node.children;\n if (children.length === 0) {\n return true;\n }\n\n const firstChild = children[0];\n return !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 if (isBlockElement(node, opts)) {\n return false;\n }\n\n if (!isNodeWithChildren(node)) {\n return false;\n }\n\n const children = node.children;\n if (children.length === 0) {\n return true;\n }\n\n return false;\n\n // TODO: WIP\n // const lastChild = children[children.length - 1];\n // return !isTextNodeEndingWithWhitespace(lastChild);\n}\n\n/**\n * Returns true if the softline between `</tagName` and `>` can be omitted.\n */\nexport function canOmitSoftlineBeforeClosingTag(\n path: AstPath,\n opts: ParserOptions\n): boolean {\n return isLastChildWithinParentBlockElement(path, opts);\n // return !hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options);\n // 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 return isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(\n path: AstPath,\n opts: ParserOptions\n): boolean {\n const parent = path.getParentNode();\n if (!parent || !isBlockElement(parent, opts)) {\n return false;\n }\n\n const children = getChildren(parent);\n const lastChild = children[children.length - 1];\n return lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n node.value = node.value && node.value.trimStart();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n node.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 tabSize: number;\n char: string;\n result: string;\n} {\n let minTabSize = Infinity;\n let result = input;\n // 1. normalize\n result = result.replace(/\\r\\n/g, '\\n');\n\n // 2. count tabSize\n let char = '';\n for (const line of result.split('\\n')) {\n if (!line) continue;\n // if any line begins with a non-whitespace char, minTabSize is 0\n if (line[0] && /^[^\\s]/.test(line[0])) {\n minTabSize = 0;\n break;\n }\n const match = line.match(/^(\\s+)\\S+/); // \\S ensures we don’t count lines of pure whitespace\n if (match) {\n if (match[1] && !char) char = match[1][0];\n if (match[1].length < minTabSize) minTabSize = match[1].length;\n }\n }\n\n // 3. reformat string\n if (minTabSize > 0 && Number.isFinite(minTabSize)) {\n result = result.replace(\n new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'),\n ''\n );\n }\n\n return {\n tabSize: minTabSize === Infinity ? 0 : minTabSize,\n char,\n result,\n };\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/** scan code for Markdown name(s) */\nexport function getMarkdownName(script: string): Set<string> {\n // default import: could be named anything\n let defaultMatch;\n while (\n (defaultMatch =\n /import\\s+([^\\s]+)\\s+from\\s+['|\"|`]astro\\/components\\/Markdown\\.astro/g.exec(\n script\n ))\n ) {\n if (defaultMatch[1]) return new Set([defaultMatch[1].trim()]);\n }\n\n // named component: must have \"Markdown\" in specifier, but can be renamed via \"as\"\n let namedMatch;\n while (\n (namedMatch =\n /import\\s+\\{\\s*([^}]+)\\}\\s+from\\s+['|\"|`]astro\\/components/g.exec(script))\n ) {\n if (namedMatch[1] && !namedMatch[1].includes('Markdown')) continue;\n // if \"Markdown\" was imported, find out whether or not it was renamed\n const rawImports = namedMatch[1]\n .trim()\n .replace(/^\\{/, '')\n .replace(/\\}$/, '')\n .trim();\n let importName = 'Markdown';\n for (const spec of rawImports.split(',')) {\n const [original, renamed] = spec.split(' as ').map((s) => s.trim());\n if (original !== 'Markdown') continue;\n importName = renamed || original;\n break;\n }\n return new Set([importName]);\n }\n return new Set(['Markdown']);\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 return 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 const stack = path.stack as anyNode[];\n return stack.some(\n (node) => node.type === 'attribute' && !isLoneMustacheTag(node)\n );\n}\n\n/**\n * Currently, the compiler has a bug that duplicates text nodes when no\n * TagLikeNode elements are present.\n */\nexport function removeDuplicates(root: RootNode) {\n root.children = root.children.filter((node, i, rootChildren) => {\n if (node.type !== 'text') return true;\n // https://stackoverflow.com/questions/2218999/how-to-remove-all-duplicates-from-an-array-of-objects\n return (\n i ===\n rootChildren.findIndex((t) => {\n if (t.position && node.position) {\n return (\n node.type === 'text' &&\n t.position.start.offset === node.position.start.offset &&\n t.position.start.line === node.position.start.line &&\n t.position.start.column === node.position.start.column\n );\n }\n })\n );\n });\n}\n\n/** True if the node is TagLikeNode:\n *\n * ElementNode | ComponentNode | CustomElementNode | FragmentNode */\nexport function isTagLikeNode(node: anyNode): node is TagLikeNode {\n return (\n node.type === 'element' ||\n node.type === 'component' ||\n node.type === 'custom-element' ||\n node.type === 'fragment'\n );\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n const parent = path.getParentNode();\n if (!parent) return [];\n\n return getChildren(parent);\n}\n\nexport function getNextNode(path: AstPath): anyNode | null {\n const node = path.getNode();\n if (node) {\n const siblings = getSiblings(path);\n if (node.position?.start === siblings[siblings.length - 1].position?.start)\n return null;\n for (let i = 0; i < siblings.length; i++) {\n const sibling = siblings[i];\n if (\n sibling.position?.start === node.position?.start &&\n i !== siblings.length - 1\n ) {\n return siblings[i + 1];\n }\n }\n }\n return null;\n}\n","import {\n AstPath as AstP,\n BuiltInParsers,\n Doc,\n ParserOptions as ParserOpts,\n Printer,\n} from 'prettier';\nimport _doc from 'prettier/doc';\nconst {\n builders: {\n breakParent,\n dedent,\n fill,\n group,\n hardline,\n indent,\n join,\n line,\n literalline,\n softline,\n },\n utils: { removeLines, stripTrailingHardline },\n} = _doc;\nimport { SassFormatter, SassFormatterConfig } from 'sass-formatter';\n\nimport { parseSortOrder } from './options';\n\nimport {\n RootNode,\n Node,\n AttributeNode,\n CommentNode,\n NodeWithText,\n selfClosingTags,\n TextNode,\n anyNode,\n} from './nodes';\n\ntype ParserOptions = ParserOpts<anyNode>;\ntype AstPath = AstP<anyNode>;\n\nimport {\n // attachCommentsHTML,\n canOmitSoftlineBeforeClosingTag,\n manualDedent,\n endsWithLinebreak,\n forceIntoExpression,\n formattableAttributes,\n getMarkdownName,\n getText,\n getUnencodedText,\n isRootNode,\n // isDocCommand,\n // isEmptyDoc,\n isEmptyTextNode,\n isInlineElement,\n isInsideQuotedAttribute,\n // isLine,\n isLoneMustacheTag,\n // isNodeWithChildren,\n isOrCanBeConvertedToShorthand,\n isPreTagContent,\n isShorthandAndMustBeConvertedToBinaryExpression,\n isTextNode,\n isTextNodeEndingWithWhitespace,\n isTextNodeStartingWithLinebreak,\n isTextNodeStartingWithWhitespace,\n printRaw,\n // replaceEndOfLineWith,\n shouldHugEnd,\n shouldHugStart,\n startsWithLinebreak,\n // trim,\n // trimChildren,\n trimTextNodeLeft,\n trimTextNodeRight,\n removeDuplicates,\n getNextNode,\n isTagLikeNode,\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 // note(drew): this isn’t doing anything currently, but Prettier requires it anyway\n // @ts-ignore\n return 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 const node = path.getValue();\n // const isMarkdownSubDoc = opts.parentParser === 'markdown'; // is this a code block within .md?\n\n // 1. handle special node types\n if (!node) {\n return '';\n }\n\n if (typeof node === 'string') {\n return node;\n }\n\n // if (Array.isArray(node)) {\n // return path.map((childPath) => childPath.call(print));\n // }\n\n // if (isASTNode(node)) {\n // return printTopLevelParts(node, path, opts, print);\n // }\n\n // 2. attach comments shallowly to children, if any (https://prettier.io/docs/en/plugins.html#manually-attaching-a-comment)\n // if (!isPreTagContent(path) && !isMarkdownSubDoc && node.type === 'Fragment') {\n // attachCommentsHTML(node);\n // }\n\n // 3. handle printing\n switch (node.type) {\n case 'root': {\n removeDuplicates(node);\n return [stripTrailingHardline(path.map(print, 'children')), hardline];\n }\n\n // case 'Fragment': {\n // const text = getText(node, opts);\n // if (text.length === 0) {\n // return '';\n // }\n\n // if (!isNodeWithChildren(node) || node.children.every(isEmptyTextNode)) return '';\n\n // if (!isPreTagContent(path)) {\n // trimChildren(node.children);\n // const output = trim(\n // [path.map(print, 'children')],\n // (n) =>\n // isLine(n) ||\n // (typeof n === 'string' && n.trim() === '') ||\n // // Because printChildren may append this at the end and\n // // may hide other lines before it\n // n === breakParent\n // );\n // if (output.every((doc) => isEmptyDoc(doc))) {\n // return '';\n // }\n // return group([...output, hardline]);\n // } else {\n // return group(path.map(print, 'children'));\n // }\n // }\n case 'text': {\n const rawText = getUnencodedText(node);\n\n // TODO: TEST PRE TAGS\n // if (isPreTagContent(path)) {\n // if (path.getParentNode()?.type === 'Attribute') {\n // // Direct child of attribute value -> add literallines at end of lines\n // // so that other things don't break in unexpected places\n // return replaceEndOfLineWith(rawText, literalline);\n // }\n // return rawText;\n // }\n\n if (isEmptyTextNode(node)) {\n const hasWhiteSpace =\n rawText.trim().length < getUnencodedText(node).length;\n const hasOneOrMoreNewlines = /\\n/.test(getUnencodedText(node));\n const hasTwoOrMoreNewlines = /\\n\\r?\\s*\\n\\r?/.test(\n getUnencodedText(node)\n );\n if (hasTwoOrMoreNewlines) {\n return [hardline, hardline];\n }\n if (hasOneOrMoreNewlines) {\n return hardline;\n }\n if (hasWhiteSpace) {\n return line;\n }\n return '';\n }\n\n /**\n * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n * each \"word\") is joined by a single `line`, which will be rendered as a single space\n * until this node's current line is out of room, at which `fill` will break at the\n * most convenient instance of `line`.\n */\n return fill(splitTextToDocs(node));\n }\n\n // case 'InlineComponent':\n // case 'Slot':\n case 'component':\n case 'fragment':\n case 'element': {\n // const isEmpty = node.children?.every((child) => isEmptyTextNode(child));\n let isEmpty: boolean;\n if (!node.children) {\n isEmpty = true;\n } else {\n isEmpty = node.children.every((child) => isEmptyTextNode(child));\n }\n const isSelfClosingTag =\n isEmpty &&\n (node.type !== 'element' || selfClosingTags.indexOf(node.name) !== -1);\n\n const attributes = path.map(print, 'attributes');\n if (isSelfClosingTag) {\n return group(['<', node.name, indent(group(attributes)), line, `/>`]);\n // return group(['<', node.name, indent(group([...attributes, opts.jsxBracketNewLine ? dedent(line) : ''])), ...[opts.jsxBracketNewLine ? '' : ' ', `/>`]]);\n }\n\n if (node.children) {\n const children = node.children;\n const firstChild = children[0];\n const lastChild = children[children.length - 1];\n\n // No hugging of content means it's either a block element and/or there's whitespace at the start/end\n let noHugSeparatorStart:\n | _doc.builders.Concat\n | _doc.builders.Line\n | _doc.builders.Softline\n | string = softline;\n let noHugSeparatorEnd:\n | _doc.builders.Concat\n | _doc.builders.Line\n | _doc.builders.Softline\n | string = softline;\n const hugStart = shouldHugStart(node, opts);\n const hugEnd = shouldHugEnd(node, opts);\n\n let body;\n\n if (isEmpty) {\n body =\n isInlineElement(path, opts, node) &&\n node.children.length &&\n isTextNodeStartingWithWhitespace(node.children[0]) &&\n !isPreTagContent(path)\n ? () => line\n : // () => (opts.jsxBracketNewLine ? '' : softline);\n () => softline;\n } else if (isPreTagContent(path)) {\n body = () => printRaw(node);\n } else if (\n isInlineElement(path, opts, node) &&\n !isPreTagContent(path)\n ) {\n body = () => path.map(print, 'children');\n } else {\n body = () => path.map(print, 'children');\n }\n\n const openingTag = [\n '<',\n node.name,\n indent(\n group([\n ...attributes,\n hugStart\n ? ''\n : !isPreTagContent(path) && !opts.bracketSameLine\n ? dedent(softline)\n : '',\n ])\n ),\n ];\n // const openingTag = ['<', node.name, indent(group([...attributes, hugStart ? '' : opts.jsxBracketNewLine && !isPreTagContent(path) ? dedent(softline) : '']))];\n\n if (hugStart && hugEnd) {\n const huggedContent = [\n softline,\n group(['>', body(), `</${node.name}`]),\n ];\n\n const omitSoftlineBeforeClosingTag =\n isEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n // const omitSoftlineBeforeClosingTag = (isEmpty && opts.jsxBracketNewLine) || canOmitSoftlineBeforeClosingTag(node, path, opts);\n return group([\n ...openingTag,\n isEmpty ? group(huggedContent) : group(indent(huggedContent)),\n omitSoftlineBeforeClosingTag ? '' : softline,\n '>',\n ]);\n }\n\n if (isPreTagContent(path)) {\n noHugSeparatorStart = '';\n noHugSeparatorEnd = '';\n } else {\n let didSetEndSeparator = false;\n\n if (!hugStart && firstChild && isTextNode(firstChild)) {\n if (\n isTextNodeStartingWithLinebreak(firstChild) &&\n firstChild !== lastChild &&\n (!isInlineElement(path, opts, node) ||\n isTextNodeEndingWithWhitespace(lastChild))\n ) {\n noHugSeparatorStart = hardline;\n noHugSeparatorEnd = hardline;\n didSetEndSeparator = true;\n } else if (isInlineElement(path, opts, node)) {\n noHugSeparatorStart = line;\n }\n trimTextNodeLeft(firstChild);\n }\n if (!hugEnd && lastChild && isTextNode(lastChild)) {\n if (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n noHugSeparatorEnd = softline;\n }\n trimTextNodeRight(lastChild);\n }\n }\n\n if (hugStart) {\n return group([\n ...openingTag,\n indent([softline, group(['>', body()])]),\n noHugSeparatorEnd,\n `</${node.name}>`,\n ]);\n }\n\n if (hugEnd) {\n return group([\n ...openingTag,\n '>',\n indent([noHugSeparatorStart, group([body(), `</${node.name}`])]),\n canOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,\n '>',\n ]);\n }\n\n if (isEmpty) {\n return group([...openingTag, '>', body(), `</${node.name}>`]);\n }\n\n return group([\n ...openingTag,\n '>',\n indent([noHugSeparatorStart, body()]),\n noHugSeparatorEnd,\n `</${node.name}>`,\n ]);\n }\n // TODO: WIP\n return '';\n }\n // case 'AttributeShorthand': {\n // return node.expression.name;\n // }\n case 'attribute': {\n const name = node.name.trim();\n const quote = opts.singleQuote ? \"'\" : '\"';\n switch (node.kind) {\n case 'empty':\n return [line, name];\n case 'expression':\n // HANDLED IN EMBED FUNCION\n return '';\n case 'quoted':\n return [line, name, '=', quote, node.value, quote];\n case 'shorthand':\n return [line, '{', name, '}'];\n case 'spread':\n return [line, '{...', name, '}'];\n case 'template-literal':\n return [line, name, '=', '`', node.value, '`'];\n default:\n break;\n }\n return '';\n }\n\n case 'doctype': {\n // https://www.w3.org/wiki/Doctypes_and_markup_styles\n return ['<!DOCTYPE html>', hardline];\n }\n // case 'Expression':\n // // missing test ?\n // return [];\n // case 'MustacheTag':\n // return [\n // '{',\n // printJS(path, print, 'expression', {\n // forceSingleLine: isInsideQuotedAttribute(path),\n // forceSingleQuote: opts.jsxSingleQuote,\n // }),\n // '}',\n // ];\n // case 'Spread':\n // return [\n // line,\n // '{...',\n // printJS(path, print, 'expression', {\n // forceSingleQuote: true,\n // forceSingleLine: false,\n // }),\n // '}',\n // ];\n case 'comment':\n const nextNode = getNextNode(path);\n let trailingLine: _doc.builders.Concat | string = '';\n if (nextNode && isTagLikeNode(nextNode)) {\n trailingLine = hardline;\n }\n return ['<!--', getUnencodedText(node), '-->', trailingLine];\n // case 'CodeSpan':\n // return getUnencodedText(node);\n // case 'CodeFence': {\n // console.debug(node);\n // // const lang = node.metadata.slice(3);\n // return [node.metadata, hardline, /** somehow call textToDoc(lang), */ node.data, hardline, '```', hardline];\n\n // // We should use `node.metadata` to select a parser to embed with... something like return [node.metadata, hardline textToDoc(node.getMetadataLanguage()), hardline, `\\`\\`\\``];\n // }\n default: {\n throw new Error(`Unhandled node type \"${node.type}\"!`);\n }\n }\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 const text = getUnencodedText(node);\n\n const textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n let docs = join(line, textLines).parts.filter((s) => s !== '');\n\n if (startsWithLinebreak(text)) {\n docs[0] = hardline;\n }\n if (startsWithLinebreak(text, 2)) {\n docs = [hardline, ...docs];\n }\n\n if (endsWithLinebreak(text)) {\n docs[docs.length - 1] = hardline;\n }\n if (endsWithLinebreak(text, 2)) {\n docs = [...docs, hardline];\n }\n\n return docs;\n}\n\nfunction expressionParser(\n text: string,\n parsers: BuiltInParsers,\n opts: ParserOptions\n) {\n const ast = parsers.babel(text, opts);\n // const ast = parsers.babel(text, parsers, opts);\n\n return { ...ast, program: ast.program.body[0].expression };\n}\n\nlet markdownComponentName = new Set();\n\nfunction embed(\n path: AstPath,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n print: printFn,\n textToDoc: (text: string, options: object) => Doc,\n opts: ParserOptions\n) {\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n if (!opts.__astro) opts.__astro = {};\n\n const node = path.getValue();\n\n if (!node) return null;\n\n if (node.type === 'expression') {\n const textContent = printRaw(node);\n\n let content: Doc;\n\n content = textToDoc(forceIntoExpression(textContent), {\n ...opts,\n parser: expressionParser,\n semi: false,\n });\n content = stripTrailingHardline(content);\n\n // if (node.children[0].value) {\n // content = textToDoc(forceIntoExpression(textContent), { parser: expressionParser });\n // } else {\n // content = textToDoc(forceIntoExpression(node.children[0].value), { parser: expressionParser });\n // }\n return [\n '{',\n // printJS(path, print, 'expression', {\n // forceSingleLine: isInsideQuotedAttribute(path),\n // forceSingleQuote: opts.jsxSingleQuote,\n // }),\n content,\n '}',\n ];\n }\n\n // ATTRIBUTE WITH EXPRESSION AS VALUE\n if (node.type === 'attribute' && node.kind === 'expression') {\n const value = node.value.trim();\n const name = node.name.trim();\n let attrNodeValue = textToDoc(forceIntoExpression(value), {\n ...opts,\n parser: expressionParser,\n semi: false,\n });\n attrNodeValue = stripTrailingHardline(attrNodeValue);\n // if (Array.isArray(attrNodeValue) && attrNodeValue[0] === ';') {\n // attrNodeValue = attrNodeValue.slice(1);\n // }\n if (name === value && opts.astroAllowShorthand) {\n return [line, '{', attrNodeValue, '}'];\n }\n return [line, name, '=', '{', attrNodeValue, '}'];\n }\n\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n // if (node.isJS) {\n // try {\n // const embeddedopts = {\n // parser: expressionParser,\n // };\n // // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // // @ts-ignore\n // if (node.forceSingleQuote) {\n // // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // // @ts-ignore\n // embeddedopts.singleQuote = true;\n // }\n\n // const docs = textToDoc(forceIntoExpression(getText(node, opts)), embeddedopts);\n // // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // // @ts-ignore\n // return node.forceSingleLine ? removeLines(docs) : docs;\n // } catch (e) {\n // return getText(node, opts);\n // }\n // }\n\n if (node.type === 'frontmatter') {\n markdownComponentName = getMarkdownName(node.value);\n return [\n group([\n '---',\n hardline,\n textToDoc(node.value, { ...opts, parser: 'typescript' }),\n '---',\n hardline,\n ]),\n hardline,\n ];\n }\n\n // format script element\n if (node.type === 'element' && node.name === 'script') {\n const scriptContent = printRaw(node);\n let formatttedScript = textToDoc(scriptContent, {\n ...opts,\n parser: 'typescript',\n });\n formatttedScript = stripTrailingHardline(formatttedScript);\n\n // print\n const attributes = path.map(print, 'attributes');\n const openingTag = group([\n '<script',\n indent(group(attributes)),\n softline,\n '>',\n ]);\n return [\n openingTag,\n indent([hardline, formatttedScript]),\n hardline,\n '</script>',\n ];\n }\n // if (isTextNode(node)) {\n // const parent = path.getParentNode();\n\n // if (parent && parent.type === 'Element' && parent.name === 'script') {\n // const formatttedScript = textToDoc(node.data, { ...opts, parser: 'typescript' });\n // return stripTrailingHardline(formatttedScript);\n // }\n // }\n\n // format style element\n if (node.type === 'element' && node.name === 'style') {\n const styleTagContent = printRaw(node);\n\n const supportedStyleLangValues = ['css', 'scss', 'sass'];\n let parserLang = 'css';\n\n if (node.attributes) {\n const langAttribute = node.attributes.filter((x) => x.name === 'lang');\n if (langAttribute.length) {\n const styleLang = langAttribute[0].value.toLowerCase();\n if (supportedStyleLangValues.includes(styleLang))\n parserLang = styleLang;\n }\n }\n\n switch (parserLang) {\n case 'css':\n case 'scss': {\n // the css parser appends an extra indented hardline, which we want outside of the `indent()`,\n // so we remove the last element of the array\n let formattedStyles = textToDoc(styleTagContent, {\n ...opts,\n parser: parserLang,\n });\n\n formattedStyles = stripTrailingHardline(formattedStyles);\n\n // print\n const attributes = path.map(print, 'attributes');\n const openingTag = group([\n '<style',\n indent(group(attributes)),\n softline,\n '>',\n ]);\n return [\n openingTag,\n indent([hardline, formattedStyles]),\n hardline,\n '</style>',\n ];\n }\n case 'sass': {\n const lineEnding =\n opts.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n const sassOptions: Partial<SassFormatterConfig> = {\n tabSize: opts.tabWidth,\n insertSpaces: !opts.useTabs,\n lineEnding,\n };\n\n // dedent the .sass, otherwise SassFormatter gets indentation wrong\n const { result: raw } = manualDedent(styleTagContent);\n\n // format\n const formattedSassIndented = SassFormatter.Format(\n raw,\n sassOptions\n ).trim();\n\n // print\n const formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n const attributes = path.map(print, 'attributes');\n const openingTag = group([\n '<style',\n indent(group(attributes)),\n softline,\n '>',\n ]);\n return [\n openingTag,\n indent(group([hardline, formattedSass])),\n hardline,\n '</style>',\n ];\n }\n }\n }\n\n // MARKDOWN COMPONENT\n if (node.type === 'component' && markdownComponentName.has(node.name)) {\n let content = printRaw(node);\n\n // dedent the content\n content = content.replace(/\\r\\n/g, '\\n');\n const contentArr = content.split('\\n').map((s) => s.trimStart());\n content = contentArr.join('\\n');\n\n // format\n let formatttedMarkdown = textToDoc(content, {\n ...opts,\n parser: 'markdown',\n });\n formatttedMarkdown = stripTrailingHardline(formatttedMarkdown);\n\n // return formatttedMarkdown;\n const attributes = path.map(print, 'attributes');\n const openingTag = group([\n `<${node.name}`,\n indent(group(attributes)),\n softline,\n '>',\n ]);\n return [\n openingTag,\n indent(group([hardline, formatttedMarkdown])),\n hardline,\n `</${node.name}>`,\n ];\n }\n\n return null;\n}\n\nfunction hasPrettierIgnore(path: AstP<CommentNode>) {\n // const node = path.getNode();\n\n // if (!node || !Array.isArray(node.comments)) return false;\n\n // const hasIgnore = node.comments.some(\n // (comment: any) => comment.data.includes('prettier-ignore') && !comment.data.includes('prettier-ignore-start') && !comment.data.includes('prettier-ignore-end')\n // );\n // return hasIgnore;\n return false;\n}\n\nconst printer: Printer = {\n print,\n printComment,\n embed,\n hasPrettierIgnore,\n};\n\nexport default printer;\n","import { SupportOption } from 'prettier';\n\ndeclare module 'prettier' {\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n interface RequiredOptions extends PluginOptions {}\n}\n\nexport interface PluginOptions {\n astroSortOrder: SortOrder;\n astroAllowShorthand: boolean;\n}\n\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n astroSortOrder: {\n since: '0.0.1',\n category: 'Astro',\n type: 'choice',\n default: 'markup | styles',\n description: 'Sort order for markup, scripts, and styles',\n choices: [\n {\n value: 'markup | styles',\n description: 'markup | styles',\n },\n {\n value: 'styles | markup',\n description: 'styles | markup',\n },\n ],\n },\n astroAllowShorthand: {\n since: '0.0.10',\n category: 'Astro',\n type: 'boolean',\n default: false,\n description:\n 'Enable/disable attribute shorthand if attribute name and expression are the same',\n },\n};\n\nexport const parseSortOrder = (sortOrder: SortOrder): SortOrderPart[] =>\n sortOrder.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 '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 {\n name: 'astro',\n parsers: ['astro'],\n extensions: ['.astro'],\n vscodeLanguageIds: ['astro'],\n },\n];\n\nexport const parsers: Record<string, Parser> = {\n astro: {\n parse: (source) => parse(source),\n astFormat: 'astro',\n locStart: (node) => node.start,\n locEnd: (node) => node.end,\n },\n};\n\nexport const printers: Record<string, Printer> = {\n astro: printer,\n};\n\nconst defaultOptions = {\n tabWidth: 2,\n};\n\nexport { options, defaultOptions };\n"],"names":["require","createRequire","createSyncFn","_doc","SassFormatter"],"mappings":";;;;;;;;;;;;;AAoKA,MAAM,cAAc,GAAG;IACrB,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;CACE,CAAC;AAEJ,MAAM,aAAa,GAAa,CAAC,GAAG,cAAc,CAAC,CAAC;AAgEpD,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;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AO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAE7D,MAAA,SAAS,GAA+B;AACnD,IAAA;AACE,QAAA,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,QAAQ,CAAC;QACtB,iBAAiB,EAAE,CAAC,OAAO,CAAC;AAC7B,KAAA;EACD;AAEW,MAAA,OAAO,GAA2B;AAC7C,IAAA,KAAK,EAAE;QACL,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;AAC3B,KAAA;EACD;AAEW,MAAA,QAAQ,GAA4B;AAC/C,IAAA,KAAK,EAAE,OAAO;EACd;AAEF,MAAM,cAAc,GAAG;AACrB,IAAA,QAAQ,EAAE,CAAC;;;;;;;;;"}
|
|
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/** scan code for Markdown name(s) */\nexport function getMarkdownName(script: string): Set<string> {\n\t// default import: could be named anything\n\tlet defaultMatch;\n\twhile (\n\t\t(defaultMatch = /import\\s+([^\\s]+)\\s+from\\s+['|\"|`]astro\\/components\\/Markdown\\.astro/g.exec(\n\t\t\tscript\n\t\t))\n\t) {\n\t\tif (defaultMatch[1]) return new Set([defaultMatch[1].trim()]);\n\t}\n\n\t// named component: must have \"Markdown\" in specifier, but can be renamed via \"as\"\n\tlet namedMatch;\n\twhile ((namedMatch = /import\\s+\\{\\s*([^}]+)\\}\\s+from\\s+['|\"|`]astro\\/components/g.exec(script))) {\n\t\tif (namedMatch[1] && !namedMatch[1].includes('Markdown')) continue;\n\t\t// if \"Markdown\" was imported, find out whether or not it was renamed\n\t\tconst rawImports = namedMatch[1].trim().replace(/^\\{/, '').replace(/\\}$/, '').trim();\n\t\tlet importName = 'Markdown';\n\t\tfor (const spec of rawImports.split(',')) {\n\t\t\tconst [original, renamed] = spec.split(' as ').map((s) => s.trim());\n\t\t\tif (original !== 'Markdown') continue;\n\t\t\timportName = renamed || original;\n\t\t\tbreak;\n\t\t}\n\t\treturn new Set([importName]);\n\t}\n\treturn new Set(['Markdown']);\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\tgetMarkdownName,\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 attributes = path.map(print, 'attributes');\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\t...attributes,\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\nlet markdownComponentName = new Set();\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\tmarkdownComponentName = getMarkdownName(node.value);\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\t// MARKDOWN COMPONENT\n\tif (node.type === 'component' && markdownComponentName.has(node.name)) {\n\t\tlet content = printRaw(node);\n\n\t\t// dedent the content\n\t\tcontent = content.replace(/\\r\\n/g, '\\n');\n\t\tconst contentArr = content.split('\\n').map((s) => s.trimStart());\n\t\tcontent = contentArr.join('\\n');\n\n\t\t// format\n\t\tlet formatttedMarkdown = textToDoc(content, {\n\t\t\t...opts,\n\t\t\tparser: 'markdown',\n\t\t});\n\t\tformatttedMarkdown = stripTrailingHardline(formatttedMarkdown);\n\n\t\t// return formatttedMarkdown;\n\t\tconst attributes = path.map(print, 'attributes');\n\t\tconst openingTag = group([`<${node.name}`, indent(group(attributes)), softline, '>']);\n\t\treturn [openingTag, indent(group([hardline, formatttedMarkdown])), hardline, `</${node.name}>`];\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,y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AAGC,yBAAa,CAAC,mMAAe,CAAC,CAAC;AAG/C,MAAM,KAAK,GAAGC,oBAAY,CAACF,SAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAE7D,MAAA,SAAS,GAA+B;AACpD,IAAA;AACC,QAAA,IAAI,EAAE,OAAO;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;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-astro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "A Prettier Plugin for formatting Astro files",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"workers/*"
|
|
10
10
|
],
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": "^14.
|
|
12
|
+
"node": "^14.15.0 || >=16.0.0",
|
|
13
13
|
"npm": ">=6.14.0"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://github.com/
|
|
15
|
+
"homepage": "https://github.com/withastro/prettier-plugin-astro/",
|
|
16
16
|
"issues": {
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/withastro/prettier-plugin-astro/issues"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"keywords": [
|
|
@@ -25,42 +25,41 @@
|
|
|
25
25
|
],
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/withastro/prettier-plugin-astro.git"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "rollup -c",
|
|
32
32
|
"dev": "rollup -c -w",
|
|
33
33
|
"test": "vitest run",
|
|
34
|
-
"test:
|
|
34
|
+
"test:watch": "vitest -w",
|
|
35
35
|
"test:ui": "vitest --ui",
|
|
36
|
-
"release": "yarn build && changeset publish",
|
|
37
36
|
"lint": "eslint .",
|
|
38
|
-
"fix": "yarn lint --fix",
|
|
39
|
-
"format": "prettier -w ."
|
|
37
|
+
"lint:fix": "yarn lint --fix",
|
|
38
|
+
"format": "prettier -w . --cache",
|
|
39
|
+
"release": "yarn build && changeset publish"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@astrojs/compiler": "^0.
|
|
43
|
-
"prettier": "^2.
|
|
42
|
+
"@astrojs/compiler": "^0.19.0",
|
|
43
|
+
"prettier": "^2.7.1",
|
|
44
44
|
"sass-formatter": "^0.7.2",
|
|
45
45
|
"synckit": "^0.7.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@changesets/cli": "^2.16.0",
|
|
49
|
-
"@rollup/plugin-commonjs": "^
|
|
50
|
-
"@rollup/plugin-
|
|
51
|
-
"@types/
|
|
52
|
-
"@
|
|
53
|
-
"@typescript-eslint/
|
|
54
|
-
"@
|
|
55
|
-
"
|
|
49
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
50
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
51
|
+
"@types/node": "^14.15.0",
|
|
52
|
+
"@types/prettier": "^2.6.3",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
54
|
+
"@typescript-eslint/parser": "^5.29.0",
|
|
55
|
+
"@vitest/ui": "^0.16.0",
|
|
56
|
+
"eslint": "^8.18.0",
|
|
56
57
|
"eslint-config-prettier": "^8.5.0",
|
|
57
58
|
"eslint-plugin-prettier": "^4.0.0",
|
|
58
|
-
"eslint-plugin-prettier-doc": "^1.0
|
|
59
|
-
"rollup": "^2.
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"typescript": "^4.6.3",
|
|
64
|
-
"vitest": "^0.9.2"
|
|
59
|
+
"eslint-plugin-prettier-doc": "^1.1.0",
|
|
60
|
+
"rollup": "^2.75.7",
|
|
61
|
+
"tslib": "^2.4.0",
|
|
62
|
+
"typescript": "^4.7.4",
|
|
63
|
+
"vitest": "^0.16.0"
|
|
65
64
|
}
|
|
66
65
|
}
|
package/workers/parse-worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { runAsWorker } = require('synckit');
|
|
2
2
|
|
|
3
3
|
runAsWorker(async (source) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const dynamicImport = new Function('file', 'return import(file)');
|
|
5
|
+
const { parse } = await dynamicImport('@astrojs/compiler');
|
|
6
|
+
const { ast } = await parse(source);
|
|
7
|
+
return ast;
|
|
8
8
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { runAsWorker } = require('synckit');
|
|
2
2
|
|
|
3
3
|
runAsWorker(async (node) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const dynamicImport = new Function('file', 'return import(file)');
|
|
5
|
+
const { serialize } = await dynamicImport('@astrojs/compiler/utils');
|
|
6
|
+
return await serialize(node);
|
|
7
7
|
});
|