Socket
Socket
Sign inDemoInstall

bravo-formatter

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bravo-formatter - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

bin/bravo-formatter-cli.cjs

4

lib/dialect.d.ts

@@ -0,1 +1,5 @@

/**
* @file 词典
* @author 天一
*/
import { DialectFormatOptions, ProcessedDialectFormatOptions } from './formatter/ExpressionFormatter.js';

@@ -2,0 +6,0 @@ import Tokenizer from './lexer/Tokenizer.js';

@@ -0,1 +1,6 @@

/**
* @file 词典
* @author 天一
*/
import Tokenizer from './lexer/Tokenizer.js';

@@ -2,0 +7,0 @@ const cache = new Map();

1

lib/expandPhrases.js

@@ -30,3 +30,2 @@ /**

//
const REQUIRED_PART = /[^[\]{}]+/y;

@@ -33,0 +32,0 @@ const REQUIRED_BLOCK = /\{.*?\}/y;

import { ParamItems } from './formatter/Params.js';
import { ParamTypes } from './lexer/TokenizerOptions.js';
export declare type IndentStyle = 'standard' | 'tabularLeft' | 'tabularRight';
export declare type KeywordCase = 'preserve' | 'upper' | 'lower';
export declare type CommaPosition = 'before' | 'after' | 'tabular';
export declare type LogicalOperatorNewline = 'before' | 'after';
export type IndentStyle = 'standard' | 'tabularLeft' | 'tabularRight';
export type KeywordCase = 'preserve' | 'upper' | 'lower';
export type CommaPosition = 'before' | 'after' | 'tabular';
export type LogicalOperatorNewline = 'before' | 'after';
export interface FormatOptions {

@@ -11,2 +11,3 @@ tabWidth: number;

keywordCase: KeywordCase;
functionCase: KeywordCase;
indentStyle: IndentStyle;

@@ -20,4 +21,8 @@ logicalOperatorNewline: LogicalOperatorNewline;

newlineBeforeSemicolon: boolean;
/**
* 特殊符号定义,如@{XXX} 将被识别为普通文本
* @example [{ quote: '{}', prefixes: ['$'], requirePrefix: true }]
*/
params?: ParamItems | string[];
paramTypes?: ParamTypes;
}
// Utility functions for config options
/**

@@ -8,3 +7,3 @@ * Creates a string to use for one step of indentation.

if (cfg.indentStyle === 'tabularLeft' || cfg.indentStyle === 'tabularRight') {
return ' '.repeat(10);
return ' '.repeat(8);
}

@@ -11,0 +10,0 @@ if (cfg.useTabs) {

@@ -15,2 +15,3 @@ /**

inline?: boolean;
escapeOperatorSpace?: boolean;
}

@@ -34,3 +35,4 @@ export interface DialectFormatOptions {

private index;
constructor({ cfg, dialectCfg, params, layout, inline }: ExpressionFormatterParams);
private escapeOperatorSpace;
constructor({ cfg, dialectCfg, params, layout, inline, escapeOperatorSpace }: ExpressionFormatterParams);
format(nodes: AstNode[]): Layout;

@@ -74,3 +76,4 @@ private formatNode;

private showNonTabularKw;
private isTabularNewlineKeyword;
}
export {};

@@ -13,2 +13,5 @@ /**

import InlineLayout, { InlineLayoutError } from './InlineLayout.js';
// Contains the same data as DialectFormatOptions,
// but optimized for faster and more conventient lookup.
/** Formats a generic SQL expression */

