prettier-plugin-embed 0.4.6 → 0.4.8

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 (55) hide show
  1. package/README.md +71 -7
  2. package/dist/embedded/css/language.d.ts +1 -1
  3. package/dist/embedded/css/options.d.ts +14 -0
  4. package/dist/embedded/es/language.d.ts +1 -1
  5. package/dist/embedded/es/options.d.ts +1 -1
  6. package/dist/embedded/glsl/language.d.ts +1 -1
  7. package/dist/embedded/graphql/language.d.ts +1 -1
  8. package/dist/embedded/html/language.d.ts +1 -1
  9. package/dist/embedded/ini/language.d.ts +1 -1
  10. package/dist/embedded/java/embedder.d.ts +12 -0
  11. package/dist/embedded/java/index.d.ts +3 -0
  12. package/dist/embedded/java/language.d.ts +9 -0
  13. package/dist/embedded/java/options.d.ts +38 -0
  14. package/dist/embedded/json/language.d.ts +1 -1
  15. package/dist/embedded/jsonata/embedder.d.ts +12 -0
  16. package/dist/embedded/jsonata/index.d.ts +3 -0
  17. package/dist/embedded/jsonata/language.d.ts +9 -0
  18. package/dist/embedded/jsonata/options.d.ts +33 -0
  19. package/dist/embedded/latex/language.d.ts +1 -1
  20. package/dist/embedded/markdown/language.d.ts +1 -1
  21. package/dist/embedded/markdown/options.d.ts +14 -0
  22. package/dist/embedded/nginx/embedder.d.ts +12 -0
  23. package/dist/embedded/nginx/index.d.ts +3 -0
  24. package/dist/embedded/nginx/language.d.ts +9 -0
  25. package/dist/embedded/nginx/options.d.ts +34 -0
  26. package/dist/embedded/noop/language.d.ts +1 -1
  27. package/dist/embedded/pegjs/embedder.d.ts +12 -0
  28. package/dist/embedded/pegjs/index.d.ts +3 -0
  29. package/dist/embedded/pegjs/language.d.ts +9 -0
  30. package/dist/embedded/pegjs/options.d.ts +36 -0
  31. package/dist/embedded/php/language.d.ts +1 -1
  32. package/dist/embedded/prisma/embedder.d.ts +12 -0
  33. package/dist/embedded/prisma/index.d.ts +3 -0
  34. package/dist/embedded/prisma/language.d.ts +9 -0
  35. package/dist/embedded/prisma/options.d.ts +33 -0
  36. package/dist/embedded/properties/language.d.ts +1 -1
  37. package/dist/embedded/pug/embedder.d.ts +12 -0
  38. package/dist/embedded/pug/index.d.ts +3 -0
  39. package/dist/embedded/pug/language.d.ts +9 -0
  40. package/dist/embedded/pug/options.d.ts +60 -0
  41. package/dist/embedded/register.d.ts +20 -14
  42. package/dist/embedded/ruby/language.d.ts +1 -1
  43. package/dist/embedded/sh/language.d.ts +1 -1
  44. package/dist/embedded/sql/language.d.ts +1 -1
  45. package/dist/embedded/toml/language.d.ts +1 -1
  46. package/dist/embedded/ts/language.d.ts +1 -1
  47. package/dist/embedded/ts/options.d.ts +1 -1
  48. package/dist/embedded/utils.d.ts +2 -2
  49. package/dist/embedded/xml/language.d.ts +1 -1
  50. package/dist/embedded/yaml/language.d.ts +1 -1
  51. package/dist/index.js +1295 -1043
  52. package/dist/options.d.ts +93 -19
  53. package/dist/types.d.ts +1 -1
  54. package/dist/utils.d.ts +1 -1
  55. package/package.json +19 -9
package/dist/options.d.ts CHANGED
@@ -67,6 +67,16 @@ export declare const options: {
67
67
  }];
68
68
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.";
69
69
  };
70
+ readonly embeddedCssParser: {
71
+ category: string;
72
+ type: "choice";
73
+ default: "scss";
74
+ description: string;
75
+ choices: {
76
+ value: "css" | "less" | "scss";
77
+ description: string;
78
+ }[];
79
+ };
70
80
  readonly embeddedEsIdentifiers: {
71
81
  readonly category: "Embed";
72
82
  readonly type: "string";
@@ -132,6 +142,15 @@ export declare const options: {
132
142
  }];
