Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit 5353b33

Browse files
committed
Merge branch 'master' into tracer
# Conflicts: # CHANGELOG.md # Gruntfile.js # demo/js/sqlite-parser-demo.js # dist/sqlite-parser-min.js # dist/sqlite-parser.js # index.js # lib/parser.js # package.json # test/core/parse-errors-spec.js
2 parents 1d9b04b + 147a522 commit 5353b33

18 files changed

+278
-68602
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015"],
3+
"plugins": ["add-module-exports"]
4+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ npm-debug.log
33
.idea/
44
.ref/
55
.tmp/
6+
lib/
7+
dist/

.npmignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
test
2-
demo
3-
dist
4-
src
1+
test/
2+
demo/
3+
src/
4+
lib/
55
.ref
66
.tmp
77
TODO.md

Gruntfile.js

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ module.exports = function(grunt) {
22
function getBanner(isDemo) {
33
return '/*!\n' +
44
' * <%= pkg.name %>' + (isDemo ? '-demo' : '') + ' - v<%= pkg.version %>\n' +
5-
' * @copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
5+
' * @copyright 2015-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
66
' * @author Nick Wronski <nick@javascript.com>\n' +
77
' */';
88
}
9+
const mochaCmd = './node_modules/.bin/mocha --compilers js:babel-core/register';
910
grunt.initConfig({
1011
pkg: grunt.file.readJSON('package.json'),
1112
browserify: {
13+
options: {
14+
transform: [require('babelify').configure({
15+
sourceMapRelative: './',
16+
compact: true,
17+
sourceMaps: true
18+
})]
19+
},
1220
dist: {
1321
options: {
1422
browserifyOptions: {
15-
debug: false,
23+
debug: true,
1624
standalone: 'sqliteParser'
1725
}
1826
},
@@ -73,37 +81,50 @@ module.exports = function(grunt) {
7381
}
7482
},
7583
clean: {
76-
build: ['lib/*.js'],
84+
build: ['.tmp/*.js', 'lib/*.js'],
7785
dist: ['dist/*.js'],
7886
interactive: ['.tmp/**/*'],
7987
demo: ['demo/**/*']
8088
},
89+
concat: {
90+
options: {
91+
stripBanners: true,
92+
// This imports the utilities used by the parser
93+
banner: "\nimport * as util from './parser-util';\n\nconst ",
94+
// This exports the compiled parser
95+
footer: "\nexport default parser.parse;"
96+
},
97+
build: {
98+
src: ['.tmp/parser.js'],
99+
dest: 'lib/parser.js'
100+
}
101+
},
81102
shell: {
82103
build: {
83104
options: {
84105
failOnError: true
85106
},
86-
command: './node_modules/.bin/pegjs --trace src/grammar.pegjs lib/parser.js'
107+
command: './node_modules/.bin/pegjs --trace -e parser src/grammar.pegjs .tmp/parser.js'
87108
},
88109
test: {
89110
options: {
90111
failOnError: true
91112
},
92-
command: './node_modules/.bin/mocha --reporter=nyan'
113+
command: `${mochaCmd} --reporter=nyan`
93114
},
94115
debug: {
95116
options: {
96117
failOnError: false,
97118
debounceDelay: 500,
98119
forever: true
99120
},
100-
command: 'DEBUG=true ./node_modules/.bin/mocha'
121+
command: `DEBUG=true ${mochaCmd}`
101122
},
102123
rewrite: {
103124
options: {
104125
failOnError: true
105126
},
106-
command: 'REWRITE=true ./node_modules/.bin/mocha'
127+
command: `REWRITE=true ${mochaCmd}`
107128
}
108129
},
109130
connect: {
@@ -116,14 +137,25 @@ module.exports = function(grunt) {
116137
}
117138
},
118139
watch: {
140+
test: {
141+
options: {
142+
debounceDelay: 250,
143+
livereload: false
144+
},
145+
files: [
146+
'index.js', 'test/**/*.js', 'src/*.js', 'src/*.pegjs',
147+
'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
148+
],
149+
tasks: ['build', 'shell:test']
150+
},
119151
debug: {
120152
options: {
121153
debounceDelay: 250,
122154
livereload: false
123155
},
124156
files: [
125-
'index.js', 'test/*.js', 'src/*.js', 'src/*.pegjs',
126-
'test/sql/*.sql', 'Gruntfile.js'
157+
'index.js', 'test/**/*.js', 'src/*.js', 'src/*.pegjs',
158+
'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
127159
],
128160
tasks: ['build', 'shell:debug']
129161
},
@@ -227,11 +259,14 @@ module.exports = function(grunt) {
227259
'build'
228260
]);
229261
grunt.registerTask('build', [
230-
'clean:build', 'shell:build', 'copy:build'
262+
'clean:build', 'shell:build', 'concat:build', 'copy:build'
231263
]);
232264
grunt.registerTask('test', [
233265
'build', 'shell:test'
234266
]);
267+
grunt.registerTask('test-watch', [
268+
'test', 'watch:test'
269+
]);
235270
grunt.registerTask('debug', [
236271
'build', 'shell:debug', 'watch:debug'
237272
]);
@@ -248,8 +283,11 @@ module.exports = function(grunt) {
248283
grunt.registerTask('demo', [
249284
'interactive', 'clean:demo', 'copy:demo', 'uglify:demo', 'usebanner:demo'
250285
]);
286+
grunt.registerTask('minidist', [
287+
'default', 'clean:dist', 'browserify:dist'
288+
]);
251289
grunt.registerTask('dist', [
252-
'default', 'clean:dist', 'browserify:dist', 'uglify:dist', 'replace:dist', 'usebanner:dist'
290+
'minidist', 'uglify:dist', 'replace:dist', 'usebanner:dist'
253291
]);
254292
grunt.registerTask('release', [
255293
'test', 'dist', 'demo', 'clean:interactive'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ describe('sqlite-parser', function() {
169169
tree.equals(this, done);
170170
});
171171

172-
// uses: test/sql/parseError1.sql
172+
// uses: test/sql/parse-error-1.sql
173173
it('parse error 1', function(done) {
174174
tree.error({
175175
'message': 'There is a syntax error near FROM Clause [Table Identifier]'

demo/css/sqlite-parser-demo.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/js/sqlite-parser-demo.js

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sqlite-parser-min.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)