prettier-plugin-embed 0.4.7 → 0.4.9
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/README.md +124 -3
- package/dist/embedded/css/language.d.ts +1 -1
- package/dist/embedded/css/options.d.ts +2 -8
- package/dist/embedded/es/language.d.ts +1 -1
- package/dist/embedded/es/options.d.ts +3 -9
- package/dist/embedded/glsl/language.d.ts +1 -1
- package/dist/embedded/glsl/options.d.ts +2 -8
- package/dist/embedded/graphql/language.d.ts +1 -1
- package/dist/embedded/graphql/options.d.ts +2 -8
- package/dist/embedded/html/language.d.ts +1 -1
- package/dist/embedded/html/options.d.ts +2 -8
- package/dist/embedded/index.d.ts +1 -1
- package/dist/embedded/ini/language.d.ts +1 -1
- package/dist/embedded/ini/options.d.ts +2 -9
- package/dist/embedded/ini/plugin-ini-types.d.ts +3 -0
- package/dist/embedded/ini/plugin-ini.d.ts +6 -0
- package/dist/embedded/java/embedder.d.ts +12 -0
- package/dist/embedded/java/index.d.ts +3 -0
- package/dist/embedded/java/language.d.ts +9 -0
- package/dist/embedded/java/options.d.ts +27 -0
- package/dist/embedded/java/plugin-java-types.d.ts +7 -0
- package/dist/embedded/java/plugin-java.d.ts +6 -0
- package/dist/embedded/json/language.d.ts +1 -1
- package/dist/embedded/json/options.d.ts +2 -8
- package/dist/embedded/jsonata/embedder.d.ts +12 -0
- package/dist/embedded/jsonata/index.d.ts +3 -0
- package/dist/embedded/jsonata/language.d.ts +9 -0
- package/dist/embedded/jsonata/options.d.ts +27 -0
- package/dist/embedded/latex/language.d.ts +1 -1
- package/dist/embedded/latex/options.d.ts +2 -8
- package/dist/embedded/markdown/embedder.d.ts +1 -1
- package/dist/embedded/markdown/language.d.ts +1 -1
- package/dist/embedded/markdown/options.d.ts +2 -9
- package/dist/embedded/markdown/plugin-markdown-types.d.ts +3 -0
- package/dist/embedded/markdown/plugin-markdown.d.ts +6 -0
- package/dist/embedded/nginx/embedder.d.ts +12 -0
- package/dist/embedded/nginx/index.d.ts +3 -0
- package/dist/embedded/nginx/language.d.ts +9 -0
- package/dist/embedded/nginx/options.d.ts +27 -0
- package/dist/embedded/nginx/plugin-nginx-types.d.ts +4 -0
- package/dist/embedded/nginx/plugin-nginx.d.ts +6 -0
- package/dist/embedded/noop/language.d.ts +1 -1
- package/dist/embedded/noop/options.d.ts +2 -2
- package/dist/embedded/pegjs/embedder.d.ts +12 -0
- package/dist/embedded/pegjs/index.d.ts +3 -0
- package/dist/embedded/pegjs/language.d.ts +9 -0
- package/dist/embedded/pegjs/options.d.ts +27 -0
- package/dist/embedded/pegjs/plugin-pegjs-types.d.ts +5 -0
- package/dist/embedded/pegjs/plugin-pegjs.d.ts +6 -0
- package/dist/embedded/php/language.d.ts +1 -1
- package/dist/embedded/php/options.d.ts +2 -11
- package/dist/embedded/php/plugin-php-types.d.ts +5 -0
- package/dist/embedded/php/plugin-php.d.ts +6 -0
- package/dist/embedded/prisma/embedder.d.ts +12 -0
- package/dist/embedded/prisma/index.d.ts +3 -0
- package/dist/embedded/prisma/language.d.ts +9 -0
- package/dist/embedded/prisma/options.d.ts +27 -0
- package/dist/embedded/properties/language.d.ts +1 -1
- package/dist/embedded/properties/options.d.ts +2 -10
- package/dist/embedded/properties/plugin-properties-types.d.ts +4 -0
- package/dist/embedded/properties/plugin-properties.d.ts +6 -0
- package/dist/embedded/pug/embedder.d.ts +12 -0
- package/dist/embedded/pug/index.d.ts +3 -0
- package/dist/embedded/pug/language.d.ts +9 -0
- package/dist/embedded/pug/options.d.ts +27 -0
- package/dist/embedded/pug/plugin-pug-types.d.ts +29 -0
- package/dist/embedded/pug/plugin-pug.d.ts +6 -0
- package/dist/embedded/register.d.ts +22 -16
- package/dist/embedded/ruby/language.d.ts +1 -1
- package/dist/embedded/ruby/options.d.ts +3 -16
- package/dist/embedded/ruby/plugin-ruby-types.d.ts +6 -0
- package/dist/embedded/ruby/plugin-ruby.d.ts +6 -0
- package/dist/embedded/sh/language.d.ts +1 -1
- package/dist/embedded/sh/options.d.ts +3 -10
- package/dist/embedded/sh/plugin-sh-types.d.ts +4 -0
- package/dist/embedded/sh/plugin-sh.d.ts +6 -0
- package/dist/embedded/sql/language.d.ts +1 -1
- package/dist/embedded/sql/options.d.ts +4 -13
- package/dist/embedded/sql/plugin-sql-cst-types.d.ts +4 -0
- package/dist/embedded/sql/plugin-sql-cst.d.ts +6 -0
- package/dist/embedded/sql/plugin-sql-types.d.ts +4 -0
- package/dist/embedded/sql/plugin-sql.d.ts +6 -0
- package/dist/embedded/toml/language.d.ts +1 -1
- package/dist/embedded/toml/options.d.ts +3 -10
- package/dist/embedded/toml/plugin-toml-types.d.ts +4 -0
- package/dist/embedded/toml/plugin-toml.d.ts +6 -0
- package/dist/embedded/ts/language.d.ts +1 -1
- package/dist/embedded/ts/options.d.ts +3 -9
- package/dist/embedded/types.d.ts +1 -1
- package/dist/embedded/utils.d.ts +7 -4
- package/dist/embedded/xml/language.d.ts +1 -1
- package/dist/embedded/xml/options.d.ts +2 -12
- package/dist/embedded/xml/parser.d.ts +1 -0
- package/dist/embedded/xml/plugin-xml-types.d.ts +6 -0
- package/dist/embedded/xml/plugin-xml.d.ts +6 -0
- package/dist/embedded/yaml/language.d.ts +1 -1
- package/dist/embedded/yaml/options.d.ts +2 -8
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1270 -1043
- package/dist/options.d.ts +78 -28
- package/dist/plugin-embed.d.ts +6 -0
- package/dist/types.d.ts +5 -24
- package/dist/utils.d.ts +1 -4
- package/package.json +51 -14
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
# Prettier Plugin Embed
|
|
6
6
|
|
|
@@ -115,11 +115,17 @@ Supported embedded languages are:
|
|
|
115
115
|
- [GraphQL](#graphql)
|
|
116
116
|
- [HTML](#html)
|
|
117
117
|
- [INI](#ini)
|
|
118
|
+
- [Java](#java)
|
|
118
119
|
- [JSON](#json)
|
|
120
|
+
- [JSONata](#jsonata)
|
|
119
121
|
- [LaTeX](#latex)
|
|
120
122
|
- [Markdown](#markdown)
|
|
123
|
+
- [NGINX](#nginx)
|
|
124
|
+
- [Pegjs](#pegjs)
|
|
121
125
|
- [PHP](#php)
|
|
126
|
+
- [Prisma](#prisma)
|
|
122
127
|
- [Properties](#properties)
|
|
128
|
+
- [Pug](#pug)
|
|
123
129
|
- [Ruby](#ruby)
|
|
124
130
|
- [Sh (Shell)](#sh-shell)
|
|
125
131
|
- [SQL](#sql)
|
|
@@ -161,7 +167,7 @@ If you want to specify different parsers for different identifiers, check [`embe
|
|
|
161
167
|
| `embeddedEsIdentifiers` | `string[]` | [`["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"]`](./src/embedded/es/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language. |
|
|
162
168
|
| `embeddedEsParser` | [`"babel" \| "babel-flow" \| "acorn" \| "espree" \| "flow" \| "meriyah"`](./src/embedded/es/options.ts) | [`"babel"`](./src/embedded/es/options.ts) | The parser used to parse the embedded ECMASCript/JavaScript language. |
|
|
163
169
|
|
|
164
|
-
Formatting embedded ECMAScript language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
170
|
+
Formatting embedded ECMAScript/JavaScript language doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
|
|
165
171
|
|
|
166
172
|
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides).
|
|
167
173
|
|
|
@@ -204,6 +210,14 @@ If you want to specify different parsers for different identifiers, check [`embe
|
|
|
204
210
|
|
|
205
211
|
Formatting embedded INI language requires the [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini) plugin to be loaded as well. And [options](https://github.com/kddnewton/prettier-plugin-ini#configuration) supported by `prettier-plugin-ini` can therefore be used to further control the formatting behavior.
|
|
206
212
|
|
|
213
|
+
#### Java
|
|
214
|
+
|
|
215
|
+
| Option | Type | Default | Description |
|
|
216
|
+
| :-----------------------: | :--------: | :------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
217
|
+
| `embeddedJavaIdentifiers` | `string[]` | [`["java"]`](./src/embedded/java/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin. |
|
|
218
|
+
|
|
219
|
+
Formatting embedded Java language requires the [`prettier-plugin-java`](https://github.com/jhipster/prettier-java/tree/main/packages/prettier-plugin-java) plugin to be loaded as well. And [options](https://github.com/jhipster/prettier-java/tree/main/packages/prettier-plugin-java#options) supported by `prettier-plugin-java` can therefore be used to further control the formatting behavior.
|
|
220
|
+
|
|
207
221
|
#### JSON
|
|
208
222
|
|
|
209
223
|
| Option | Type | Default | Description |
|
|
@@ -215,6 +229,14 @@ Formatting embedded JSON language doesn't require other plugins and uses the par
|
|
|
215
229
|
|
|
216
230
|
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides).
|
|
217
231
|
|
|
232
|
+
#### JSONata
|
|
233
|
+
|
|
234
|
+
| Option | Type | Default | Description |
|
|
235
|
+
| :--------------------------: | :--------: | :------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
236
|
+
| `embeddedJsonataIdentifiers` | `string[]` | [`["jsonata"]`](./src/embedded/jsonata/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin. |
|
|
237
|
+
|
|
238
|
+
Formatting embedded JSONata language requires the [`@stedi/prettier-plugin-jsonata`](https://github.com/Stedi/prettier-plugin-jsonata) plugin to be loaded as well.
|
|
239
|
+
|
|
218
240
|
#### LaTeX
|
|
219
241
|
|
|
220
242
|
| Option | Type | Default | Description |
|
|
@@ -238,6 +260,24 @@ If you want to specify different parsers for different identifiers, check [`embe
|
|
|
238
260
|
|
|
239
261
|
The `remark` parser is [an alias of the `markdown` parser](https://github.com/prettier/prettier/blob/ed23dacc9e655c3876971b30859497b17ff2cf9f/src/language-markdown/parser-markdown.js#L57).
|
|
240
262
|
|
|
263
|
+
#### NGINX
|
|
264
|
+
|
|
265
|
+
| Option | Type | Default | Description |
|
|
266
|
+
| :------------------------: | :--------: | :--------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
267
|
+
| `embeddedNginxIdentifiers` | `string[]` | [`["nginx"]`](./src/embedded/nginx/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin. |
|
|
268
|
+
|
|
269
|
+
Formatting embedded NGINX language requires the [`prettier-plugin-nginx`](https://github.com/jxddk/prettier-plugin-nginx) plugin to be loaded as well. And [options](https://github.com/jxddk/prettier-plugin-nginx?tab=readme-ov-file#configuration) supported by `prettier-plugin-nginx` can therefore be used to further control the formatting behavior.
|
|
270
|
+
|
|
271
|
+
#### Pegjs
|
|
272
|
+
|
|
273
|
+
| Option | Type | Default | Description |
|
|
274
|
+
| :------------------------: | :--------: | :------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
275
|
+
| `embeddedPegjsIdentifiers` | `string[]` | [`["pegjs", "peggy", "peg"]`](./src/embedded/pegjs/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin. |
|
|
276
|
+
|
|
277
|
+
Formatting embedded Pegjs language requires the [`prettier-plugin-pegjs`](https://github.com/siefkenj/prettier-plugin-pegjs) plugin to be loaded as well. And [options](https://github.com/siefkenj/prettier-plugin-pegjs?tab=readme-ov-file#options) supported by `prettier-plugin-pegjs` can therefore be used to further control the formatting behavior.
|
|
278
|
+
|
|
279
|
+
Note that `prettier-plugin-pegjs` supports different parsers for the action blocks and they are specified by the [`actionParser` option](https://github.com/siefkenj/prettier-plugin-pegjs?tab=readme-ov-file#options). If you want to specify different action parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides).
|
|
280
|
+
|
|
241
281
|
#### PHP
|
|
242
282
|
|
|
243
283
|
| Option | Type | Default | Description |
|
|
@@ -246,6 +286,14 @@ The `remark` parser is [an alias of the `markdown` parser](https://github.com/pr
|
|
|
246
286
|
|
|
247
287
|
Formatting embedded PHP language requires the [`@prettier/plugin-php`](https://github.com/prettier/plugin-php) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-php#configuration) supported by `@prettier/plugin-php` can therefore be used to further control the formatting behavior.
|
|
248
288
|
|
|
289
|
+
#### Prisma
|
|
290
|
+
|
|
291
|
+
| Option | Type | Default | Description |
|
|
292
|
+
| :-------------------------: | :--------: | :----------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
293
|
+
| `embeddedPrismaIdentifiers` | `string[]` | [`["prisma"]`](./src/embedded/prisma/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin. |
|
|
294
|
+
|
|
295
|
+
Formatting embedded Prisma language requires the [`prettier-plugin-prisma`](https://github.com/avocadowastaken/prettier-plugin-prisma) plugin to be loaded as well.
|
|
296
|
+
|
|
249
297
|
#### Properties
|
|
250
298
|
|
|
251
299
|
| Option | Type | Default | Description |
|
|
@@ -254,6 +302,14 @@ Formatting embedded PHP language requires the [`@prettier/plugin-php`](https://g
|
|
|
254
302
|
|
|
255
303
|
Formatting embedded Properties language requires the [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties) plugin to be loaded as well. And [options](https://github.com/eemeli/prettier-plugin-properties#configuration) supported by `prettier-plugin-properties` can therefore be used to further control the formatting behavior.
|
|
256
304
|
|
|
305
|
+
#### Pug
|
|
306
|
+
|
|
307
|
+
| Option | Type | Default | Description |
|
|
308
|
+
| :----------------------: | :--------: | :------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
309
|
+
| `embeddedPugIdentifiers` | `string[]` | [`["pug", "jade"]`](./src/embedded/pug/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin. |
|
|
310
|
+
|
|
311
|
+
Formatting embedded Pug language requires the [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug) plugin to be loaded as well. And [options](https://github.com/prettier/plugin-pug?tab=readme-ov-file#configuration) supported by `@prettier/plugin-pug` can therefore be used to further control the formatting behavior.
|
|
312
|
+
|
|
257
313
|
#### Ruby
|
|
258
314
|
|
|
259
315
|
| Option | Type | Default | Description |
|
|
@@ -293,7 +349,7 @@ Note that `prettier-plugin-sql` supports many different SQL dialects which are s
|
|
|
293
349
|
| :-----------------------: | :--------: | :------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
294
350
|
| `embeddedTomlIdentifiers` | `string[]` | [`["toml"]`](./src/embedded/toml/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin. |
|
|
295
351
|
|
|
296
|
-
Formatting embedded TOML language requires the [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) plugin to be loaded as well. And options supported by `prettier-plugin-toml` can therefore be used to further control the formatting behavior.
|
|
352
|
+
Formatting embedded TOML language requires the [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) plugin to be loaded as well. And [options](https://github.com/un-ts/prettier/blob/master/packages/toml/src/options.ts) supported by `prettier-plugin-toml` can therefore be used to further control the formatting behavior.
|
|
297
353
|
|
|
298
354
|
#### TS (TypeScript)
|
|
299
355
|
|
|
@@ -365,6 +421,71 @@ An example `.json` file is:
|
|
|
365
421
|
>
|
|
366
422
|
> Please note that not every option is supported to override. That largely depends on at which phase those options will kick in and take effect. For example, you can't override `tabWidth` in `embeddedOverrides` because this option is used in the [`printDocToString`](https://github.com/prettier/prettier/blob/7aecca5d6473d73f562ca3af874831315f8f2581/src/document/printer.js#L302) phase, where `prettier-plugin-embed` cannot override this option for only a set of specified identifiers. To find the list of unsupported options, please check the interface definition of `EmbeddedOverride` in the [source code](https://github.com/Sec-ant/prettier-plugin-embed/blob/main/src/types.ts).
|
|
367
423
|
|
|
424
|
+
### Typed Options
|
|
425
|
+
|
|
426
|
+
There're several ways to use the typed options provided by this plugin. Taking the embedded SQL language as an example:
|
|
427
|
+
|
|
428
|
+
- **Augment the `Options` type from `Prettier` to use plugin-specific options**
|
|
429
|
+
|
|
430
|
+
Register options from `prettier-plugin-embed` (this plugin):
|
|
431
|
+
|
|
432
|
+
```ts
|
|
433
|
+
/// <reference types="prettier-plugin-embed/plugin-embed" />
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Register options from `prettier-plugin-sql`:
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
/// <reference types="prettier-plugin-embed/embedded/sql/plugin-sql" />
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Other embedded languages share the same pattern:
|
|
443
|
+
|
|
444
|
+
```ts
|
|
445
|
+
/// <reference types="prettier-plugin-embed/embedded/<language>/<(no prettier or scope) plugin name>" />
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
- **Import plugin-specific options**
|
|
449
|
+
|
|
450
|
+
Import options from `prettier-plugin-embed` (this plugin):
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
import type { PluginEmbedOptions } from "prettier-plugin-embed";
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Import options from `prettier-plugin-sql`:
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
import type { PluginSqlOptions } from "prettier-plugin-embed/embedded/sql/plugin-sql-types";
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**NOTE:** You can also import the types from the `prettier-plugin-sql` plugin directly. However, not all of the plugins provide types, or provide them in a predictable way, so this plugin exports them in a more unified manner.
|
|
463
|
+
|
|
464
|
+
Other embedded languages share the same pattern:
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
import type { Plugin<Language>Options } from "prettier-plugin-embed/embedded/<language>/<(no prettier or scope) plugin name>-types";
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
- **Use `JSDoc` in JavaScript files**
|
|
471
|
+
|
|
472
|
+
```js
|
|
473
|
+
/**
|
|
474
|
+
* @type {import("prettier-plugin-embed").PluginEmbedOptions}
|
|
475
|
+
*/
|
|
476
|
+
const pluginEmbedOptions = {
|
|
477
|
+
embeddedSqlIdentifiers: ["sql"],
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @type {import("prettier-plugin-embed/embedded/sql/plugin-sql-types").PluginSqlOptions}
|
|
482
|
+
*/
|
|
483
|
+
const pluginSqlOptions = {
|
|
484
|
+
language: "postgresql",
|
|
485
|
+
keywordCase: "upper",
|
|
486
|
+
};
|
|
487
|
+
```
|
|
488
|
+
|
|
368
489
|
## Contributing
|
|
369
490
|
|
|
370
491
|
Bug fixes, new language support and tests are welcome. Please have a look at the project structure before getting started. Feel free to leave questions or suggestions.
|
|
@@ -6,14 +6,12 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
6
6
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L887
|
|
7
7
|
*/
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["css"];
|
|
9
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
9
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
11
|
declare const CSS_PARSERS: readonly ["css", "less", "scss"];
|
|
12
12
|
type CssParser = (typeof CSS_PARSERS)[number];
|
|
13
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers";
|
|
14
14
|
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedCssParser";
|
|
15
|
-
export interface PrettierPluginDepsOptions {
|
|
16
|
-
}
|
|
17
15
|
export declare const options: {
|
|
18
16
|
readonly embeddedCssIdentifiers: {
|
|
19
17
|
readonly category: "Embed";
|
|
@@ -41,13 +39,9 @@ declare module "../types.js" {
|
|
|
41
39
|
}
|
|
42
40
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
43
41
|
}
|
|
44
|
-
interface
|
|
42
|
+
interface PluginEmbedOptions {
|
|
45
43
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
46
44
|
[EMBEDDED_LANGUAGE_PARSER]?: CssParser;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
|
-
declare module "prettier" {
|
|
50
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
47
|
export {};
|
|
@@ -6,14 +6,12 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
6
6
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L3314
|
|
7
7
|
*/
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"];
|
|
9
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
9
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
11
|
declare const ES_PARSERS: readonly ["babel", "babel-flow", "acorn", "espree", "flow", "meriyah"];
|
|
12
|
-
type EsParser = (typeof ES_PARSERS)[number];
|
|
12
|
+
export type EsParser = (typeof ES_PARSERS)[number];
|
|
13
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedEsIdentifiers";
|
|
14
14
|
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedEsParser";
|
|
15
|
-
export interface PrettierPluginDepsOptions {
|
|
16
|
-
}
|
|
17
15
|
export declare const options: {
|
|
18
16
|
readonly embeddedEsIdentifiers: {
|
|
19
17
|
readonly category: "Embed";
|
|
@@ -41,13 +39,9 @@ declare module "../types.js" {
|
|
|
41
39
|
}
|
|
42
40
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
43
41
|
}
|
|
44
|
-
interface
|
|
42
|
+
interface PluginEmbedOptions {
|
|
45
43
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
46
44
|
[EMBEDDED_LANGUAGE_PARSER]?: EsParser;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
|
-
declare module "prettier" {
|
|
50
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
47
|
export {};
|
|
@@ -6,11 +6,9 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
6
6
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2180
|
|
7
7
|
*/
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["glsl", "shader"];
|
|
9
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
9
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
11
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedGlslIdentifiers";
|
|
12
|
-
export interface PrettierPluginDepsOptions {
|
|
13
|
-
}
|
|
14
12
|
export declare const options: {
|
|
15
13
|
readonly embeddedGlslIdentifiers: {
|
|
16
14
|
readonly category: "Embed";
|
|
@@ -28,12 +26,8 @@ declare module "../types.js" {
|
|
|
28
26
|
}
|
|
29
27
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
30
28
|
}
|
|
31
|
-
interface
|
|
29
|
+
interface PluginEmbedOptions {
|
|
32
30
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
declare module "prettier" {
|
|
36
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
33
|
export {};
|
|
@@ -5,11 +5,9 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
5
5
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2578
|
|
6
6
|
*/
|
|
7
7
|
declare const DEFAULT_IDENTIFIERS: readonly ["graphql", "gql"];
|
|
8
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
8
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
9
9
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
10
10
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedGraphqlIdentifiers";
|
|
11
|
-
export interface PrettierPluginDepsOptions {
|
|
12
|
-
}
|
|
13
11
|
export declare const options: {
|
|
14
12
|
readonly embeddedGraphqlIdentifiers: {
|
|
15
13
|
readonly category: "Embed";
|
|
@@ -27,12 +25,8 @@ declare module "../types.js" {
|
|
|
27
25
|
}
|
|
28
26
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
29
27
|
}
|
|
30
|
-
interface
|
|
28
|
+
interface PluginEmbedOptions {
|
|
31
29
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
|
-
declare module "prettier" {
|
|
35
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
32
|
export {};
|
|
@@ -6,14 +6,12 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
6
6
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2684
|
|
7
7
|
*/
|
|
8
8
|
declare const DEFAULT_IDENTIFIERS: readonly ["html", "xhtml"];
|
|
9
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
9
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
10
10
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
11
11
|
declare const HTML_PARSERS: readonly ["html", "vue", "angular", "lwc"];
|
|
12
12
|
type HtmlParser = (typeof HTML_PARSERS)[number];
|
|
13
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedHtmlIdentifiers";
|
|
14
14
|
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedHtmlParser";
|
|
15
|
-
export interface PrettierPluginDepsOptions {
|
|
16
|
-
}
|
|
17
15
|
export declare const options: {
|
|
18
16
|
readonly embeddedHtmlIdentifiers: {
|
|
19
17
|
readonly category: "Embed";
|
|
@@ -41,13 +39,9 @@ declare module "../types.js" {
|
|
|
41
39
|
}
|
|
42
40
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
43
41
|
}
|
|
44
|
-
interface
|
|
42
|
+
interface PluginEmbedOptions {
|
|
45
43
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
46
44
|
[EMBEDDED_LANGUAGE_PARSER]?: HtmlParser;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
|
-
declare module "prettier" {
|
|
50
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
47
|
export {};
|
package/dist/embedded/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./register.js";
|
|
2
|
-
export type { EmbeddedDefaultIdentifier, EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers,
|
|
2
|
+
export type { EmbeddedDefaultIdentifier, EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers, PluginEmbedOptions, } from "./types.js";
|
|
3
3
|
export { makeIdentifiersOptionName, type AutocompleteStringList, } from "./utils.js";
|
|
@@ -5,12 +5,9 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
5
5
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2928
|
|
6
6
|
*/
|
|
7
7
|
declare const DEFAULT_IDENTIFIERS: readonly ["ini", "cfg", "pro"];
|
|
8
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
8
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
9
9
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
10
10
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedIniIdentifiers";
|
|
11
|
-
export interface PrettierPluginDepsOptions {
|
|
12
|
-
iniSpaceAroundEquals?: boolean;
|
|
13
|
-
}
|
|
14
11
|
export declare const options: {
|
|
15
12
|
readonly embeddedIniIdentifiers: {
|
|
16
13
|
readonly category: "Embed";
|
|
@@ -28,12 +25,8 @@ declare module "../types.js" {
|
|
|
28
25
|
}
|
|
29
26
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
30
27
|
}
|
|
31
|
-
interface
|
|
28
|
+
interface PluginEmbedOptions {
|
|
32
29
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
declare module "prettier" {
|
|
36
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
32
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Options } from "prettier";
|
|
2
|
+
import type { Embedder } from "../../types.js";
|
|
3
|
+
import { language } from "./language.js";
|
|
4
|
+
export declare const embedder: Embedder<Options>;
|
|
5
|
+
/**
|
|
6
|
+
* Register the embedder to the EmbeddedEmbedders
|
|
7
|
+
*/
|
|
8
|
+
declare module "../types.js" {
|
|
9
|
+
interface EmbeddedEmbedders {
|
|
10
|
+
[language]: typeof embedder;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
|
|
2
|
+
declare const DEFAULT_IDENTIFIERS: readonly ["java"];
|
|
3
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
4
|
+
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
5
|
+
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedJavaIdentifiers";
|
|
6
|
+
export declare const options: {
|
|
7
|
+
readonly embeddedJavaIdentifiers: {
|
|
8
|
+
readonly category: "Embed";
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly array: true;
|
|
11
|
+
readonly default: [{
|
|
12
|
+
readonly value: ["java"];
|
|
13
|
+
}];
|
|
14
|
+
readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type Options = typeof options;
|
|
18
|
+
declare module "../types.js" {
|
|
19
|
+
interface EmbeddedOptions extends Options {
|
|
20
|
+
}
|
|
21
|
+
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
22
|
+
}
|
|
23
|
+
interface PluginEmbedOptions {
|
|
24
|
+
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location:
|
|
3
|
+
* https://github.com/jhipster/prettier-java/blob/983a09d890ae832565ceda1a28b3074e061e3cea/packages/prettier-plugin-java/src/options.js
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginJavaOptions {
|
|
6
|
+
entrypoint?: "arrayInitializer" | "variableInitializerList" | "block" | "blockStatements" | "blockStatement" | "localVariableDeclarationStatement" | "localVariableDeclaration" | "localVariableType" | "statement" | "statementWithoutTrailingSubstatement" | "emptyStatement" | "labeledStatement" | "expressionStatement" | "statementExpression" | "ifStatement" | "assertStatement" | "switchStatement" | "switchBlock" | "switchBlockStatementGroup" | "switchLabel" | "switchRule" | "caseConstant" | "whileStatement" | "doStatement" | "forStatement" | "basicForStatement" | "forInit" | "forUpdate" | "statementExpressionList" | "enhancedForStatement" | "breakStatement" | "continueStatement" | "returnStatement" | "throwStatement" | "synchronizedStatement" | "tryStatement" | "catches" | "catchClause" | "catchFormalParameter" | "catchType" | "finally" | "tryWithResourcesStatement" | "resourceSpecification" | "resourceList" | "resource" | "yieldStatement" | "variableAccess" | "classDeclaration" | "normalClassDeclaration" | "classModifier" | "typeParameters" | "typeParameterList" | "superclass" | "superinterfaces" | "interfaceTypeList" | "classPermits" | "classBody" | "classBodyDeclaration" | "classMemberDeclaration" | "fieldDeclaration" | "fieldModifier" | "variableDeclaratorList" | "variableDeclarator" | "variableDeclaratorId" | "variableInitializer" | "unannType" | "unannPrimitiveTypeWithOptionalDimsSuffix" | "unannPrimitiveType" | "unannReferenceType" | "unannClassOrInterfaceType" | "unannClassType" | "unannInterfaceType" | "unannTypeVariable" | "methodDeclaration" | "methodModifier" | "methodHeader" | "result" | "methodDeclarator" | "receiverParameter" | "formalParameterList" | "formalParameter" | "variableParaRegularParameter" | "variableArityParameter" | "variableModifier" | "throws" | "exceptionTypeList" | "exceptionType" | "methodBody" | "instanceInitializer" | "staticInitializer" | "constructorDeclaration" | "constructorModifier" | "constructorDeclarator" | "simpleTypeName" | "constructorBody" | "explicitConstructorInvocation" | "unqualifiedExplicitConstructorInvocation" | "qualifiedExplicitConstructorInvocation" | "enumDeclaration" | "enumBody" | "enumConstantList" | "enumConstant" | "enumConstantModifier" | "enumBodyDeclarations" | "recordDeclaration" | "recordHeader" | "recordComponentList" | "recordComponent" | "variableArityRecordComponent" | "recordComponentModifier" | "recordBody" | "recordBodyDeclaration" | "compactConstructorDeclaration" | "isDims" | "expression" | "lambdaExpression" | "lambdaParameters" | "lambdaParametersWithBraces" | "lambdaParameterList" | "inferredLambdaParameterList" | "explicitLambdaParameterList" | "lambdaParameter" | "regularLambdaParameter" | "lambdaParameterType" | "lambdaBody" | "ternaryExpression" | "binaryExpression" | "unaryExpression" | "unaryExpressionNotPlusMinus" | "primary" | "primaryPrefix" | "primarySuffix" | "fqnOrRefType" | "fqnOrRefTypePartRest" | "fqnOrRefTypePartCommon" | "fqnOrRefTypePartFirst" | "parenthesisExpression" | "castExpression" | "primitiveCastExpression" | "referenceTypeCastExpression" | "newExpression" | "unqualifiedClassInstanceCreationExpression" | "classOrInterfaceTypeToInstantiate" | "typeArgumentsOrDiamond" | "diamond" | "methodInvocationSuffix" | "argumentList" | "arrayCreationExpression" | "arrayCreationDefaultInitSuffix" | "arrayCreationExplicitInitSuffix" | "dimExprs" | "dimExpr" | "classLiteralSuffix" | "arrayAccessSuffix" | "methodReferenceSuffix" | "pattern" | "typePattern" | "recordPattern" | "componentPatternList" | "componentPattern" | "unnamedPattern" | "guard" | "isRefTypeInMethodRef" | "interfaceDeclaration" | "normalInterfaceDeclaration" | "interfaceModifier" | "extendsInterfaces" | "interfacePermits" | "interfaceBody" | "interfaceMemberDeclaration" | "constantDeclaration" | "constantModifier" | "interfaceMethodDeclaration" | "interfaceMethodModifier" | "annotationTypeDeclaration" | "annotationTypeBody" | "annotationTypeMemberDeclaration" | "annotationTypeElementDeclaration" | "annotationTypeElementModifier" | "defaultValue" | "annotation" | "elementValuePairList" | "elementValuePair" | "elementValue" | "elementValueArrayInitializer" | "elementValueList" | "literal" | "integerLiteral" | "floatingPointLiteral" | "booleanLiteral" | "moduleName" | "packageName" | "typeName" | "expressionName" | "methodName" | "packageOrTypeName" | "ambiguousName" | "compilationUnit" | "ordinaryCompilationUnit" | "modularCompilationUnit" | "packageDeclaration" | "packageModifier" | "importDeclaration" | "typeDeclaration" | "moduleDeclaration" | "moduleDirective" | "requiresModuleDirective" | "exportsModuleDirective" | "opensModuleDirective" | "usesModuleDirective" | "providesModuleDirective" | "requiresModifier" | "primitiveType" | "numericType" | "integralType" | "floatingPointType" | "referenceType" | "classOrInterfaceType" | "classType" | "interfaceType" | "typeVariable" | "dims" | "typeParameter" | "typeParameterModifier" | "typeBound" | "additionalBound" | "typeArguments" | "typeArgumentList" | "typeArgument" | "wildcard" | "wildcardBounds";
|
|
7
|
+
}
|
|
@@ -5,14 +5,12 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
|
|
|
5
5
|
* - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L3141
|
|
6
6
|
*/
|
|
7
7
|
declare const DEFAULT_IDENTIFIERS: readonly ["json", "jsonl"];
|
|
8
|
-
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
8
|
+
type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
|
|
9
9
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
10
10
|
declare const JSON_PARSERS: readonly ["json", "json5", "jsonc", "json-stringify"];
|
|
11
11
|
type JsonParser = (typeof JSON_PARSERS)[number];
|
|
12
12
|
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedJsonParser";
|
|
13
13
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedJsonIdentifiers";
|
|
14
|
-
export interface PrettierPluginDepsOptions {
|
|
15
|
-
}
|
|
16
14
|
export declare const options: {
|
|
17
15
|
readonly embeddedJsonIdentifiers: {
|
|
18
16
|
readonly category: "Embed";
|
|
@@ -40,13 +38,9 @@ declare module "../types.js" {
|
|
|
40
38
|
}
|
|
41
39
|
interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
|
|
42
40
|
}
|
|
43
|
-
interface
|
|
41
|
+
interface PluginEmbedOptions {
|
|
44
42
|
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
|
|
45
43
|
[EMBEDDED_LANGUAGE_PARSER]?: JsonParser;
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
declare module "prettier" {
|
|
49
|
-
interface Options extends PrettierPluginDepsOptions {
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
46
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Options } from "prettier";
|
|
2
|
+
import type { Embedder } from "../../types.js";
|
|
3
|
+
import { language } from "./language.js";
|
|
4
|
+
export declare const embedder: Embedder<Options>;
|
|
5
|
+
/**
|
|
6
|
+
* Register the embedder to the EmbeddedEmbedders
|
|
7
|
+
*/
|
|
8
|
+
declare module "../types.js" {
|
|
9
|
+
interface EmbeddedEmbedders {
|
|
10
|
+
[language]: typeof embedder;
|
|
11
|
+
}
|
|
12
|
+
}
|