Skip to content

Commit 3767094

Browse files
committed
Merge branch '2.x'
2 parents 9e53d4f + a8f2eb5 commit 3767094

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4068
-3414
lines changed

.jshintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"globalstrict": true,
44
"browser": true,
55
"predef": [
6-
"TraceKit",
76
"console",
8-
"_slice"
7+
"module",
8+
"require"
99
]
1010
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 2.0.0
4+
5+
* CHANGE: Raven.js now wraps functions passed to timer functions, event listeners, and XMLHttpRequest handlers
6+
* CHANGE: Removed jQuery, Backbone, and native plugins (now handled inside raven.js)
7+
* CHANGE: Default HTTP transport changed from `Image` GET to `XMLHttpRequest` POST (w/ CORS)
8+
* CHANGE: When using CommonJS, plugins are initialized via `Raven.addPlugin(require('raven-js/plugins/ember'))`
9+
* CHANGE: Raven builds are generated using Browserify
10+
* NEW: Integration tests (/test/integration/index.html)
11+
312
## 1.3.0
413
* CHANGE: `console` plugin will now send all arguments as an `extra` value. See: https://github.com/getsentry/raven-js/pull/398
514
* CHANGE: Bump to v7 of the Sentry API spec. This now requires a Sentry 7.7.0+ https://github.com/getsentry/raven-js/pull/403

Gruntfile.js

Lines changed: 74 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
var proxyquire = require('proxyquireify');
2+
var versionify = require('browserify-versionify');
3+
14
module.exports = function(grunt) {
25
"use strict";
36

47
var _ = require('lodash');
58
var path = require('path');
6-
7-
var coreFiles = [
8-
'template/_header.js',
9-
'vendor/**/*.js',
10-
'src/**/*.js',
11-
'template/_footer.js'
12-
];
9+
var through = require('through2');
1310

1411
var excludedPlugins = [
1512
'react-native'
@@ -26,6 +23,21 @@ module.exports = function(grunt) {
2623
return path;
2724
});
2825

26+
// custom browserify transformer to re-write plugins to
27+
// self-register with Raven via addPlugin
28+
function AddPluginBrowserifyTransformer() {
29+
return function (file) {
30+
return through(function (buf, enc, next) {
31+
buf = buf.toString('utf8');
32+
if (/plugins/.test(file)) {
33+
buf += "\nrequire('../src/singleton').addPlugin(module.exports);";
34+
}
35+
this.push(buf);
36+
next();
37+
});
38+
};
39+
}
40+
2941
// Taken from http://dzone.com/snippets/calculate-all-combinations
3042
var combine = function (a) {
3143
var fn = function (n, src, got, all) {
@@ -65,7 +77,7 @@ module.exports = function(grunt) {
6577
key.sort();
6678

6779
var dest = path.join('build/', key.join(','), '/raven.js');
68-
dict[dest] = coreFiles.concat(comb);
80+
dict[dest] = ['src/singleton.js'].concat(comb);
6981

7082
return dict;
7183
}, {});
@@ -75,18 +87,38 @@ module.exports = function(grunt) {
7587
aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},
7688

7789
clean: ['build'],
78-
concat: {
90+
91+
browserify: {
7992
options: {
80-
separator: '\n',
81-
banner: grunt.file.read('template/_copyright.js'),
82-
process: true
93+
browserifyOptions: {
94+
banner: grunt.file.read('template/_copyright.js'),
95+
standalone: 'Raven' // umd
96+
97+
},
98+
transform: [versionify]
8399
},
84100
core: {
85-
src: coreFiles.concat(plugins),
101+
src: 'src/singleton.js',
86102
dest: 'build/raven.js'
87103
},
88-
all: {
89-
files: pluginConcatFiles
104+
plugins: {
105+
files: pluginConcatFiles,
106+
options: {
107+
transform: [
108+
[ versionify ],
109+
[ new AddPluginBrowserifyTransformer() ]
110+
]
111+
}
112+
},
113+
test: {
114+
src: 'test/**/*.test.js',
115+
dest: 'build/raven.test.js',
116+
options: {
117+
browserifyOptions: {
118+
debug: true // source maps
119+
},
120+
plugin: [proxyquire.plugin]
121+
}
90122
}
91123
},
92124

@@ -100,7 +132,13 @@ module.exports = function(grunt) {
100132
sourceMappingURL: function (dest) {
101133
return path.basename(dest, '.js') + '.map';
102134
},
103-
preserveComments: 'some'
135+
preserveComments: 'some',
136+
compress: {
137+
dead_code: true,
138+
global_defs: {
139+
"TEST": false
140+
}
141+
}
104142
},
105143
dist: {
106144
src: ['build/**/*.js'],
@@ -121,18 +159,22 @@ module.exports = function(grunt) {
121159
},
122160

123161
mocha: {
124-
all: {
125-
options: {
126-
mocha: {
127-
ignoreLeaks: true,
128-
grep: grunt.option('grep')
129-
},
130-
log: true,
131-
reporter: 'Dot',
132-
run: true
162+
options: {
163+
mocha: {
164+
ignoreLeaks: true,
165+
grep: grunt.option('grep')
133166
},
167+
log: true,
168+
reporter: 'Dot',
169+
run: true
170+
},
171+
unit: {
134172
src: ['test/index.html'],
135173
nonull: true
174+
},
175+
integration: {
176+
src: ['test/integration/index.html'],
177+
nonull: true
136178
}
137179
},
138180

@@ -251,13 +293,13 @@ module.exports = function(grunt) {
251293

252294
// Grunt contrib tasks
253295
grunt.loadNpmTasks('grunt-contrib-uglify');
254-
grunt.loadNpmTasks('grunt-contrib-concat');
255296
grunt.loadNpmTasks('grunt-contrib-clean');
256297
grunt.loadNpmTasks('grunt-contrib-jshint');
257298
grunt.loadNpmTasks('grunt-contrib-connect');
258299
grunt.loadNpmTasks('grunt-contrib-copy');
259300

260301
// 3rd party Grunt tasks
302+
grunt.loadNpmTasks('grunt-browserify');
261303
grunt.loadNpmTasks('grunt-mocha');
262304
grunt.loadNpmTasks('grunt-release');
263305
grunt.loadNpmTasks('grunt-s3');
@@ -266,15 +308,16 @@ module.exports = function(grunt) {
266308

267309
// Build tasks
268310
grunt.registerTask('_prep', ['clean', 'gitinfo', 'version']);
269-
grunt.registerTask('concat.core', ['_prep', 'concat:core']);
270-
grunt.registerTask('concat.all', ['_prep', 'concat:all']);
271-
grunt.registerTask('build.core', ['concat.core', 'uglify', 'fixSourceMaps', 'sri:dist']);
272-
grunt.registerTask('build.all', ['concat.all', 'uglify', 'fixSourceMaps', 'sri:dist', 'sri:build']);
311+
grunt.registerTask('browserify.core', ['_prep', 'browserify:core']);
312+
grunt.registerTask('browserify.plugins', ['_prep', 'browserify:plugins']);
313+
grunt.registerTask('build.test', ['_prep', 'browserify:test']);
314+
grunt.registerTask('build.core', ['browserify.core', 'uglify', 'fixSourceMaps', 'sri:dist']);
315+
grunt.registerTask('build.all', ['browserify.plugins', 'uglify', 'fixSourceMaps', 'sri:dist', 'sri:build']);
273316
grunt.registerTask('build', ['build.all']);
274317
grunt.registerTask('dist', ['build.core', 'copy:dist']);
275318

276319
// Test task
277-
grunt.registerTask('test', ['jshint', 'mocha']);
320+
grunt.registerTask('test', ['jshint', 'browserify.core', 'browserify:test', 'mocha']);
278321

279322
// Webserver tasks
280323
grunt.registerTask('run:test', ['connect:test']);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Raven.js is a tiny standalone JavaScript client for [Sentry](https://getsentry.com/).
44

5-
**Raven.js v1.3 requires Sentry v7.7.0 or later.**
5+
**Raven.js v2.0 requires Sentry v8.0.0 or later.**
66

77
## Resources
88

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven-js",
3-
"version": "1.3.0",
3+
"version": "2.0.0-rc1",
44
"dependencies": {},
55
"main": "dist/raven.js",
66
"ignore": [

0 commit comments

Comments
 (0)