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.
Files changed (104) hide show
  1. package/README.md +124 -3
  2. package/dist/embedded/css/language.d.ts +1 -1
  3. package/dist/embedded/css/options.d.ts +2 -8
  4. package/dist/embedded/es/language.d.ts +1 -1
  5. package/dist/embedded/es/options.d.ts +3 -9
  6. package/dist/embedded/glsl/language.d.ts +1 -1
  7. package/dist/embedded/glsl/options.d.ts +2 -8
  8. package/dist/embedded/graphql/language.d.ts +1 -1
  9. package/dist/embedded/graphql/options.d.ts +2 -8
  10. package/dist/embedded/html/language.d.ts +1 -1
  11. package/dist/embedded/html/options.d.ts +2 -8
  12. package/dist/embedded/index.d.ts +1 -1
  13. package/dist/embedded/ini/language.d.ts +1 -1
  14. package/dist/embedded/ini/options.d.ts +2 -9
  15. package/dist/embedded/ini/plugin-ini-types.d.ts +3 -0
  16. package/dist/embedded/ini/plugin-ini.d.ts +6 -0
  17. package/dist/embedded/java/embedder.d.ts +12 -0
  18. package/dist/embedded/java/index.d.ts +3 -0
  19. package/dist/embedded/java/language.d.ts +9 -0
  20. package/dist/embedded/java/options.d.ts +27 -0
  21. package/dist/embedded/java/plugin-java-types.d.ts +7 -0
  22. package/dist/embedded/java/plugin-java.d.ts +6 -0
  23. package/dist/embedded/json/language.d.ts +1 -1
  24. package/dist/embedded/json/options.d.ts +2 -8
  25. package/dist/embedded/jsonata/embedder.d.ts +12 -0
  26. package/dist/embedded/jsonata/index.d.ts +3 -0
  27. package/dist/embedded/jsonata/language.d.ts +9 -0
  28. package/dist/embedded/jsonata/options.d.ts +27 -0
  29. package/dist/embedded/latex/language.d.ts +1 -1
  30. package/dist/embedded/latex/options.d.ts +2 -8
  31. package/dist/embedded/markdown/embedder.d.ts +1 -1
  32. package/dist/embedded/markdown/language.d.ts +1 -1
  33. package/dist/embedded/markdown/options.d.ts +2 -9
  34. package/dist/embedded/markdown/plugin-markdown-types.d.ts +3 -0
  35. package/dist/embedded/markdown/plugin-markdown.d.ts +6 -0
  36. package/dist/embedded/nginx/embedder.d.ts +12 -0
  37. package/dist/embedded/nginx/index.d.ts +3 -0
  38. package/dist/embedded/nginx/language.d.ts +9 -0
  39. package/dist/embedded/nginx/options.d.ts +27 -0
  40. package/dist/embedded/nginx/plugin-nginx-types.d.ts +4 -0
  41. package/dist/embedded/nginx/plugin-nginx.d.ts +6 -0
  42. package/dist/embedded/noop/language.d.ts +1 -1
  43. package/dist/embedded/noop/options.d.ts +2 -2
  44. package/dist/embedded/pegjs/embedder.d.ts +12 -0
  45. package/dist/embedded/pegjs/index.d.ts +3 -0
  46. package/dist/embedded/pegjs/language.d.ts +9 -0
  47. package/dist/embedded/pegjs/options.d.ts +27 -0
  48. package/dist/embedded/pegjs/plugin-pegjs-types.d.ts +5 -0
  49. package/dist/embedded/pegjs/plugin-pegjs.d.ts +6 -0
  50. package/dist/embedded/php/language.d.ts +1 -1
  51. package/dist/embedded/php/options.d.ts +2 -11
  52. package/dist/embedded/php/plugin-php-types.d.ts +5 -0
  53. package/dist/embedded/php/plugin-php.d.ts +6 -0
  54. package/dist/embedded/prisma/embedder.d.ts +12 -0
  55. package/dist/embedded/prisma/index.d.ts +3 -0
  56. package/dist/embedded/prisma/language.d.ts +9 -0
  57. package/dist/embedded/prisma/options.d.ts +27 -0
  58. package/dist/embedded/properties/language.d.ts +1 -1
  59. package/dist/embedded/properties/options.d.ts +2 -10
  60. package/dist/embedded/properties/plugin-properties-types.d.ts +4 -0
  61. package/dist/embedded/properties/plugin-properties.d.ts +6 -0
  62. package/dist/embedded/pug/embedder.d.ts +12 -0
  63. package/dist/embedded/pug/index.d.ts +3 -0
  64. package/dist/embedded/pug/language.d.ts +9 -0
  65. package/dist/embedded/pug/options.d.ts +27 -0
  66. package/dist/embedded/pug/plugin-pug-types.d.ts +29 -0
  67. package/dist/embedded/pug/plugin-pug.d.ts +6 -0
  68. package/dist/embedded/register.d.ts +22 -16
  69. package/dist/embedded/ruby/language.d.ts +1 -1
  70. package/dist/embedded/ruby/options.d.ts +3 -16
  71. package/dist/embedded/ruby/plugin-ruby-types.d.ts +6 -0
  72. package/dist/embedded/ruby/plugin-ruby.d.ts +6 -0
  73. package/dist/embedded/sh/language.d.ts +1 -1
  74. package/dist/embedded/sh/options.d.ts +3 -10
  75. package/dist/embedded/sh/plugin-sh-types.d.ts +4 -0
  76. package/dist/embedded/sh/plugin-sh.d.ts +6 -0
  77. package/dist/embedded/sql/language.d.ts +1 -1
  78. package/dist/embedded/sql/options.d.ts +4 -13
  79. package/dist/embedded/sql/plugin-sql-cst-types.d.ts +4 -0
  80. package/dist/embedded/sql/plugin-sql-cst.d.ts +6 -0
  81. package/dist/embedded/sql/plugin-sql-types.d.ts +4 -0
  82. package/dist/embedded/sql/plugin-sql.d.ts +6 -0
  83. package/dist/embedded/toml/language.d.ts +1 -1
  84. package/dist/embedded/toml/options.d.ts +3 -10
  85. package/dist/embedded/toml/plugin-toml-types.d.ts +4 -0
  86. package/dist/embedded/toml/plugin-toml.d.ts +6 -0
  87. package/dist/embedded/ts/language.d.ts +1 -1
  88. package/dist/embedded/ts/options.d.ts +3 -9
  89. package/dist/embedded/types.d.ts +1 -1
  90. package/dist/embedded/utils.d.ts +7 -4
  91. package/dist/embedded/xml/language.d.ts +1 -1
  92. package/dist/embedded/xml/options.d.ts +2 -12
  93. package/dist/embedded/xml/parser.d.ts +1 -0
  94. package/dist/embedded/xml/plugin-xml-types.d.ts +6 -0
  95. package/dist/embedded/xml/plugin-xml.d.ts +6 -0
  96. package/dist/embedded/yaml/language.d.ts +1 -1
  97. package/dist/embedded/yaml/options.d.ts +2 -8
  98. package/dist/index.d.ts +7 -2
  99. package/dist/index.js +1270 -1043
  100. package/dist/options.d.ts +78 -28
  101. package/dist/plugin-embed.d.ts +6 -0
  102. package/dist/types.d.ts +5 -24
  103. package/dist/utils.d.ts +1 -4
  104. package/package.json +51 -14
