prettier-plugin-embed 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -97,6 +97,8 @@ Embedded languages to be formatted are required to be enclosed in the template l
97
97
 
98
98
  To exclude certain identifiers from being identified, including the default ones supported by the [`embedded-language-formatting`](https://prettier.io/docs/en/options.html#embedded-language-formatting) option, add them to the list of the `embeddedNoopIdentifiers` option. Any matching identifiers listed in this option will take precedence over other `embedded<Language>Identifiers` options, effectively disabling their formatting.
99
99
 
100
+ **Important: Until this notice is removed, always specify identifiers explicitly and do not rely on the built-in defaults, as they may be subject to change.**
101
+
100
102
  ### Language-Specific Options
101
103
 
102
104
  <details>
@@ -129,6 +131,14 @@ Formatting embedded CSS code doesn't require other plugins and uses the parsers
129
131
 
130
132
  Formatting embedded ECMAScript 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 ECMAScript code.
131
133
 
134
+ #### GLSL
135
+
136
+ | Option | Default | Description |
137
+ | :-----------------------: | :---------------------------------------: | -------------------------------------------------------------------------------------------------- |
138
+ | `embeddedGlslIdentifiers` | [`[...]`](./src/embedded/glsl/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as GLSL code |
139
+
140
+ 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
+
132
142
  #### HTML
133
143
 
134
144
  | Option | Default | Description |
@@ -6,7 +6,7 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
6
6
  declare const DEFAULT_IDENTIFIERS: readonly ["css"];
7
7
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
- declare const embeddedLanguageIdentifiersOptionName: "embeddedCssIdentifiers";
9
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers";
10
10
  export interface PrettierPluginDepsOptions {
11
11
  }
12
12
  export declare const options: {
@@ -27,7 +27,7 @@ declare module "../types.js" {
27
27
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
28
28
  }
29
29
  interface PrettierPluginEmbedOptions {
30
- [embeddedLanguageIdentifiersOptionName]?: Identifiers;
30
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
31
31
  }
32
32
  }
33
33
  declare module "prettier" {
@@ -8,8 +8,8 @@ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
9
  declare const DEFAULT_ES_PARSERS: readonly ["babel", "babel-flow", "acorn", "espree", "flow", "meriyah"];
10
10
  type EsParser = (typeof DEFAULT_ES_PARSERS)[number];
11
- declare const embeddedLanguageIdentifiersOptionName: "embeddedEsIdentifiers";
12
- declare const embeddedLanguageParserOptionName: "embeddedEsParser";
11
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedEsIdentifiers";
12
+ declare const EMBEDDED_LANGUAGE_PARSER: "embeddedEsParser";
13
13
  export interface PrettierPluginDepsOptions {
14
14
  }
15
15
  export declare const options: {
@@ -37,8 +37,8 @@ declare module "../types.js" {
37
37
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
38
38
  }
39
39
  interface PrettierPluginEmbedOptions {
40
- [embeddedLanguageIdentifiersOptionName]?: Identifiers;
41
- [embeddedLanguageParserOptionName]?: EsParser;
40
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
41
+ [EMBEDDED_LANGUAGE_PARSER]?: EsParser;
42
42
  }
43
43
  }
44
44
  declare module "prettier" {
@@ -6,7 +6,7 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
6
6
  declare const DEFAULT_IDENTIFIERS: readonly ["md", "livemd", "markdown", "mdown", "mdwn", "mkd", "mkdn", "mkdown", "ronn", "scd", "workbook"];
7
7
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
- declare const embeddedLanguageIdentifiersOptionName: "embeddedMarkdownIdentifiers";
9
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedMarkdownIdentifiers";
10
10
  export interface PrettierPluginDepsOptions {
11
11
  __inJsTemplate?: boolean;
12
12
  }
@@ -28,7 +28,7 @@ declare module "../types.js" {
28
28
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
29
29
  }
30
30
  interface PrettierPluginEmbedOptions {
31
- [embeddedLanguageIdentifiersOptionName]?: Identifiers;
31
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
32
32
  }
33
33
  }
34
34
  declare module "prettier" {
@@ -4,13 +4,13 @@ export declare const embeddedParsers: EmbeddedParsers;
4
4
  export declare const embeddedEmbedders: EmbeddedEmbedders;
5
5
  export declare const embeddedOptions: EmbeddedOptions;
6
6
  import * as __glob__0_0 from "./css/index.js";
7
- import * as __glob__0_1 from "./glsl/index.js";
7
+ import * as __glob__0_1 from "./es/index.js";
8
8
  import * as __glob__0_2 from "./html/index.js";
9
- import * as __glob__0_3 from "./es/index.js";
9
+ import * as __glob__0_3 from "./glsl/index.js";
10
10
  import * as __glob__0_4 from "./markdown/index.js";
11
11
  import * as __glob__0_5 from "./noop/index.js";
12
12
  import * as __glob__0_6 from "./php/index.js";
13
13
  import * as __glob__0_7 from "./ruby/index.js";
14
- import * as __glob__0_8 from "./sql/index.js";
15
- import * as __glob__0_9 from "./ts/index.js";
14
+ import * as __glob__0_8 from "./ts/index.js";
15
+ import * as __glob__0_9 from "./sql/index.js";
16
16
  import * as __glob__0_10 from "./xml/index.js";
@@ -1,14 +1,12 @@
1
1
  import type { SqlBaseOptions as PrettierPluginDepsOptions } from "prettier-plugin-sql";
2
2
  import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
3
3
  /** References
4
- * - https://github.com/un-ts/prettier/blob/a5f1aae6464aa54749377d69a8237a70a6509a13/packages/sql/src/index.ts
4
+ * - https://github.com/un-ts/prettier/blob/master/packages/sql/src/index.ts
5
+ * "sql" is the default dialect, so we only have "sql" as the default identifier to avoid confusion.
5
6
  */
6
- export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "db2", "db2i", "hive", "mariadb", "mysql", "n1ql", "postgresql", "plsql", "redshift", "singlestoredb", "snowflake", "spark", "sqlite", "transactsql", "tsql", "trino"];
7
- export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql", "snowflake"];
8
- type Identifiers = AutocompleteStringList<typeof SQL_FORMATTER_LANGUAGES | typeof NODE_SQL_PARSER_DATABASES>;
9
- type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof SQL_FORMATTER_LANGUAGES | typeof NODE_SQL_PARSER_DATABASES>;
10
- export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number];
11
- export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number];
7
+ declare const DEFAULT_IDENTIFIERS: readonly ["sql"];
8
+ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
9
+ type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
12
10
  declare const embeddedLanguageIdentifiers: "embeddedSqlIdentifiers";
13
11
  export { PrettierPluginDepsOptions };
14
12
  export declare const options: {
@@ -17,7 +15,7 @@ export declare const options: {
17
15
  type: "string";
18
16
  array: true;
19
17
  default: {
20
- value: string[];
18
+ value: "sql"[];
21
19
  }[];
22
20
  description: string;
23
21
  };
@@ -8,8 +8,8 @@ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
9
  declare const DEFAULT_TS_PARSERS: readonly ["typescript", "babel-ts"];
10
10
  type TsParser = (typeof DEFAULT_TS_PARSERS)[number];
11
- declare const EMBEDDED_LANGUAGE_PARSER = "embeddedTsParser";
12
- declare const embeddedLanguageIdentifiers: "embeddedTsIdentifiers";
11
+ declare const EMBEDDED_LANGUAGE_PARSER: "embeddedTsParser";
12
+ declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedTsIdentifiers";
13
13
  export interface PrettierPluginDepsOptions {
14
14
  }
15
15
  export declare const options: {
@@ -37,7 +37,7 @@ declare module "../types.js" {
37
37
  interface EmbeddedDefaultIdentifiersHolder extends DefaultIdentifiersHolder {
38
38
  }
39
39
  interface PrettierPluginEmbedOptions {
40
- [embeddedLanguageIdentifiers]?: Identifiers;
40
+ [EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers;
41
41
  [EMBEDDED_LANGUAGE_PARSER]?: TsParser;
42
42
  }
43
43
  }