133
143
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.";
134
144
  };
145
+ readonly embeddedJavaIdentifiers: {
146
+ readonly category: "Embed";
147
+ readonly type: "string";
148
+ readonly array: true;
149
+ readonly default: [{
150
+ readonly value: ["java"];
151
+ }];
152
+ 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.";
153
+ };
135
154
  readonly embeddedJsonIdentifiers: {
136
155
  readonly category: "Embed";
137
156
  readonly type: "string";
@@ -151,6 +170,15 @@ export declare const options: {
151
170
  description: string;
152
171
  }[];
153
172
  };
173
+ readonly embeddedJsonataIdentifiers: {
174
+ readonly category: "Embed";
175
+ readonly type: "string";
176
+ readonly array: true;
177
+ readonly default: [{
178
+ readonly value: ["jsonata"];
179
+ }];
180
+ readonly description: "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.";
181
+ };
154
182
  readonly embeddedLatexIdentifiers: {
155
183
  readonly category: "Embed";
156
184
  readonly type: "string";
@@ -169,6 +197,53 @@ export declare const options: {
169
197
  }];
170
198
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.";
171
199
  };
200
+ readonly embeddedMarkdownParser: {
201
+ category: string;
202
+ type: "choice";
203
+ default: "markdown";
204
+ description: string;
205
+ choices: {
206
+ value: "markdown" | "mdx" | "remark";
207
+ description: string;
208
+ }[];
209
+ };
210
+ readonly embeddedNginxIdentifiers: {
211
+ readonly category: "Embed";
212
+ readonly type: "string";
213
+ readonly array: true;
214
+ readonly default: [{
215
+ readonly value: ["nginx"];
216
+ }];
217
+ readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.";
218
+ };
219
+ readonly embeddedTsIdentifiers: {
220
+ readonly category: "Embed";
221
+ readonly type: "string";
222
+ readonly array: true;
223
+ readonly default: [{
224
+ readonly value: ["ts", "tsx", "cts", "mts", "typescript"];
225
+ }];
226
+ readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language.";
227
+ };
228
+ readonly embeddedTsParser: {
229
+ category: string;
230
+ type: "choice";
231
+ default: "typescript";
232
+ description: string;
233
+ choices: {
234
+ value: "typescript" | "babel-ts";
235
+ description: string;
236
+ }[];
237
+ };
238
+ readonly embeddedPegjsIdentifiers: {
239
+ readonly category: "Embed";
240
+ readonly type: "string";
241
+ readonly array: true;
242
+ readonly default: [{
243
+ readonly value: ["pegjs", "peggy", "peg"];
244
+ }];
245
+ readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.";
246
+ };
172
247
  readonly embeddedPhpIdentifiers: {
173
248
  readonly category: "Embed";
174
249
  readonly type: "string";
@@ -178,6 +253,15 @@ export declare const options: {
178
253
  }];
179
254
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.";
180
255
  };
256
+ readonly embeddedPrismaIdentifiers: {
257
+ readonly category: "Embed";
258
+ readonly type: "string";
259
+ readonly array: true;
260
+ readonly default: [{
261
+ readonly value: ["prisma"];
262
+ }];
263
+ readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.";
264
+ };
181
265
  readonly embeddedPropertiesIdentifiers: {
182
266
  readonly category: "Embed";
183
267
  readonly type: "string";
@@ -187,6 +271,15 @@ export declare const options: {
187
271
  }];
188
272
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.";
189
273
  };
274
+ readonly embeddedPugIdentifiers: {
275
+ readonly category: "Embed";
276
+ readonly type: "string";
277
+ readonly array: true;
278
+ readonly default: [{
279
+ readonly value: ["pug", "jade"];
280
+ }];
281
+ readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.";
282
+ };
190
283
  readonly embeddedRubyIdentifiers: {
191
284
  readonly category: "Embed";
192
285
  readonly type: "string";
@@ -253,25 +346,6 @@ export declare const options: {
253
346
  }];
254
347
  readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.";
255
348
  };
