prettier-plugin-sql-cst 0.17.2 → 0.17.4
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/node_utils.d.ts +3 -1
- package/dist/node_utils.js +7 -2
- package/dist/syntax/base.js +1 -1
- package/dist/syntax/data_type.js +3 -3
- package/dist/syntax/expr.js +3 -4
- package/package.json +2 -2
package/dist/node_utils.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare const isCreateTriggerStmt: (node: any) => node is import("sql-par
|
|
|
30
30
|
export declare const isExecuteClause: (node: any) => node is import("sql-parser-cst").ExecuteClause;
|
|
31
31
|
export declare const isDataTypeName: (node: any) => node is import("sql-parser-cst").DataTypeName;
|
|
32
32
|
export declare const isIntervalDataType: (node: any) => node is import("sql-parser-cst").IntervalDataType;
|
|
33
|
+
export declare const isIntervalUnit: (node: any) => node is import("sql-parser-cst").IntervalUnit;
|
|
34
|
+
export declare const isIntervalUnitRange: (node: any) => node is import("sql-parser-cst").IntervalUnitRange;
|
|
33
35
|
export declare const isTimeDataType: (node: any) => node is import("sql-parser-cst").TimeDataType;
|
|
34
36
|
export declare const isParametricDataType: (node: any) => node is import("sql-parser-cst").ParametricDataType;
|
|
35
|
-
export declare const isDataType: (node: any) => boolean;
|
|
37
|
+
export declare const isDataType: ([node, ...ancestors]: any[]) => boolean;
|
package/dist/node_utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDataType = exports.isParametricDataType = exports.isTimeDataType = exports.isIntervalDataType = exports.isDataTypeName = exports.isExecuteClause = exports.isCreateTriggerStmt = exports.isBigqueryQuotedMemberExpr = exports.isDynamicallyLoadedFunction = exports.isLanguageClause = exports.isAlterActionRename = exports.isDropProcedureStmt = exports.isAlterProcedureStmt = exports.isCreateProcedureStmt = exports.isDropFunctionStmt = exports.isAlterFunctionStmt = exports.isCreateFunctionStmt = exports.isListExpr = exports.isCompoundSelectStmt = exports.isSelectStmt = exports.isMemberExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonbLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
3
|
+
exports.isDataType = exports.isParametricDataType = exports.isTimeDataType = exports.isIntervalUnitRange = exports.isIntervalUnit = exports.isIntervalDataType = exports.isDataTypeName = exports.isExecuteClause = exports.isCreateTriggerStmt = exports.isBigqueryQuotedMemberExpr = exports.isDynamicallyLoadedFunction = exports.isLanguageClause = exports.isAlterActionRename = exports.isDropProcedureStmt = exports.isAlterProcedureStmt = exports.isCreateProcedureStmt = exports.isDropFunctionStmt = exports.isAlterFunctionStmt = exports.isCreateFunctionStmt = exports.isListExpr = exports.isCompoundSelectStmt = exports.isSelectStmt = exports.isMemberExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonbLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
var is = function (type) {
|
|
6
6
|
return function (node) {
|
|
@@ -38,11 +38,16 @@ exports.isCreateTriggerStmt = is("create_trigger_stmt");
|
|
|
38
38
|
exports.isExecuteClause = is("execute_clause");
|
|
39
39
|
exports.isDataTypeName = is("data_type_name");
|
|
40
40
|
exports.isIntervalDataType = is("interval_data_type");
|
|
41
|
+
exports.isIntervalUnit = is("interval_unit");
|
|
42
|
+
exports.isIntervalUnitRange = is("interval_unit_range");
|
|
41
43
|
exports.isTimeDataType = is("time_data_type");
|
|
42
44
|
exports.isParametricDataType = is("parametric_data_type");
|
|
43
|
-
var isDataType = function (
|
|
45
|
+
var isDataType = function (_a) {
|
|
46
|
+
var node = _a[0], ancestors = _a.slice(1);
|
|
44
47
|
return (0, exports.isDataTypeName)(node) ||
|
|
45
48
|
(0, exports.isIntervalDataType)(node) ||
|
|
49
|
+
((0, exports.isIntervalUnit)(node) && (0, exports.isDataType)(ancestors)) ||
|
|
50
|
+
((0, exports.isIntervalUnitRange)(node) && (0, exports.isDataType)(ancestors)) ||
|
|
46
51
|
(0, exports.isTimeDataType)(node) ||
|
|
47
52
|
(0, exports.isParametricDataType)(node);
|
|
48
53
|
};
|
package/dist/syntax/base.js
CHANGED
|
@@ -5,7 +5,7 @@ var node_utils_1 = require("../node_utils");
|
|
|
5
5
|
exports.baseMap = {
|
|
6
6
|
/** cst-ignore: name */
|
|
7
7
|
keyword: function (print, node, path, options) {
|
|
8
|
-
var keywordCase = (0, node_utils_1.isDataType)(path.
|
|
8
|
+
var keywordCase = (0, node_utils_1.isDataType)(path.ancestors)
|
|
9
9
|
? options.sqlTypeCase
|
|
10
10
|
: options.sqlKeywordCase;
|
|
11
11
|
switch (keywordCase) {
|
package/dist/syntax/data_type.js
CHANGED
|
@@ -30,9 +30,9 @@ exports.dataTypeMap = {
|
|
|
30
30
|
print(["timeKw", "precision"])
|
|
31
31
|
], (node.timeZoneKw ? [print.spaced("timeZoneKw")] : []), true)));
|
|
32
32
|
},
|
|
33
|
-
interval_data_type: function (print) {
|
|
34
|
-
|
|
35
|
-
},
|
|
33
|
+
interval_data_type: function (print) { return print.spaced(["intervalKw", "unit"]); },
|
|
34
|
+
interval_unit_range: function (print) { return print.spaced(["fromUnit", "toKw", "toUnit"]); },
|
|
35
|
+
interval_unit: function (print) { return print.spaced(["unitKw", "precision"]); },
|
|
36
36
|
parametric_data_type: function (print) { return print(["typeKw", "params"]); },
|
|
37
37
|
generic_type_params: function (print) {
|
|
38
38
|
return (0, print_utils_1.group)(["<", (0, print_utils_1.indent)([print_utils_1.softline, print("params")]), print_utils_1.softline, ">"]);
|
package/dist/syntax/expr.js
CHANGED
|
@@ -141,10 +141,9 @@ exports.exprMap = {
|
|
|
141
141
|
extract_expr: function (print) { return print(["extractKw", "args"]); },
|
|
142
142
|
extract_from: function (print) { return print.spaced(["unit", "fromKw", "expr"]); },
|
|
143
143
|
week_expr: function (print) { return print(["weekKw", "args"]); },
|
|
144
|
-
interval_literal: function (print) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
interval_unit: function (print) { return print("unitKw"); },
|
|
144
|
+
interval_literal: function (print) {
|
|
145
|
+
return print.spaced(["intervalKw", "precision", "value", "unit"]);
|
|
146
|
+
},
|
|
148
147
|
array_literal_expr: function (print) { return print(["arrayKw", "expr"]); },
|
|
149
148
|
array_expr: function (print) {
|
|
150
149
|
return (0, print_utils_1.group)(["[", (0, print_utils_1.indent)([print_utils_1.softline, print("expr")]), print_utils_1.softline, "]"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-sql-cst",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "Prettier plugin for SQL",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Barna Magyarkuti <bmagyarkuti@gmail.com>",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"prettier": "^3.0.3",
|
|
40
|
-
"sql-parser-cst": "^0.
|
|
40
|
+
"sql-parser-cst": "^0.38.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^29.2.5",
|