@@ -19,2 +22,3 @@ export default class ExpressionFormatter {

index = -1;
escapeOperatorSpace = false;
constructor({

@@ -25,3 +29,4 @@ cfg,

layout,
inline = false
inline = false,
escapeOperatorSpace = false
}) {

@@ -33,2 +38,3 @@ this.cfg = cfg;

this.layout = layout;
this.escapeOperatorSpace = escapeOperatorSpace;
}

@@ -117,3 +123,5 @@ format(nodes) {

// format parenthesis after function name token
this.escapeOperatorSpace = true;
this.formatNode(node.parenthesis);
this.escapeOperatorSpace = false;
}

@@ -174,2 +182,3 @@ formatArraySubscript(node) {

if (isTabularStyle(this.cfg)) {
this.escapeOperatorSpace = true;
this.layout.indentation.increaseTabularBlockLevel();

@@ -179,2 +188,3 @@ this.layout = this.formatSubExpression(node.expr); // case后的表达式

this.layout.indentation.decreaseTabularBlockLevel();
this.escapeOperatorSpace = false;
} else {

@@ -190,5 +200,8 @@ this.layout.indentation.increaseBlockLevel();

formatCaseWhen(node) {
// this.layout.add(WS.SPACE);
this.layout.add(WS.NEWLINE, WS.INDENT);
this.formatNode(node.whenKw);
this.escapeOperatorSpace = true;
this.layout = this.formatSubExpression(node.condition);
this.escapeOperatorSpace = false;
this.formatNode(node.thenKw);

@@ -228,2 +241,5 @@ this.layout = this.formatSubExpression(node.result);

this.layout.indentation.increaseTopLevel();
if (this.isTabularNewlineKeyword(node.nameKw)) {
this.layout.add(WS.NEWLINE, WS.INDENT);
}
this.layout = this.formatSubExpression(node.children);

@@ -280,7 +296,11 @@ this.layout.indentation.decreaseTopLevel();

formatComma(_node) {
// 逗号前紧跟换行符,则加入indent缩进
if (!this.layout.isAfterNewLine()) {
this.layout.add(WS.NO_SPACE);
}
if (!this.inline) {
// newline after comma
this.layout.add(WS.NO_SPACE, ',', WS.NEWLINE, WS.INDENT);
this.layout.add(',', WS.NEWLINE, WS.INDENT);
} else {
this.layout.add(WS.NO_SPACE, ',', WS.SPACE);
this.layout.add(',', WS.SPACE);
}

@@ -366,3 +386,4 @@ }

layout: this.layout,
inline: this.inline
inline: this.inline,
escapeOperatorSpace: this.escapeOperatorSpace
}).format(nodes);

@@ -373,3 +394,3 @@ }

try {
// inlinelayou, when longer than the preset size。throw InlineLayoutError
// inlinelayout, when longer than the preset size。throw InlineLayoutError
// 行内模式,expression。inlineLayout内部处理超出配置项后,抛出InlineLayoutError,后继续使用换行模式

@@ -405,2 +426,3 @@ return new ExpressionFormatter({

case TokenType.XOR:
case TokenType.ON:
return this.formatLogicalOperator(node);

@@ -417,2 +439,7 @@ default:

this.layout.indentation.increaseTopLevel();
// tabular style, add newline when keyword longer than 8 characters
if (this.isTabularNewlineKeyword(node)) {
this.layout.add(WS.NEWLINE, WS.INDENT);
}
} else {

@@ -430,4 +457,16 @@ this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(node), WS.SPACE);

this.layout.indentation.decreaseTopLevel();
this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(node), WS.SPACE);
this.layout.indentation.increaseTopLevel();
// 函数内、casewhen内AND作为普通文本处理,仅处理超长换行的逻辑
if (this.escapeOperatorSpace) {
// if (!this.inline) {
// // 由formatParenthesis判断是否超长
// // newline before AND
// this.layout.add(WS.NEWLINE, WS.INDENT, node.text, WS.SPACE);
// } else {
// }
this.layout.add(node.text, WS.SPACE);
} else {
this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(node), WS.SPACE);
this.layout.indentation.increaseTopLevel();
}
} else {

@@ -450,2 +489,6 @@ this.layout.add(WS.NEWLINE, WS.INDENT, this.showKw(node), WS.SPACE);

showNonTabularKw(node) {
// 如clickhouse语法,函数大小写敏感,不可以随格式化改变
if (this.cfg.functionCase === 'preserve' && node.tokenType === TokenType.RESERVED_FUNCTION_NAME) {
return equalizeWhitespace(node.raw);
}
switch (this.cfg.keywordCase) {

@@ -460,3 +503,9 @@ case 'preserve':

}
// under tabular style, if keyword length longer than 8, start newline with indent for trailing identifier
isTabularNewlineKeyword(node) {
// create 语句例外,无需换行
return this.showKw(node).length >= 8 && isTabularStyle(this.cfg) && !/^create/i.test(node.text);
}
}
//# sourceMappingURL=ExpressionFormatter.js.map

@@ -27,3 +27,3 @@ import { maxLength } from '../utils.js';

* ' foo,',
* ' bar,',
* ' bar, --comment',
* ' baz',

@@ -37,3 +37,3 @@ * 'FROM'

* ['SELECT'],
* [' foo,', ' bar,', ' baz'],
* [' foo,', ' bar, --comment', ' baz'],
* ['FROM']

@@ -49,3 +49,3 @@ * ]

