prettier-plugin-embed 0.5.1 → 0.6.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.
package/dist/options.d.ts CHANGED
@@ -157,7 +157,7 @@ export declare const options: {
157
157
  default: "babel";
158
158
  description: string;
159
159
  choices: {
160
- value: "babel" | "babel-flow" | "acorn" | "espree" | "flow" | "meriyah";
160
+ value: "acorn" | "babel" | "babel-flow" | "espree" | "flow" | "meriyah";
161
161
  description: string;
162
162
  }[];
163
163
  };
@@ -251,7 +251,7 @@ export declare const options: {
251
251
  default: "html";
252
252
  description: string;
253
253
  choices: {
254
- value: "html" | "vue" | "angular" | "lwc";
254
+ value: "angular" | "html" | "lwc" | "vue";
255
255
  description: string;
256
256
  }[];
257
257
  };
@@ -345,7 +345,7 @@ export declare const options: {
345
345
  default: "json";
346
346
  description: string;
347
347
  choices: {
348
- value: "json" | "json5" | "jsonc" | "json-stringify";
348
+ value: "json" | "json-stringify" | "json5" | "jsonc";
349
349
  description: string;
350
350
  }[];
351
351
  };
@@ -533,7 +533,7 @@ export declare const options: {
533
533
  default: "typescript";
534
534
  description: string;
535
535
  choices: {
536
- value: "typescript" | "babel-ts";
536
+ value: "babel-ts" | "typescript";
537
537
  description: string;
538
538
  }[];
539
539
  };
@@ -683,7 +683,7 @@ export declare const options: {
683
683
  default: "ruby";
684
684
  description: string;
685
685
  choices: {
686
- value: "ruby" | "rbs" | "haml";
686
+ value: "haml" | "rbs" | "ruby";
687
687
  description: string;
688
688
  }[];
689
689
  };
@@ -759,7 +759,7 @@ export declare const options: {
759
759
  default: "sqlite";
760
760
  description: string;
761
761
  choices: {
762
- value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql";
762
+ value: "bigquery" | "mariadb" | "mysql" | "postgresql" | "sqlite";
763
763
  description: string;
764
764
  }[];
765
765
  };
package/dist/parsers.d.ts CHANGED
@@ -1,10 +1,4 @@
1
1
  export declare const parsers: {
2
- embeddedXml: import("prettier").Parser;
3
- meriyah: import("prettier").Parser;
4
- typescript: import("prettier").Parser;
5
- flow: import("prettier").Parser;
6
- acorn: import("prettier").Parser;
7
- espree: import("prettier").Parser;
8
2
  __babel_estree: import("prettier").Parser;
9
3
  __js_expression: import("prettier").Parser;
10
4
  __ts_expression: import("prettier").Parser;
@@ -19,4 +13,10 @@ export declare const parsers: {
19
13
  "json-stringify": import("prettier").Parser;
20
14
  json5: import("prettier").Parser;
21
15
  jsonc: import("prettier").Parser;
16
+ acorn: import("prettier").Parser;
17
+ espree: import("prettier").Parser;
18
+ flow: import("prettier").Parser;
19
+ meriyah: import("prettier").Parser;
20
+ typescript: import("prettier").Parser;
21
+ embeddedXml: import("prettier").Parser;
22
22
  };
@@ -0,0 +1,5 @@
1
+ export type LiteralUnion<LiteralType, BaseType extends string> = LiteralType | (BaseType & Record<never, never>);
2
+ export type OmitIndexSignature<T> = {
3
+ [K in keyof T as Record<never, never> extends Record<K, unknown> ? never : K]: T[K];
4
+ };
5
+ export type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer Intersection) => void ? Intersection & T : never;
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { TemplateLiteral } from "estree";
2
2
  import type { AstPath, Doc, Options } from "prettier";
3
3
  import type { printer } from "prettier/doc";
4
- import type { OmitIndexSignature } from "type-fest";
5
4
  import type { AutocompleteStringList, EmbeddedDefaultComment, EmbeddedDefaultTag, EmbeddedLanguage, makeCommentsOptionName, makeIdentifiersOptionName, makeTagsOptionName, PluginEmbedOptions } from "./embedded/index.js";
6
5
  import type { PluginEmbedLanguageAgnosticOptions } from "./options.js";
6
+ import type { OmitIndexSignature } from "./type-utils.js";
7
7
  export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
