prettier-plugin-embed
Advanced tools
Comparing version 0.0.3 to 0.0.4
export * from "./register.js"; | ||
export type { EmbeddedNames, EmbeddedParsers, EmbeddedEmbedders, EmbeddedOptions, } from "./types.js"; | ||
export type { EmbeddedName, EmbeddedParsers, EmbeddedEmbedders, EmbeddedOptions, } from "./types.js"; |
@@ -1,2 +0,2 @@ | ||
import { SupportOption } from "prettier"; | ||
import type { SupportOption } from "prettier"; | ||
import { name } from "./name.js"; | ||
@@ -3,0 +3,0 @@ export declare const option: SupportOption; |
@@ -1,2 +0,2 @@ | ||
import { SupportOption } from "prettier"; | ||
import type { SupportOption } from "prettier"; | ||
import { name } from "./name.js"; | ||
@@ -3,0 +3,0 @@ export declare const option: SupportOption; |
@@ -1,5 +0,9 @@ | ||
import type { EmbeddedEmbedders, EmbeddedNames, EmbeddedParsers, EmbeddedOptions } from "./types.js"; | ||
export declare const embeddedNames: EmbeddedNames[]; | ||
import type { EmbeddedEmbedders, EmbeddedName, EmbeddedParsers, EmbeddedOptions } from "./types.js"; | ||
export declare const embeddedNames: EmbeddedName[]; | ||
export declare const embeddedParsers: EmbeddedParsers; | ||
export declare const embeddedEmbedders: EmbeddedEmbedders; | ||
export declare const embeddedOptions: EmbeddedOptions; | ||
import * as __glob__0_0 from "./noop/index.js"; | ||
import * as __glob__0_1 from "./sql/index.js"; | ||
import * as __glob__0_2 from "./php/index.js"; | ||
import * as __glob__0_3 from "./xml/index.js"; |
@@ -1,2 +0,2 @@ | ||
import { SupportOption } from "prettier"; | ||
import type { SupportOption } from "prettier"; | ||
import type { SqlBaseOptions as PrettierPluginDepsOptions } from "prettier-plugin-sql"; | ||
@@ -3,0 +3,0 @@ import { name } from "./name.js"; |
@@ -1,3 +0,3 @@ | ||
import { Parser, SupportOption, Options } from "prettier"; | ||
import { Embedder } from "../types.js"; | ||
import type { Parser, SupportOption, Options } from "prettier"; | ||
import type { Embedder } from "../types.js"; | ||
export interface EmbeddedParsers { | ||
@@ -14,2 +14,2 @@ [name: string]: Parser | undefined; | ||
} | ||
export type EmbeddedNames = keyof EmbeddedNamesHolder; | ||
export type EmbeddedName = keyof EmbeddedNamesHolder; |
@@ -1,5 +0,5 @@ | ||
import { Expression, Comment, TemplateLiteral } from "estree"; | ||
import { AstPath, Options } from "prettier"; | ||
import type { Expression, Comment, TemplateLiteral } from "estree"; | ||
import type { AstPath, Options } from "prettier"; | ||
import { builders } from "prettier/doc"; | ||
import { InternalPrintFun } from "../types.js"; | ||
import type { InternalPrintFun } from "../types.js"; | ||
export declare function printTemplateExpression(path: AstPath<Expression & { | ||
@@ -6,0 +6,0 @@ comments?: Comment[]; |
@@ -1,2 +0,2 @@ | ||
import { SupportOption } from "prettier"; | ||
import type { SupportOption } from "prettier"; | ||
import { name } from "./name.js"; | ||
@@ -3,0 +3,0 @@ export declare const option: SupportOption; |
@@ -8,3 +8,3 @@ import H from "prettier/parser-babel"; | ||
import { printers as Z } from "prettier/plugins/estree.mjs"; | ||
const C = "embeddedNoop", ee = { | ||
const P = "embeddedNoop", ee = { | ||
category: "Global", | ||
@@ -17,3 +17,3 @@ type: "string", | ||
__proto__: null, | ||
name: C, | ||
name: P, | ||
option: ee | ||
@@ -34,8 +34,8 @@ }, Symbol.toStringTag, { value: "Module" })), ne = "embeddedPhp"; | ||
} | ||
const ie = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), I = { | ||
const ie = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), L = { | ||
randomUUID: ie | ||
}; | ||
function k(e, t, n) { | ||
if (I.randomUUID && !t && !e) | ||
return I.randomUUID(); | ||
if (L.randomUUID && !t && !e) | ||
return L.randomUUID(); | ||
e = e || {}; | ||
@@ -51,3 +51,3 @@ const o = e.random || (e.rng || oe)(); | ||
} | ||
const { group: le, indent: ce, softline: U, lineSuffixBoundary: ae } = E; | ||
const { group: le, indent: ce, softline: I, lineSuffixBoundary: ae } = E; | ||
function ue(e, t) { | ||
@@ -57,3 +57,3 @@ var r; | ||
let o = t(); | ||
return (r = n == null ? void 0 : n.comments) != null && r.length && (o = le([ce([U, o]), U])), ["${", o, ae, "}"]; | ||
return (r = n == null ? void 0 : n.comments) != null && r.length && (o = le([ce([I, o]), I])), ["${", o, ae, "}"]; | ||
} | ||
@@ -154,3 +154,3 @@ function j(e, t) { | ||
description: "Specify embedded SQL languages. This requires prettier-plugin-sql" | ||
}, G = [ | ||
}, C = [ | ||
"sql", | ||
@@ -172,3 +172,3 @@ "bigquery", | ||
"trino" | ||
], W = [ | ||
], G = [ | ||
"bigquery", | ||
@@ -182,3 +182,3 @@ "db2", | ||
"flinksql" | ||
], { label: ve, hardline: R, group: O, line: qe, indent: Ee } = E, { mapDoc: Se } = N, we = async (e, t, n, o, r, s) => { | ||
], { label: ve, hardline: U, group: O, line: qe, indent: Ee } = E, { mapDoc: Se } = N, we = async (e, t, n, o, r, s) => { | ||
try { | ||
@@ -207,3 +207,3 @@ A("prettier-plugin-sql", o, r); | ||
(v) => v === ` | ||
` ? (h = !0, l.push(R)) : l.push(v) | ||
` ? (h = !0, l.push(U)) : l.push(v) | ||
); | ||
@@ -216,3 +216,3 @@ } else { | ||
return l; | ||
}), p = h ? R : y && g ? qe : null; | ||
}), p = h ? U : y && g ? qe : null; | ||
return p ? O([ | ||
@@ -237,6 +237,6 @@ "`", | ||
}, Oe = { | ||
"sql-formatter": (e) => G.includes(e), | ||
"node-sql-parser": (e) => W.includes(e) | ||
"sql-formatter": (e) => C.includes(e), | ||
"node-sql-parser": (e) => G.includes(e) | ||
}; | ||
function B(e, t) { | ||
function R(e, t) { | ||
for (const n of t) | ||
@@ -249,4 +249,4 @@ if (Oe[n](e)) | ||
} | ||
function F(e, t, n) { | ||
let o = B(e, n); | ||
function B(e, t, n) { | ||
let o = R(e, n); | ||
if (o) | ||
@@ -256,10 +256,10 @@ return o; | ||
for (let s = r - 1; s >= 0; --s) | ||
if (o = B(t[s], n), o) | ||
if (o = R(t[s], n), o) | ||
return o; | ||
} | ||
function Te(e, t, n) { | ||
return e.formatter === "sql-formatter" ? F(t, n, [ | ||
return e.formatter === "sql-formatter" ? B(t, n, [ | ||
"sql-formatter", | ||
"node-sql-parser" | ||
]) : F(t, n, [ | ||
]) : B(t, n, [ | ||
"node-sql-parser", | ||
@@ -271,9 +271,9 @@ "sql-formatter" | ||
__proto__: null, | ||
NODE_SQL_PARSER_DATABASES: W, | ||
SQL_FORMATTER_LANGUAGES: G, | ||
NODE_SQL_PARSER_DATABASES: G, | ||
SQL_FORMATTER_LANGUAGES: C, | ||
embedder: we, | ||
name: xe, | ||
option: _e | ||
}, Symbol.toStringTag, { value: "Module" })), M = "embeddedXml"; | ||
function P(e, t) { | ||
}, Symbol.toStringTag, { value: "Module" })), W = "embeddedXml"; | ||
function F(e, t) { | ||
const n = new SyntaxError( | ||
@@ -289,3 +289,3 @@ e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")" | ||
const r = t[0]; | ||
throw P(r.message, { | ||
throw F(r.message, { | ||
loc: { | ||
@@ -302,3 +302,3 @@ start: { line: r.line, column: r.column }, | ||
const r = n[0]; | ||
throw P(r.message, { | ||
throw F(r.message, { | ||
loc: { | ||
@@ -335,3 +335,3 @@ start: { | ||
const x = /\s$/.test(b) ? " " : "", _ = j(n, t), q = await e(b.slice(y), { | ||
parser: M | ||
parser: W | ||
}), h = Ie(q, (p) => { | ||
@@ -381,6 +381,6 @@ if (typeof p != "string") | ||
embedder: Ue, | ||
name: M, | ||
name: W, | ||
option: Re, | ||
parser: Ne | ||
}, Symbol.toStringTag, { value: "Module" })), L = [], z = {}, V = {}, Q = {}, Fe = /* @__PURE__ */ Object.assign({ | ||
}, Symbol.toStringTag, { value: "Module" })), M = [], z = {}, V = {}, Q = {}, Fe = /* @__PURE__ */ Object.assign({ | ||
"./noop/index.ts": te, | ||
@@ -392,3 +392,3 @@ "./php/index.ts": $e, | ||
Object.values(Fe).forEach(({ name: e, parser: t, embedder: n, option: o }) => { | ||
de(L, e, C), t && (z[e] = t), n && (V[e] = n), Q[e] = o; | ||
de(M, e, P), t && (z[e] = t), n && (V[e] = n), Q[e] = o; | ||
}); | ||
@@ -404,5 +404,3 @@ const Je = { | ||
...z | ||
}; | ||
console.log(L); | ||
const { estree: D } = Z, Pe = function(e, t) { | ||
}, { estree: D } = Z, Pe = function(e, t) { | ||
var o; | ||
@@ -412,3 +410,3 @@ const { node: n } = e; | ||
return null; | ||
for (const r of L) { | ||
for (const r of M) { | ||
const s = t[r]; | ||
@@ -420,4 +418,4 @@ if (!s) | ||
s, | ||
t.disableEmbeddedDetectionByComment ?? [] | ||
) ?? Ge(e, s, t.disableEmbeddedDetectionByTag ?? []); | ||
t.noEmbeddedDetectionByComment ?? [] | ||
) ?? Ge(e, s, t.noEmbeddedDetectionByTag ?? []); | ||
if (a === void 0) | ||
@@ -466,3 +464,3 @@ continue; | ||
...Q, | ||
disableEmbeddedDetectionByComment: { | ||
noEmbeddedDetectionByComment: { | ||
category: "Global", | ||
@@ -474,3 +472,3 @@ type: "string", | ||
}, | ||
disableEmbeddedDetectionByTag: { | ||
noEmbeddedDetectionByTag: { | ||
category: "Global", | ||
@@ -485,3 +483,3 @@ type: "string", | ||
V as embeddedEmbedders, | ||
L as embeddedNames, | ||
M as embeddedNames, | ||
Q as embeddedOptions, | ||
@@ -488,0 +486,0 @@ z as embeddedParsers, |
@@ -5,5 +5,5 @@ import type { SupportOptions } from "prettier"; | ||
interface Options { | ||
disableEmbeddedDetectionByComment?: string[]; | ||
disableEmbeddedDetectionByTag?: string[]; | ||
noEmbeddedDetectionByComment?: string[]; | ||
noEmbeddedDetectionByTag?: string[]; | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Options, Doc, AstPath } from "prettier"; | ||
import type { Options, Doc, AstPath } from "prettier"; | ||
import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree"; | ||
@@ -3,0 +3,0 @@ export type PrettierNode = EsTreeNode & { |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"type": "module", | ||
@@ -50,3 +50,4 @@ "files": [ | ||
"build": "vite build", | ||
"postbuild": "tsc", | ||
"add-glob-import-types": "tsx ./scripts/add-glob-import-types.ts", | ||
"postbuild": "tsc --project ./tsconfig.production.json && npm run add-glob-import-types", | ||
"test": "vitest", | ||
@@ -77,2 +78,3 @@ "test:ui": "vitest --ui", | ||
"eslint": "^8.50.0", | ||
"fast-glob": "^3.3.1", | ||
"npm-check-updates": "^16.14.5", | ||
@@ -82,2 +84,3 @@ "playwright": "^1.38.1", | ||
"semantic-release": "^22.0.5", | ||
"tsx": "^3.13.0", | ||
"typescript": "^5.2.2", | ||
@@ -84,0 +87,0 @@ "vite": "^4.4.11", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25033
696
0
23