// plus one (which doesn't end with comma)
while (lines[i].match(/.*,$/)) {
while (lines[i].match(/.*,(\s*(--.*)?$)/)) {
i++;

@@ -61,4 +61,4 @@ group.push(lines[i]);

function formatTabular(commaLines) {
const maxLineLength = maxLength(commaLines);
return trimTrailingCommas(commaLines).map((line, i) => {
const commaPosition = maxLength(trimTrailingComments(commaLines)) - 1;
return commaLines.map((line, i) => {
if (i === commaLines.length - 1) {

@@ -68,5 +68,10 @@ return line; // do not add comma for last item

return line + ' '.repeat(maxLineLength - line.length - 1) + ',';
return indentComma(line, commaPosition);
});
}
function indentComma(line, commaPosition) {
const [, code, comment] = line.match(/^(.*?),(\s*--.*)?$/) || [];
const spaces = ' '.repeat(commaPosition - code.length);
return `${code}${spaces},${comment ?? ''}`;
}
function formatBefore(commaLines, indent) {

@@ -88,4 +93,7 @@ return trimTrailingCommas(commaLines).map((line, i) => {

function trimTrailingCommas(lines) {
return lines.map(line => line.replace(/,$/, ''));
return lines.map(line => line.replace(/,(\s*(--.*)?$)/, '$1'));
}
function trimTrailingComments(lines) {
return lines.map(line => line.replace(/\s*--.*/, ''));
}
//# sourceMappingURL=formatCommaPositions.js.map
import { FormatOptions } from '../FormatOptions.js';
import { StatementNode } from '../parser/ast.js';
import { Dialect } from '../dialect.js';

@@ -16,3 +17,3 @@ /** Main formatter class that produces a final output string from list of tokens */

format(query: string): string;
private parse;
parse(query: string): StatementNode[];
private formatAst;

@@ -19,0 +20,0 @@ private formatStatement;

@@ -6,2 +6,3 @@ import { indentString } from './config.js';

import formatAliasPositions from './formatAliasPositions.js';
import formatCreateTypePositions from './formatCreateTypePositions.js';
import ExpressionFormatter from './ExpressionFormatter.js';

@@ -56,8 +57,15 @@ import Layout, { WS } from './Layout.js';

postFormat(query) {
if (this.cfg.tabulateAlias) {
query = formatAliasPositions(query);
try {
if (this.cfg.tabulateAlias) {
query = formatAliasPositions(query);
}
if (this.cfg.indentStyle !== 'standard') {
query = formatCreateTypePositions(query);
}
if (this.cfg.commaPosition === 'before' || this.cfg.commaPosition === 'tabular') {
query = formatCommaPositions(query, this.cfg.commaPosition, indentString(this.cfg));
}
} catch (e) {
console.log('error happend in postFormat');
}
if (this.cfg.commaPosition === 'before' || this.cfg.commaPosition === 'tabular') {
query = formatCommaPositions(query, this.cfg.commaPosition, indentString(this.cfg));
}
return query;

@@ -64,0 +72,0 @@ }

@@ -13,3 +13,3 @@ import Indentation from './Indentation.js';

}
export declare type LayoutItem = WS.SPACE | WS.SINGLE_INDENT | WS.NEWLINE | WS.MANDATORY_NEWLINE | WS.TAB_WIDTH_INDENT | string;
export type LayoutItem = WS.SPACE | WS.SINGLE_INDENT | WS.NEWLINE | WS.MANDATORY_NEWLINE | WS.TAB_WIDTH_INDENT | string;
/**

@@ -35,2 +35,3 @@ * API for constructing SQL string (especially the whitespace part).

private trimWhitespace;
isAfterNewLine(): boolean;
private addNewline;

@@ -37,0 +38,0 @@ private addIndentation;

@@ -9,4 +9,3 @@ /**

/** Whitespace modifiers to be used with add() method */
export let WS;
(function (WS) {
export let WS = /*#__PURE__*/function (WS) {
WS[WS["SPACE"] = 0] = "SPACE";

@@ -20,3 +19,4 @@ WS[WS["NO_SPACE"] = 1] = "NO_SPACE";

WS[WS["TAB_WIDTH_INDENT"] = 7] = "TAB_WIDTH_INDENT";
})(WS || (WS = {}));
return WS;
}({});
/**

@@ -94,2 +94,9 @@ * API for constructing SQL string (especially the whitespace part).

}
isAfterNewLine() {
let index = this.items.length - 1;
while (index >= 0 && isHorizontalWhitespace(this.items[index])) {
index--;
}
return this.items[index] === WS.NEWLINE || this.items[index] === WS.MANDATORY_NEWLINE;
}
addNewline(newline) {

@@ -96,0 +103,0 @@ if (this.items.length > 0) {

@@ -1,2 +0,2 @@

export declare type ParamItems = {
export type ParamItems = {
[k: string]: string;

@@ -3,0 +3,0 @@ };

@@ -17,5 +17,5 @@ import { isLogicalOperator, TokenType } from '../lexer/token.js';

if (indentStyle === 'tabularLeft') {
tokenText = tokenText.padEnd(9, ' '); // 取10格,可修改为8格
tokenText = tokenText.padEnd(7, ' '); // 取10格,可修改为8格
} else {
tokenText = tokenText.padStart(9, ' ');
tokenText = tokenText.padStart(7, ' ');
}

@@ -22,0 +22,0 @@ return tokenText + ['', ...tail].join(' ');

export * from './sqlFormatter.js';
export type { IndentStyle, KeywordCase, CommaPosition, LogicalOperatorNewline, FormatOptions, } from './FormatOptions.js';
export type { IndentStyle, KeywordCase, CommaPosition, LogicalOperatorNewline, FormatOptions } from './FormatOptions.js';
export type { DialectOptions } from './dialect.js';
export { expandPhrases } from './expandPhrases.js';

@@ -11,3 +11,4 @@ import { expandPhrases } from '../../expandPhrases.js';

// queries
'WITH', 'FROM', 'WHERE', 'GROUP BY', 'HAVING', 'WINDOW', 'PARTITION BY', 'ORDER BY', 'SORT BY', 'CLUSTER BY', 'DISTRIBUTE BY', 'LIMIT',
// 'WITH', 对齐dorado,暂时移除
'FROM', 'WHERE', 'GROUP BY', 'HAVING', 'WINDOW', 'PARTITION BY', 'ORDER BY', 'SORT BY', 'CLUSTER BY', 'DISTRIBUTE BY', 'LIMIT', 'SET',
// Data manipulation

@@ -18,4 +19,2 @@ // - insert:

'INSERT INTO [TABLE]', 'VALUES',
// - update:
'SET',
// - merge:

@@ -45,3 +44,3 @@ 'MERGE INTO', 'WHEN [NOT] MATCHED [THEN]', 'UPDATE SET', 'INSERT [VALUES]',

// other
'ALTER', 'CREATE', 'USE', 'DESCRIBE', 'DROP', 'FETCH', 'SHOW', 'STORED AS', 'STORED BY', 'ROW FORMAT']);
'ALTER', 'CREATE', 'DESCRIBE', 'DROP', 'FETCH', 'SHOW', 'STORED AS', 'STORED BY', 'ROW FORMAT', 'TBLPROPERTIES']);
const reservedSetOperations = expandPhrases(['UNION [ALL | DISTINCT]']);

@@ -48,0 +47,0 @@

@@ -7,8 +7,8 @@ import { expandPhrases } from '../../expandPhrases.js';

// queries
'WITH [RECURSIVE]', 'FROM', 'WHERE', 'GROUP BY [ALL | DISTINCT]', 'HAVING', 'WINDOW', 'PARTITION BY', 'ORDER BY', 'LIMIT', 'OFFSET', 'FETCH {FIRST | NEXT}',
// 'WITH [RECURSIVE]',
'FROM', 'WHERE', 'GROUP BY [ALL | DISTINCT]', 'HAVING', 'WINDOW', 'PARTITION BY', 'ORDER BY', 'LIMIT', 'OFFSET', 'FETCH {FIRST | NEXT}',
// Data manipulation
// - insert:
'INSERT INTO', 'VALUES',
'INSERT INTO', 'VALUES', 'SET',
// - update:
'SET',
// Data definition

@@ -35,3 +35,3 @@ 'CREATE [RECURSIVE] VIEW', 'CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE']);

// other
'SET SCHEMA']);
'SET SCHEMA', 'SHOW CREATE', 'SHOW', 'SYSTEM SET']);
const reservedSetOperations = expandPhrases(['UNION [ALL | DISTINCT]', 'EXCEPT [ALL | DISTINCT]', 'INTERSECT [ALL | DISTINCT]']);

@@ -38,0 +38,0 @@ const reservedJoins = expandPhrases(['JOIN', '{LEFT | RIGHT | FULL} [OUTER] JOIN', '{INNER | CROSS} JOIN', 'NATURAL [INNER] JOIN', 'NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN']);

@@ -17,5 +17,3 @@ /**

* array accessor `foo[1]` and array literal `[1, 2, 3]`.
*
* 二义性特殊处理,如函数名降级为关键词、元数据被误判为关键词、区分数组对象取数与数组数据
*/
export declare function disambiguateTokens(tokens: Token[]): Token[];

@@ -18,4 +18,2 @@ /**

* array accessor `foo[1]` and array literal `[1, 2, 3]`.
*
* 二义性特殊处理,如函数名降级为关键词、元数据被误判为关键词、区分数组对象取数与数组数据
*/

@@ -25,5 +23,2 @@ export function disambiguateTokens(tokens) {

}
// Ensures that no keyword token (RESERVED_*) is preceded by dot (.).
// 区分关键词与ID类型
const dotKeywordToIdent = (token, i, tokens) => {

@@ -37,12 +32,7 @@ if (isReserved(token.type)) {

text: token.raw
}; // 前方是点,手动将该Token重置为ID类型,避免与关键词类型冲突 导致格式化异常
};
}
}
return token;
};
// Ensures that all RESERVED_FUNCTION_NAME tokens are followed by "(".
// If they're not, converts the token to RESERVED_KEYWORD.
// 解决函数名与关键词冲突的问题
const funcNameToKeyword = (token, i, tokens) => {

@@ -60,4 +50,2 @@ if (token.type === TokenType.RESERVED_FUNCTION_NAME) {

};
// 区分[]属于数组,还是元数据的取数逻辑。避免产生额外的indent
const identToArrayIdent = (token, i, tokens) => {

@@ -75,4 +63,2 @@ if (token.type === TokenType.IDENTIFIER) {

};
// 同上,区分关键词的取数逻辑
const keywordToArrayKeyword = (token, i, tokens) => {

@@ -90,4 +76,2 @@ if (token.type === TokenType.RESERVED_KEYWORD) {

};
// 获取上一个非注释 Token,
const prevNonCommentToken = (tokens, index) => nextNonCommentToken(tokens, index, -1);

@@ -94,0 +78,0 @@ const nextNonCommentToken = (tokens, index, dir = 1) => {

@@ -6,3 +6,4 @@ /**

/**
* 注释嵌套场景的解析,没开启的话就不需要
* An object mimicking a regular expression,
* for matching nested block-comments.
*/

@@ -9,0 +10,0 @@ export declare class NestedComment implements RegExpLike {

/**
* @file 支持嵌套多行注释的场景,如 `\/** aaa \/** *\/ *\/`
*/
/* eslint-disable no-cond-assign */

@@ -12,3 +11,4 @@

/**
* 注释嵌套场景的解析,没开启的话就不需要
* An object mimicking a regular expression,
* for matching nested block-comments.
*/

@@ -15,0 +15,0 @@ export class NestedComment {

@@ -58,2 +58,2 @@ /**

*/
export declare const identifierPattern: ({ first, rest, dashes, allowFirstCharNumber, }?: IdentChars) => string;
export declare const identifierPattern: ({ first, rest, dashes, allowFirstCharNumber }?: IdentChars) => string;

@@ -114,3 +114,3 @@ /**

// PostgreSQL dollar-quoted
'$$': String.raw`(?<tag>\$\w*\$)[\s\S]*?\k<tag>`,
$$: String.raw`(?<tag>\$\w*\$)[\s\S]*?\k<tag>`,
// BigQuery '''triple-quoted''' (using \' to escape)

@@ -128,2 +128,4 @@ "'''..'''": String.raw`'''[^\\]*?(?:\\.[^\\]*?)*?'''`,

return quotePatterns[quoteTypes];
} else if ('regex' in quoteTypes) {
return quoteTypes.regex;
} else {

@@ -130,0 +132,0 @@ return prefixesPattern(quoteTypes) + quotePatterns[quoteTypes.quote];

@@ -24,2 +24,3 @@ /** Token type enum for all possible Token categories */

AND = "AND",
ON = "ON",
OR = "OR",

@@ -40,2 +41,3 @@ XOR = "XOR",

POSITIONAL_PARAMETER = "POSITIONAL_PARAMETER",
CUSTOM_PARAMETER = "CUSTOM_PARAMETER",
DELIMITER = "DELIMITER",

@@ -42,0 +44,0 @@ EOF = "EOF"

/** Token type enum for all possible Token categories */
export let TokenType;
/** Struct to store the most basic cohesive unit of language grammar */
(function (TokenType) {
export let TokenType = /*#__PURE__*/function (TokenType) {
TokenType["QUOTED_IDENTIFIER"] = "QUOTED_IDENTIFIER";

@@ -27,2 +24,3 @@ TokenType["IDENTIFIER"] = "IDENTIFIER";

TokenType["AND"] = "AND";
TokenType["ON"] = "ON";
TokenType["OR"] = "OR";

@@ -43,5 +41,10 @@ TokenType["XOR"] = "XOR";

TokenType["POSITIONAL_PARAMETER"] = "POSITIONAL_PARAMETER";
TokenType["CUSTOM_PARAMETER"] = "CUSTOM_PARAMETER";
TokenType["DELIMITER"] = "DELIMITER";
TokenType["EOF"] = "EOF";
})(TokenType || (TokenType = {}));
return TokenType;
}({});
/** Struct to store the most basic cohesive unit of language grammar */
/** Creates EOF token positioned at given location */

@@ -89,4 +92,4 @@ export const createEofToken = index => ({

/** Checks if token is any Reserved Keyword or Clause */
export const isReserved = type => type === TokenType.RESERVED_KEYWORD || type === TokenType.RESERVED_FUNCTION_NAME || type === TokenType.RESERVED_PHRASE || type === TokenType.RESERVED_CLAUSE || type === TokenType.RESERVED_SELECT || type === TokenType.RESERVED_SET_OPERATION || type === TokenType.RESERVED_JOIN || type === TokenType.ARRAY_KEYWORD || type === TokenType.CASE || type === TokenType.END || type === TokenType.WHEN || type === TokenType.ELSE || type === TokenType.THEN || type === TokenType.LIMIT || type === TokenType.BETWEEN || type === TokenType.AND || type === TokenType.OR || type === TokenType.XOR;
export const isLogicalOperator = type => type === TokenType.AND || type === TokenType.OR || type === TokenType.XOR;
export const isReserved = type => type === TokenType.RESERVED_KEYWORD || type === TokenType.RESERVED_FUNCTION_NAME || type === TokenType.RESERVED_PHRASE || type === TokenType.RESERVED_CLAUSE || type === TokenType.RESERVED_SELECT || type === TokenType.RESERVED_SET_OPERATION || type === TokenType.RESERVED_JOIN || type === TokenType.ARRAY_KEYWORD || type === TokenType.CASE || type === TokenType.END || type === TokenType.WHEN || type === TokenType.ELSE || type === TokenType.THEN || type === TokenType.LIMIT || type === TokenType.BETWEEN || type === TokenType.ON || type === TokenType.AND || type === TokenType.OR || type === TokenType.XOR;
export const isLogicalOperator = type => type === TokenType.AND || type === TokenType.OR || type === TokenType.XOR || type === TokenType.ON;
//# sourceMappingURL=token.js.map
import { TokenType } from './token.js';
import * as regex from './regexFactory.js';
import TokenizerEngine from './TokenizerEngine.js';
import { escapeRegExp } from './regexUtil.js';
import { escapeRegExp, patternToRegex } from './regexUtil.js';
import { equalizeWhitespace } from '../utils.js';

@@ -91,2 +91,6 @@ import { NestedComment } from './NestedComment.js';

}, {
type: TokenType.ON,
regex: /ON\b/iuy,
text: toCanonical
}, {
type: TokenType.OR,

@@ -151,3 +155,3 @@ regex: /OR\b/iuy,

buildParamRules(cfg, paramTypesOverrides) {
var _cfg$paramTypes, _cfg$paramTypes2, _cfg$paramTypes3, _cfg$paramTypes4;
var _cfg$paramTypes, _cfg$paramTypes2, _cfg$paramTypes3, _cfg$paramTypes4, _cfg$paramTypes5;
// Each dialect has its own default parameter types (if any),

@@ -159,3 +163,4 @@ // but these can be overriden by the user of the library.

numbered: (paramTypesOverrides === null || paramTypesOverrides === void 0 ? void 0 : paramTypesOverrides.numbered) || ((_cfg$paramTypes3 = cfg.paramTypes) === null || _cfg$paramTypes3 === void 0 ? void 0 : _cfg$paramTypes3.numbered) || [],
positional: typeof (paramTypesOverrides === null || paramTypesOverrides === void 0 ? void 0 : paramTypesOverrides.positional) === 'boolean' ? paramTypesOverrides.positional : (_cfg$paramTypes4 = cfg.paramTypes) === null || _cfg$paramTypes4 === void 0 ? void 0 : _cfg$paramTypes4.positional
positional: typeof (paramTypesOverrides === null || paramTypesOverrides === void 0 ? void 0 : paramTypesOverrides.positional) === 'boolean' ? paramTypesOverrides.positional : (_cfg$paramTypes4 = cfg.paramTypes) === null || _cfg$paramTypes4 === void 0 ? void 0 : _cfg$paramTypes4.positional,
custom: (paramTypesOverrides === null || paramTypesOverrides === void 0 ? void 0 : paramTypesOverrides.custom) || ((_cfg$paramTypes5 = cfg.paramTypes) === null || _cfg$paramTypes5 === void 0 ? void 0 : _cfg$paramTypes5.custom) || []
};

@@ -183,3 +188,7 @@ return this.validRules([{

regex: paramTypes.positional ? /[?]/y : undefined
}]);
}, ...paramTypes.custom.map(customParam => ({
type: TokenType.CUSTOM_PARAMETER,
regex: patternToRegex(customParam.regex),
key: customParam.key ?? (v => v)
}))]);
}

@@ -186,0 +195,0 @@

@@ -9,3 +9,3 @@ import { quotePatterns } from './regexFactory.js';

}
export declare type PlainQuoteType = keyof typeof quotePatterns;
export type PlainQuoteType = keyof typeof quotePatterns;
export interface PrefixedQuoteType {

@@ -16,7 +16,7 @@ quote: PlainQuoteType;

}
export declare type QuoteType = PlainQuoteType | PrefixedQuoteType;
export interface VariableRegex {
export interface RegexPattern {
regex: string;
}
export declare type VariableType = VariableRegex | PrefixedQuoteType;
export type QuoteType = PlainQuoteType | PrefixedQuoteType | RegexPattern;
export type VariableType = RegexPattern | PrefixedQuoteType;
export interface ParamTypes {

@@ -27,3 +27,8 @@ positional?: boolean;

quoted?: (':' | '@' | '$')[];
custom?: CustomParameter[];
}
export interface CustomParameter {
regex: string;
key?: (text: string) => string;
}
export interface TokenizerOptions {

@@ -30,0 +35,0 @@ reservedSelect: string[];

@@ -136,4 +136,4 @@ import { TokenType } from '../lexer/token.js';

}
export declare type CommentNode = LineCommentNode | BlockCommentNode;
export declare type AstNode = ClauseNode | SetOperationNode | FunctionCallNode | ArraySubscriptNode | PropertyAccessNode | ParenthesisNode | BetweenPredicateNode | CaseExpressionNode | CaseWhenNode | CaseElseNode | LimitClauseNode | AllColumnsAsteriskNode | LiteralNode | IdentifierNode | KeywordNode | ParameterNode | OperatorNode | CommaNode | LineCommentNode | BlockCommentNode;
export type CommentNode = LineCommentNode | BlockCommentNode;
export type AstNode = ClauseNode | SetOperationNode | FunctionCallNode | ArraySubscriptNode | PropertyAccessNode | ParenthesisNode | BetweenPredicateNode | CaseExpressionNode | CaseWhenNode | CaseElseNode | LimitClauseNode | AllColumnsAsteriskNode | LiteralNode | IdentifierNode | KeywordNode | ParameterNode | OperatorNode | CommaNode | LineCommentNode | BlockCommentNode;
export {};

@@ -1,3 +0,2 @@

export let NodeType;
(function (NodeType) {
export let NodeType = /*#__PURE__*/function (NodeType) {
NodeType["statement"] = "statement";

@@ -24,3 +23,12 @@ NodeType["clause"] = "clause";

NodeType["block_comment"] = "block_comment";
})(NodeType || (NodeType = {}));
return NodeType;
}({});
// <ident>[<expr>]
// BETWEEN <expr1> AND <expr2>
// LIMIT <count>
// LIMIT <offset>, <count>
// The "*" operator used in SELECT *
//# sourceMappingURL=ast.js.map

@@ -34,3 +34,3 @@ import nearley from 'nearley';

} else {
throw new Error('Parse error: Ambiguous grammar');
throw new Error(`Parse error: Ambiguous grammar\n${JSON.stringify(results, undefined, 2)}`);
}

@@ -37,0 +37,0 @@ }

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

@@ -47,2 +47,21 @@ // Generated automatically by nearley, version 2.20.1

};
const addCommentsToArray = (nodes, {
leading,
trailing
}) => {
if (leading !== null && leading !== void 0 && leading.length) {
const [first, ...rest] = nodes;
nodes = [addComments(first, {
leading
}), ...rest];
}
if (trailing !== null && trailing !== void 0 && trailing.length) {
const lead = nodes.slice(0, -1);
const last = nodes[nodes.length - 1];
nodes = [...lead, addComments(last, {
trailing
})];
}
return nodes;
};
;

@@ -88,7 +107,12 @@ ;

"symbols": ["expressions_or_clauses", "statement$subexpression$1"],
"postprocess": ([children, [delimiter]]) => ({
type: NodeType.statement,
children,
hasSemicolon: delimiter.type === TokenType.DELIMITER
})
"postprocess": ([children, [delimiter]]) => {
var _children$;
return {
type: NodeType.statement,
children,
hasSemicolon: delimiter.type === TokenType.DELIMITER,
end: delimiter.start,
start: (_children$ = children[0]) === null || _children$ === void 0 ? void 0 : _children$.start
};
}
}, {

@@ -202,3 +226,4 @@ "name": "expressions_or_clauses$ebnf$1",

nameKw: toKeywordNode(nameToken),
children: [exp, ...expressions]
children: [exp, ...expressions],
start: nameToken.start
})

@@ -213,3 +238,4 @@ }, {

nameKw: toKeywordNode(nameToken),
children: []
children: [],
start: nameToken.start
})

@@ -239,3 +265,4 @@ }, {

nameKw: toKeywordNode(nameToken),
children
children,
start: nameToken.start
})

