prettier-plugin-embed 0.2.5 → 0.3.0-rc.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/README.md +33 -7
- package/dist/embedded/register.d.ts +4 -4
- package/dist/embedded/sql/options.d.ts +4 -4
- package/dist/embedded/types.d.ts +0 -4
- package/dist/embedded/utils.d.ts +2 -1
- package/dist/index.js +788 -810
- package/dist/options.d.ts +17 -6
- package/dist/types.d.ts +7 -0
- package/package.json +18 -18
package/dist/options.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare const NO_EMBEDDED_IDENTIFICATION_BY_COMMENT = "noEmbeddedIdentificationB
|
|
|
4
4
|
declare const NO_EMBEDDED_IDENTIFICATION_BY_TAG = "noEmbeddedIdentificationByTag";
|
|
5
5
|
declare const PRESERVE_EMBEDDED_EXTERIOR_WHITESPACES = "preserveEmbeddedExteriorWhitespaces";
|
|
6
6
|
declare const NO_EMBEDDED_MULTI_LINE_INDENTATION = "noEmbeddedMultiLineIndentation";
|
|
7
|
+
declare const EMBEDDED_OVERRIDES = "embeddedOverrides";
|
|
7
8
|
export declare const options: {
|
|
8
9
|
noEmbeddedIdentificationByComment: {
|
|
9
10
|
category: "Global";
|
|
@@ -41,6 +42,13 @@ export declare const options: {
|
|
|
41
42
|
}[];
|
|
42
43
|
description: string;
|
|
43
44
|
};
|
|
45
|
+
embeddedOverrides: {
|
|
46
|
+
category: "Global";
|
|
47
|
+
type: "string";
|
|
48
|
+
array: false;
|
|
49
|
+
default: undefined;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
44
52
|
embeddedNoopIdentifiers: {
|
|
45
53
|
category: "Global";
|
|
46
54
|
type: "string";
|
|
@@ -132,7 +140,7 @@ export declare const options: {
|
|
|
132
140
|
type: "string";
|
|
133
141
|
array: true;
|
|
134
142
|
default: {
|
|
135
|
-
value:
|
|
143
|
+
value: string[];
|
|
136
144
|
}[];
|
|
137
145
|
description: string;
|
|
138
146
|
};
|
|
@@ -171,12 +179,15 @@ export declare const options: {
|
|
|
171
179
|
description: string;
|
|
172
180
|
};
|
|
173
181
|
};
|
|
182
|
+
export interface PrettierPluginGlobalOptions {
|
|
183
|
+
[NO_EMBEDDED_IDENTIFICATION_BY_COMMENT]?: EmbeddedIdentifiers;
|
|
184
|
+
[NO_EMBEDDED_IDENTIFICATION_BY_TAG]?: EmbeddedIdentifiers;
|
|
185
|
+
[PRESERVE_EMBEDDED_EXTERIOR_WHITESPACES]?: EmbeddedIdentifiers;
|
|
186
|
+
[NO_EMBEDDED_MULTI_LINE_INDENTATION]?: EmbeddedIdentifiers;
|
|
187
|
+
[EMBEDDED_OVERRIDES]?: string;
|
|
188
|
+
}
|
|
174
189
|
declare module "./embedded/types.js" {
|
|
175
|
-
interface PrettierPluginEmbedOptions {
|
|
176
|
-
[NO_EMBEDDED_IDENTIFICATION_BY_COMMENT]?: EmbeddedIdentifiers;
|
|
177
|
-
[NO_EMBEDDED_IDENTIFICATION_BY_TAG]?: EmbeddedIdentifiers;
|
|
178
|
-
[PRESERVE_EMBEDDED_EXTERIOR_WHITESPACES]?: EmbeddedIdentifiers;
|
|
179
|
-
[NO_EMBEDDED_MULTI_LINE_INDENTATION]?: EmbeddedIdentifiers;
|
|
190
|
+
interface PrettierPluginEmbedOptions extends PrettierPluginGlobalOptions {
|
|
180
191
|
}
|
|
181
192
|
}
|
|
182
193
|
declare module "prettier" {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Options, Doc, AstPath } from "prettier";
|
|
2
2
|
import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree";
|
|
3
|
+
import { type EmbeddedDefaultIdentifier, type AutocompleteStringList, type PrettierPluginEmbedOptions, makeIdentifiersOptionName, EmbeddedLanguage } from "./embedded/index.js";
|
|
4
|
+
import type { PrettierPluginGlobalOptions } from "./options.js";
|
|
3
5
|
export type PrettierNode = EsTreeNode & {
|
|
4
6
|
comments?: (Comment & {
|
|
5
7
|
leading: boolean;
|
|
@@ -9,3 +11,8 @@ export type PrettierNode = EsTreeNode & {
|
|
|
9
11
|
};
|
|
10
12
|
export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
|
|
11
13
|
export type Embedder<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, identifier: string, identifiers: string[]) => Promise<Doc>;
|
|
14
|
+
export interface EmbeddedOverride {
|
|
15
|
+
identifiers: AutocompleteStringList<EmbeddedDefaultIdentifier[]>;
|
|
16
|
+
options: Omit<Omit<Options, keyof PrettierPluginEmbedOptions> & Omit<PrettierPluginEmbedOptions, keyof PrettierPluginGlobalOptions | ReturnType<typeof makeIdentifiersOptionName<EmbeddedLanguage>>>, "printWidth" | "endOfLine" | "useTabs" | "tabWidth" | "parser" | "filepath" | "embeddedLanguageFormatting" | `__${string}`>;
|
|
17
|
+
}
|
|
18
|
+
export type EmbeddedOverrides = EmbeddedOverride[];
|
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
|
+
"version": "0.3.0-rc.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"./dist"
|
|
@@ -61,37 +61,37 @@
|
|
|
61
61
|
"postncu": "npm i"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@commitlint/cli": "^18.
|
|
65
|
-
"@commitlint/config-conventional": "^18.
|
|
64
|
+
"@commitlint/cli": "^18.4.3",
|
|
65
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
66
66
|
"@semantic-release/git": "^10.0.1",
|
|
67
|
-
"@types/estree": "^1.0.
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
69
|
-
"@typescript-eslint/parser": "^6.
|
|
67
|
+
"@types/estree": "^1.0.5",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
69
|
+
"@typescript-eslint/parser": "^6.12.0",
|
|
70
70
|
"@vitest/browser": "^0.34.6",
|
|
71
71
|
"@vitest/coverage-istanbul": "^0.34.6",
|
|
72
72
|
"@vitest/ui": "^0.34.6",
|
|
73
73
|
"code-tag": "^1.1.0",
|
|
74
|
-
"eslint": "^8.
|
|
75
|
-
"fast-glob": "^3.3.
|
|
76
|
-
"npm-check-updates": "^16.14.
|
|
77
|
-
"playwright": "^1.
|
|
78
|
-
"semantic-release": "^22.0.
|
|
79
|
-
"tsx": "^
|
|
80
|
-
"typescript": "^5.
|
|
81
|
-
"vite": "^
|
|
74
|
+
"eslint": "^8.54.0",
|
|
75
|
+
"fast-glob": "^3.3.2",
|
|
76
|
+
"npm-check-updates": "^16.14.11",
|
|
77
|
+
"playwright": "^1.40.0",
|
|
78
|
+
"semantic-release": "^22.0.8",
|
|
79
|
+
"tsx": "^4.2.0",
|
|
80
|
+
"typescript": "^5.3.2",
|
|
81
|
+
"vite": "^5.0.0",
|
|
82
82
|
"vitest": "^0.34.6"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"@prettier/plugin-php": "
|
|
85
|
+
"@prettier/plugin-php": ">=0.20.1 <1",
|
|
86
86
|
"@prettier/plugin-ruby": "^4.0.0",
|
|
87
87
|
"@prettier/plugin-xml": "^3.1.0",
|
|
88
88
|
"@xml-tools/parser": "^1.0.11",
|
|
89
89
|
"chevrotain": "7.1.1",
|
|
90
90
|
"prettier": "^3.0.0",
|
|
91
|
-
"prettier-plugin-glsl": "
|
|
92
|
-
"prettier-plugin-sql": "
|
|
91
|
+
"prettier-plugin-glsl": ">=0.1.2 <1",
|
|
92
|
+
"prettier-plugin-sql": ">=0.15.0 <1"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"
|
|
95
|
+
"micro-memoize": "^4.1.2"
|
|
96
96
|
}
|
|
97
97
|
}
|