@@ -5,21 +5,12 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
5
5
  * - https://github.com/prettier/plugin-ruby/blob/0a2100ca3b8b53d9491270ece64806d95da181a6/src/plugin.js#L194
6
6
  */
7
7
  declare const DEFAULT_IDENTIFIERS: readonly ["ruby"];
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 RUBY_PARSERS: readonly ["ruby", "rbs", "haml"];
11
11
  export type RubyParser = (typeof RUBY_PARSERS)[number];
12
- declare const EMBEDDED_LANGUAGE_PARSER = "embeddedRubyParser";
13
12
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedRubyIdentifiers";
14
- export interface PrettierPluginDepsOptions {
15
- rubyPlugins?: AutocompleteStringList<[
16
- "plugin/single_quotes",
17
- "plugin/trailing_comma",
18
- "plugin/disable_auto_ternary"
19
- ]>;
20
- rubySingleQuote?: boolean;
21
- rubyExecutablePath?: string;
22
- }
13
+ declare const EMBEDDED_LANGUAGE_PARSER: "embeddedRubyParser";
23
14
  export declare const options: {
24
15
  readonly embeddedRubyIdentifiers: {
25
16
  readonly category: "Embed";
@@ -47,13 +38,9 @@ declare module "../types.js" {
47
38
  }
48
39
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
49
40
  }
50
- interface PrettierPluginEmbedOptions {
41
+ interface PluginEmbedOptions {
51
42
  [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
52
43
  [EMBEDDED_LANGUAGE_PARSER]?: RubyParser;
53
44
  }
54
45
  }
55
- declare module "prettier" {
56
- interface Options extends PrettierPluginDepsOptions {
57
- }
58
- }
59
46
  export {};
@@ -0,0 +1,6 @@
1
+ import type { AutocompleteStringList } from "../utils.js";
2
+ export interface PluginRubyOptions {
3
+ rubyPlugins?: AutocompleteStringList<"plugin/single_quotes" | "plugin/trailing_comma" | "plugin/disable_auto_ternary">;
4
+ rubySingleQuote?: boolean;
5
+ rubyExecutablePath?: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginRubyOptions } from "./plugin-ruby-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginRubyOptions {}
6
+ }
@@ -4,6 +4,6 @@ export declare const language = "embeddedSh";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -1,16 +1,13 @@
1
- import type { ShParserOptions } from "prettier-plugin-sh";
2
- import { type AutocompleteStringList, type StringListToInterfaceKey, type UnionToIntersection } from "../utils.js";
1
+ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
3
2
  /**
4
3
  * References:
5
4
  *
6
5
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L6445C8-L6445C8
7
6
  */
8
7
  declare const DEFAULT_IDENTIFIERS: readonly ["sh"];
9
- type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
+ type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
10
9
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
11
10
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedShIdentifiers";
12
- export interface PrettierPluginDepsOptions extends Partial<UnionToIntersection<ShParserOptions>> {
13
- }
14
11
  export declare const options: {
15
12
  readonly embeddedShIdentifiers: {
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 PrettierPluginEmbedOptions {
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,4 @@
1
+ import type { ShParserOptions } from "prettier-plugin-sh";
2
+ import type { NormalizeOptions } from "../utils.js";
3
+ export interface PluginShOptions extends NormalizeOptions<ShParserOptions> {
4
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginShOptions } from "./plugin-sh-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginShOptions {}
6
+ }
@@ -4,6 +4,6 @@ export declare const language = "embeddedSql";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -1,6 +1,4 @@
1
- import type { SqlBaseOptions as PrettierPluginSqlOptions } from "prettier-plugin-sql";
2
- import type { SqlPluginOptions as PrettierPluginSqlCstRequiredOptions } from "prettier-plugin-sql-cst";
3
- import { type AutocompleteStringList, type StringListToInterfaceKey, type UnionToIntersection } from "../utils.js";
1
+ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
4
2
  /**
5
3
  * References
6
4
  *
@@ -8,7 +6,7 @@ import { type AutocompleteStringList, type StringListToInterfaceKey, type UnionT
8
6
  * dialect, so we only have "sql" as the default identifier to avoid confusion.
9
7
  */
10
8
  declare const DEFAULT_IDENTIFIERS: readonly ["sql"];
11
- type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
9
+ type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
12
10
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
13
11
  declare const SQL_PLUGINS: readonly ["prettier-plugin-sql", "prettier-plugin-sql-cst"];
14
12
  type SqlPlugin = (typeof SQL_PLUGINS)[number];
@@ -17,9 +15,6 @@ type SqlCstParser = (typeof SQL_CST_PARSERS)[number];
17
15
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedSqlIdentifiers";
18
16
  declare const EMBEDDED_LANGUAGE_PLUGIN: "embeddedSqlPlugin";
19
17
  declare const EMBEDDED_LANGUAGE_PARSER: "embeddedSqlParser";
20
- type PrettierPluginSqlCstOptions = Partial<PrettierPluginSqlCstRequiredOptions>;
21
- export interface PrettierPluginDepsOptions extends UnionToIntersection<PrettierPluginSqlOptions>, PrettierPluginSqlCstOptions {
22
- }
23
18
  export declare const options: {
24
19
  readonly embeddedSqlIdentifiers: {
25
20
  readonly category: "Embed";
@@ -46,7 +41,7 @@ export declare const options: {
46
41
  default: "sqlite";
47
42
  description: string;
48
43
  choices: {
49
- value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql";
44
+ value: "bigquery" | "mariadb" | "mysql" | "postgresql" | "sqlite";
50
45
  description: string;
51
46
  }[];
52
47
  };
@@ -57,14 +52,10 @@ declare module "../types.js" {
57
52
  }
58
53
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
59
54
  }
60
- interface PrettierPluginEmbedOptions {
55
+ interface PluginEmbedOptions {
61
56
  [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
62
57
  [EMBEDDED_LANGUAGE_PLUGIN]?: SqlPlugin;
63
58
  [EMBEDDED_LANGUAGE_PARSER]?: SqlCstParser;
64
59
  }
65
60
  }
66
- declare module "prettier" {
67
- interface Options extends PrettierPluginDepsOptions {
68
- }
69
- }
70
61
  export {};
@@ -0,0 +1,4 @@
1
+ import type { SqlPluginOptions } from "prettier-plugin-sql-cst";
2
+ import type { NormalizeOptions } from "../utils.js";
3
+ export interface PluginSqlCstOptions extends NormalizeOptions<SqlPluginOptions> {
4
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginSqlCstOptions } from "./plugin-sql-cst-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginSqlCstOptions {}
6
+ }
@@ -0,0 +1,4 @@
1
+ import type { SqlBaseOptions } from "prettier-plugin-sql";
2
+ import type { NormalizeOptions } from "../utils.js";
3
+ export interface PluginSqlOptions extends NormalizeOptions<SqlBaseOptions> {
4
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginSqlOptions } from "./plugin-sql-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginSqlOptions {}
6
+ }
@@ -4,6 +4,6 @@ export declare const language = "embeddedToml";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -1,16 +1,13 @@
1
- import type { PrettierTaploOptions } from "prettier-plugin-toml";
2
- import { type AutocompleteStringList, type StringListToInterfaceKey, type UnionToIntersection } from "../utils.js";
1
+ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
3
2
  /**
4
3
  * References:
5
4
  *
6
5
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L6890
7
6
  */
8
7
  declare const DEFAULT_IDENTIFIERS: readonly ["toml"];
9
- type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
+ type Identifiers = AutocompleteStringList<(typeof DEFAULT_IDENTIFIERS)[number]>;
10
9
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
11
10
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedTomlIdentifiers";
12
- export interface PrettierPluginDepsOptions extends UnionToIntersection<PrettierTaploOptions> {
13
- }
14
11
  export declare const options: {
15
12
  readonly embeddedTomlIdentifiers: {
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 PrettierPluginEmbedOptions {
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,4 @@
1
+ import type { PrettierTaploOptions } from "prettier-plugin-toml";
2
+ import type { NormalizeOptions } from "../utils.js";
3
+ export interface PluginTomlOptions extends NormalizeOptions<PrettierTaploOptions> {
4
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginTomlOptions } from "./plugin-toml-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginTomlOptions {}
6
+ }
@@ -4,6 +4,6 @@ export declare const language = "embeddedTs";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -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#L7158
7
7
  */
8
8
  declare const DEFAULT_IDENTIFIERS: readonly ["ts", "tsx", "cts", "mts", "typescript"];
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 TS_PARSERS: readonly ["typescript", "babel-ts"];
12
- type TsParser = (typeof TS_PARSERS)[number];
12
+ export type TsParser = (typeof TS_PARSERS)[number];
13
13
  declare const EMBEDDED_LANGUAGE_PARSER: "embeddedTsParser";
14
14
  declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedTsIdentifiers";
15
- export interface PrettierPluginDepsOptions {
16
- }
17
15
  export declare const options: {
18
16
  readonly embeddedTsIdentifiers: {
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 PrettierPluginEmbedOptions {
42
+ interface PluginEmbedOptions {
45
43
  [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
46
44
  [EMBEDDED_LANGUAGE_PARSER]?: TsParser;
47
45
  }
48
46
  }
49
- declare module "prettier" {
50
- interface Options extends PrettierPluginDepsOptions {
51
- }
52
- }
53
47
  export {};
@@ -14,6 +14,6 @@ export type EmbeddedLanguage = Satisfies<EmbeddedLanguageNamingConvention, keyof
14
14
  export interface EmbeddedDefaultIdentifiersHolder {
15
15
  }
16
16
  export type EmbeddedDefaultIdentifier = keyof EmbeddedDefaultIdentifiersHolder;
17
- export interface PrettierPluginEmbedOptions {
17
+ export interface PluginEmbedOptions {
18
18
  }
19
19
  export {};
@@ -1,12 +1,13 @@
1
1
  import type { Comment, Expression, TemplateLiteral } from "estree";
2
2
  import type { AstPath, Doc, Options } from "prettier";
3
3
  import { builders } from "prettier/doc";
4
+ import type { LiteralUnion, OmitIndexSignature, UnionToIntersection } from "type-fest";
4
5
  import type { InternalPrintFun } from "../types.js";
5
6
  export declare function printTemplateExpression(path: AstPath<Expression & {
6
7
  comments?: Comment[];
7
8
  }>, print: InternalPrintFun): builders.Doc[];
8
9
  export declare function printTemplateExpressions(path: AstPath<TemplateLiteral>, print: InternalPrintFun): builders.Doc[][];
9
- export declare function simpleRehydrateDoc(doc: Doc, placeholderRegex: RegExp, expressionDocs: Doc[]): builders.Doc[] | builders.DocCommand;
10
+ export declare function simpleRehydrateDoc(doc: Doc, placeholderRegex: RegExp, expressionDocs: Doc[], replaceLiteralNewlinesToHardlines?: boolean): builders.Doc[] | builders.DocCommand;
10
11
  export declare function throwIfPluginIsNotFound(pluginName: string, options: Options, identifier: string): void;
11
12
  export declare function insertLanguage(languages: string[], language: string, firstLanguage: string): void;
12
13
  export declare const randomUUID: () => string;
@@ -18,9 +19,11 @@ export declare function escapeRegExp(text: string): string;
18
19
  export declare function makeIdentifiersOptionName<T extends string>(language: T): `${T}Identifiers`;
19
20
  export declare function makePluginOptionName<T extends string>(language: T): `${T}Plugin`;
20
21
  export declare function makeParserOptionName<T extends string>(language: T): `${T}Parser`;
21
- export type AutocompleteStringList<T extends readonly string[]> = (T[number][] & string[]) | string[];
22
+ export type AutocompleteStringList<T extends string> = LiteralUnion<T, string>[];
22
23
  export type StringListToInterfaceKey<T extends readonly string[]> = {
23
- [key in T[number]]: void;
24
+ [key in T[number]]: undefined;
24
25
  };
25
26
  export type Satisfies<U, T extends U> = T;
26
- export type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
27
+ export type NormalizeOptions<T> = OmitIndexSignature<{
28
+ [k in keyof UnionToIntersection<T>]?: k extends keyof T ? T[k] : UnionToIntersection<T>[k];
29
+ }>;
@@ -4,6 +4,6 @@ export declare const language = "embeddedXml";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -6,15 +6,9 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
6
6
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L7712
7
7
  */
8
8
  declare const DEFAULT_IDENTIFIERS: readonly ["xml", "opml", "rss", "svg"];
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: "embeddedXmlIdentifiers";
12
- export interface PrettierPluginDepsOptions {
13
- xmlSelfClosingSpace?: boolean;
14
- xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
15
- xmlSortAttributesByKey?: boolean;
16
- xmlQuoteAttributes?: "preserve" | "single" | "double";
17
- }
18
12
  export declare const options: {
19
13
  readonly embeddedXmlIdentifiers: {
20
14
  readonly category: "Embed";
@@ -44,12 +38,8 @@ declare module "../types.js" {
44
38
  }
45
39
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
46
40
  }
47
- interface PrettierPluginEmbedOptions {
41
+ interface PluginEmbedOptions {
48
42
  [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
49
43
  }
50
44
  }
51
- declare module "prettier" {
52
- interface Options extends PrettierPluginDepsOptions {
53
- }
54
- }
55
45
  export {};
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import type { CstNode } from "chevrotain";
2
3
  import type { Parser } from "prettier";
3
4
  import { language } from "./language.js";
@@ -0,0 +1,6 @@
1
+ export interface PluginXmlOptions {
2
+ xmlSelfClosingSpace?: boolean;
3
+ xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
4
+ xmlSortAttributesByKey?: boolean;
5
+ xmlQuoteAttributes?: "preserve" | "single" | "double";
6
+ }
@@ -0,0 +1,6 @@
1
+ import "prettier";
2
+ import type { PluginXmlOptions } from "./plugin-xml-types.js";
3
+
4
+ declare module "prettier" {
5
+ interface Options extends PluginXmlOptions {}
6
+ }
@@ -4,6 +4,6 @@ export declare const language = "embeddedYaml";
4
4
  */
5
5
  declare module "../types.js" {
6
6
  interface EmbeddedLanguagesHolder {
7
- [language]: void;
7
+ [language]: undefined;
8
8
  }
9
9
  }
@@ -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#L7940
6
6
  */
7
7
  declare const DEFAULT_IDENTIFIERS: readonly ["yaml", "yml"];
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: "embeddedYamlIdentifiers";
11
- export interface PrettierPluginDepsOptions {
12
- }
13
11
  export declare const options: {
14
12
  readonly embeddedYamlIdentifiers: {
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 PrettierPluginEmbedOptions {
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 {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
- export * from "./embedded/index.js";
2
1
  export { options } from "./options.js";
3
2
  export { parsers } from "./parsers.js";
4
3
  export { printers } from "./printers.js";
5
- export type * from "./types.js";
4
+ export type { PluginEmbedOptions } from "./embedded/index.js";
5
+ export type { EmbeddedOverride } from "./types.js";
6
+ export type {
7
+ /**
8
+ * @deprecated Renamed to `PluginEmbedOptions`
9
+ */
10
+ PluginEmbedOptions as PrettierPluginEmbedOptions, } from "./embedded/index.js";