@@ -271,2 +298,24 @@ }, {

}, {
"name": "expression_chain$ebnf$1",
"symbols": []
}, {
"name": "expression_chain$ebnf$1",
"symbols": ["expression_chain$ebnf$1", "_expression_with_comments"],
"postprocess": d => d[0].concat([d[1]])
}, {
"name": "expression_chain",
"symbols": ["expression", "expression_chain$ebnf$1"],
"postprocess": ([expr, chain]) => [expr, ...chain]
}, {
"name": "andless_expression_chain$ebnf$1",
"symbols": []
}, {
"name": "andless_expression_chain$ebnf$1",
"symbols": ["andless_expression_chain$ebnf$1", "_andless_expression_with_comments"],
"postprocess": d => d[0].concat([d[1]])
}, {
"name": "andless_expression_chain",
"symbols": ["andless_expression", "andless_expression_chain$ebnf$1"],
"postprocess": ([expr, chain]) => [expr, ...chain]
}, {
"name": "expression_with_comments_",

@@ -278,2 +327,14 @@ "symbols": ["expression", "_"],

}, {
"name": "_expression_with_comments",
"symbols": ["_", "expression"],
"postprocess": ([_, expr]) => addComments(expr, {
leading: _
})
}, {
"name": "_andless_expression_with_comments",
"symbols": ["_", "andless_expression"],
"postprocess": ([_, expr]) => addComments(expr, {
leading: _
})
}, {
"name": "free_form_sql$subexpression$1",

@@ -290,5 +351,8 @@ "symbols": ["asteriskless_free_form_sql"]

"name": "asteriskless_free_form_sql$subexpression$1",
"symbols": ["asteriskless_expression"]
"symbols": ["asteriskless_andless_expression"]
}, {
"name": "asteriskless_free_form_sql$subexpression$1",
"symbols": ["logic_operator"]
}, {
"name": "asteriskless_free_form_sql$subexpression$1",
"symbols": ["between_predicate"]

@@ -310,6 +374,6 @@ }, {

"name": "expression$subexpression$1",
"symbols": ["asteriskless_expression"]
"symbols": ["andless_expression"]
}, {
"name": "expression$subexpression$1",
"symbols": ["asterisk"]
"symbols": ["logic_operator"]
}, {

@@ -320,40 +384,50 @@ "name": "expression",

}, {
"name": "asteriskless_expression$subexpression$1",
"name": "andless_expression$subexpression$1",
"symbols": ["asteriskless_andless_expression"]
}, {
"name": "andless_expression$subexpression$1",
"symbols": ["asterisk"]
}, {
"name": "andless_expression",
"symbols": ["andless_expression$subexpression$1"],
"postprocess": unwrap
}, {
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["array_subscript"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["case_expression"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["function_call"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["property_access"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["parenthesis"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["curly_braces"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["square_brackets"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["operator"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["identifier"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["parameter"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["literal"]
}, {
"name": "asteriskless_expression$subexpression$1",
"name": "asteriskless_andless_expression$subexpression$1",
"symbols": ["keyword"]
}, {
"name": "asteriskless_expression",
"symbols": ["asteriskless_expression$subexpression$1"],
"name": "asteriskless_andless_expression",
"symbols": ["asteriskless_andless_expression$subexpression$1"],
"postprocess": unwrap

@@ -410,3 +484,6 @@ }, {

openParen: "(",
closeParen: ")"
closeParen: ")",
start: open.start,
// 记录表达式的起止,用于获取子查询的起止范围
end: close.start
})

@@ -487,12 +564,12 @@ }, {

type: "BETWEEN"
} : BETWEEN, "_", "expression", "_", lexer.has("AND") ? {
} : BETWEEN, "_", "andless_expression_chain", "_", lexer.has("AND") ? {
type: "AND"
} : AND, "_", "expression"],
} : AND, "_", "andless_expression"],
"postprocess": ([betweenToken, _1, expr1, _2, andToken, _3, expr2]) => ({
type: NodeType.between_predicate,
betweenKw: toKeywordNode(betweenToken),
expr1: [addComments(expr1, {
expr1: addCommentsToArray(expr1, {
leading: _1,
trailing: _2
})],
}),
andKw: toKeywordNode(andToken),

@@ -642,2 +719,7 @@ expr2: [addComments(expr2, {

}, {
"name": "parameter$subexpression$1",
"symbols": [lexer.has("CUSTOM_PARAMETER") ? {
type: "CUSTOM_PARAMETER"
} : CUSTOM_PARAMETER]
}, {
"name": "parameter",

@@ -683,3 +765,7 @@ "symbols": ["parameter$subexpression$1"],

}, {
"name": "keyword$subexpression$1",
"name": "keyword",
"symbols": ["keyword$subexpression$1"],
"postprocess": ([[token]]) => toKeywordNode(token)
}, {
"name": "logic_operator$subexpression$1",
"symbols": [lexer.has("AND") ? {

@@ -689,3 +775,3 @@ type: "AND"

}, {
"name": "keyword$subexpression$1",
"name": "logic_operator$subexpression$1",
"symbols": [lexer.has("OR") ? {

@@ -695,3 +781,8 @@ type: "OR"

}, {
"name": "keyword$subexpression$1",
"name": "logic_operator$subexpression$1",
"symbols": [lexer.has("ON") ? {
type: "ON"
} : ON]
}, {
"name": "logic_operator$subexpression$1",
"symbols": [lexer.has("XOR") ? {

@@ -701,4 +792,4 @@ type: "XOR"

}, {
"name": "keyword",
"symbols": ["keyword$subexpression$1"],
"name": "logic_operator",
"symbols": ["logic_operator$subexpression$1"],
"postprocess": ([[token]]) => toKeywordNode(token)

@@ -705,0 +796,0 @@ }, {

import { Token } from '../lexer/token.js';
declare type NearleyToken = Token & {
type NearleyToken = Token & {
value: string;

@@ -4,0 +4,0 @@ };

@@ -6,3 +6,2 @@ import { lineColFromIndex } from '../lexer/lineColFromIndex.js';

// which however is wrong. Instead Nearley expects a text field.
export default class LexerAdapter {

@@ -9,0 +8,0 @@ index = 0;

@@ -0,27 +1,15 @@

import * as allDialects from './allDialects.js';
import { FormatOptions } from './FormatOptions.js';
import { DialectOptions } from './dialect.js';
export declare const formatters: {
bigquery: DialectOptions;
db2: DialectOptions;
hive: DialectOptions;
mariadb: DialectOptions;
mysql: DialectOptions;
n1ql: DialectOptions;
plsql: DialectOptions;
postgresql: DialectOptions;
redshift: DialectOptions;
singlestoredb: DialectOptions;
snowflake: DialectOptions;
spark: DialectOptions;
sql: DialectOptions;
sqlite: DialectOptions;
transactsql: DialectOptions;
trino: DialectOptions;
tsql: DialectOptions;
import Formatter from './formatter/Formatter.js';
import { StatementNode } from './parser/ast.js';
declare const dialectNameMap: Record<string, keyof typeof allDialects>;
export declare const supportedDialects: string[];
export type SqlLanguage = keyof typeof dialectNameMap;
export type FormatOptionsWithLanguage = Partial<FormatOptions> & {
language?: SqlLanguage;
};
export declare type SqlLanguage = keyof typeof formatters;
export declare const supportedDialects: string[];
export interface FormatOptionsWithLanguage extends FormatOptions {
language: SqlLanguage | DialectOptions;
}
export type FormatOptionsWithDialect = Partial<FormatOptions> & {
dialect: DialectOptions;
};
/**

@@ -31,8 +19,17 @@ * Format whitespace in a query to make it easier to read.

* @param {string} query - input SQL query string
* @param {Partial<FormatOptionsWithLanguage>} cfg Configuration options (see docs in README)
* @param {FormatOptionsWithLanguage} cfg Configuration options (see docs in README)
* @return {string} formatted query
*/
export declare const format: (query: string, cfg?: Partial<FormatOptionsWithLanguage>) => string;
export declare class ConfigError extends Error {
}
export declare type FormatFn = typeof format;
export declare const format: (query: string, cfg?: FormatOptionsWithLanguage) => string;
export declare const parse: (query: string, cfg?: Partial<FormatOptionsWithLanguage>) => StatementNode[];
/**
* Like the above format(), but language parameter is mandatory
* and must be a Dialect object instead of a string.
*
* @param {string} query - input SQL query string
* @param {FormatOptionsWithDialect} cfg Configuration options (see docs in README)
* @return {string} formatted query
*/
export declare const formatDialect: (query: string, { dialect, ...cfg }: FormatOptionsWithDialect) => Formatter;
export type FormatFn = typeof format;
export {};

@@ -1,42 +0,28 @@

import { bigquery } from './languages/bigquery/bigquery.formatter.js';
import { db2 } from './languages/db2/db2.formatter.js';
import { hive } from './languages/hive/hive.formatter.js';
import { mariadb } from './languages/mariadb/mariadb.formatter.js';
import { mysql } from './languages/mysql/mysql.formatter.js';
import { n1ql } from './languages/n1ql/n1ql.formatter.js';
import { plsql } from './languages/plsql/plsql.formatter.js';
import { postgresql } from './languages/postgresql/postgresql.formatter.js';
import { redshift } from './languages/redshift/redshift.formatter.js';
import { spark } from './languages/spark/spark.formatter.js';
import { sqlite } from './languages/sqlite/sqlite.formatter.js';
import { sql } from './languages/sql/sql.formatter.js';
import { trino } from './languages/trino/trino.formatter.js';
import { transactsql } from './languages/transactsql/transactsql.formatter.js';
import { singlestoredb } from './languages/singlestoredb/singlestoredb.formatter.js';
import { snowflake } from './languages/snowflake/snowflake.formatter.js';
import * as allDialects from './allDialects.js';
import { createDialect } from './dialect.js';
import Formatter from './formatter/Formatter.js';
export const formatters = {
bigquery,
db2,
hive,
mariadb,
mysql,
n1ql,
plsql,
postgresql,
redshift,
singlestoredb,
snowflake,
spark,
sql,
sqlite,
transactsql,
trino,
tsql: transactsql // alias for transactsql
import { ConfigError, validateConfig } from './validateConfig.js';
const dialectNameMap = {
bigquery: 'bigquery',
db2: 'db2',
hive: 'hive',
mariadb: 'mariadb',
mysql: 'mysql',
n1ql: 'n1ql',
plsql: 'plsql',
postgresql: 'postgresql',
redshift: 'redshift',
spark: 'spark',
sqlite: 'sqlite',
sql: 'sql',
trino: 'trino',
transactsql: 'transactsql',
tsql: 'transactsql',
// alias for transactsq
singlestoredb: 'singlestoredb',
snowflake: 'snowflake',
clickhouse: 'clickhouse'
};
export const supportedDialects = Object.keys(formatters);
export const supportedDialects = Object.keys(dialectNameMap);
const defaultOptions = {
language: 'sql',
tabWidth: 2,

@@ -52,3 +38,4 @@ useTabs: false,

denseOperators: false,
newlineBeforeSemicolon: false
newlineBeforeSemicolon: false,
functionCase: 'preserve'
};

@@ -60,6 +47,38 @@

* @param {string} query - input SQL query string
* @param {Partial<FormatOptionsWithLanguage>} cfg Configuration options (see docs in README)
* @param {FormatOptionsWithLanguage} cfg Configuration options (see docs in README)
* @return {string} formatted query
*/
export const format = (query, cfg = {}) => {
if (typeof cfg.language === 'string' && !supportedDialects.includes(cfg.language)) {
throw new ConfigError(`Unsupported SQL dialect: ${cfg.language}`);
}
const canonicalDialectName = dialectNameMap[cfg.language || 'sql'];
return formatDialect(query, {
...cfg,
dialect: allDialects[canonicalDialectName]
}).format(query);
};
export const parse = (query, cfg = {}) => {
if (typeof cfg.language === 'string' && !supportedDialects.includes(cfg.language)) {
throw new ConfigError(`Unsupported SQL dialect: ${cfg.language}`);
}
const canonicalDialectName = dialectNameMap[cfg.language || 'sql'];
return formatDialect(query, {
...cfg,
dialect: allDialects[canonicalDialectName]
}).parse(query);
};
/**
* Like the above format(), but language parameter is mandatory
* and must be a Dialect object instead of a string.
*
* @param {string} query - input SQL query string
* @param {FormatOptionsWithDialect} cfg Configuration options (see docs in README)
* @return {string} formatted query
*/
export const formatDialect = (query, {
dialect,
...cfg
}) => {
if (typeof query !== 'string') {

@@ -72,38 +91,4 @@ throw new Error('Invalid query argument. Expected string, instead got ' + typeof query);

});
const dialectOptions = typeof options.language === 'string' ? formatters[options.language] : options.language;
return new Formatter(createDialect(dialectOptions), options).format(query);
return new Formatter(createDialect(dialect), options);
};
export class ConfigError extends Error {}
function validateConfig(cfg) {
if (typeof cfg.language === 'string' && !supportedDialects.includes(cfg.language)) {
throw new ConfigError(`Unsupported SQL dialect: ${cfg.language}`);
}
if ('multilineLists' in cfg) {
throw new ConfigError('multilineLists config is no more supported.');
}
if ('newlineBeforeOpenParen' in cfg) {
throw new ConfigError('newlineBeforeOpenParen config is no more supported.');
}
if ('newlineBeforeCloseParen' in cfg) {
throw new ConfigError('newlineBeforeCloseParen config is no more supported.');
}
if ('aliasAs' in cfg) {
throw new ConfigError('aliasAs config is no more supported.');
}
if (cfg.expressionWidth <= 0) {
throw new ConfigError(`expressionWidth config must be positive number. Received ${cfg.expressionWidth} instead.`);
}
if (cfg.commaPosition === 'before' && cfg.useTabs) {
throw new ConfigError('commaPosition: before does not work when tabs are used for indentation.');
}
if (cfg.params && !validateParams(cfg.params)) {
// eslint-disable-next-line no-console
console.warn('WARNING: All "params" option values should be strings.');
}
return cfg;
}
function validateParams(params) {
const paramValues = params instanceof Array ? params : Object.values(params);
return paramValues.every(p => typeof p === 'string');
}
//# sourceMappingURL=sqlFormatter.js.map

@@ -9,2 +9,2 @@ export declare const dedupe: (arr: string[]) => string[];

export declare const isMultiline: (text: string) => boolean;
export declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
{
"name": "bravo-formatter",
"version": "1.0.0",
"version": "1.0.1",
"description": "Format whitespace in a SQL query to make it more readable",
"license": "MIT",
"main": "dist/bravo-formatter.min.cjs",
"main": "lib/index.js",
"unpkg": "dist/bravo-formatter.min.js",
"module": "lib/index.js",
"types": "lib/src/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./lib/src/index.d.ts",
"import": "./lib/index.js",
"require": "./dist/bravo-formatter.min.cjs"
}
},
"types": "lib/index.d.ts",
"bin": {

@@ -60,3 +52,3 @@ "bravo-formatter": "./bin/bravo-formatter-cli.cjs"

"check": "yarn ts:check && yarn pretty:check && yarn lint",
"tPrepare": "yarn clean && yarn grammar && yarn fix && yarn check && yarn build",
"prepare": "yarn clean && yarn grammar && yarn build",
"pre-commit": "npm-run-all --parallel ts:changes lint:changes",

@@ -99,5 +91,5 @@ "grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts",

"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"release-it": "^15.1.1",
"rimraf": "^3.0.2",
"prettier": "^2.8.4",
"ts-loader": "^9.3.1",

@@ -104,0 +96,0 @@ "typescript": "^4.7.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc