prettier-plugin-embed 0.0.2 → 0.0.3
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/embedded/index.d.ts +2 -6
- package/dist/embedded/noop/index.d.ts +2 -0
- package/dist/embedded/noop/name.d.ts +6 -0
- package/dist/embedded/noop/option.d.ts +15 -0
- package/dist/embedded/php/embedder.d.ts +9 -0
- package/dist/embedded/php/index.d.ts +3 -0
- package/dist/embedded/php/name.d.ts +6 -0
- package/dist/embedded/php/option.d.ts +20 -0
- package/dist/embedded/register.d.ts +5 -0
- package/dist/embedded/sql/embedder.d.ts +9 -0
- package/dist/embedded/sql/index.d.ts +1 -2
- package/dist/embedded/sql/name.d.ts +5 -0
- package/dist/embedded/sql/option.d.ts +20 -1
- package/dist/embedded/types.d.ts +14 -1
- package/dist/embedded/utils.d.ts +3 -1
- package/dist/embedded/xml/embedder.d.ts +9 -0
- package/dist/embedded/xml/index.d.ts +1 -2
- package/dist/embedded/xml/name.d.ts +5 -0
- package/dist/embedded/xml/option.d.ts +20 -1
- package/dist/embedded/xml/parser.d.ts +7 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +373 -225
- package/dist/options.d.ts +6 -0
- package/dist/parsers.d.ts +1 -0
- package/dist/printers.d.ts +1 -1
- package/dist/types.d.ts +1 -2
- package/package.json +11 -10
- package/dist/embedded/sql/printer.d.ts +0 -3
- package/dist/embedded/sql/types.d.ts +0 -13
- package/dist/embedded/xml/printer.d.ts +0 -3
- package/dist/embedded/xml/types.d.ts +0 -14
package/dist/embedded/index.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const embeddedLanguageNames: readonly ["embeddedXml", "embeddedSql"];
|
|
4
|
-
export declare const embeddedParsers: Record<string, Parser>;
|
|
5
|
-
export declare const embeddedPrinters: Record<string, EmbeddedPrinter>;
|
|
6
|
-
export declare const embeddedOptions: SupportOptions;
|
|
1
|
+
export * from "./register.js";
|
|
2
|
+
export type { EmbeddedNames, EmbeddedParsers, EmbeddedEmbedders, EmbeddedOptions, } from "./types.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SupportOption } from "prettier";
|
|
2
|
+
import { name } from "./name.js";
|
|
3
|
+
export declare const option: SupportOption;
|
|
4
|
+
declare module "../types.js" {
|
|
5
|
+
interface EmbeddedOptions {
|
|
6
|
+
[name]: typeof option;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface PrettierPluginEmbedOptions {
|
|
10
|
+
[name]?: string[];
|
|
11
|
+
}
|
|
12
|
+
declare module "prettier" {
|
|
13
|
+
interface Options extends PrettierPluginEmbedOptions {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Options } from "prettier";
|
|
2
|
+
import type { Embedder } from "../../types.js";
|
|
3
|
+
import { name } from "./name.js";
|
|
4
|
+
export declare const embedder: Embedder<Options>;
|
|
5
|
+
declare module "../types.js" {
|
|
6
|
+
interface EmbeddedEmbedders {
|
|
7
|
+
[name]: typeof embedder;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SupportOption } from "prettier";
|
|
2
|
+
import { name } from "./name.js";
|
|
3
|
+
export declare const option: SupportOption;
|
|
4
|
+
declare module "../types.js" {
|
|
5
|
+
interface EmbeddedOptions {
|
|
6
|
+
[name]: typeof option;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface PrettierPluginDepsOptions {
|
|
10
|
+
phpVersion?: "5.0" | "5.1" | "5.2" | "5.3" | "5.4" | "5.5" | "5.6" | "7.0" | "7.1" | "7.2" | "7.3" | "7.4" | "8.0" | "8.1" | "8.2";
|
|
11
|
+
trailingCommaPHP?: boolean;
|
|
12
|
+
braceStyle?: "psr-2" | "per-cs" | "1tbs";
|
|
13
|
+
}
|
|
14
|
+
export interface PrettierPluginEmbedOptions {
|
|
15
|
+
[name]?: string[];
|
|
16
|
+
}
|
|
17
|
+
declare module "prettier" {
|
|
18
|
+
interface Options extends PrettierPluginDepsOptions, PrettierPluginEmbedOptions {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EmbeddedEmbedders, EmbeddedNames, EmbeddedParsers, EmbeddedOptions } from "./types.js";
|
|
2
|
+
export declare const embeddedNames: EmbeddedNames[];
|
|
3
|
+
export declare const embeddedParsers: EmbeddedParsers;
|
|
4
|
+
export declare const embeddedEmbedders: EmbeddedEmbedders;
|
|
5
|
+
export declare const embeddedOptions: EmbeddedOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Options } from "prettier";
|
|
2
|
+
import type { Embedder } from "../../types.js";
|
|
3
|
+
import { name } from "./name.js";
|
|
4
|
+
export declare const embedder: Embedder<Options>;
|
|
5
|
+
declare module "../types.js" {
|
|
6
|
+
interface EmbeddedEmbedders {
|
|
7
|
+
[name]: typeof embedder;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
import { SupportOption } from "prettier";
|
|
2
|
-
|
|
2
|
+
import type { SqlBaseOptions as PrettierPluginDepsOptions } from "prettier-plugin-sql";
|
|
3
|
+
import { name } from "./name.js";
|
|
4
|
+
export declare const option: SupportOption;
|
|
5
|
+
declare module "../types.js" {
|
|
6
|
+
interface EmbeddedOptions {
|
|
7
|
+
[name]: typeof option;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "hive", "mariadb", "mysql", "postgresql", "db2", "plsql", "n1ql", "redshift", "singlestoredb", "spark", "sqlite", "transactsql", "tsql", "trino"];
|
|
11
|
+
export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql"];
|
|
12
|
+
export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number];
|
|
13
|
+
export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number];
|
|
14
|
+
export { PrettierPluginDepsOptions };
|
|
15
|
+
export interface PrettierPluginEmbedOptions {
|
|
16
|
+
[name]?: SqlFormatterLanguage[] | NodeSqlParserDataBase[] | string[];
|
|
17
|
+
}
|
|
18
|
+
declare module "prettier" {
|
|
19
|
+
interface Options extends PrettierPluginDepsOptions, PrettierPluginEmbedOptions {
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/embedded/types.d.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { Parser, SupportOption, Options } from "prettier";
|
|
2
|
+
import { Embedder } from "../types.js";
|
|
3
|
+
export interface EmbeddedParsers {
|
|
4
|
+
[name: string]: Parser | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface EmbeddedEmbedders {
|
|
7
|
+
[name: string]: Embedder<Options> | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface EmbeddedOptions {
|
|
10
|
+
[name: string]: SupportOption | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface EmbeddedNamesHolder {
|
|
13
|
+
}
|
|
14
|
+
export type EmbeddedNames = keyof EmbeddedNamesHolder;
|
package/dist/embedded/utils.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Expression, Comment, TemplateLiteral } from "estree";
|
|
2
|
-
import { AstPath } from "prettier";
|
|
2
|
+
import { AstPath, Options } from "prettier";
|
|
3
3
|
import { builders } from "prettier/doc";
|
|
4
4
|
import { InternalPrintFun } from "../types.js";
|
|
5
5
|
export declare function printTemplateExpression(path: AstPath<Expression & {
|
|
6
6
|
comments?: Comment[];
|
|
7
7
|
}>, print: InternalPrintFun): builders.Doc[];
|
|
8
8
|
export declare function printTemplateExpressions(path: AstPath<TemplateLiteral>, print: InternalPrintFun): builders.Doc[][];
|
|
9
|
+
export declare function throwIfPluginIsNotFound(pluginName: string, options: Options, lang: string): void;
|
|
10
|
+
export declare function insertEmbeddedLanguageName(names: string[], name: string, headName: string): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Options } from "prettier";
|
|
2
|
+
import type { Embedder } from "../../types.js";
|
|
3
|
+
import { name } from "./name.js";
|
|
4
|
+
export declare const embedder: Embedder<Options>;
|
|
5
|
+
declare module "../types.js" {
|
|
6
|
+
interface EmbeddedEmbedders {
|
|
7
|
+
[name]: typeof embedder;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
import { SupportOption } from "prettier";
|
|
2
|
-
|
|
2
|
+
import { name } from "./name.js";
|
|
3
|
+
export declare const option: SupportOption;
|
|
4
|
+
declare module "../types.js" {
|
|
5
|
+
interface EmbeddedOptions {
|
|
6
|
+
[name]: typeof option;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface PrettierPluginDepsOptions {
|
|
10
|
+
xmlSelfClosingSpace?: boolean;
|
|
11
|
+
xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
|
|
12
|
+
xmlSortAttributesByKey?: boolean;
|
|
13
|
+
xmlQuoteAttributes?: "preserve" | "single" | "double";
|
|
14
|
+
}
|
|
15
|
+
export interface PrettierPluginEmbedOptions {
|
|
16
|
+
[name]?: string[];
|
|
17
|
+
}
|
|
18
|
+
declare module "prettier" {
|
|
19
|
+
interface Options extends PrettierPluginDepsOptions, PrettierPluginEmbedOptions {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Parser } from "prettier";
|
|
2
2
|
import { parse as xmlToolsParse } from "@xml-tools/parser";
|
|
3
|
+
import { name } from "./name.js";
|
|
3
4
|
type CstNode = ReturnType<typeof xmlToolsParse>["cst"];
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const parser: Parser<CstNode>;
|
|
6
|
+
declare module "../types.js" {
|
|
7
|
+
interface EmbeddedParsers {
|
|
8
|
+
[name]: Parser;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
5
11
|
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,151 +1,152 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { printers as
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
end: {
|
|
24
|
-
line: n.line,
|
|
25
|
-
column: n.column + n.length
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (r.length > 0) {
|
|
31
|
-
const n = r[0];
|
|
32
|
-
throw L(n.message, {
|
|
33
|
-
loc: {
|
|
34
|
-
start: {
|
|
35
|
-
line: n.token.startLine ?? NaN,
|
|
36
|
-
column: n.token.startColumn ?? NaN
|
|
37
|
-
},
|
|
38
|
-
end: {
|
|
39
|
-
line: n.token.endLine ?? NaN,
|
|
40
|
-
column: n.token.endColumn ?? NaN
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return o;
|
|
46
|
-
},
|
|
47
|
-
astFormat: "xml",
|
|
48
|
-
locStart(e) {
|
|
49
|
-
return e.location.startOffset;
|
|
50
|
-
},
|
|
51
|
-
locEnd(e) {
|
|
52
|
-
return e.location.endOffset ?? NaN;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
let $;
|
|
56
|
-
const V = new Uint8Array(16);
|
|
57
|
-
function Q() {
|
|
58
|
-
if (!$ && ($ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !$))
|
|
1
|
+
import H from "prettier/parser-babel";
|
|
2
|
+
import X from "prettier/parser-espree";
|
|
3
|
+
import J from "prettier/parser-flow";
|
|
4
|
+
import K from "prettier/parser-typescript";
|
|
5
|
+
import { builders as E, utils as N } from "prettier/doc";
|
|
6
|
+
import { parse as Y } from "@xml-tools/parser";
|
|
7
|
+
import { printers as Z } from "prettier/plugins/estree.mjs";
|
|
8
|
+
const C = "embeddedNoop", ee = {
|
|
9
|
+
category: "Global",
|
|
10
|
+
type: "string",
|
|
11
|
+
array: !0,
|
|
12
|
+
default: [{ value: [] }],
|
|
13
|
+
description: "Specify embedded languages that will not be formatted."
|
|
14
|
+
}, te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
15
|
+
__proto__: null,
|
|
16
|
+
name: C,
|
|
17
|
+
option: ee
|
|
18
|
+
}, Symbol.toStringTag, { value: "Module" })), ne = "embeddedPhp";
|
|
19
|
+
let S;
|
|
20
|
+
const re = new Uint8Array(16);
|
|
21
|
+
function oe() {
|
|
22
|
+
if (!S && (S = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !S))
|
|
59
23
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
60
|
-
return
|
|
24
|
+
return S(re);
|
|
61
25
|
}
|
|
62
|
-
const
|
|
26
|
+
const c = [];
|
|
63
27
|
for (let e = 0; e < 256; ++e)
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
return
|
|
28
|
+
c.push((e + 256).toString(16).slice(1));
|
|
29
|
+
function se(e, t = 0) {
|
|
30
|
+
return c[e[t + 0]] + c[e[t + 1]] + c[e[t + 2]] + c[e[t + 3]] + "-" + c[e[t + 4]] + c[e[t + 5]] + "-" + c[e[t + 6]] + c[e[t + 7]] + "-" + c[e[t + 8]] + c[e[t + 9]] + "-" + c[e[t + 10]] + c[e[t + 11]] + c[e[t + 12]] + c[e[t + 13]] + c[e[t + 14]] + c[e[t + 15]];
|
|
67
31
|
}
|
|
68
|
-
const
|
|
69
|
-
randomUUID:
|
|
32
|
+
const ie = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), I = {
|
|
33
|
+
randomUUID: ie
|
|
70
34
|
};
|
|
71
|
-
function
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
35
|
+
function k(e, t, n) {
|
|
36
|
+
if (I.randomUUID && !t && !e)
|
|
37
|
+
return I.randomUUID();
|
|
74
38
|
e = e || {};
|
|
75
|
-
const o = e.random || (e.rng ||
|
|
39
|
+
const o = e.random || (e.rng || oe)();
|
|
76
40
|
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
|
|
77
|
-
|
|
78
|
-
for (let
|
|
79
|
-
t[
|
|
41
|
+
n = n || 0;
|
|
42
|
+
for (let r = 0; r < 16; ++r)
|
|
43
|
+
t[n + r] = o[r];
|
|
80
44
|
return t;
|
|
81
45
|
}
|
|
82
|
-
return
|
|
46
|
+
return se(o);
|
|
83
47
|
}
|
|
84
|
-
const { group:
|
|
85
|
-
function
|
|
86
|
-
var
|
|
87
|
-
const { node:
|
|
48
|
+
const { group: le, indent: ce, softline: U, lineSuffixBoundary: ae } = E;
|
|
49
|
+
function ue(e, t) {
|
|
50
|
+
var r;
|
|
51
|
+
const { node: n } = e;
|
|
88
52
|
let o = t();
|
|
89
|
-
return (
|
|
53
|
+
return (r = n == null ? void 0 : n.comments) != null && r.length && (o = le([ce([U, o]), U])), ["${", o, ae, "}"];
|
|
90
54
|
}
|
|
91
|
-
function
|
|
55
|
+
function j(e, t) {
|
|
92
56
|
return e.map(
|
|
93
|
-
(
|
|
57
|
+
(n) => ue(n, t),
|
|
94
58
|
"expressions"
|
|
95
59
|
);
|
|
96
60
|
}
|
|
97
|
-
|
|
61
|
+
function A(e, t, n) {
|
|
62
|
+
var o;
|
|
63
|
+
if (!(((o = t.plugins) == null ? void 0 : o.map((r) => r.name)) ?? []).includes(e))
|
|
64
|
+
throw new Error(
|
|
65
|
+
`Cannot format embedded language "${n}" because plugin "${e}" is not loaded.`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function de(e, t, n) {
|
|
69
|
+
if (t === n) {
|
|
70
|
+
e.unshift(t);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let o = 0, r = e.length;
|
|
74
|
+
for (; o < r; ) {
|
|
75
|
+
const s = o + r >>> 1;
|
|
76
|
+
if (e[s] === n) {
|
|
77
|
+
e.push(t);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
e[s] < t ? o = s + 1 : r = s;
|
|
81
|
+
}
|
|
82
|
+
e.splice(o, 0, t);
|
|
83
|
+
}
|
|
84
|
+
const { label: pe, hardline: me, line: ge, group: w, indent: fe } = E, { mapDoc: be } = N, ye = async (e, t, n, o, r) => {
|
|
98
85
|
try {
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
A("@prettier/plugin-php", o, r);
|
|
87
|
+
const s = "$p" + k().replaceAll("-", ""), { node: a } = n, b = a.quasis.map(
|
|
88
|
+
(i, l, { length: m }) => l === m - 1 ? i.value.cooked : i.value.cooked + `${s}${l}`
|
|
101
89
|
).join("");
|
|
102
|
-
let d = "",
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
parser:
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
let d = "", y = 0;
|
|
91
|
+
const g = /^\s+/.exec(b);
|
|
92
|
+
g && (y = g.index + g[0].length, d = " ");
|
|
93
|
+
const x = /\s$/.test(b) ? " " : "", _ = j(n, t), q = await e(b.slice(y), {
|
|
94
|
+
parser: "php"
|
|
95
|
+
});
|
|
96
|
+
let h = !1;
|
|
97
|
+
const $ = be(q, (i) => {
|
|
98
|
+
if (typeof i != "string")
|
|
99
|
+
return Array.isArray(i) || (i.type === "group" && i.break || i.type === "line" && (i.hard || i.literal)) && (h = !0), i;
|
|
100
|
+
const l = [], m = i.split(new RegExp("\\" + s + "(\\d+)", "g"));
|
|
101
|
+
for (let u = 0; u < m.length; u++) {
|
|
102
|
+
let f = m[u];
|
|
103
|
+
if (u % 2 == 0) {
|
|
104
|
+
if (!f)
|
|
115
105
|
continue;
|
|
116
|
-
|
|
106
|
+
f = f.replaceAll(/([\\`]|\${)/g, "\\$1"), l.push(f);
|
|
117
107
|
} else {
|
|
118
|
-
const
|
|
119
|
-
|
|
108
|
+
const v = Number(f);
|
|
109
|
+
l.push(_[v]);
|
|
120
110
|
}
|
|
121
111
|
}
|
|
122
|
-
return
|
|
123
|
-
}),
|
|
124
|
-
return
|
|
112
|
+
return l;
|
|
113
|
+
}), p = h ? me : d && x ? ge : null;
|
|
114
|
+
return p ? w([
|
|
125
115
|
"`",
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
fe([p, w($)]),
|
|
117
|
+
p,
|
|
128
118
|
"`"
|
|
129
|
-
]) :
|
|
119
|
+
]) : pe(
|
|
130
120
|
{ hug: !1 },
|
|
131
|
-
|
|
121
|
+
w([
|
|
132
122
|
"`",
|
|
133
123
|
d,
|
|
134
|
-
|
|
135
|
-
|
|
124
|
+
w([$]),
|
|
125
|
+
x,
|
|
136
126
|
"`"
|
|
137
127
|
])
|
|
138
128
|
);
|
|
139
|
-
} catch (
|
|
140
|
-
throw console.error(
|
|
129
|
+
} catch (s) {
|
|
130
|
+
throw console.error(s), s;
|
|
141
131
|
}
|
|
142
|
-
},
|
|
132
|
+
}, he = {
|
|
143
133
|
category: "Global",
|
|
144
134
|
type: "string",
|
|
145
135
|
array: !0,
|
|
146
|
-
default: [{ value: ["
|
|
147
|
-
description: "
|
|
148
|
-
},
|
|
136
|
+
default: [{ value: ["php"] }],
|
|
137
|
+
description: "Specify embedded PHP languages. This requires @prettier/plugin-php"
|
|
138
|
+
}, $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
139
|
+
__proto__: null,
|
|
140
|
+
embedder: ye,
|
|
141
|
+
name: ne,
|
|
142
|
+
option: he
|
|
143
|
+
}, Symbol.toStringTag, { value: "Module" })), xe = "embeddedSql", _e = {
|
|
144
|
+
category: "Global",
|
|
145
|
+
type: "string",
|
|
146
|
+
array: !0,
|
|
147
|
+
default: [{ value: ["sql"] }],
|
|
148
|
+
description: "Specify embedded SQL languages. This requires prettier-plugin-sql"
|
|
149
|
+
}, G = [
|
|
149
150
|
"sql",
|
|
150
151
|
"bigquery",
|
|
151
152
|
"hive",
|
|
@@ -162,7 +163,7 @@ const { label: Y, hardline: Z, line: ee, group: E, indent: te } = S, { mapDoc: n
|
|
|
162
163
|
"transactsql",
|
|
163
164
|
"tsql",
|
|
164
165
|
"trino"
|
|
165
|
-
],
|
|
166
|
+
], W = [
|
|
166
167
|
"bigquery",
|
|
167
168
|
"db2",
|
|
168
169
|
"hive",
|
|
@@ -171,149 +172,296 @@ const { label: Y, hardline: Z, line: ee, group: E, indent: te } = S, { mapDoc: n
|
|
|
171
172
|
"postgresql",
|
|
172
173
|
"transactsql",
|
|
173
174
|
"flinksql"
|
|
174
|
-
], { label:
|
|
175
|
+
], { label: ve, hardline: R, group: O, line: qe, indent: Ee } = E, { mapDoc: Se } = N, we = async (e, t, n, o, r, s) => {
|
|
175
176
|
try {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
n =
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
b = {
|
|
184
|
-
formatter: "sql-formatter",
|
|
185
|
-
language: n
|
|
186
|
-
};
|
|
187
|
-
else if (R.includes(n))
|
|
188
|
-
b = {
|
|
189
|
-
formatter: "node-sql-parser",
|
|
190
|
-
database: n
|
|
191
|
-
};
|
|
192
|
-
else
|
|
193
|
-
throw new SyntaxError(`Unrecognized language: ${n}`);
|
|
194
|
-
else if (R.includes(n))
|
|
195
|
-
b = {
|
|
196
|
-
formatter: "node-sql-parser",
|
|
197
|
-
database: n
|
|
198
|
-
};
|
|
199
|
-
else if (A.includes(n))
|
|
200
|
-
b = {
|
|
201
|
-
formatter: "sql-formatter",
|
|
202
|
-
language: n
|
|
203
|
-
};
|
|
204
|
-
else
|
|
205
|
-
throw new SyntaxError(`Unrecognized language: ${n}`);
|
|
206
|
-
const N = await e(d, {
|
|
177
|
+
A("prettier-plugin-sql", o, r);
|
|
178
|
+
const a = "p" + k().replaceAll("-", ""), { node: b } = n, d = b.quasis.map(
|
|
179
|
+
(i, l, { length: m }) => l === m - 1 ? i.value.cooked : i.value.cooked + `${a}${l}`
|
|
180
|
+
).join(""), y = /^\s/.test(d) ? " " : "", g = /\s$/.test(d) ? " " : "", x = j(n, t), _ = Te(o, r, s);
|
|
181
|
+
if (typeof _ > "u")
|
|
182
|
+
throw new SyntaxError(`Unrecognized language: ${r}`);
|
|
183
|
+
const q = await e(d, {
|
|
207
184
|
parser: "sql",
|
|
208
|
-
...
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
185
|
+
..._
|
|
186
|
+
});
|
|
187
|
+
let h = !1;
|
|
188
|
+
const $ = Se(q, (i) => {
|
|
189
|
+
if (typeof i != "string")
|
|
190
|
+
return i;
|
|
191
|
+
const l = [], m = i.split(new RegExp(a + "(\\d+)", "g"));
|
|
192
|
+
for (let u = 0; u < m.length; u++) {
|
|
193
|
+
let f = m[u];
|
|
194
|
+
if (u % 2 == 0) {
|
|
195
|
+
if (!f)
|
|
217
196
|
continue;
|
|
218
|
-
|
|
197
|
+
f = f.replaceAll(/([\\`]|\${)/g, "\\$1"), f.split(/(\n)/).forEach(
|
|
198
|
+
(v) => v === `
|
|
199
|
+
` ? (h = !0, l.push(R)) : l.push(v)
|
|
200
|
+
);
|
|
219
201
|
} else {
|
|
220
|
-
const
|
|
221
|
-
|
|
202
|
+
const v = Number(f);
|
|
203
|
+
l.push(x[v]);
|
|
222
204
|
}
|
|
223
205
|
}
|
|
224
|
-
return
|
|
225
|
-
}),
|
|
226
|
-
return
|
|
206
|
+
return l;
|
|
207
|
+
}), p = h ? R : y && g ? qe : null;
|
|
208
|
+
return p ? O([
|
|
209
|
+
"`",
|
|
210
|
+
Ee([p, O($)]),
|
|
211
|
+
p,
|
|
212
|
+
"`"
|
|
213
|
+
]) : ve(
|
|
227
214
|
{ hug: !1 },
|
|
228
|
-
|
|
215
|
+
O([
|
|
229
216
|
"`",
|
|
217
|
+
y,
|
|
218
|
+
O($),
|
|
230
219
|
g,
|
|
231
|
-
w(x),
|
|
232
|
-
f,
|
|
233
220
|
"`"
|
|
234
221
|
])
|
|
235
222
|
);
|
|
236
|
-
} catch (
|
|
237
|
-
throw console.error(
|
|
223
|
+
} catch (a) {
|
|
224
|
+
throw console.error(a), a;
|
|
238
225
|
}
|
|
239
|
-
},
|
|
226
|
+
}, Oe = {
|
|
227
|
+
"sql-formatter": (e) => G.includes(e),
|
|
228
|
+
"node-sql-parser": (e) => W.includes(e)
|
|
229
|
+
};
|
|
230
|
+
function B(e, t) {
|
|
231
|
+
for (const n of t)
|
|
232
|
+
if (Oe[n](e))
|
|
233
|
+
return {
|
|
234
|
+
formatter: n,
|
|
235
|
+
language: e
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function F(e, t, n) {
|
|
239
|
+
let o = B(e, n);
|
|
240
|
+
if (o)
|
|
241
|
+
return o;
|
|
242
|
+
const r = t.indexOf(e);
|
|
243
|
+
for (let s = r - 1; s >= 0; --s)
|
|
244
|
+
if (o = B(t[s], n), o)
|
|
245
|
+
return o;
|
|
246
|
+
}
|
|
247
|
+
function Te(e, t, n) {
|
|
248
|
+
return e.formatter === "sql-formatter" ? F(t, n, [
|
|
249
|
+
"sql-formatter",
|
|
250
|
+
"node-sql-parser"
|
|
251
|
+
]) : F(t, n, [
|
|
252
|
+
"node-sql-parser",
|
|
253
|
+
"sql-formatter"
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
257
|
+
__proto__: null,
|
|
258
|
+
NODE_SQL_PARSER_DATABASES: W,
|
|
259
|
+
SQL_FORMATTER_LANGUAGES: G,
|
|
260
|
+
embedder: we,
|
|
261
|
+
name: xe,
|
|
262
|
+
option: _e
|
|
263
|
+
}, Symbol.toStringTag, { value: "Module" })), M = "embeddedXml";
|
|
264
|
+
function P(e, t) {
|
|
265
|
+
const n = new SyntaxError(
|
|
266
|
+
e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")"
|
|
267
|
+
);
|
|
268
|
+
return Object.assign(n, t);
|
|
269
|
+
}
|
|
270
|
+
const Ne = {
|
|
271
|
+
parse(e) {
|
|
272
|
+
const { lexErrors: t, parseErrors: n, cst: o } = Y(e);
|
|
273
|
+
if (t.length > 0) {
|
|
274
|
+
const r = t[0];
|
|
275
|
+
throw P(r.message, {
|
|
276
|
+
loc: {
|
|
277
|
+
start: { line: r.line, column: r.column },
|
|
278
|
+
end: {
|
|
279
|
+
line: r.line,
|
|
280
|
+
column: r.column + r.length
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (n.length > 0) {
|
|
286
|
+
const r = n[0];
|
|
287
|
+
throw P(r.message, {
|
|
288
|
+
loc: {
|
|
289
|
+
start: {
|
|
290
|
+
line: r.token.startLine ?? NaN,
|
|
291
|
+
column: r.token.startColumn ?? NaN
|
|
292
|
+
},
|
|
293
|
+
end: {
|
|
294
|
+
line: r.token.endLine ?? NaN,
|
|
295
|
+
column: r.token.endColumn ?? NaN
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return o;
|
|
301
|
+
},
|
|
302
|
+
astFormat: "xml",
|
|
303
|
+
locStart(e) {
|
|
304
|
+
return e.location.startOffset;
|
|
305
|
+
},
|
|
306
|
+
locEnd(e) {
|
|
307
|
+
return e.location.endOffset ?? NaN;
|
|
308
|
+
}
|
|
309
|
+
}, { label: ke, hardline: je, line: Ae, group: T, indent: Le } = E, { mapDoc: Ie } = N, Ue = async (e, t, n, o, r) => {
|
|
310
|
+
try {
|
|
311
|
+
A("@prettier/plugin-xml", o, r);
|
|
312
|
+
const s = k(), { node: a } = n, b = a.quasis.map(
|
|
313
|
+
(p, i, { length: l }) => i === l - 1 ? p.value.cooked : p.value.cooked + `${s}-${i}`
|
|
314
|
+
).join("");
|
|
315
|
+
let d = "", y = 0;
|
|
316
|
+
const g = /^\s+/.exec(b);
|
|
317
|
+
g && (y = g.index + g[0].length, d = " ");
|
|
318
|
+
const x = /\s$/.test(b) ? " " : "", _ = j(n, t), q = await e(b.slice(y), {
|
|
319
|
+
parser: M
|
|
320
|
+
}), h = Ie(q, (p) => {
|
|
321
|
+
if (typeof p != "string")
|
|
322
|
+
return p;
|
|
323
|
+
const i = [], l = p.split(new RegExp(s + "-(\\d+)", "g"));
|
|
324
|
+
for (let m = 0; m < l.length; m++) {
|
|
325
|
+
let u = l[m];
|
|
326
|
+
if (m % 2 == 0) {
|
|
327
|
+
if (!u)
|
|
328
|
+
continue;
|
|
329
|
+
u = u.replaceAll(/([\\`]|\${)/g, "\\$1"), i.push(u);
|
|
330
|
+
} else {
|
|
331
|
+
const f = Number(u);
|
|
332
|
+
i.push(_[f]);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return i;
|
|
336
|
+
}), $ = o.xmlWhitespaceSensitivity === "ignore" ? je : d && x ? Ae : null;
|
|
337
|
+
return $ ? T([
|
|
338
|
+
"`",
|
|
339
|
+
Le([$, T(h)]),
|
|
340
|
+
$,
|
|
341
|
+
"`"
|
|
342
|
+
]) : ke(
|
|
343
|
+
{ hug: !1 },
|
|
344
|
+
T([
|
|
345
|
+
"`",
|
|
346
|
+
d,
|
|
347
|
+
T(h),
|
|
348
|
+
x,
|
|
349
|
+
"`"
|
|
350
|
+
])
|
|
351
|
+
);
|
|
352
|
+
} catch (s) {
|
|
353
|
+
throw console.error(s), s;
|
|
354
|
+
}
|
|
355
|
+
}, Re = {
|
|
240
356
|
category: "Global",
|
|
241
357
|
type: "string",
|
|
242
358
|
array: !0,
|
|
243
|
-
default: [{ value: ["
|
|
244
|
-
description: "
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
359
|
+
default: [{ value: ["xml", "svg"] }],
|
|
360
|
+
description: "Specify embedded XML languages. This requires @prettier/plugin-xml"
|
|
361
|
+
}, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
362
|
+
__proto__: null,
|
|
363
|
+
embedder: Ue,
|
|
364
|
+
name: M,
|
|
365
|
+
option: Re,
|
|
366
|
+
parser: Ne
|
|
367
|
+
}, Symbol.toStringTag, { value: "Module" })), L = [], z = {}, V = {}, Q = {}, Fe = /* @__PURE__ */ Object.assign({
|
|
368
|
+
"./noop/index.ts": te,
|
|
369
|
+
"./php/index.ts": $e,
|
|
370
|
+
"./sql/index.ts": De,
|
|
371
|
+
"./xml/index.ts": Be
|
|
372
|
+
});
|
|
373
|
+
Object.values(Fe).forEach(({ name: e, parser: t, embedder: n, option: o }) => {
|
|
374
|
+
de(L, e, C), t && (z[e] = t), n && (V[e] = n), Q[e] = o;
|
|
375
|
+
});
|
|
376
|
+
const Je = {
|
|
257
377
|
// parsers from internal
|
|
258
|
-
|
|
259
|
-
...
|
|
260
|
-
...
|
|
261
|
-
...
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
378
|
+
// TODO: find out which parsers are required and which are optional
|
|
379
|
+
...H.parsers,
|
|
380
|
+
...X.parsers,
|
|
381
|
+
...J.parsers,
|
|
382
|
+
...K.parsers,
|
|
383
|
+
// parsers from this plugin
|
|
384
|
+
...z
|
|
385
|
+
};
|
|
386
|
+
console.log(L);
|
|
387
|
+
const { estree: D } = Z, Pe = function(e, t) {
|
|
265
388
|
var o;
|
|
266
|
-
const { node:
|
|
267
|
-
if (
|
|
389
|
+
const { node: n } = e;
|
|
390
|
+
if (n.type !== "TemplateLiteral" || n.quasis.some(({ value: { cooked: r } }) => r === null))
|
|
268
391
|
return null;
|
|
269
|
-
for (const
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
392
|
+
for (const r of L) {
|
|
393
|
+
const s = t[r];
|
|
394
|
+
if (!s)
|
|
272
395
|
continue;
|
|
273
|
-
const
|
|
274
|
-
|
|
396
|
+
const a = Ce(
|
|
397
|
+
e,
|
|
398
|
+
s,
|
|
399
|
+
t.disableEmbeddedDetectionByComment ?? []
|
|
400
|
+
) ?? Ge(e, s, t.disableEmbeddedDetectionByTag ?? []);
|
|
401
|
+
if (a === void 0)
|
|
275
402
|
continue;
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
403
|
+
const b = V[r];
|
|
404
|
+
if (!b)
|
|
405
|
+
return null;
|
|
406
|
+
const d = e.node;
|
|
407
|
+
return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (...y) => {
|
|
408
|
+
const g = await b(...y, a, s);
|
|
409
|
+
return E.label(
|
|
410
|
+
{ embed: !0, ...g.label },
|
|
411
|
+
g
|
|
282
412
|
);
|
|
283
413
|
};
|
|
284
414
|
}
|
|
285
|
-
return ((o =
|
|
415
|
+
return ((o = D.embed) == null ? void 0 : o.call(D, e, t)) ?? null;
|
|
286
416
|
};
|
|
287
|
-
function
|
|
288
|
-
if (
|
|
417
|
+
function Ce({ node: e, parent: t }, n, o) {
|
|
418
|
+
if (n.length === 0 || e.type !== "TemplateLiteral")
|
|
289
419
|
return;
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
420
|
+
const r = e.comments ?? (t == null ? void 0 : t.comments);
|
|
421
|
+
if (!r)
|
|
292
422
|
return;
|
|
293
|
-
const
|
|
294
|
-
if (!(
|
|
295
|
-
for (const
|
|
296
|
-
if (` ${
|
|
297
|
-
return
|
|
423
|
+
const s = r[r.length - 1];
|
|
424
|
+
if (!(s.type !== "Block" || !s.leading)) {
|
|
425
|
+
for (const a of n)
|
|
426
|
+
if (` ${a} ` === s.value && !o.includes(a))
|
|
427
|
+
return a;
|
|
298
428
|
}
|
|
299
429
|
}
|
|
300
|
-
function
|
|
301
|
-
if (
|
|
302
|
-
for (const
|
|
303
|
-
if (t.tag.name === o)
|
|
304
|
-
return
|
|
430
|
+
function Ge({ node: e, parent: t }, n, o) {
|
|
431
|
+
if (n.length !== 0 && !(e.type !== "TemplateLiteral" || (t == null ? void 0 : t.type) !== "TaggedTemplateExpression" || t.tag.type !== "Identifier")) {
|
|
432
|
+
for (const r of n)
|
|
433
|
+
if (t.tag.name === r && !o.includes(r))
|
|
434
|
+
return r;
|
|
305
435
|
}
|
|
306
436
|
}
|
|
307
|
-
const
|
|
437
|
+
const Ke = {
|
|
308
438
|
estree: {
|
|
309
|
-
...
|
|
310
|
-
embed:
|
|
439
|
+
...D,
|
|
440
|
+
embed: Pe
|
|
441
|
+
}
|
|
442
|
+
}, Ye = {
|
|
443
|
+
...Q,
|
|
444
|
+
disableEmbeddedDetectionByComment: {
|
|
445
|
+
category: "Global",
|
|
446
|
+
type: "string",
|
|
447
|
+
array: !0,
|
|
448
|
+
default: [{ value: [] }],
|
|
449
|
+
description: 'This option turns off "/* lang */`...`" comment-based language detection for the specified languages.'
|
|
450
|
+
},
|
|
451
|
+
disableEmbeddedDetectionByTag: {
|
|
452
|
+
category: "Global",
|
|
453
|
+
type: "string",
|
|
454
|
+
array: !0,
|
|
455
|
+
default: [{ value: [] }],
|
|
456
|
+
description: 'This option turns off "lang`...`" tag-based language detection for the specified languages.'
|
|
311
457
|
}
|
|
312
|
-
}, Ne = {
|
|
313
|
-
...pe
|
|
314
458
|
};
|
|
315
459
|
export {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
460
|
+
V as embeddedEmbedders,
|
|
461
|
+
L as embeddedNames,
|
|
462
|
+
Q as embeddedOptions,
|
|
463
|
+
z as embeddedParsers,
|
|
464
|
+
Ye as options,
|
|
465
|
+
Je as parsers,
|
|
466
|
+
Ke as printers
|
|
319
467
|
};
|
package/dist/options.d.ts
CHANGED
package/dist/parsers.d.ts
CHANGED
package/dist/printers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Plugin } from "prettier";
|
|
2
2
|
export declare const printers: Plugin["printers"];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Options, Doc, AstPath } from "prettier";
|
|
2
2
|
import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree";
|
|
3
|
-
export * from "./embedded/types.js";
|
|
4
3
|
export type PrettierNode = EsTreeNode & {
|
|
5
4
|
comments?: (Comment & {
|
|
6
5
|
leading: boolean;
|
|
@@ -9,4 +8,4 @@ export type PrettierNode = EsTreeNode & {
|
|
|
9
8
|
})[];
|
|
10
9
|
};
|
|
11
10
|
export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
|
|
12
|
-
export type
|
|
11
|
+
export type Embedder<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, lang: string, langs: string[]) => Promise<Doc>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "prettier-plugin-embed",
|
|
3
3
|
"description": "A prettier plugin to format embedded languages in js/ts files.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"./dist"
|
|
@@ -54,15 +54,14 @@
|
|
|
54
54
|
"ncu": "npx npm-check-updates -u",
|
|
55
55
|
"postncu": "npm i"
|
|
56
56
|
},
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"prettier": "^3.0.3",
|
|
60
|
-
"@prettier/plugin-xml": "^3.2.1",
|
|
61
|
-
"prettier-plugin-sql": "^0.15.1"
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"uuid": "^9.0.1"
|
|
62
59
|
},
|
|
63
60
|
"devDependencies": {
|
|
64
61
|
"@commitlint/cli": "^17.7.2",
|
|
65
62
|
"@commitlint/config-conventional": "^17.7.0",
|
|
63
|
+
"@prettier/plugin-php": "^0.20.1",
|
|
64
|
+
"@prettier/plugin-xml": "^3.2.1",
|
|
66
65
|
"@semantic-release/git": "^10.0.1",
|
|
67
66
|
"@types/estree": "^1.0.2",
|
|
68
67
|
"@types/uuid": "^9.0.4",
|
|
@@ -73,14 +72,16 @@
|
|
|
73
72
|
"@vitest/ui": "^0.34.6",
|
|
74
73
|
"code-tag": "^1.1.0",
|
|
75
74
|
"eslint": "^8.50.0",
|
|
76
|
-
"npm-check-updates": "^16.14.
|
|
75
|
+
"npm-check-updates": "^16.14.5",
|
|
77
76
|
"playwright": "^1.38.1",
|
|
77
|
+
"prettier-plugin-sql": "^0.15.1",
|
|
78
78
|
"semantic-release": "^22.0.5",
|
|
79
79
|
"typescript": "^5.2.2",
|
|
80
|
-
"vite": "^4.4.
|
|
80
|
+
"vite": "^4.4.11",
|
|
81
81
|
"vitest": "^0.34.6"
|
|
82
82
|
},
|
|
83
|
-
"
|
|
84
|
-
"
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"@xml-tools/parser": "^1.0.11",
|
|
85
|
+
"prettier": "^3.0.3"
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { name } from "./name.js";
|
|
2
|
-
import { SqlBaseOptions as PrettierPluginSqlOptions } from "prettier-plugin-sql";
|
|
3
|
-
export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "hive", "mariadb", "mysql", "postgresql", "db2", "plsql", "n1ql", "redshift", "singlestoredb", "spark", "sqlite", "transactsql", "tsql", "trino"];
|
|
4
|
-
export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql"];
|
|
5
|
-
export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number];
|
|
6
|
-
export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number];
|
|
7
|
-
export interface PrettierPluginEmbedSqlOptions {
|
|
8
|
-
[name]?: SqlFormatterLanguage[] | NodeSqlParserDataBase[];
|
|
9
|
-
}
|
|
10
|
-
declare module "prettier" {
|
|
11
|
-
interface Options extends PrettierPluginSqlOptions, PrettierPluginEmbedSqlOptions {
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { name } from "./name.js";
|
|
2
|
-
export interface PrettierPluginXmlOptions {
|
|
3
|
-
xmlSelfClosingSpace?: boolean;
|
|
4
|
-
xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
|
|
5
|
-
xmlSortAttributesByKey?: boolean;
|
|
6
|
-
xmlQuoteAttributes?: "preserve" | "single" | "double";
|
|
7
|
-
}
|
|
8
|
-
export interface PrettierPluginEmbedXmlOptions {
|
|
9
|
-
[name]?: string[];
|
|
10
|
-
}
|
|
11
|
-
declare module "prettier" {
|
|
12
|
-
interface Options extends PrettierPluginXmlOptions, PrettierPluginEmbedXmlOptions {
|
|
13
|
-
}
|
|
14
|
-
}
|