8
8
  export interface EmbedderPayload {
9
9
  commentOrTag: string;
package/dist/utils.d.ts CHANGED
@@ -2,18 +2,18 @@ import type { Expression, Node, TemplateLiteral } from "estree";
2
2
  import { type AstPath, type Options, type Printer } from "prettier";
3
3
  import { type EmbeddedComment, type EmbeddedLanguage, type EmbeddedTag } from "./embedded/index.js";
4
4
  import type { EmbeddedOverride } from "./types.js";
5
- export declare function resolveEmbeddedOverrideOptions(embeddedOverridesString: string | undefined, { commentOrTag, kind, filepath, }: {
5
+ export declare function resolveEmbeddedOverrideOptions(options: Options, { commentOrTag, kind, }: {
6
6
  commentOrTag: EmbeddedComment | EmbeddedTag;
7
7
  kind: "comment" | "tag";
8
- filepath?: string;
9
8
  }): Promise<EmbeddedOverride["options"] | undefined>;
9
+ export declare function matchTagExpressionPattern(tagExpression: Expression, pattern: string): boolean;
10
10
  export declare const compareTagExpressionToTagString: (tagExpression: Expression, tagString: string, parse: (text: string) => Node | Promise<Node>) => boolean;
11
11
  export declare function parseCommentFromTemplateLiteralAstPath({ node, parent, }: AstPath<Node> & {
12
12
  node: TemplateLiteral;
13
13
  }): string | undefined;
14
14
  export declare function parseTagFromTemplateLiteralAstPath({ parent, }: AstPath<Node> & {
15
15
  node: TemplateLiteral;
16
- }): string | TemplateLiteral | import("estree").ArrayExpression | import("estree").ArrowFunctionExpression | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").CallExpression | import("estree").ChainExpression | import("estree").ClassExpression | import("estree").ConditionalExpression | import("estree").FunctionExpression | import("estree").ImportExpression | import("estree").Literal | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").MetaProperty | import("estree").ObjectExpression | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | import("estree").ThisExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").YieldExpression | undefined;
16
+ }): string | import("estree").ArrayExpression | import("estree").ArrowFunctionExpression | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").ChainExpression | import("estree").ClassExpression | import("estree").ConditionalExpression | import("estree").FunctionExpression | import("estree").ImportExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").MetaProperty | import("estree").ObjectExpression | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | TemplateLiteral | import("estree").ThisExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").YieldExpression | import("estree").CallExpression | import("estree").Literal | undefined;
17
17
  export declare function createCommentsInOptionsGenerator(options: Options, comment: string): (_: EmbeddedLanguage) => Generator<string, void, undefined>;
18
18
  export declare function createTagsInOptionsGenerator(options: Options, tag?: string): (_: EmbeddedLanguage) => Generator<string, void, undefined>;
19
19
  export declare function createEmbeddedDoc(node: TemplateLiteral, embeddedLanguage: EmbeddedLanguage, commentOrTag: EmbeddedComment | EmbeddedTag, kind: "comment" | "tag", options: Options): ReturnType<Exclude<Printer["embed"], undefined>>;
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.5.1",
5
+ "version": "0.6.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "./dist"
@@ -57,69 +57,60 @@
57
57
  "access": "public"
58
58
  },
