plpgsql-parse 0.3.0 → 1.0.0
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/deparse.js +2 -2
- package/esm/deparse.js +1 -1
- package/esm/parse.js +1 -1
- package/package.json +7 -7
- package/parse.d.ts +1 -1
- package/parse.js +3 -3
package/deparse.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.deparseSync = deparseSync;
|
|
12
12
|
exports.deparse = deparse;
|
|
13
|
-
const
|
|
13
|
+
const libpg_query_1 = require("libpg-query");
|
|
14
14
|
const pgsql_parse_1 = require("pgsql-parse");
|
|
15
15
|
const pgsql_deparser_1 = require("pgsql-deparser");
|
|
16
16
|
const plpgsql_deparser_1 = require("plpgsql-deparser");
|
|
@@ -88,7 +88,7 @@ function deparseWithBodyComments(rawStmt, fnComments, pretty) {
|
|
|
88
88
|
if (!cleanSql)
|
|
89
89
|
return null;
|
|
90
90
|
// Parse PL/pgSQL from the clean SQL
|
|
91
|
-
const plpgsqlRaw = (0,
|
|
91
|
+
const plpgsqlRaw = (0, libpg_query_1.parsePlPgSQLSync)(cleanSql);
|
|
92
92
|
const { ast: hydrated } = (0, plpgsql_deparser_1.hydratePlpgsqlAst)(plpgsqlRaw);
|
|
93
93
|
const dehydrated = (0, plpgsql_deparser_1.dehydratePlpgsqlAst)(hydrated);
|
|
94
94
|
const plpgsqlFunc = dehydrated.plpgsql_funcs?.[0]?.PLpgSQL_function;
|
package/esm/deparse.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This module does NOT modify plpgsql-deparser or pgsql-deparser.
|
|
8
8
|
*/
|
|
9
|
-
import { parsePlPgSQLSync, } from '
|
|
9
|
+
import { parsePlPgSQLSync, } from 'libpg-query';
|
|
10
10
|
import { isRawComment, isRawWhitespace, isRawStmt, } from 'pgsql-parse';
|
|
11
11
|
import { Deparser } from 'pgsql-deparser';
|
|
12
12
|
import { hydratePlpgsqlAst, dehydratePlpgsqlAst, deparseFunctionSync, } from 'plpgsql-deparser';
|
package/esm/parse.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This module does NOT modify plpgsql-parser or pgsql-parse — it
|
|
7
7
|
* composes them and adds body-comment metadata on top.
|
|
8
8
|
*/
|
|
9
|
-
import { parseSync as parseSqlSync, loadModule, } from '
|
|
9
|
+
import { parseSync as parseSqlSync, loadModule, } from 'libpg-query';
|
|
10
10
|
import { parseSync as pgsqlParseSync } from 'pgsql-parse';
|
|
11
11
|
import { scanBodyComments } from './body-scanner';
|
|
12
12
|
export { loadModule };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plpgsql-parse",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Comment and whitespace preserving PL/pgSQL parser",
|
|
6
6
|
"main": "index.js",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"round-trip"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"pgsql-deparser": "
|
|
47
|
-
"pgsql-parse": "0.
|
|
48
|
-
"plpgsql-deparser": "0.
|
|
44
|
+
"@pgsql/types": "^18.0.0",
|
|
45
|
+
"libpg-query": "18.1.1",
|
|
46
|
+
"pgsql-deparser": "18.0.0",
|
|
47
|
+
"pgsql-parse": "1.0.0",
|
|
48
|
+
"plpgsql-deparser": "1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"makage": "^0.1.8"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "f700ee16d18aeacd2788eeb4410d73928cd11a5f"
|
|
54
54
|
}
|
package/parse.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This module does NOT modify plpgsql-parser or pgsql-parse — it
|
|
7
7
|
* composes them and adds body-comment metadata on top.
|
|
8
8
|
*/
|
|
9
|
-
import { loadModule } from '
|
|
9
|
+
import { loadModule } from 'libpg-query';
|
|
10
10
|
import type { PlpgsqlParseResult } from './types';
|
|
11
11
|
export { loadModule };
|
|
12
12
|
/**
|
package/parse.js
CHANGED
|
@@ -11,8 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.loadModule = void 0;
|
|
12
12
|
exports.parseSync = parseSync;
|
|
13
13
|
exports.parse = parse;
|
|
14
|
-
const
|
|
15
|
-
Object.defineProperty(exports, "loadModule", { enumerable: true, get: function () { return
|
|
14
|
+
const libpg_query_1 = require("libpg-query");
|
|
15
|
+
Object.defineProperty(exports, "loadModule", { enumerable: true, get: function () { return libpg_query_1.loadModule; } });
|
|
16
16
|
const pgsql_parse_1 = require("pgsql-parse");
|
|
17
17
|
const body_scanner_1 = require("./body-scanner");
|
|
18
18
|
/**
|
|
@@ -68,7 +68,7 @@ function parseSync(sql) {
|
|
|
68
68
|
// 1. Outer SQL: use pgsql-parse for comment/whitespace preservation
|
|
69
69
|
const enhanced = (0, pgsql_parse_1.parseSync)(sql);
|
|
70
70
|
// 2. Also parse with the standard SQL parser to get statement ASTs
|
|
71
|
-
const sqlResult = (0,
|
|
71
|
+
const sqlResult = (0, libpg_query_1.parseSync)(sql);
|
|
72
72
|
const stmts = sqlResult.stmts ?? [];
|
|
73
73
|
// 3. For each PL/pgSQL function, extract body comments
|
|
74
74
|
const functions = [];
|