prettier-plugin-embed 0.3.1 → 0.4.0

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.
Files changed (94) hide show
  1. package/README.md +78 -9
  2. package/dist/embedded/css/embedder.d.ts +5 -2
  3. package/dist/embedded/css/index.d.ts +1 -1
  4. package/dist/embedded/css/language.d.ts +9 -0
  5. package/dist/embedded/css/options.d.ts +11 -9
  6. package/dist/embedded/es/embedder.d.ts +5 -2
  7. package/dist/embedded/es/index.d.ts +1 -1
  8. package/dist/embedded/es/language.d.ts +9 -0
  9. package/dist/embedded/es/options.d.ts +21 -16
  10. package/dist/embedded/glsl/embedder.d.ts +5 -2
  11. package/dist/embedded/glsl/index.d.ts +1 -1
  12. package/dist/embedded/glsl/language.d.ts +9 -0
  13. package/dist/embedded/glsl/options.d.ts +14 -12
  14. package/dist/embedded/graphql/embedder.d.ts +12 -0
  15. package/dist/embedded/graphql/index.d.ts +3 -0
  16. package/dist/embedded/graphql/language.d.ts +9 -0
  17. package/dist/embedded/graphql/options.d.ts +38 -0
  18. package/dist/embedded/html/embedder.d.ts +5 -2
  19. package/dist/embedded/html/index.d.ts +1 -1
  20. package/dist/embedded/html/language.d.ts +9 -0
  21. package/dist/embedded/html/options.d.ts +14 -12
  22. package/dist/embedded/ini/embedder.d.ts +12 -0
  23. package/dist/embedded/ini/index.d.ts +3 -0
  24. package/dist/embedded/ini/language.d.ts +9 -0
  25. package/dist/embedded/ini/options.d.ts +39 -0
  26. package/dist/embedded/json/embedder.d.ts +12 -0
  27. package/dist/embedded/json/index.d.ts +3 -0
  28. package/dist/embedded/json/language.d.ts +9 -0
  29. package/dist/embedded/json/options.d.ts +52 -0
  30. package/dist/embedded/latex/embedder.d.ts +12 -0
  31. package/dist/embedded/latex/index.d.ts +3 -0
  32. package/dist/embedded/latex/language.d.ts +9 -0
  33. package/dist/embedded/latex/options.d.ts +38 -0
  34. package/dist/embedded/markdown/embedder.d.ts +5 -2
  35. package/dist/embedded/markdown/index.d.ts +1 -1
  36. package/dist/embedded/markdown/language.d.ts +9 -0
  37. package/dist/embedded/markdown/options.d.ts +12 -10
  38. package/dist/embedded/noop/index.d.ts +1 -1
  39. package/dist/embedded/noop/language.d.ts +9 -0
  40. package/dist/embedded/noop/options.d.ts +10 -10
  41. package/dist/embedded/php/embedder.d.ts +5 -2
  42. package/dist/embedded/php/index.d.ts +1 -1
  43. package/dist/embedded/php/language.d.ts +9 -0
  44. package/dist/embedded/php/options.d.ts +14 -12
  45. package/dist/embedded/properties/embedder.d.ts +12 -0
  46. package/dist/embedded/properties/index.d.ts +3 -0
  47. package/dist/embedded/properties/language.d.ts +9 -0
  48. package/dist/embedded/properties/options.d.ts +40 -0
  49. package/dist/embedded/register.d.ts +17 -9
  50. package/dist/embedded/ruby/embedder.d.ts +5 -2
  51. package/dist/embedded/ruby/index.d.ts +1 -1
  52. package/dist/embedded/ruby/language.d.ts +9 -0
  53. package/dist/embedded/ruby/options.d.ts +24 -25
  54. package/dist/embedded/sh/embedder.d.ts +12 -0
  55. package/dist/embedded/sh/index.d.ts +3 -0
  56. package/dist/embedded/sh/language.d.ts +9 -0
  57. package/dist/embedded/sh/options.d.ts +39 -0
  58. package/dist/embedded/sql/embedder.d.ts +5 -2
  59. package/dist/embedded/sql/index.d.ts +1 -1
  60. package/dist/embedded/sql/language.d.ts +9 -0
  61. package/dist/embedded/sql/options.d.ts +55 -15
  62. package/dist/embedded/toml/embedder.d.ts +12 -0
  63. package/dist/embedded/toml/index.d.ts +3 -0
  64. package/dist/embedded/toml/language.d.ts +9 -0
  65. package/dist/embedded/toml/options.d.ts +39 -0
  66. package/dist/embedded/ts/embedder.d.ts +5 -2
  67. package/dist/embedded/ts/index.d.ts +1 -1
  68. package/dist/embedded/ts/language.d.ts +9 -0
  69. package/dist/embedded/ts/options.d.ts +21 -16
  70. package/dist/embedded/utils.d.ts +3 -1
  71. package/dist/embedded/xml/embedder.d.ts +5 -2
  72. package/dist/embedded/xml/index.d.ts +1 -1
  73. package/dist/embedded/xml/language.d.ts +9 -0
  74. package/dist/embedded/xml/options.d.ts +25 -21
  75. package/dist/embedded/xml/parser.d.ts +2 -2
  76. package/dist/embedded/yaml/embedder.d.ts +12 -0
  77. package/dist/embedded/yaml/index.d.ts +3 -0
  78. package/dist/embedded/yaml/language.d.ts +9 -0
  79. package/dist/embedded/yaml/options.d.ts +38 -0
  80. package/dist/index.js +1101 -702
  81. package/dist/options.d.ts +263 -146
  82. package/dist/utils.d.ts +1 -1
  83. package/package.json +26 -23
  84. package/dist/embedded/css/embedded-language.d.ts +0 -6
  85. package/dist/embedded/es/embedded-language.d.ts +0 -6
  86. package/dist/embedded/glsl/embedded-language.d.ts +0 -6
  87. package/dist/embedded/html/embedded-language.d.ts +0 -6
  88. package/dist/embedded/markdown/embedded-language.d.ts +0 -6
  89. package/dist/embedded/noop/embedded-language.d.ts +0 -6
  90. package/dist/embedded/php/embedded-language.d.ts +0 -6
  91. package/dist/embedded/ruby/embedded-language.d.ts +0 -6
  92. package/dist/embedded/sql/embedded-language.d.ts +0 -6
  93. package/dist/embedded/ts/embedded-language.d.ts +0 -6
  94. package/dist/embedded/xml/embedded-language.d.ts +0 -6
