prettier-plugin-sql-cst 0.8.0 → 0.8.2

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.
Files changed (56) hide show
  1. package/README.md +6 -4
  2. package/dist/CstToDocMap.d.ts +11 -0
  3. package/dist/PrintFn.d.ts +14 -0
  4. package/dist/embed.d.ts +3 -0
  5. package/dist/embedJs.d.ts +3 -0
  6. package/dist/embedJson.d.ts +3 -0
  7. package/dist/index.d.ts +6 -0
  8. package/dist/node_utils.d.ts +16 -0
  9. package/dist/options.d.ts +8 -0
  10. package/dist/printComment.d.ts +3 -0
  11. package/dist/printSql.d.ts +5 -0
  12. package/dist/print_utils.d.ts +13 -0
  13. package/dist/syntax/alias.d.ts +3 -0
  14. package/dist/syntax/alter_table.d.ts +3 -0
  15. package/dist/syntax/analyze.d.ts +3 -0
  16. package/dist/syntax/base.d.ts +3 -0
  17. package/dist/syntax/bigquery.d.ts +3 -0
  18. package/dist/syntax/constraint.d.ts +3 -0
  19. package/dist/syntax/create_table.d.ts +3 -0
  20. package/dist/syntax/data_type.d.ts +3 -0
  21. package/dist/syntax/dcl.d.ts +3 -0
  22. package/dist/syntax/delete.d.ts +3 -0
  23. package/dist/syntax/delete.js +1 -1
  24. package/dist/syntax/drop_table.d.ts +3 -0
  25. package/dist/syntax/explain.d.ts +3 -0
  26. package/dist/syntax/expr.d.ts +3 -0
  27. package/dist/syntax/expr.js +7 -4
  28. package/dist/syntax/frame.d.ts +3 -0
  29. package/dist/syntax/function.d.ts +3 -0
  30. package/dist/syntax/index.d.ts +3 -0
  31. package/dist/syntax/insert.d.ts +3 -0
  32. package/dist/syntax/merge.d.ts +3 -0
  33. package/dist/syntax/prepared_statements.d.ts +3 -0
  34. package/dist/syntax/proc_clause.d.ts +3 -0
  35. package/dist/syntax/procedural_language.d.ts +3 -0
  36. package/dist/syntax/procedure.d.ts +3 -0
  37. package/dist/syntax/program.d.ts +3 -0
  38. package/dist/syntax/schema.d.ts +3 -0
  39. package/dist/syntax/select.d.ts +3 -0
  40. package/dist/syntax/select.js +1 -1
  41. package/dist/syntax/sqlite.d.ts +3 -0
  42. package/dist/syntax/transaction.d.ts +3 -0
  43. package/dist/syntax/transformMap.d.ts +3 -0
  44. package/dist/syntax/trigger.d.ts +3 -0
  45. package/dist/syntax/truncate.d.ts +3 -0
  46. package/dist/syntax/update.d.ts +3 -0
  47. package/dist/syntax/update.js +1 -1
  48. package/dist/syntax/view.d.ts +3 -0
  49. package/dist/transform/addFinalSemicolon.d.ts +2 -0
  50. package/dist/transform/aliasAs.d.ts +2 -0
  51. package/dist/transform/comments.d.ts +10 -0
  52. package/dist/transform/stripTrailingCommas.d.ts +2 -0
  53. package/dist/transform/transformCst.d.ts +2 -0
  54. package/dist/utils.d.ts +9 -0
  55. package/dist/visitAllNodes.d.ts +2 -0
  56. package/package.json +3 -2
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  A [Prettier][] plugin for SQL that uses [sql-parser-cst][] and the
4
4
  actual [Prettier formatting algorithm][wadler-prettier].
5
5
 
6
+ **[Try it live!][live]**
7
+
6
8
  Like Prettier for JavaScript,
7
9
  this plugin formats SQL expressions differently depending on their length.
8
10
  A short SQL query will be formatted on a single line:
@@ -26,15 +28,15 @@ SELECT
26
28
  client.id,
27
29
  client.name AS client_name,
28
30
  organization.name AS org_name,
29
- count(order.id) AS nr_of_orders
31
+ count(orders.id) AS nr_of_orders
30
32
  FROM
31
33
  client
32
34
  LEFT JOIN organization ON client.organization_id = organization.id
33
- LEFT JOIN order ON order.client_id = client.id
35
+ LEFT JOIN orders ON orders.client_id = client.id
34
36
  WHERE
35
37
  client.status = 'active'
