prettier-plugin-sql
Advanced tools
Comparing version 0.15.3 to 0.16.0
@@ -7,5 +7,7 @@ /// <reference path="../shim.d.ts" /> | ||
declare const NODE_SQL_PARSER = "node-sql-parser"; | ||
declare const SQL_CST = "sql-cst"; | ||
export type SqlBaseOptions = Option & Partial<FormatOptions> & { | ||
language?: string; | ||
formatter?: typeof NODE_SQL_PARSER | typeof SQL_FORMATTER; | ||
formatter?: typeof NODE_SQL_PARSER | typeof SQL_CST | typeof SQL_FORMATTER; | ||
params?: string; | ||
paramTypes?: string; | ||
@@ -12,0 +14,0 @@ }; |
@@ -8,2 +8,3 @@ import { JSOX } from 'jsox'; | ||
const NODE_SQL_PARSER = 'node-sql-parser'; | ||
const SQL_CST = 'sql-cst'; | ||
const ENDINGS = { | ||
@@ -30,3 +31,3 @@ lf: '\n', | ||
sql: { | ||
print(path, { type, database, endOfLine, paramTypes, ...options }) { | ||
print(path, { type, database, endOfLine, params, paramTypes, ...options }) { | ||
const value = path.node; | ||
@@ -36,2 +37,5 @@ let formatted = typeof value === 'string' | ||
...options, | ||
params: params == null | ||
? undefined | ||
: JSOX.parse(params), | ||
paramTypes: paramTypes == null | ||
@@ -63,2 +67,6 @@ ? undefined | ||
}, | ||
{ | ||
value: SQL_CST, | ||
description: 'use `prettier-plugin-sql-cst` under the hood', | ||
}, | ||
], | ||
@@ -81,2 +89,14 @@ }, | ||
{ | ||
value: 'db2', | ||
description: 'IBM DB2: https://www.ibm.com/products/db2', | ||
}, | ||
{ | ||
value: 'db2i', | ||
description: 'IBM DB2i (experimental): https://www.ibm.com/docs/en/i/7.5?topic=overview-db2-i', | ||
}, | ||
{ | ||
value: 'hive', | ||
description: 'Apache Hive: https://hive.apache.org', | ||
}, | ||
{ | ||
value: 'mariadb', | ||
@@ -90,10 +110,6 @@ description: 'MariaDB: https://mariadb.com', | ||
{ | ||
value: 'postgresql', | ||
description: 'PostgreSQL: https://www.postgresql.org', | ||
value: 'n1ql', | ||
description: 'Couchbase N1QL: https://www.couchbase.com/products/n1ql', | ||
}, | ||
{ | ||
value: 'db2', | ||
description: 'IBM DB2: https://www.ibm.com/analytics/db2', | ||
}, | ||
{ | ||
value: 'plsql', | ||
@@ -103,4 +119,4 @@ description: 'Oracle PL/SQL: https://www.oracle.com/database/technologies/appdev/plsql.html', | ||
{ | ||
value: 'n1ql', | ||
description: 'Couchbase N1QL: https://www.couchbase.com/products/n1ql', | ||
value: 'postgresql', | ||
description: 'PostgreSQL: https://www.postgresql.org', | ||
}, | ||
@@ -116,2 +132,6 @@ { | ||
{ | ||
value: 'snowflake', | ||
description: 'Snowflake: https://docs.snowflake.com', | ||
}, | ||
{ | ||
value: 'spark', | ||
@@ -125,6 +145,2 @@ description: 'Spark: https://spark.apache.org', | ||
{ | ||
value: 'trino', | ||
description: 'Trino: https://trino.io', | ||
}, | ||
{ | ||
value: 'transactsql', | ||
@@ -137,2 +153,6 @@ description: 'SQL Server Transact-SQL: https://docs.microsoft.com/en-us/sql/sql-server/', | ||
}, | ||
{ | ||
value: 'trino', | ||
description: 'Trino: https://trino.io', | ||
}, | ||
], | ||
@@ -258,20 +278,4 @@ }, | ||
category: 'Format', | ||
type: 'choice', | ||
description: 'Specifies parameter values to fill in for placeholders inside SQL for `sql-formatter`. This option is designed to be used through API (though nothing really prevents usage from command line).', | ||
choices: [ | ||
{ | ||
value: Array, | ||
description: '`Array` of strings and/or numbers for position placeholders', | ||
}, | ||
{ | ||
value: Object, | ||
description: '`Object` of name-value pairs for named (and indexed) placeholders', | ||
}, | ||
], | ||
exception(value) { | ||
return (value == null || | ||
(Array.isArray(value) | ||
? value.every((v) => typeof v === 'string' || typeof v === 'number') | ||
: typeof value === 'object')); | ||
}, | ||
type: 'string', | ||
description: 'Specifies `JSOX` **stringified** parameter values to fill in for placeholders inside SQL for `sql-formatter`. This option is designed to be used through API (though nothing really prevents usage from command line).', | ||
}, | ||
@@ -337,2 +341,6 @@ paramTypes: { | ||
}, | ||
{ | ||
value: 'snowflake', | ||
description: 'Snowflake (alpha): https://docs.snowflake.com', | ||
}, | ||
], | ||
@@ -339,0 +347,0 @@ }, |
{ | ||
"name": "prettier-plugin-sql", | ||
"version": "0.15.3", | ||
"version": "0.16.0", | ||
"type": "module", | ||
@@ -49,5 +49,5 @@ "description": "An opinionated sql formatter plugin for Prettier", | ||
"jsox": "^1.2.118", | ||
"node-sql-parser": "^4.7.0", | ||
"sql-formatter": "^12.2.4", | ||
"tslib": "^2.6.0" | ||
"node-sql-parser": "^4.11.0", | ||
"sql-formatter": "^13.1.0", | ||
"tslib": "^2.6.2" | ||
}, | ||
@@ -54,0 +54,0 @@ "publishConfig": { |
@@ -60,11 +60,13 @@ # prettier-plugin-sql ![npm bundle size](https://img.shields.io/bundlephobia/min/prettier-plugin-sql) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/prettier-plugin-sql) | ||
| 'bigquery' | ||
| 'db2' | ||
| 'db2i' // (experimental) | ||
| 'hive' | ||
| 'mariadb' | ||
| 'mysql' | ||
| 'n1ql' | ||
| 'postgresql' | ||
| 'db2' | ||
| 'plsql' | ||
| 'n1ql' | ||
| 'redshift' | ||
| 'singlestoredb' | ||
| 'snowflake' | ||
| 'spark' | ||
@@ -74,3 +76,4 @@ | 'sqlite' | ||
| 'tsql' | ||
| 'trino' // default `sql` | ||
| 'trino' | ||
// default `sql` | ||
keywordCase: 'preserve' | 'upper' | 'lower' // default `preserve` | ||
@@ -85,3 +88,4 @@ indentStyle: 'standard' | 'tabularLeft' | 'tabularRight' // default `standard` | ||
newlineBeforeSemicolon: boolean // default `false` | ||
params: Array | Object | ||
params: string // `JSOX` **stringified**, please refer https://github.com/sql-formatter-org/sql-formatter/blob/master/docs/params.md for more details | ||
paramTypes: string // `JSOX` **stringified**, please refer https://github.com/sql-formatter-org/sql-formatter/blob/master/docs/paramTypes.md for more details | ||
@@ -98,3 +102,5 @@ // node-sql-parser | ||
| 'transactsql' | ||
| 'flinksql' // default `mysql` | ||
| 'flinksql' | ||
| 'snowflake' // (alpha) | ||
// default `mysql` | ||
} | ||
@@ -113,2 +119,4 @@ ``` | ||
[![Backers](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin) | ||
| 1stG | RxTS | UnTS | | ||
@@ -115,0 +123,0 @@ | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
63442
1009
135
+ Addedsql-formatter@13.1.0(transitive)
- Removedsql-formatter@12.2.4(transitive)
Updatednode-sql-parser@^4.11.0
Updatedsql-formatter@^13.1.0
Updatedtslib@^2.6.2