package/README.md CHANGED
@@ -85,6 +85,10 @@ await prettier.format(code, {
85
85
  }
86
86
  ```
87
87
 
88
+ ### Quick Start Config Examples
89
+
90
+ Here're some [quick start config examples](./ConfigExamples.md) to use this plugin for various embedded languages. Check beblow for a detailed explanation of all the available options.
91
+
88
92
  ### An Overview of the Philosophy
89
93
 
90
94
  To use this plugin, [`embedded-language-formatting`](https://prettier.io/docs/en/options.html#embedded-language-formatting) option must be set to `auto` (which is the default setting as of now), because this option serves as the main switch for activating embedded language formatting.
@@ -139,6 +143,14 @@ Formatting embedded ECMAScript code doesn't require other plugins and uses the p
139
143
 
140
144
  Formatting embedded GLSL code requires [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl) to be loaded as well.
141
145
 
146
+ #### GraphQL
147
+
148
+ | Option | Default | Description |
149
+ | :--------------------------: | :------------------------------------------: | ----------------------------------------------------------------------------------------------------- |
150
+ | `embeddedGraphqlIdentifiers` | [`[...]`](./src/embedded/graphql/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as GraphQL code |
151
+
152
+ Formatting embedded GraphQL code doesn't require other plugins and uses the parsers and printers provided by Prettier natively. This can override the native embedded language formatting for GraphQL code. If you want to keep the native behavior, set `embeddedGraphqlIdentifiers` to `[]` or other identifiers.
153
+
142
154
  #### HTML
143
155
 
144
156
  | Option | Default | Description |
@@ -147,6 +159,31 @@ Formatting embedded GLSL code requires [`prettier-plugin-glsl`](https://github.c
147
159
 
148
160
  Formatting embedded HTML code doesn't require other plugins and uses the parsers and printers provided by Prettier natively. This can override the native embedded language formatting for HTML code.
149
161
 
162
+ #### INI
163
+
164
+ | Option | Default | Description |
165
+ | :----------------------: | :--------------------------------------: | ------------------------------------------------------------------------------------------------- |
166
+ | `embeddedIniIdentifiers` | [`[...]`](./src/embedded/ini/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as INI code |
167
+
168
+ Formatting embedded INI code requires [`prettier-plugin-ini`](https://github.com/kddnewton/prettier-plugin-ini) 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.
169
+
170
+ #### JSON
171
+
172
+ | Option | Default | Description |
173
+ | :-----------------------: | :----------------------------------------: | -------------------------------------------------------------------------------------------------- |
174
+ | `embeddedJsonIdentifiers` | [`[...]`](./src/embedded/json/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as JSON code |
175
+ | `embeddedJsonParser` | [`"json"`](./src/embedded/json/options.ts) | The parser used to parse the JSON code |
176
+
177
+ Formatting embedded JSON code doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
178
+
179
+ #### LaTeX
180
+
181
+ | Option | Default | Description |
182
+ | :------------------------: | :----------------------------------------: | --------------------------------------------------------------------------------------------------- |
183
+ | `embeddedLatexIdentifiers` | [`[...]`](./src/embedded/latex/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as LaTeX code |
184
+
185
+ Formatting embedded LaTeX code requires [`prettier-plugin-latex`](https://github.com/siefkenj/prettier-plugin-latex) to be loaded as well.
186
+
150
187
  #### Markdown
151
188
 
152
189
  | Option | Default | Description |
@@ -163,6 +200,14 @@ Formatting embedded Markdown code doesn't require other plugins and uses the par
163
200
 
164
201
  Formatting embedded PHP code requires [`@prettier/plugin-php`](https://github.com/prettier/plugin-php) 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.
165
202
 
203
+ #### Properties
204
+
205
+ | Option | Default | Description |
206
+ | :-----------------------------: | :---------------------------------------------: | ------------------------------------------------------------------------------------------------------------- |
207
+ | `embeddedPropertiesIdentifiers` | [`[...]`](./src/embedded/properties/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as Java Properties code |
208
+
209
+ Formatting embedded Java Properties code requires [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties) 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.
210
+
166
211
  #### Ruby
167
212
 
168
213
  | Option | Default | Description |
@@ -172,15 +217,35 @@ Formatting embedded PHP code requires [`@prettier/plugin-php`](https://github.co
172
217
 
173
218
  Formatting embedded Ruby code requires [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby) to be loaded and [its dependencies to be installed](https://github.com/prettier/plugin-ruby#getting-started) as well. And [options](https://github.com/prettier/plugin-ruby#configuration) supported by `@prettier/plugin-ruby` can therefore be used to further control the formatting behavior.
174
219
 
220
+ #### Shell
221
+
222
+ | Option | Default | Description |
223
+ | :---------------------: | :-------------------------------------: | --------------------------------------------------------------------------------------------------- |
224
+ | `embeddedShIdentifiers` | [`[...]`](./src/embedded/sh/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as Shell code |
225
+
226
+ Formatting embedded Shell code requires [`prettier-plugin-sh`](https://github.com/un-ts/prettier/tree/master/packages/sh#readme) to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sh#parser-options) supported by `prettier-plugin-sh` can therefore be used to further control the formatting behavior.
227
+
228
+ Note that `prettier-plugin-sh` supports different variants of shell syntaxes and they are specified by the [`variant` option](https://github.com/un-ts/prettier/tree/master/packages/sh#parser-options). To map a subset of identifiers to another dialect, please use [`embeddedOverrides`](#embeddedoverrides).
229
+
175
230
  #### SQL
176
231
 
177
- | Option | Default | Description |
178
- | :----------------------: | :--------------------------------------: | ------------------------------------------------------------------------------------------------- |
179
- | `embeddedSqlIdentifiers` | [`[...]`](./src/embedded/sql/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as SQL code |
232
+ | Option | Default | Description |
233
+ | :----------------------: | :------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------- |
234
+ | `embeddedSqlIdentifiers` | [`[...]`](./src/embedded/sql/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as SQL code |
235
+ | `embeddedSqlPlugin` | [`"prettier-plugin-sql"`](./src/embedded/sql/options.ts) | The plugin used to format the SQL code. Available options are `"prettier-plugin-sql"` and `"prettier-plugin-sql-cst"`. |
236
+ | `embeddedSqlParser` | [`"sqlite"`](./src/embedded/sql/options.ts) | The parser used to parse the SQL code. Available options are `"sqlite"` and `"bigquery"`. This option is only for `prettier-plugin-sql-cst` |
237
+
238
+ Formatting embedded SQL code requires [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) or [`prettier-plugin-sql-cst`](https://github.com/nene/prettier-plugin-sql-cst) to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options) supported by `prettier-plugin-sql`, or [options](https://github.com/nene/prettier-plugin-sql-cst?tab=readme-ov-file#configuration) supported by `prettier-plugin-sql-cst` can therefore be used to further control the formatting behavior.
239
+
240
+ Note that `prettier-plugin-sql` supports many different SQL dialects and they are specified by the [`language` or `database` option](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options). And `prettier-plugin-sql-cst` also supports other parsers. To map a subset of identifiers to another dialect or parser, please use [`embeddedOverrides`](#embeddedoverrides).
241
+
242
+ #### TOML
180
243
 
181
- Formatting embedded SQL code requires [`prettier-plugin-sql`](https://github.com/un-ts/prettier/tree/master/packages/sql#readme) to be loaded as well. And [options](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options) supported by `prettier-plugin-sql` can therefore be used to further control the formatting behavior.
244
+ | Option | Default | Description |
245
+ | :-----------------------: | :---------------------------------------: | -------------------------------------------------------------------------------------------------- |
246
+ | `embeddedTomlIdentifiers` | [`[...]`](./src/embedded/toml/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as TOML code |
182
247
 
183
- Note that `prettier-plugin-sql` supports many different SQL dialects and they are specified by the [`language` or `database` option](https://github.com/un-ts/prettier/tree/master/packages/sql#parser-options). To map a subset of identifiers to another dialect, please use [`embeddedOverrides`](#embeddedoverrides).
248
+ Formatting embedded TOML code requires [`prettier-plugin-toml`](https://github.com/un-ts/prettier/tree/master/packages/toml#readme) to be loaded as well. And options supported by `prettier-plugin-toml` can therefore be used to further control the formatting behavior.
184
249
 
185
250
  #### TS
186
251
 
@@ -199,6 +264,14 @@ Formatting embedded TypeScript code doesn't require other plugins and uses the p
199
264
 
200
265
  Formatting embedded XML code requires [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml) to be loaded as well. And [options](https://github.com/prettier/plugin-xml#configuration) supported by `@prettier/plugin-xml` can therefore be used to further control the formatting behavior.
201
266
 
267
+ #### YAML
268
+
269
+ | Option | Default | Description |
270
+ | :-----------------------: | :---------------------------------------: | -------------------------------------------------------------------------------------------------- |
271
+ | `embeddedYamlIdentifiers` | [`[...]`](./src/embedded/yaml/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as YAML code |
272
+
273
+ Formatting embedded YAML code doesn't require other plugins and uses the parsers and printers provided by Prettier natively.
274
+
202
275
  </details>
203
276
 
204
277
  ### Language-Agnostic Options
@@ -240,10 +313,6 @@ An example `.json` file is:
240
313
 
241
314
  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).
242
315
 
243
- ## Demos
244
-
245
- TBD.
246
-
247
316
  ## Contributing
248
317
 
249
318
  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.
@@ -1,9 +1,12 @@
1
1
  import type { Options } from "prettier";
2
2
  import type { Embedder } from "../../types.js";
3
- import { embeddedLanguage } from "./embedded-language.js";
3
+ import { language } from "./language.js";
4
4
  export declare const embedder: Embedder<Options>;
5
+ /**
6
+ * Register the embedder to the EmbeddedEmbedders
7
+ */
5
8
  declare module "../types.js" {
6
9
  interface EmbeddedEmbedders {
7
- [embeddedLanguage]: typeof embedder;
10
+ [language]: typeof embedder;
8
11
  }
9
12
  }
@@ -1,3 +1,3 @@
1
- export * from "./embedded-language.js";
2
1
  export * from "./embedder.js";
2
+ export * from "./language.js";
3
3
  export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedCss";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -1,5 +1,7 @@
1
1
  import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
- /** References:
2
+ /**
3
+ * References:
4
+ *
3
5
  * - https://github.com/microsoft/vscode/blob/de0121cf0e05d1673903551b6dbb2871556bfae9/extensions/css/package.json#L22
4
6
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L887
5
7
  */
@@ -10,14 +12,14 @@ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers";
10
12
  export interface PrettierPluginDepsOptions {
11
13
  }
12
14
  export declare const options: {
13
- embeddedCssIdentifiers: {
14
- category: "Global";
15
- type: "string";
16
- array: true;
17
- default: {
18
- value: "css"[];
19
- }[];
20
- description: string;
15
+ readonly embeddedCssIdentifiers: {
16
+ readonly category: "Embed";
17
+ readonly type: "string";
18
+ readonly array: true;
19
+ readonly default: [{
20
+ readonly value: ["css"];
21
+ }];
22
+ readonly description: "Specify embedded CSS language identifiers.";
21
23
  };
22
24
  };
23
25
  type Options = typeof options;
@@ -1,9 +1,12 @@
1
1
  import type { Options } from "prettier";
2
2
  import type { Embedder } from "../../types.js";
3
- import { embeddedLanguage } from "./embedded-language.js";
3
+ import { language } from "./language.js";
4
4
  export declare const embedder: Embedder<Options>;
5
+ /**
6
+ * Register the embedder to the EmbeddedEmbedders
7
+ */
5
8
  declare module "../types.js" {
6
9
  interface EmbeddedEmbedders {
7
- [embeddedLanguage]: typeof embedder;
10
+ [language]: typeof embedder;
8
11
  }
9
12
  }
@@ -1,3 +1,3 @@
1
- export * from "./embedded-language.js";
2
1
  export * from "./embedder.js";
2
+ export * from "./language.js";
3
3
  export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedEs";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -1,33 +1,38 @@
1
1
  import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
- /** References:
2
+ /**
3
+ * References:
4
+ *
3
5
  * - https://github.com/microsoft/vscode/blob/de0121cf0e05d1673903551b6dbb2871556bfae9/extensions/javascript/package.json#L37
4
6
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L3314
5
7
  */
6
8
  declare const DEFAULT_IDENTIFIERS: readonly ["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"];
7
9
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
10
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
- declare const DEFAULT_ES_PARSERS: readonly ["babel", "babel-flow", "acorn", "espree", "flow", "meriyah"];
10
- type EsParser = (typeof DEFAULT_ES_PARSERS)[number];
11
+ declare const ES_PARSERS: readonly ["babel", "babel-flow", "acorn", "espree", "flow", "meriyah"];
12
+ type EsParser = (typeof ES_PARSERS)[number];
11
13
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedEsIdentifiers";
12
14
  declare const EMBEDDED_LANGUAGE_PARSER: "embeddedEsParser";
13
15
  export interface PrettierPluginDepsOptions {
14
16
  }
15
17
  export declare const options: {
16
- embeddedEsIdentifiers: {
17
- category: "Global";
18
- type: "string";
19
- array: true;
20
- default: {
21
- value: ("js" | "jsx" | "es" | "es6" | "mjs" | "cjs" | "pac" | "javascript")[];
22
- }[];
23
- description: string;
18
+ readonly embeddedEsIdentifiers: {
19
+ readonly category: "Embed";
20
+ readonly type: "string";
21
+ readonly array: true;
22
+ readonly default: [{
23
+ readonly value: ["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"];
24
+ }];
25
+ readonly description: "Specify embedded ES language identifiers.";
24
26
  };
25
- embeddedEsParser: {
26
- category: "Global";
27
- type: "string";
28
- array: false;
29
- default: string;
27
+ readonly embeddedEsParser: {
28
+ category: string;
29
+ type: "choice";
30
+ default: "babel";
30
31
  description: string;
32
+ choices: {
33
+ value: "babel" | "babel-flow" | "acorn" | "espree" | "flow" | "meriyah";
34
+ description: string;
35
+ }[];
31
36
  };
32
37
  };
33
38
  type Options = typeof options;
@@ -1,9 +1,12 @@
1
1
  import type { Options } from "prettier";
2
2
  import type { Embedder } from "../../types.js";
3
- import { embeddedLanguage } from "./embedded-language.js";
3
+ import { language } from "./language.js";
4
4
  export declare const embedder: Embedder<Options>;
5
+ /**
6
+ * Register the embedder to the EmbeddedEmbedders
7
+ */
5
8
  declare module "../types.js" {
6
9
  interface EmbeddedEmbedders {
7
- [embeddedLanguage]: typeof embedder;
10
+ [language]: typeof embedder;
8
11
  }
9
12
  }
@@ -1,3 +1,3 @@
1
- export * from "./embedded-language.js";
2
1
  export * from "./embedder.js";
2
+ export * from "./language.js";
3
3
  export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedGlsl";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -1,23 +1,25 @@
1
1
  import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
- /** References:
2
+ /**
3
+ * References:
4
+ *
3
5
  * - https://github.com/NaridaL/glsl-language-toolkit/blob/a7bd08d3f31355b335ae002b6a44c2999998b952/packages/prettier-plugin-glsl/src/prettier-plugin.ts#L88
4
6
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2180
5
7
  */
6
- declare const DEFAULT_IDENTIFIERS: readonly ["glsl", "fp", "frag", "frg", "fs", "fsh", "fshader", "geo", "geom", "glslf", "glslv", "gs", "gshader", "rchit", "rmiss", "shader", "tesc", "tese", "vert", "vrx", "vsh", "vshader"];
8
+ declare const DEFAULT_IDENTIFIERS: readonly ["glsl", "shader"];
7
9
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
10
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
- declare const embeddedLanguageIdentifiers: "embeddedGlslIdentifiers";
11
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedGlslIdentifiers";
10
12
  export interface PrettierPluginDepsOptions {
11
13
  }
12
14
  export declare const options: {
13
- embeddedGlslIdentifiers: {
14
- category: "Global";
15
- type: "string";
16
- array: true;
17
- default: {
18
- value: ("glsl" | "fp" | "frag" | "frg" | "fs" | "fsh" | "fshader" | "geo" | "geom" | "glslf" | "glslv" | "gs" | "gshader" | "rchit" | "rmiss" | "shader" | "tesc" | "tese" | "vert" | "vrx" | "vsh" | "vshader")[];
19
- }[];
20
- description: string;
15
+ readonly embeddedGlslIdentifiers: {
16
+ readonly category: "Embed";
17
+ readonly type: "string";
18
+ readonly array: true;
19
+ readonly default: [{
20
+ readonly value: ["glsl", "shader"];
21
+ }];
22
+ readonly description: "Specify embedded GLSL language identifiers. This requires \"prettier-plugin-glsl\".";
21
23
  };
22
24
  };
23
25
  type Options = typeof options;
@@ -27,7 +29,7 @@ declare module "../types.js" {
27
29
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
28
30
  }
29
31
  interface PrettierPluginEmbedOptions {
30
- [embeddedLanguageIdentifiers]?: Identifiers;
32
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
31
33
  }
32
34
  }
33
35
  declare module "prettier" {
@@ -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,3 @@
1
+ export * from "./embedder.js";
2
+ export * from "./language.js";
3
+ export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedGraphql";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -0,0 +1,38 @@
1
+ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
+ /**
3
+ * References:
4
+ *
5
+ * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2578
6
+ */
7
+ declare const DEFAULT_IDENTIFIERS: readonly ["graphql", "gql"];
8
+ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
9
+ type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
10
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedGraphqlIdentifiers";
11
+ export interface PrettierPluginDepsOptions {
12
+ }
13
+ export declare const options: {
14
+ readonly embeddedGraphqlIdentifiers: {
15
+ readonly category: "Embed";
16
+ readonly type: "string";
17
+ readonly array: true;
18
+ readonly default: [{
19
+ readonly value: ["graphql", "gql"];
20
+ }];
21
+ readonly description: "Specify embedded GraphQL language identifiers.";
22
+ };
23
+ };
24
+ type Options = typeof options;
25
+ declare module "../types.js" {
26
+ interface EmbeddedOptions extends Options {
27
+ }
28
+ interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
29
+ }
30
+ interface PrettierPluginEmbedOptions {
31
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
32
+ }
33
+ }
34
+ declare module "prettier" {
35
+ interface Options extends PrettierPluginDepsOptions {
36
+ }
37
+ }
38
+ export {};
@@ -1,9 +1,12 @@
1
1
  import type { Options } from "prettier";
2
2
  import type { Embedder } from "../../types.js";
3
- import { embeddedLanguage } from "./embedded-language.js";
3
+ import { language } from "./language.js";
4
4
  export declare const embedder: Embedder<Options>;
5
+ /**
6
+ * Register the embedder to the EmbeddedEmbedders
7
+ */
5
8
  declare module "../types.js" {
6
9
  interface EmbeddedEmbedders {
7
- [embeddedLanguage]: typeof embedder;
10
+ [language]: typeof embedder;
8
11
  }
9
12
  }
@@ -1,3 +1,3 @@
1
- export * from "./embedded-language.js";
2
1
  export * from "./embedder.js";
2
+ export * from "./language.js";
3
3
  export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedHtml";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -1,23 +1,25 @@
1
1
  import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
- /** References
2
+ /**
3
+ * References
4
+ *
3
5
  * - https://github.com/microsoft/vscode/blob/de0121cf0e05d1673903551b6dbb2871556bfae9/extensions/html/package.json#L18
4
6
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2684
5
7
  */
6
- declare const DEFAULT_IDENTIFIERS: readonly ["html", "htm", "shtml", "xhtml", "xht", "mdoc", "jsp", "asp", "aspx", "jshtm", "volt", "rhtml"];
8
+ declare const DEFAULT_IDENTIFIERS: readonly ["html", "xhtml"];
7
9
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
10
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
- declare const embeddedLanguageIdentifiers: "embeddedHtmlIdentifiers";
11
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedHtmlIdentifiers";
10
12
  export interface PrettierPluginDepsOptions {
11
13
  }
12
14
  export declare const options: {
13
- embeddedHtmlIdentifiers: {
14
- category: "Global";
15
- type: "string";
16
- array: true;
17
- default: {
18
- value: ("html" | "htm" | "shtml" | "xhtml" | "xht" | "mdoc" | "jsp" | "asp" | "aspx" | "jshtm" | "volt" | "rhtml")[];
19
- }[];
20
- description: string;
15
+ readonly embeddedHtmlIdentifiers: {
16
+ readonly category: "Embed";
17
+ readonly type: "string";
18
+ readonly array: true;
19
+ readonly default: [{
20
+ readonly value: ["html", "xhtml"];
21
+ }];
22
+ readonly description: "Specify embedded HTML language identifiers.";
21
23
  };
22
24
  };
23
25
  type Options = typeof options;
@@ -27,7 +29,7 @@ declare module "../types.js" {
27
29
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
28
30
  }
29
31
  interface PrettierPluginEmbedOptions {
30
- [embeddedLanguageIdentifiers]?: Identifiers;
32
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
31
33
  }
32
34
  }
33
35
  declare module "prettier" {
@@ -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,3 @@
1
+ export * from "./embedder.js";
2
+ export * from "./language.js";
3
+ export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedIni";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }
@@ -0,0 +1,39 @@
1
+ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
2
+ /**
3
+ * References:
4
+ *
5
+ * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L2928
6
+ */
7
+ declare const DEFAULT_IDENTIFIERS: readonly ["ini", "cfg", "pro"];
8
+ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
9
+ type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
10
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedIniIdentifiers";
11
+ export interface PrettierPluginDepsOptions {
12
+ iniSpaceAroundEquals?: boolean;
13
+ }
14
+ export declare const options: {
15
+ readonly embeddedIniIdentifiers: {
16
+ readonly category: "Embed";
17
+ readonly type: "string";
18
+ readonly array: true;
19
+ readonly default: [{
20
+ readonly value: ["ini", "cfg", "pro"];
21
+ }];
22
+ readonly description: "Specify embedded INI language identifiers. This requires \"prettier-plugin-ini\".";
23
+ };
24
+ };
25
+ type Options = typeof options;
26
+ declare module "../types.js" {
27
+ interface EmbeddedOptions extends Options {
28
+ }
29
+ interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
30
+ }
31
+ interface PrettierPluginEmbedOptions {
32
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
33
+ }
34
+ }
35
+ declare module "prettier" {
36
+ interface Options extends PrettierPluginDepsOptions {
37
+ }
38
+ }
39
+ 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,3 @@
1
+ export * from "./embedder.js";
2
+ export * from "./language.js";
3
+ export * from "./options.js";
@@ -0,0 +1,9 @@
1
+ export declare const language = "embeddedJson";
2
+ /**
3
+ * Register the language to the EmbeddedLanguagesHolder
4
+ */
5
+ declare module "../types.js" {
6
+ interface EmbeddedLanguagesHolder {
7
+ [language]: void;
8
+ }
9
+ }