36
38
  AND client.id IN (28, 214, 457)
37
- AND order.status IN ('active', 'pending', 'processing')
39
+ AND orders.status IN ('active', 'pending', 'processing')
38
40
  GROUP BY client.id
39
41
  ORDER BY client.name
40
42
  LIMIT 100;
@@ -109,10 +111,10 @@ The specifics of the [SQL formatting style][STYLE_GUIDE] are still very much sub
109
111
  Though the general principles should be mostly in place by now.
110
112
 
111
113
  [prettier]: https://prettier.io/
114
+ [live]: https://nene.github.io/prettier-sql-playground/
112
115
  [printWidth]: https://prettier.io/docs/en/options.html#print-width
113
116
  [tabWidth]: https://prettier.io/docs/en/options.html#tab-width
114
117
  [useTabs]: https://prettier.io/docs/en/options.html#tabs
115
118
  [sql-parser-cst]: https://github.com/nene/sql-parser-cst
116
119
  [wadler-prettier]: http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf
117
120
  [STYLE_GUIDE]: ./STYLE_GUIDE.md
118
- [#2]: https://github.com/nene/prettier-plugin-sql-cst/issues/2
@@ -0,0 +1,11 @@
1
+ import { Node } from "sql-parser-cst";
2
+ import { AstPath, Doc } from "prettier";
3
+ import { PrintFn } from "./PrintFn";
4
+ import { AllPrettierOptions } from "./options";
5
+ export type NodeByType<TType, TNode> = Extract<TNode, {
6
+ type: TType;
7
+ }>;
8
+ export type ToDocFn<TNode> = (print: PrintFn<TNode>, node: TNode, path: AstPath<TNode>, options: AllPrettierOptions<TNode>) => Doc;
9
+ export type CstToDocMap<TNode extends Node> = {
10
+ [TType in TNode["type"]]: ToDocFn<NodeByType<TType, TNode>>;
11
+ };
@@ -0,0 +1,14 @@
1
+ import { AstPath, Doc } from "prettier";
2
+ import { Node } from "sql-parser-cst";
3
+ export type OldPrintFn = (path: AstPath<Node> | string) => Doc;
4
+ export type PrintFn<T, K = PrintableKey<T>> = {
5
+ (path: AstPath<Node>): Doc;
6
+ (path: K extends keyof T ? (T[K] extends any[] ? K : never) : never): Doc[];
7
+ (path: K): Doc;
8
+ (path: K[]): Doc[];
9
+ spaced(path: K): Doc[];
10
+ spaced(path: K[]): Doc[];
11
+ };
12
+ export type PrintableKey<T> = Exclude<keyof T, ReservedKey>;
13
+ type ReservedKey = "type" | "range" | "leading" | "trailing";
14
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Printer } from "prettier";
2
+ import { Node } from "sql-parser-cst";
3
+ export declare const embed: NonNullable<Printer<Node>["embed"]>;
@@ -0,0 +1,3 @@
1
+ import { Printer } from "prettier";
2
+ import { Node } from "sql-parser-cst";
3
+ export declare const embedJs: NonNullable<Printer<Node>["embed"]>;
@@ -0,0 +1,3 @@
1
+ import { Printer } from "prettier";
2
+ import { Node } from "sql-parser-cst";
3
+ export declare const embedJson: NonNullable<Printer<Node>["embed"]>;
@@ -0,0 +1,6 @@
1
+ import { Node } from "sql-parser-cst";
2
+ import { Parser, Printer, SupportLanguage } from "prettier";
3
+ export { options } from "./options";
4
+ export declare const languages: SupportLanguage[];
5
+ export declare const parsers: Record<string, Parser<Node>>;
6
+ export declare const printers: Record<string, Printer>;
@@ -0,0 +1,16 @@
1
+ import { Node } from "sql-parser-cst";
2
+ export declare const isProgram: (node: any) => node is import("sql-parser-cst").Program;
3
+ export declare const isValuesClause: (node: any) => node is import("sql-parser-cst").ValuesClause;
4
+ export declare const isFuncCall: (node: any) => node is import("sql-parser-cst").FuncCall;
5
+ export declare const isFuncArgs: (node: any) => node is import("sql-parser-cst").FuncArgs;
6
+ export declare const isCreateTableStmt: (node: any) => node is import("sql-parser-cst").CreateTableStmt;
7
+ export declare const isKeyword: (node: any) => node is import("sql-parser-cst").Keyword<string>;
8
+ export declare const isEmpty: (node: any) => node is import("sql-parser-cst").Empty;
9
+ export declare const isJsonLiteral: (node: any) => node is import("sql-parser-cst").JsonLiteral;
10
+ export declare const isStringLiteral: (node: any) => node is import("sql-parser-cst").StringLiteral;
11
+ export declare const isArraySubscript: (node: any) => node is import("sql-parser-cst").ArraySubscript;
12
+ export declare const isAsClause: (node: any) => node is import("sql-parser-cst").AsClause<Node>;
13
+ export declare const isParenExpr: (node: any) => node is import("sql-parser-cst").ParenExpr<Node>;
14
+ export declare const isListExpr: (node: any) => node is import("sql-parser-cst").ListExpr<Node>;
15
+ export declare const isCreateFunctionStmt: (node: any) => node is import("sql-parser-cst").CreateFunctionStmt;
16
+ export declare const isLanguageClause: (node: any) => node is import("sql-parser-cst").LanguageClause;
@@ -0,0 +1,8 @@
1
+ import { ParserOptions, SupportOptions } from "prettier";
2
+ import { Node, ParserOptions as CstParserOptions } from "sql-parser-cst";
3
+ export interface SqlPluginOptions {
4
+ sqlKeywordCase: "preserve" | "upper" | "lower";
5
+ sqlParamTypes: NonNullable<CstParserOptions["paramTypes"]>;
6
+ }
7
+ export type AllPrettierOptions<T = Node> = ParserOptions<T> & SqlPluginOptions;
8
+ export declare const options: SupportOptions;
@@ -0,0 +1,3 @@
1
+ import { AstPath } from "prettier";
2
+ import { Whitespace } from "sql-parser-cst";
3
+ export declare const printComment: (path: AstPath<Whitespace>) => string;
@@ -0,0 +1,5 @@
1
+ import { Node } from "sql-parser-cst";
2
+ import { AstPath, Doc } from "prettier";
3
+ import { OldPrintFn } from "./PrintFn";
4
+ import { AllPrettierOptions } from "./options";
5
+ export declare function printSql(path: AstPath<Node>, options: AllPrettierOptions, oldPrint: OldPrintFn): Doc;
@@ -0,0 +1,13 @@
1
+ import { Doc, doc } from "prettier";
2
+ import { Node } from "sql-parser-cst";
3
+ export declare const line: doc.builders.Line, hardline: doc.builders.Concat, softline: doc.builders.Softline, indent: typeof doc.builders.indent, group: typeof doc.builders.group, lineSuffix: typeof doc.builders.lineSuffix, ifBreak: typeof doc.builders.ifBreak, breakParent: doc.builders.BreakParent;
4
+ export declare const stripTrailingHardline: typeof doc.utils.stripTrailingHardline;
5
+ /** Improved join() that also accepts a non-array docs parameter */
6
+ export declare const join: (sep: Doc, docs: Doc) => Doc;
7
+ /** True when the Node contains a newline in original source code */
8
+ export declare const containsNewline: (node: Node, opts: {
9
+ originalText: string;
10
+ }) => boolean;
11
+ export declare const hasEmptyLineBetweenNodes: (node1: Node, node2: Node, opts: {
12
+ originalText: string;
13
+ }) => boolean;
@@ -0,0 +1,3 @@
1
+ import { Alias } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const aliasMap: CstToDocMap<Alias>;
@@ -0,0 +1,3 @@
1
+ import { AlterTableStmt, AllAlterActionNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const alterTableMap: Partial<CstToDocMap<AlterTableStmt | AllAlterActionNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AnalyzeStmt } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const analyzeMap: CstToDocMap<AnalyzeStmt>;
@@ -0,0 +1,3 @@
1
+ import { AllColumns, Empty, Keyword } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const baseMap: Partial<CstToDocMap<Keyword | Empty | AllColumns>>;
@@ -0,0 +1,3 @@
1
+ import { AllBigqueryNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const bigqueryMap: Partial<CstToDocMap<AllBigqueryNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllConstraintNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const constraintMap: Partial<CstToDocMap<AllConstraintNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllCreateTableNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const createTableMap: Partial<CstToDocMap<AllCreateTableNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllDataTypeNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const dataTypeMap: Partial<CstToDocMap<AllDataTypeNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllDclStatements } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const dclMap: Partial<CstToDocMap<AllDclStatements>>;
@@ -0,0 +1,3 @@
1
+ import { AllDeleteNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const deleteMap: CstToDocMap<AllDeleteNodes>;
@@ -4,5 +4,5 @@ exports.deleteMap = void 0;
4
4
  var print_utils_1 = require("../print_utils");
5
5
  exports.deleteMap = {
6
6
  delete_stmt: function (print) { return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses")); },
7
- delete_clause: function (print) { return print.spaced(["deleteKw", "fromKw", "table"]); },
7
+ delete_clause: function (print) { return print.spaced(["deleteKw", "fromKw", "tables"]); },
8
8
  };
@@ -0,0 +1,3 @@
1
+ import { DropTableStmt } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const dropTableMap: CstToDocMap<DropTableStmt>;
@@ -0,0 +1,3 @@
1
+ import { ExplainStmt } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const explainMap: CstToDocMap<ExplainStmt>;
@@ -0,0 +1,3 @@
1
+ import { AllExprNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const exprMap: Partial<CstToDocMap<AllExprNodes>>;
@@ -103,19 +103,22 @@ exports.exprMap = {
103
103
  return (0, print_utils_1.group)((0, print_utils_1.join)(" ", __spreadArray([fnCall], extras, true)));
104
104
  }
105
105
  },
106
- func_args: function (print) { return print.spaced(["distinctKw", "args"]); },
106
+ func_args: function (print) { return print.spaced(["distinctKw", "args", "having"]); },
107
107
  filter_arg: function (print) { return print.spaced(["filterKw", "where"]); },
108
108
  over_arg: function (print) { return print.spaced(["overKw", "window"]); },
109
+ having_arg: function (print) { return print.spaced(["havingKw", "minMaxKw", "expr"]); },
109
110
  cast_expr: function (print) { return print(["castKw", "args"]); },
110
111
  cast_arg: function (print) { return print.spaced(["expr", "asKw", "dataType", "format"]); },
111
112
  cast_format: function (print) { return print.spaced(["formatKw", "string", "timezone"]); },
112
113
  cast_format_timezone: function (print) { return print.spaced(["atTimeZoneKw", "timezone"]); },
113
114
  raise_expr: function (print) { return print(["raiseKw", "args"]); },
114
115
  raise_expr_type: function (print) { return print("typeKw"); },
116
+ extract_expr: function (print) { return print(["extractKw", "args"]); },
117
+ extract_from: function (print) { return print.spaced(["unit", "fromKw", "expr"]); },
118
+ week_expr: function (print) { return print(["weekKw", "args"]); },
115
119
  interval_expr: function (print) { return print.spaced(["intervalKw", "expr", "unit"]); },
116
- interval_unit_range: function (print) {
117
- return print.spaced(["fromUnitKw", "toKw", "toUnitKw"]);
118
- },
120
+ interval_unit_range: function (print) { return print.spaced(["fromUnit", "toKw", "toUnit"]); },
121
+ interval_unit: function (print) { return print("unitKw"); },
119
122
  array_expr: function (print) {
120
123
  return (0, print_utils_1.group)(["[", (0, print_utils_1.indent)([print_utils_1.softline, print("expr")]), print_utils_1.softline, "]"]);
121
124
  },
@@ -0,0 +1,3 @@
1
+ import { AllFrameNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const frameMap: CstToDocMap<AllFrameNodes>;
@@ -0,0 +1,3 @@
1
+ import { AllFunctionNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const functionMap: Partial<CstToDocMap<AllFunctionNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllIndexNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const indexMap: Partial<CstToDocMap<AllIndexNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllInsertNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const insertMap: Partial<CstToDocMap<AllInsertNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllMergeNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const mergeMap: Partial<CstToDocMap<AllMergeNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllPreparedStatementNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const preparedStatementsMap: Partial<CstToDocMap<AllPreparedStatementNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllProcClauseNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const procClauseMap: Partial<CstToDocMap<AllProcClauseNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllProceduralNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const proceduralLanguageMap: Partial<CstToDocMap<AllProceduralNodes>>;
@@ -0,0 +1,3 @@
1
+ import { AllProcedureNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const procedureMap: Partial<CstToDocMap<AllProcedureNodes>>;
@@ -0,0 +1,3 @@
1
+ import { Program } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const programMap: CstToDocMap<Program>;
@@ -0,0 +1,3 @@
1
+ import { AllSchemaStatements } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const schemaMap: Partial<CstToDocMap<AllSchemaStatements>>;
@@ -0,0 +1,3 @@
1
+ import { AllSelectNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const selectMap: Partial<CstToDocMap<AllSelectNodes>>;
@@ -17,7 +17,7 @@ exports.selectMap = {
17
17
  (0, print_utils_1.indent)([print_utils_1.line, print("tables")]),
18
18
  ]);
19
19
  },
20
- common_table_expression: function (print) { return [
20
+ common_table_expr: function (print) { return [
21
21
  print(["table", "columns"]),
22
22
  " ",
23
23
  print.spaced(["asKw", "materializedKw", "expr"]),
@@ -0,0 +1,3 @@
1
+ import { AllSqliteNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const sqliteMap: CstToDocMap<AllSqliteNodes>;
@@ -0,0 +1,3 @@
1
+ import { AllTransactionNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const transactionMap: CstToDocMap<AllTransactionNodes>;
@@ -0,0 +1,3 @@
1
+ import { Node } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const transformMap: Partial<CstToDocMap<Node>>;
@@ -0,0 +1,3 @@
1
+ import { AllTriggerNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const triggerMap: Partial<CstToDocMap<AllTriggerNodes>>;
@@ -0,0 +1,3 @@
1
+ import { TruncateStmt } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const truncateMap: CstToDocMap<TruncateStmt>;
@@ -0,0 +1,3 @@
1
+ import { AllUpdateNodes } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const updateMap: Partial<CstToDocMap<AllUpdateNodes>>;
@@ -5,7 +5,7 @@ var print_utils_1 = require("../print_utils");
5
5
  exports.updateMap = {
6
6
  update_stmt: function (print) { return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses")); },
7
7
  update_clause: function (print) {
8
- return print.spaced(["updateKw", "options", "orAction", "tables"]);
8
+ return print.spaced(["updateKw", "hints", "orAction", "tables"]);
9
9
  },
10
10
  set_clause: function (print, node) {
11
11
  if (node.assignments.items.length > 1) {
@@ -0,0 +1,3 @@
1
+ import { AllViewStatements } from "sql-parser-cst";
2
+ import { CstToDocMap } from "../CstToDocMap";
3
+ export declare const viewMap: Partial<CstToDocMap<AllViewStatements>>;
@@ -0,0 +1,2 @@
1
+ import { Program } from "sql-parser-cst";
2
+ export declare const addFinalSemicolon: (program: Program, originalText: string) => Program;
@@ -0,0 +1,2 @@
1
+ import { Program } from "sql-parser-cst";
2
+ export declare const processAliasAs: (cst: Program) => Program;
@@ -0,0 +1,10 @@
1
+ import { Program, Whitespace } from "sql-parser-cst";
2
+ /**
3
+ * Gathers comments from .leading and .trailing fields of all nodes
4
+ * into a single .comments field in root Program node.
5
+ *
6
+ * Deletes the .leading and .trailing fields of all nodes.
7
+ */
8
+ export declare const moveCommentsToRoot: (cst: Program) => Program & {
9
+ comments: Whitespace[];
10
+ };
@@ -0,0 +1,2 @@
1
+ import { Program } from "sql-parser-cst";
2
+ export declare const stripTrailingCommas: (cst: Program) => Program;
@@ -0,0 +1,2 @@
1
+ import { Program } from "sql-parser-cst";
2
+ export declare const transformCst: (cst: Program, originalText: string) => Program;
@@ -0,0 +1,9 @@
1
+ import { Node } from "sql-parser-cst";
2
+ export declare const isDefined: <T>(value: T | undefined) => value is T;
3
+ export declare const isString: (value: any) => value is string;
4
+ export declare const isObject: (x: any) => x is Record<string, any>;
5
+ export declare const isArray: (x: any) => x is any[];
6
+ export declare const isEmptyArray: (x: any) => x is [];
7
+ export declare const isNode: (value: any) => value is Node;
8
+ export declare const arrayWrap: <T>(x: T | T[]) => T[];
9
+ export declare const last: <T>(arr: T[]) => T;
@@ -0,0 +1,2 @@
1
+ import { Node } from "sql-parser-cst";
2
+ export declare const visitAllNodes: (node: Node, visit: (node: Node) => void) => void;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "prettier-plugin-sql-cst",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Prettier plugin for SQL",
5
5
  "author": "Rene Saarsoo <nene@triin.net>",
6
6
  "license": "GPL-3.0-or-later",
7
7
  "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "https://github.com/nene/prettier-plugin-sql-cst"
@@ -29,7 +30,7 @@
29
30
  ],
30
31
  "dependencies": {
31
32
  "prettier": "^2.8.2",
32
- "sql-parser-cst": "^0.14.1"
33
+ "sql-parser-cst": "^0.17.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@types/jest": "^29.2.5",