Skip to content

Commit 0823f6a

Browse files
author
Malte Legenhausen
committed
Upgraded to Babel 6
1 parent 5992650 commit 0823f6a

File tree

7 files changed

+25
-38
lines changed

7 files changed

+25
-38
lines changed

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,4 @@ module.exports = function(source, inputSourceMap) {
6868

6969
result = transpile(source, options);
7070
this.callback(null, result.code, result.map);
71-
7271
};

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
22
"name": "babel-loader",
3-
"version": "5.3.3",
3+
"version": "6.0.0",
44
"description": "babel module loader for webpack",
55
"main": "index.js",
66
"dependencies": {
7-
"babel-core": "^5.4.0",
7+
"babel-core": "^6.0.12",
88
"loader-utils": "^0.2.9",
99
"object-assign": "^3.0.0"
1010
},
1111
"peerDependencies": {
12-
"babel-core": "^5.0.0",
12+
"babel-core": "^6.0.12",
1313
"webpack": "*"
1414
},
1515
"devDependencies": {
16-
"babel-core": "^5.5.8",
16+
"babel-core": "^6.0.12",
17+
"babel-preset-es2015": "^6.0.12",
1718
"expect.js": "^0.3.1",
1819
"istanbul": "^0.3.15",
1920
"jscs": "^1.13.1",

test/cache.test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ describe('Filesystem Cache', function() {
4242

4343
it('should output files to cache directory', function(done) {
4444

45+
var loader = babelLoader + '?presets[]=es2015&cacheDirectory=' + cacheDir;
4546
var config = assign({}, globalConfig, {
4647
module: {
4748
loaders: [
4849
{
4950
test: /\.jsx?/,
50-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
51+
loader: loader,
5152
exclude: /node_modules/,
5253
},
5354
],
@@ -71,7 +72,7 @@ describe('Filesystem Cache', function() {
7172
loaders: [
7273
{
7374
test: /\.jsx?/,
74-
loader: babelLoader + '?cacheDirectory',
75+
loader: babelLoader + '?presets[]=es2015cacheDirectory',
7576
exclude: /node_modules/,
7677
},
7778
],
@@ -95,12 +96,13 @@ describe('Filesystem Cache', function() {
9596
});
9697

9798
it('should read from cache directory if cached file exists', function(done) {
99+
var loader = babelLoader + '?presets[]=es2015&cacheDirectory=' + cacheDir;
98100
var config = assign({}, globalConfig, {
99101
module: {
100102
loaders: [
101103
{
102104
test: /\.jsx?/,
103-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
105+
loader: loader,
104106
exclude: /node_modules/,
105107
},
106108
],
@@ -125,12 +127,13 @@ describe('Filesystem Cache', function() {
125127
});
126128

127129
it('should have one file per module', function(done) {
130+
var loader = babelLoader + '?presets[]=es2015&cacheDirectory=' + cacheDir;
128131
var config = assign({}, globalConfig, {
129132
module: {
130133
loaders: [
131134
{
132135
test: /\.jsx?/,
133-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
136+
loader: loader,
134137
exclude: /node_modules/,
135138
},
136139
],
@@ -163,6 +166,7 @@ describe('Filesystem Cache', function() {
163166
query: {
164167
cacheDirectory: cacheDir,
165168
cacheIdentifier: 'a',
169+
presets: ['es2015'],
166170
},
167171
},
168172
],
@@ -178,6 +182,7 @@ describe('Filesystem Cache', function() {
178182
query: {
179183
cacheDirectory: cacheDir,
180184
cacheIdentifier: 'b',
185+
presets: ['es2015'],
181186
},
182187
},
183188
],

test/fixtures/experimental.js

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

test/loader.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('Loader', function() {
4545
loaders: [
4646
{
4747
test: /\.jsx?/,
48-
loader: babelLoader,
48+
loader: babelLoader + '?presets[]=es2015',
4949
exclude: /node_modules/,
5050
},
5151
],
@@ -78,15 +78,15 @@ describe('Loader', function() {
7878
loaders: [
7979
{
8080
test: /\.jsx?/,
81-
loader: babelLoader,
81+
loader: babelLoader + '?presets[]=es2015',
8282
exclude: /node_modules/,
8383
},
8484
],
8585
},
8686
});
8787

8888
webpack(config, function(err, stats) {
89-
expect(stats.compilation.errors).to.have.length();
89+
expect(stats.compilation.errors.length).to.be(1);
9090
expect(stats.compilation.errors[0]).to.be.an(Error);
9191

9292
return done();

test/options.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ describe('Options', function() {
4040

4141
it('should interpret options given to the loader', function(done) {
4242
var config = assign({}, globalConfig, {
43-
entry: './test/fixtures/experimental.js',
43+
entry: './test/fixtures/basic.js',
4444
module: {
4545
loaders: [
4646
{
4747
test: /\.jsx?/,
48-
loader: babelLoader + '?stage=0',
48+
loader: babelLoader + '?presets[]=es2015',
4949
exclude: /node_modules/,
5050
},
5151
],
@@ -67,9 +67,9 @@ describe('Options', function() {
6767
it('should interpret options given globally', function(done) {
6868

6969
var config = assign({}, globalConfig, {
70-
entry: './test/fixtures/experimental.js',
70+
entry: './test/fixtures/basic.js',
7171
babel: {
72-
stage: 0,
72+
presets: ['es2015'],
7373
},
7474
module: {
7575
loaders: [
@@ -96,15 +96,15 @@ describe('Options', function() {
9696

9797
it('should give priority to loader options', function(done) {
9898
var config = assign({}, globalConfig, {
99-
entry: './test/fixtures/experimental.js',
99+
entry: './test/fixtures/basic.js',
100100
babel: {
101-
stage: 4,
101+
presets: [],
102102
},
103103
module: {
104104
loaders: [
105105
{
106106
test: /\.jsx?/,
107-
loader: babelLoader + '?stage=0',
107+
loader: babelLoader + '?presets[]=es2015',
108108
exclude: /node_modules/,
109109
},
110110
],

test/sourcemaps.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('Sourcemaps', function() {
4747
loaders: [
4848
{
4949
test: /\.jsx?/,
50-
loader: babelLoader,
50+
loader: babelLoader + '?presets[]=es2015',
5151
exclude: /node_modules/,
5252
},
5353
],

0 commit comments

Comments
 (0)