@matdata/sparql-formatter 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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * SPARQL 1.2 formatter.
3
+ *
4
+ * ```js
5
+ * import { format } from "@matdata/sparql-formatter";
6
+ * format("select * where {?s ?p ?o}");
7
+ * ```
8
+ */
9
+ import type { Ast } from "./ast.js";
10
+ import { parse } from "./parser.js";
11
+ import { type FormatOptions } from "./printer.js";
12
+ import { tokenize } from "./lexer.js";
13
+ export { parse } from "./parser.js";
14
+ export { tokenize } from "./lexer.js";
15
+ export { SparqlSyntaxError } from "./errors.js";
16
+ export type { FormatOptions, Case } from "./printer.js";
17
+ export type { Token, Comment, TokenType } from "./lexer.js";
18
+ export type * from "./ast.js";
19
+ /** Format a parsed query. */
20
+ export declare function formatAst(ast: Ast, options?: FormatOptions): string;
21
+ /**
22
+ * Format a SPARQL 1.2 query or update.
23
+ *
24
+ * @throws {SparqlSyntaxError} when the input is not valid SPARQL.
25
+ */
26
+ export declare function format(query: string, options?: FormatOptions): string;
27
+ /** Check whether a query is valid SPARQL 1.2 syntax. */
28
+ export declare function isValid(query: string): boolean;
29
+ /**
30
+ * Drop-in replacement for the `spfmt` object of the `sparql-formatter`
31
+ * package (`spfmt.format(query, formattingMode, indentDepth)`).
32
+ */
33
+ export declare const spfmt: {
34
+ parse: typeof parse;
35
+ tokenize: typeof tokenize;
36
+ format(query: string, formattingMode?: "default" | "compact", indentDepth?: number): string;
37
+ };
38
+ export default format;