59
59
  "devDependencies": {
60
- "@biomejs/biome": "2.3.10",
61
- "@changesets/cli": "^2.29.8",
62
- "@commitlint/cli": "^20.2.0",
63
- "@commitlint/config-conventional": "^20.2.0",
64
- "@prettier/plugin-php": "^0.24.0",
65
- "@prettier/plugin-pug": "^3.4.2",
60
+ "@biomejs/biome": "2.5.15",
61
+ "@changesets/cli": "^3.0.3",
62
+ "@commitlint/cli": "^21.2.3",
63
+ "@commitlint/config-conventional": "^21.2.3",
64
+ "@prettier/plugin-php": "^0.25.0",
65
+ "@prettier/plugin-pug": "^3.6.0",
66
66
  "@prettier/plugin-ruby": "^4.0.4",
67
67
  "@prettier/plugin-xml": "^3.4.2",
68
68
  "@stedi/prettier-plugin-jsonata": "^2.1.8",
69
- "@types/node": "^25.0.3",
70
- "@vitest/coverage-istanbul": "^4.0.16",
71
- "@vitest/ui": "^4.0.16",
72
- "@xml-tools/parser": "^1.0.11",
73
- "chevrotain": "7.1.1",
74
- "concurrently": "^9.2.1",
75
- "copy-files-from-to": "^3.13.0",
76
- "esbuild": "^0.27.1",
77
- "lint-staged": "^16.2.7",
78
- "npm-check-updates": "^19.2.0",
79
- "prettier": "^3.7.4",
80
- "prettier-plugin-glsl": "^0.2.2",
69
+ "@types/node": "^26.6.5",
70
+ "@vitest/coverage-v8": "5.0.3",
71
+ "@vitest/ui": "^5.0.3",
72
+ "concurrently": "^10.0.6",
73
+ "copy-files-from-to": "^4.0.1",
74
+ "lint-staged": "^17.6.0",
75
+ "npm-check-updates": "^23.1.1",
76
+ "prettier": "^3.9.10",
77
+ "prettier-plugin-glsl": "^0.3.1",
81
78
  "prettier-plugin-ini": "^1.3.0",
82
- "prettier-plugin-java": "^2.7.7",
79
+ "prettier-plugin-java": "^2.11.0",
83
80
  "prettier-plugin-latex": "^2.0.1",
84
- "prettier-plugin-nginx": "^1.0.3",
81
+ "prettier-plugin-nginx": "^2.0.0",
85
82
  "prettier-plugin-pegjs": "^2.0.2",
86
83
  "prettier-plugin-prisma": "^5.0.0",
87
- "prettier-plugin-properties": "^0.3.0",
88
- "prettier-plugin-sh": "^0.18.0",
89
- "prettier-plugin-sql": "^0.19.2",
90
- "prettier-plugin-sql-cst": "^0.17.2",
91
- "prettier-plugin-toml": "^2.0.6",
92
- "simple-git-hooks": "^2.13.1",
93
- "tinyglobby": "^0.2.15",
94
- "tsx": "^4.21.0",
95
- "typescript": "^5.9.3",
96
- "vite": "^7.3.0",
97
- "vitest": "^4.0.16"
84
+ "prettier-plugin-properties": "^0.3.1",
85
+ "prettier-plugin-sh": "^0.20.2",
86
+ "prettier-plugin-sql": "^0.20.0",
87
+ "prettier-plugin-sql-cst": "^0.23.0",
88
+ "prettier-plugin-toml": "^3.0.2",
89
+ "simple-git-hooks": "^2.14.0",
90
+ "tinyglobby": "^0.2.17",
91
+ "tsx": "^4.23.15",
92
+ "typescript": "^7.0.2",
93
+ "vite": "^8.3.4",
94
+ "vitest": "^5.0.3"
98
95
  },
99
96
  "dependencies": {
100
- "@types/estree": "^1.0.8",
101
- "dedent": "^1.7.1",
102
- "micro-memoize": "^5.1.1",
103
- "package-up": "^5.0.0",
104
- "tiny-jsonc": "^1.0.2",
105
- "type-fest": "^5.3.1"
97
+ "@types/estree": "^1.0.9",
98
+ "dedent": "^1.7.2",
99
+ "tiny-jsonc": "^1.0.2"
106
100
  },
107
101
  "scripts": {
108
102
  "update-hooks": "simple-git-hooks",
109
103
  "lint": "biome lint .",
110
104
  "type-check": "tsc --noEmit --emitDeclarationOnly false",
111
- "format:prettier": "prettier . --write",
112
- "format:biome": "biome format . --write",
113
- "format": "conc \"pnpm:format:prettier\" \"pnpm:format:biome\"",
114
- "check:biome": "biome check . --write",
115
- "check": "conc \"pnpm:format:prettier\" \"pnpm:check:biome\"",
116
- "prebuild": "pnpm -s check && pnpm -s type-check",
105
+ "format": "prettier . --write && biome check --write .",
106
+ "check": "prettier . --check && biome check .",
107
+ "prebuild": "pnpm check && pnpm type-check",
117
108
  "build": "vite build",
118
109
  "add-glob-import-types": "tsx ./scripts/add-glob-import-types.ts",
119
- "nocheck-chevrotain-types": "tsx ./scripts/nocheck-chevrotain-types.ts",
120
110
  "copy": "copy-files-from-to",
121
- "postbuild": "tsc --project ./tsconfig.production.json && conc \"pnpm:add-glob-import-types\" \"pnpm:nocheck-chevrotain-types\" \"pnpm:copy\"",
122
- "test:ci": "vitest --run",
111
+ "postbuild": "tsc --project ./tsconfig.production.json && conc \"pnpm:add-glob-import-types\" \"pnpm:copy\"",
112
+ "test:ci": "vitest --run --pool=threads --coverage",
113
+ "test:consumer": "pnpm build && node ./scripts/test-consumer.mjs",
123
114
  "test": "vitest",
124
115
  "test:ui": "vitest --ui",
125
116
  "process-readme": "tsx ./scripts/process-readme",