256
- readonly embeddedTsIdentifiers: {
257
- readonly category: "Embed";
258
- readonly type: "string";
259
- readonly array: true;
260
- readonly default: [{
261
- readonly value: ["ts", "tsx", "cts", "mts", "typescript"];
262
- }];
263
- readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language.";
264
- };
265
- readonly embeddedTsParser: {
266
- category: string;
267
- type: "choice";
268
- default: "typescript";
269
- description: string;
270
- choices: {
271
- value: "typescript" | "babel-ts";
272
- description: string;
273
- }[];
274
- };
275
349
  readonly embeddedXmlIdentifiers: {
276
350
  readonly category: "Embed";
277
351
  readonly type: "string";
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { TemplateLiteral } from "estree";
2
2
  import type { AstPath, Doc, Options } from "prettier";
3
- import { makeIdentifiersOptionName, type AutocompleteStringList, type EmbeddedDefaultIdentifier, type EmbeddedLanguage, type PrettierPluginEmbedOptions } from "./embedded/index.js";
3
+ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type EmbeddedLanguage, type PrettierPluginEmbedOptions, makeIdentifiersOptionName } from "./embedded/index.js";
4
4
  import type { PrettierPluginGlobalOptions } from "./options.js";
5
5
  import { RemoveIndex } from "./utils.js";
6
6
  declare module "estree" {
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Node } from "estree";
2
2
  import { type AstPath, type Options } from "prettier";
3
- export declare const resolveEmbeddedOverrideOptions: (embeddedOverridesString: string | undefined, identifier: string, sourceFilePath?: string) => Promise<Omit<Omit<RemoveIndex<Options>, keyof import("./index.js").PrettierPluginEmbedOptions> & Omit<import("./index.js").PrettierPluginEmbedOptions, "embeddedNoopIdentifiers" | "embeddedCssIdentifiers" | "embeddedEsIdentifiers" | "embeddedGlslIdentifiers" | "embeddedGraphqlIdentifiers" | "embeddedHtmlIdentifiers" | "embeddedIniIdentifiers" | "embeddedJsonIdentifiers" | "embeddedLatexIdentifiers" | "embeddedMarkdownIdentifiers" | "embeddedPhpIdentifiers" | "embeddedPropertiesIdentifiers" | "embeddedRubyIdentifiers" | "embeddedShIdentifiers" | "embeddedSqlIdentifiers" | "embeddedTomlIdentifiers" | "embeddedTsIdentifiers" | "embeddedXmlIdentifiers" | "embeddedYamlIdentifiers" | keyof import("./options.js").PrettierPluginGlobalOptions>, "parser" | "filepath" | "endOfLine" | "embeddedLanguageFormatting" | "printWidth" | "tabWidth" | "useTabs" | `__${string}`> | undefined>;
3
+ export declare const resolveEmbeddedOverrideOptions: (embeddedOverridesString: string | undefined, identifier: string, sourceFilePath?: string) => Promise<Omit<Omit<RemoveIndex<Options>, keyof import("./index.js").PrettierPluginEmbedOptions> & Omit<import("./index.js").PrettierPluginEmbedOptions, "embeddedNoopIdentifiers" | "embeddedCssIdentifiers" | "embeddedEsIdentifiers" | "embeddedGlslIdentifiers" | "embeddedGraphqlIdentifiers" | "embeddedHtmlIdentifiers" | "embeddedIniIdentifiers" | "embeddedJavaIdentifiers" | "embeddedJsonIdentifiers" | "embeddedJsonataIdentifiers" | "embeddedLatexIdentifiers" | "embeddedMarkdownIdentifiers" | "embeddedNginxIdentifiers" | "embeddedTsIdentifiers" | "embeddedPegjsIdentifiers" | "embeddedPhpIdentifiers" | "embeddedPrismaIdentifiers" | "embeddedPropertiesIdentifiers" | "embeddedPugIdentifiers" | "embeddedRubyIdentifiers" | "embeddedShIdentifiers" | "embeddedSqlIdentifiers" | "embeddedTomlIdentifiers" | "embeddedXmlIdentifiers" | "embeddedYamlIdentifiers" | keyof import("./options.js").PrettierPluginGlobalOptions>, "parser" | "filepath" | "endOfLine" | "embeddedLanguageFormatting" | "printWidth" | "tabWidth" | "useTabs" | `__${string}`> | undefined>;
4
4
  export declare function getIdentifierFromComment({ node, parent }: AstPath<Node>, comments: string[], options: Options): string | undefined;
