-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring: use webpack + HMR unit tests + one build bundle per lang…
…uage
- Loading branch information
Showing
15 changed files
with
4,232 additions
and
4,170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ lib/ | |
.coveralls.yml | ||
bower_components/ | ||
umd/ | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"name": "Attach unit tests", | ||
"request": "attach", | ||
"port": 9240, | ||
"resolveSourceMapLocations": [ | ||
"${workspaceFolder}/**", | ||
"!**/node_modules/**" | ||
], | ||
"skipFiles": [ | ||
"<node_internals>/*.js", | ||
"**/loader.js", // webpack hmr reloader | ||
"node_modules/core-js/**", | ||
"output/**" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"mochaExplorer.hmrBundle": "output/dev/tests.js", | ||
// When using HMR, it is recommanded to configure a different debug port here. | ||
// otherwise, you wont be able to use mocha tests in multiple instances of vscode. | ||
"mochaExplorer.debuggerPort": 9240, | ||
"mochaExplorer.require": "source-map-support/register", | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/CVS": true, | ||
"**/.DS_Store": true, | ||
"node_modules": true, | ||
"output": true, | ||
"package-lock.json": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1 @@ | ||
// Type definitions for node-sql-parser 1.0 | ||
// Project: https://github.com/taozhi8833998/node-sql-parser#readme | ||
// Definitions by: taozhi8833998 <https://github.com/taozhi8833998> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.4 | ||
|
||
export interface With { | ||
name: string; | ||
stmt: any[]; | ||
columns?: any[]; | ||
} | ||
export type WhilteListCheckMode = 'table' | 'column'; | ||
export interface Option { | ||
database?: string, | ||
type?: string, | ||
} | ||
export interface TableColumnAst { | ||
tableList: string[]; | ||
columnList: string[]; | ||
ast: AST[] | AST; | ||
} | ||
export interface From { | ||
db: string | null; | ||
table: string; | ||
as: string | null; | ||
} | ||
export interface Dual { | ||
type: 'dual'; | ||
} | ||
export interface Limit { | ||
type: string; | ||
value: number; | ||
} | ||
export interface OrderBy { | ||
type: 'ASC' | 'DESC'; | ||
expr: any; | ||
} | ||
export interface ColumnRef { | ||
type: 'column_ref'; | ||
table: string | null; | ||
column: string; | ||
} | ||
export interface SetList { | ||
column: string; | ||
value: any; | ||
table: string | null; | ||
} | ||
export interface InsertReplaceValue { | ||
type: 'expr_list'; | ||
value: any[]; | ||
} | ||
export interface Star { | ||
type: 'star'; | ||
value: '*'; | ||
} | ||
export interface AggrFunc { | ||
type: 'aggr_func'; | ||
name: string; | ||
args: ColumnRef | AggrFunc | Star | null; | ||
} | ||
export interface Column { | ||
expr: ColumnRef | AggrFunc; | ||
as: string; | ||
} | ||
export interface Select { | ||
with: With | null; | ||
type: 'select'; | ||
options: any[] | null; | ||
distinct: 'DISTINCT' | null; | ||
columns: any[] | Column[] | '*'; | ||
from: Array<From | Dual> | null; | ||
where: any; | ||
groupby: ColumnRef[] | null; | ||
having: any[] | null; | ||
orderby: OrderBy[] | null; | ||
limit: Limit[] | null; | ||
} | ||
export interface Insert_Replace { | ||
type: 'replace' | 'insert'; | ||
db: string | null; | ||
table: any; | ||
columns: string[] | null; | ||
values: InsertReplaceValue[]; | ||
} | ||
export interface Update { | ||
type: 'update'; | ||
db: string | null; | ||
table: Array<From | Dual> | null; | ||
set: SetList[]; | ||
where: any; | ||
} | ||
export interface Delete { | ||
type: 'delete'; | ||
table: any; | ||
from: Array<From | Dual>; | ||
where: any; | ||
} | ||
|
||
export interface Alter { | ||
type: 'alter', | ||
table: From, | ||
expr: any | ||
} | ||
|
||
export interface Use { | ||
type: 'use'; | ||
db: string; | ||
} | ||
|
||
export type AST = Use | Select | Insert_Replace | Update | Delete | Alter; | ||
|
||
export class Parser { | ||
constructor(); | ||
|
||
parse(sql: string, opt?: Option): TableColumnAst; | ||
|
||
astify(sql: string, opt?: Option): AST[] | AST; | ||
|
||
sqlify(ast: AST[] | AST, opt?: Option): string; | ||
|
||
whiteListCheck(sql: string, whiteList: string[], opt?: Option): Error | undefined; | ||
|
||
tableList(sql: string, opt?: Option): string[]; | ||
|
||
columnList(sql: string, opt?: Option): string[]; | ||
} | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const Parser = require('./lib/parser').default | ||
const util = require('./lib/util') | ||
import Parser from './src/parser'; | ||
import * as util from './src/util'; | ||
|
||
module.exports = { | ||
export { | ||
Parser, | ||
util, | ||
} | ||
}; | ||
|
||
if (global && global.window) { | ||
global.window.NodeSQLParser = { | ||
Parser, | ||
util, | ||
} | ||
}; | ||
} |
Oops, something went wrong.