5
5
  export declare function getIdentifierFromTag({ node, parent }: AstPath<Node>, tags: string[], options: Options): string | undefined;
6
6
  export type RemoveIndex<T> = {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "prettier-plugin-embed",
3
3
  "description": "A configurable Prettier plugin to format embedded languages in js/ts files.",
4
4
  "private": false,
5
- "version": "0.4.6",
5
+ "version": "0.4.8",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "./dist"
@@ -42,11 +42,14 @@
42
42
  "access": "public"
43
43
  },
44
44
  "scripts": {
45
+ "prepare": "husky install",
46
+ "bump": "bumpp",
45
47
  "dev": "vite",
46
- "lint": "eslint . --ext .ts",
48
+ "lint": "biome lint .",
47
49
  "type-check": "tsc --noEmit --emitDeclarationOnly false",
48
- "format": "prettier . --write",
49
- "prebuild": "npm run lint && npm run type-check && npm run format",
50
+ "format": "biome format . --write",
51
+ "check": "biome check --apply .",
52
+ "prebuild": "npm run check && npm run type-check",
50
53
  "build": "vite build",
51
54
  "add-glob-import-types": "tsx ./scripts/add-glob-import-types.ts",
52
55
  "postbuild": "tsc --project ./tsconfig.production.json && npm run add-glob-import-types",
@@ -61,37 +64,44 @@
61
64
  "postncu": "npm i"
62
65
  },
63
66
  "devDependencies": {
67
+ "@biomejs/biome": "1.5.2",
64
68
  "@commitlint/cli": "^18.4.4",
65
69
  "@commitlint/config-conventional": "^18.4.4",
66
70
  "@prettier/plugin-php": "^0.22.1",
71
+ "@prettier/plugin-pug": "^3.0.0",
67
72
  "@prettier/plugin-ruby": "^4.0.4",
68
73
  "@prettier/plugin-xml": "^3.2.2",
74
+ "@stedi/prettier-plugin-jsonata": "^2.1.1",
69
75
  "@types/estree": "^1.0.5",
70
76
  "@types/node": "^20.11.5",
71
- "@typescript-eslint/eslint-plugin": "^6.19.0",
72
- "@typescript-eslint/parser": "^6.19.0",
73
77
  "@vitest/coverage-istanbul": "^1.2.1",
74
78
  "@vitest/ui": "^1.2.1",
75
79
  "@xml-tools/parser": "^1.0.11",
80
+ "bumpp": "^9.3.0",
76
81
  "chevrotain": "7.1.1",
77
82
  "esbuild": "^0.19.11",
78
- "eslint": "^8.56.0",
79
83
  "fast-glob": "^3.3.2",
84
+ "husky": "^8.0.3",
85
+ "lint-staged": "^15.2.0",
80
86
  "npm-check-updates": "^16.14.12",
81
87
  "prettier": "^3.2.4",
82
88
  "prettier-plugin-glsl": "^0.1.3",
83
89
  "prettier-plugin-ini": "^1.1.0",
90
+ "prettier-plugin-java": "^2.5.0",
84
91
  "prettier-plugin-jsdoc": "^1.3.0",
85
92
  "prettier-plugin-latex": "^2.0.1",
93
+ "prettier-plugin-nginx": "^1.0.3",
86
94
  "prettier-plugin-organize-imports": "^3.2.4",
95
+ "prettier-plugin-pegjs": "^2.0.2",
96
+ "prettier-plugin-prisma": "^5.0.0",
87
97
  "prettier-plugin-properties": "^0.3.0",
88
- "prettier-plugin-sh": "^0.13.1",
98
+ "prettier-plugin-sh": "^0.14.0",
89
99
  "prettier-plugin-sql": "^0.18.0",
90
100
  "prettier-plugin-sql-cst": "^0.10.2",
91
101
  "prettier-plugin-toml": "^2.0.1",
92
102
  "tsx": "^4.7.0",
93
103
  "typescript": "^5.3.3",
94
- "vite": "^5.0.11",
104
+ "vite": "^5.0.12",
95
105
  "vitest": "^1.2.1"
96
106
  },
97
107
  "dependencies": {