babel-loader 5.4.1 → 5.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -1
- package/.editorconfig +0 -14
- package/.jscsrc +0 -9
- package/.jshintignore +0 -2
- package/.jshintrc +0 -5
- package/.npmignore +0 -4
- package/CONTRIBUTING.md +0 -17
- package/test/cache.test.js +0 -205
- package/test/fixtures/babelrc-test/.babelrc +0 -3
- package/test/fixtures/babelrc-test/1/2/3/.gitkeep +0 -0
- package/test/fixtures/basic.js +0 -11
- package/test/fixtures/constant.js +0 -1
- package/test/fixtures/experimental.js +0 -18
- package/test/fixtures/import.js +0 -7
- package/test/fixtures/syntax.js +0 -12
- package/test/loader.test.js +0 -97
- package/test/options.test.js +0 -126
- package/test/resolverc.test.js +0 -15
- package/test/sourcemaps.test.js +0 -119
package/package.json
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "babel-loader",
|
3
|
-
"version": "5.4.
|
3
|
+
"version": "5.4.2",
|
4
4
|
"description": "babel module loader for webpack",
|
5
5
|
"main": "index.js",
|
6
|
+
"files": [
|
7
|
+
"index.js",
|
8
|
+
"lib"
|
9
|
+
],
|
6
10
|
"dependencies": {
|
7
11
|
"babel-core": "^5.4.0",
|
8
12
|
"loader-utils": "^0.2.9",
|
package/.editorconfig
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# top-most EditorConfig file
|
2
|
-
root = true
|
3
|
-
|
4
|
-
# Unix-style newlines with a newline ending every file
|
5
|
-
[*]
|
6
|
-
charset = utf-8
|
7
|
-
end_of_line = lf
|
8
|
-
indent_style = space
|
9
|
-
indent_size = 2
|
10
|
-
insert_final_newline = true
|
11
|
-
trim_trailing_whitespace = true
|
12
|
-
|
13
|
-
[*.md]
|
14
|
-
trim_trailing_whitespace = false
|
package/.jscsrc
DELETED
package/.jshintignore
DELETED
package/.jshintrc
DELETED
package/.npmignore
DELETED
package/CONTRIBUTING.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
1. Fork it!
|
4
|
-
2. Create your feature branch: `git checkout -b my-new-feature`
|
5
|
-
3. Commit your changes: `git commit -am 'Add some feature'`
|
6
|
-
4. Push to the branch: `git push origin my-new-feature`
|
7
|
-
5. Submit a pull request :D
|
8
|
-
|
9
|
-
# Code Standards
|
10
|
-
|
11
|
-
I'm not too strict with coding styles.
|
12
|
-
|
13
|
-
While personally I'm using the [node-style-guide](https://github.com/felixge/node-style-guide), as long you don't to something too weird or fancy, that's probably ok.
|
14
|
-
|
15
|
-
If, however, you want to ensure that you're following the node style guide, you can use [JSCS](https://github.com/jscs-dev/node-jscs). The rules are already set on the [.jscsrc](https://github.com/babel/babel-loader/blob/master/.jscsrc) file and there's most likely some [package](http://jscs.info/overview.html#friendly-packages) to your editor already.
|
16
|
-
|
17
|
-
Documentation, wether in the state of JavaDoc or simple line comments are always welcome.
|
package/test/cache.test.js
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var fs = require('fs');
|
4
|
-
var os = require('os');
|
5
|
-
var path = require('path');
|
6
|
-
var assign = require('object-assign');
|
7
|
-
var expect = require('expect.js');
|
8
|
-
var mkdirp = require('mkdirp');
|
9
|
-
var rimraf = require('rimraf');
|
10
|
-
var webpack = require('webpack');
|
11
|
-
|
12
|
-
describe('Filesystem Cache', function() {
|
13
|
-
|
14
|
-
var cacheDir = path.resolve(__dirname, 'output/cache/cachefiles');
|
15
|
-
var outputDir = path.resolve(__dirname, './output/cache/');
|
16
|
-
var babelLoader = path.resolve(__dirname, '../');
|
17
|
-
var globalConfig = {
|
18
|
-
entry: './test/fixtures/basic.js',
|
19
|
-
output: {
|
20
|
-
path: outputDir,
|
21
|
-
filename: '[id].cache.js',
|
22
|
-
},
|
23
|
-
module: {
|
24
|
-
loaders: [
|
25
|
-
{
|
26
|
-
test: /\.jsx?/,
|
27
|
-
loader: babelLoader,
|
28
|
-
exclude: /node_modules/,
|
29
|
-
},
|
30
|
-
],
|
31
|
-
},
|
32
|
-
};
|
33
|
-
|
34
|
-
// Clean generated cache files before each test
|
35
|
-
// so that we can call each test with an empty state.
|
36
|
-
beforeEach(function(done) {
|
37
|
-
rimraf(outputDir, function(err) {
|
38
|
-
if (err) { return done(err); }
|
39
|
-
mkdirp(cacheDir, done);
|
40
|
-
});
|
41
|
-
});
|
42
|
-
|
43
|
-
it('should output files to cache directory', function(done) {
|
44
|
-
|
45
|
-
var config = assign({}, globalConfig, {
|
46
|
-
module: {
|
47
|
-
loaders: [
|
48
|
-
{
|
49
|
-
test: /\.jsx?/,
|
50
|
-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
|
51
|
-
exclude: /node_modules/,
|
52
|
-
},
|
53
|
-
],
|
54
|
-
},
|
55
|
-
});
|
56
|
-
|
57
|
-
webpack(config, function(err, stats) {
|
58
|
-
expect(err).to.be(null);
|
59
|
-
|
60
|
-
fs.readdir(cacheDir, function(err, files) {
|
61
|
-
expect(err).to.be(null);
|
62
|
-
expect(files).to.not.be.empty();
|
63
|
-
done();
|
64
|
-
});
|
65
|
-
});
|
66
|
-
});
|
67
|
-
|
68
|
-
it('should output files to OS\'s tmp dir', function(done) {
|
69
|
-
var config = assign({}, globalConfig, {
|
70
|
-
module: {
|
71
|
-
loaders: [
|
72
|
-
{
|
73
|
-
test: /\.jsx?/,
|
74
|
-
loader: babelLoader + '?cacheDirectory',
|
75
|
-
exclude: /node_modules/,
|
76
|
-
},
|
77
|
-
],
|
78
|
-
},
|
79
|
-
});
|
80
|
-
|
81
|
-
webpack(config, function(err, stats) {
|
82
|
-
expect(err).to.be(null);
|
83
|
-
|
84
|
-
fs.readdir(os.tmpdir(), function(err, files) {
|
85
|
-
|
86
|
-
files = files.filter(function(file) {
|
87
|
-
return /\b[0-9a-f]{5,40}\.json\.gzip\b/.test(file);
|
88
|
-
});
|
89
|
-
|
90
|
-
expect(err).to.be(null);
|
91
|
-
expect(files).to.not.be.empty();
|
92
|
-
done();
|
93
|
-
});
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
|
-
it('should read from cache directory if cached file exists', function(done) {
|
98
|
-
var config = assign({}, globalConfig, {
|
99
|
-
module: {
|
100
|
-
loaders: [
|
101
|
-
{
|
102
|
-
test: /\.jsx?/,
|
103
|
-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
|
104
|
-
exclude: /node_modules/,
|
105
|
-
},
|
106
|
-
],
|
107
|
-
},
|
108
|
-
});
|
109
|
-
|
110
|
-
// @TODO Find a way to know if the file as correctly read without relying on
|
111
|
-
// Istanbul for coverage.
|
112
|
-
webpack(config, function(err, stats) {
|
113
|
-
expect(err).to.be(null);
|
114
|
-
|
115
|
-
webpack(config, function(err, stats) {
|
116
|
-
expect(err).to.be(null);
|
117
|
-
fs.readdir(cacheDir, function(err, files) {
|
118
|
-
expect(err).to.be(null);
|
119
|
-
expect(files).to.not.be.empty();
|
120
|
-
done();
|
121
|
-
});
|
122
|
-
});
|
123
|
-
});
|
124
|
-
|
125
|
-
});
|
126
|
-
|
127
|
-
it('should have one file per module', function(done) {
|
128
|
-
var config = assign({}, globalConfig, {
|
129
|
-
module: {
|
130
|
-
loaders: [
|
131
|
-
{
|
132
|
-
test: /\.jsx?/,
|
133
|
-
loader: babelLoader + '?cacheDirectory=' + cacheDir,
|
134
|
-
exclude: /node_modules/,
|
135
|
-
},
|
136
|
-
],
|
137
|
-
},
|
138
|
-
});
|
139
|
-
|
140
|
-
webpack(config, function(err, stats) {
|
141
|
-
expect(err).to.be(null);
|
142
|
-
|
143
|
-
fs.readdir(cacheDir, function(err, files) {
|
144
|
-
expect(err).to.be(null);
|
145
|
-
expect(files).to.have.length(3);
|
146
|
-
done();
|
147
|
-
});
|
148
|
-
});
|
149
|
-
|
150
|
-
});
|
151
|
-
|
152
|
-
|
153
|
-
it('should generate a new file if the identifier changes', function(done) {
|
154
|
-
|
155
|
-
var configs = [
|
156
|
-
assign({}, globalConfig, {
|
157
|
-
module: {
|
158
|
-
loaders: [
|
159
|
-
{
|
160
|
-
test: /\.jsx?/,
|
161
|
-
loader: babelLoader,
|
162
|
-
exclude: /node_modules/,
|
163
|
-
query: {
|
164
|
-
cacheDirectory: cacheDir,
|
165
|
-
cacheIdentifier: 'a',
|
166
|
-
},
|
167
|
-
},
|
168
|
-
],
|
169
|
-
},
|
170
|
-
}),
|
171
|
-
assign({}, globalConfig, {
|
172
|
-
module: {
|
173
|
-
loaders: [
|
174
|
-
{
|
175
|
-
test: /\.jsx?/,
|
176
|
-
loader: babelLoader,
|
177
|
-
exclude: /node_modules/,
|
178
|
-
query: {
|
179
|
-
cacheDirectory: cacheDir,
|
180
|
-
cacheIdentifier: 'b',
|
181
|
-
},
|
182
|
-
},
|
183
|
-
],
|
184
|
-
},
|
185
|
-
}),
|
186
|
-
];
|
187
|
-
var counter = configs.length;
|
188
|
-
|
189
|
-
configs.forEach(function(config) {
|
190
|
-
webpack(config, function(err, stats) {
|
191
|
-
expect(err).to.be(null);
|
192
|
-
counter -= 1;
|
193
|
-
|
194
|
-
if (!counter) {
|
195
|
-
fs.readdir(cacheDir, function(err, files) {
|
196
|
-
expect(err).to.be(null);
|
197
|
-
expect(files).to.have.length(6);
|
198
|
-
done();
|
199
|
-
});
|
200
|
-
}
|
201
|
-
});
|
202
|
-
});
|
203
|
-
|
204
|
-
});
|
205
|
-
});
|
File without changes
|
package/test/fixtures/basic.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
const LOADER = true;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/*jshint esnext:true*/
|
2
|
-
|
3
|
-
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
|
4
|
-
let n = { x, y, ...z };
|
5
|
-
|
6
|
-
// Array comprehensions
|
7
|
-
var results = [
|
8
|
-
for(c of customers)
|
9
|
-
if (c.city == "Seattle")
|
10
|
-
{ name: c.name, age: c.age }
|
11
|
-
]
|
12
|
-
|
13
|
-
// Generator comprehensions
|
14
|
-
var results = (
|
15
|
-
for(c of customers)
|
16
|
-
if (c.city == "Seattle")
|
17
|
-
{ name: c.name, age: c.age }
|
18
|
-
)
|
package/test/fixtures/import.js
DELETED
package/test/fixtures/syntax.js
DELETED
package/test/loader.test.js
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var fs = require('fs');
|
4
|
-
var path = require('path');
|
5
|
-
var assign = require('object-assign');
|
6
|
-
var expect = require('expect.js');
|
7
|
-
var mkdirp = require('mkdirp');
|
8
|
-
var rimraf = require('rimraf');
|
9
|
-
var webpack = require('webpack');
|
10
|
-
|
11
|
-
describe('Loader', function() {
|
12
|
-
|
13
|
-
var outputDir = path.resolve(__dirname, './output/loader');
|
14
|
-
var babelLoader = path.resolve(__dirname, '../');
|
15
|
-
var globalConfig = {
|
16
|
-
entry: './test/fixtures/basic.js',
|
17
|
-
output: {
|
18
|
-
path: outputDir,
|
19
|
-
filename: '[id].loader.js',
|
20
|
-
},
|
21
|
-
module: {
|
22
|
-
loaders: [
|
23
|
-
{
|
24
|
-
test: /\.jsx?/,
|
25
|
-
loader: babelLoader,
|
26
|
-
exclude: /node_modules/,
|
27
|
-
},
|
28
|
-
],
|
29
|
-
},
|
30
|
-
};
|
31
|
-
|
32
|
-
// Clean generated cache files before each test
|
33
|
-
// so that we can call each test with an empty state.
|
34
|
-
beforeEach(function(done) {
|
35
|
-
rimraf(outputDir, function(err) {
|
36
|
-
if (err) { return done(err); }
|
37
|
-
mkdirp(outputDir, done);
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
it('should transpile the code snippet', function(done) {
|
42
|
-
var config = assign({}, globalConfig, {
|
43
|
-
entry: './test/fixtures/basic.js',
|
44
|
-
module: {
|
45
|
-
loaders: [
|
46
|
-
{
|
47
|
-
test: /\.jsx?/,
|
48
|
-
loader: babelLoader,
|
49
|
-
exclude: /node_modules/,
|
50
|
-
},
|
51
|
-
],
|
52
|
-
},
|
53
|
-
});
|
54
|
-
|
55
|
-
webpack(config, function(err, stats) {
|
56
|
-
expect(err).to.be(null);
|
57
|
-
|
58
|
-
fs.readdir(outputDir, function(err, files) {
|
59
|
-
expect(err).to.be(null);
|
60
|
-
expect(files.length).to.equal(1);
|
61
|
-
fs.readFile(path.resolve(outputDir, files[0]), function(err, data) {
|
62
|
-
var test = 'var App = function App()';
|
63
|
-
var subject = data.toString();
|
64
|
-
|
65
|
-
expect(err).to.be(null);
|
66
|
-
expect(subject.indexOf(test)).to.not.equal(-1);
|
67
|
-
|
68
|
-
return done();
|
69
|
-
});
|
70
|
-
});
|
71
|
-
});
|
72
|
-
});
|
73
|
-
|
74
|
-
it('should not throw error on syntax error', function(done) {
|
75
|
-
var config = assign({}, globalConfig, {
|
76
|
-
entry: './test/fixtures/syntax.js',
|
77
|
-
module: {
|
78
|
-
loaders: [
|
79
|
-
{
|
80
|
-
test: /\.jsx?/,
|
81
|
-
loader: babelLoader,
|
82
|
-
exclude: /node_modules/,
|
83
|
-
},
|
84
|
-
],
|
85
|
-
},
|
86
|
-
});
|
87
|
-
|
88
|
-
webpack(config, function(err, stats) {
|
89
|
-
expect(stats.compilation.errors).to.have.length();
|
90
|
-
expect(stats.compilation.errors[0]).to.be.an(Error);
|
91
|
-
|
92
|
-
return done();
|
93
|
-
});
|
94
|
-
|
95
|
-
});
|
96
|
-
|
97
|
-
});
|
package/test/options.test.js
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var fs = require('fs');
|
4
|
-
var path = require('path');
|
5
|
-
var assign = require('object-assign');
|
6
|
-
var expect = require('expect.js');
|
7
|
-
var mkdirp = require('mkdirp');
|
8
|
-
var rimraf = require('rimraf');
|
9
|
-
var webpack = require('webpack');
|
10
|
-
|
11
|
-
describe('Options', function() {
|
12
|
-
|
13
|
-
var outputDir = path.resolve(__dirname, './output/options');
|
14
|
-
var babelLoader = path.resolve(__dirname, '../');
|
15
|
-
var globalConfig = {
|
16
|
-
entry: './test/fixtures/basic.js',
|
17
|
-
output: {
|
18
|
-
path: outputDir,
|
19
|
-
filename: '[id].options.js',
|
20
|
-
},
|
21
|
-
module: {
|
22
|
-
loaders: [
|
23
|
-
{
|
24
|
-
test: /\.jsx?/,
|
25
|
-
loader: babelLoader,
|
26
|
-
exclude: /node_modules/,
|
27
|
-
},
|
28
|
-
],
|
29
|
-
},
|
30
|
-
};
|
31
|
-
|
32
|
-
// Clean generated cache files before each test
|
33
|
-
// so that we can call each test with an empty state.
|
34
|
-
beforeEach(function(done) {
|
35
|
-
rimraf(outputDir, function(err) {
|
36
|
-
if (err) { return done(err); }
|
37
|
-
mkdirp(outputDir, done);
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
it('should interpret options given to the loader', function(done) {
|
42
|
-
var config = assign({}, globalConfig, {
|
43
|
-
entry: './test/fixtures/experimental.js',
|
44
|
-
module: {
|
45
|
-
loaders: [
|
46
|
-
{
|
47
|
-
test: /\.jsx?/,
|
48
|
-
loader: babelLoader + '?stage=0',
|
49
|
-
exclude: /node_modules/,
|
50
|
-
},
|
51
|
-
],
|
52
|
-
},
|
53
|
-
});
|
54
|
-
|
55
|
-
webpack(config, function(err, stats) {
|
56
|
-
expect(err).to.be(null);
|
57
|
-
|
58
|
-
fs.readdir(outputDir, function(err, files) {
|
59
|
-
expect(err).to.be(null);
|
60
|
-
expect(files).to.not.be.empty();
|
61
|
-
|
62
|
-
done();
|
63
|
-
});
|
64
|
-
});
|
65
|
-
});
|
66
|
-
|
67
|
-
it('should interpret options given globally', function(done) {
|
68
|
-
|
69
|
-
var config = assign({}, globalConfig, {
|
70
|
-
entry: './test/fixtures/experimental.js',
|
71
|
-
babel: {
|
72
|
-
stage: 0,
|
73
|
-
},
|
74
|
-
module: {
|
75
|
-
loaders: [
|
76
|
-
{
|
77
|
-
test: /\.jsx?/,
|
78
|
-
loader: babelLoader,
|
79
|
-
exclude: /node_modules/,
|
80
|
-
},
|
81
|
-
],
|
82
|
-
},
|
83
|
-
});
|
84
|
-
|
85
|
-
webpack(config, function(err, stats) {
|
86
|
-
expect(err).to.be(null);
|
87
|
-
|
88
|
-
fs.readdir(outputDir, function(err, files) {
|
89
|
-
expect(err).to.be(null);
|
90
|
-
expect(files).to.not.be.empty();
|
91
|
-
|
92
|
-
done();
|
93
|
-
});
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
|
-
it('should give priority to loader options', function(done) {
|
98
|
-
var config = assign({}, globalConfig, {
|
99
|
-
entry: './test/fixtures/experimental.js',
|
100
|
-
babel: {
|
101
|
-
stage: 4,
|
102
|
-
},
|
103
|
-
module: {
|
104
|
-
loaders: [
|
105
|
-
{
|
106
|
-
test: /\.jsx?/,
|
107
|
-
loader: babelLoader + '?stage=0',
|
108
|
-
exclude: /node_modules/,
|
109
|
-
},
|
110
|
-
],
|
111
|
-
},
|
112
|
-
});
|
113
|
-
|
114
|
-
webpack(config, function(err, stats) {
|
115
|
-
expect(err).to.be(null);
|
116
|
-
|
117
|
-
fs.readdir(outputDir, function(err, files) {
|
118
|
-
expect(err).to.be(null);
|
119
|
-
expect(files).to.not.be.empty();
|
120
|
-
|
121
|
-
done();
|
122
|
-
});
|
123
|
-
});
|
124
|
-
});
|
125
|
-
|
126
|
-
});
|
package/test/resolverc.test.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var path = require('path');
|
4
|
-
var expect = require('expect.js');
|
5
|
-
var resolveRc = require('../lib/resolve-rc.js');
|
6
|
-
|
7
|
-
describe('ResolveRc', function() {
|
8
|
-
|
9
|
-
it('should find the .babelrc file', function() {
|
10
|
-
var start = path.resolve(__dirname, 'fixtures/babelrc-test/1/2/3');
|
11
|
-
var result = resolveRc(start);
|
12
|
-
|
13
|
-
expect(result).to.be.a('string');
|
14
|
-
});
|
15
|
-
});
|
package/test/sourcemaps.test.js
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var fs = require('fs');
|
4
|
-
var path = require('path');
|
5
|
-
var assign = require('object-assign');
|
6
|
-
var expect = require('expect.js');
|
7
|
-
var mkdirp = require('mkdirp');
|
8
|
-
var rimraf = require('rimraf');
|
9
|
-
var webpack = require('webpack');
|
10
|
-
|
11
|
-
describe('Sourcemaps', function() {
|
12
|
-
|
13
|
-
var outputDir = path.resolve(__dirname, './output/sourcemaps');
|
14
|
-
var babelLoader = path.resolve(__dirname, '../');
|
15
|
-
var globalConfig = {
|
16
|
-
entry: './test/fixtures/basic.js',
|
17
|
-
output: {
|
18
|
-
path: outputDir,
|
19
|
-
filename: '[id].options.js',
|
20
|
-
},
|
21
|
-
module: {
|
22
|
-
loaders: [
|
23
|
-
{
|
24
|
-
test: /\.jsx?/,
|
25
|
-
loader: babelLoader,
|
26
|
-
exclude: /node_modules/,
|
27
|
-
},
|
28
|
-
],
|
29
|
-
},
|
30
|
-
};
|
31
|
-
|
32
|
-
// Clean generated cache files before each test
|
33
|
-
// so that we can call each test with an empty state.
|
34
|
-
beforeEach(function(done) {
|
35
|
-
rimraf(outputDir, function(err) {
|
36
|
-
if (err) { return done(err); }
|
37
|
-
mkdirp(outputDir, done);
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
it('should output webpack\'s sourcemap', function(done) {
|
42
|
-
|
43
|
-
var config = assign({}, globalConfig, {
|
44
|
-
devtool: 'source-map',
|
45
|
-
entry: './test/fixtures/basic.js',
|
46
|
-
module: {
|
47
|
-
loaders: [
|
48
|
-
{
|
49
|
-
test: /\.jsx?/,
|
50
|
-
loader: babelLoader,
|
51
|
-
exclude: /node_modules/,
|
52
|
-
},
|
53
|
-
],
|
54
|
-
},
|
55
|
-
});
|
56
|
-
|
57
|
-
webpack(config, function(err, stats) {
|
58
|
-
expect(err).to.be(null);
|
59
|
-
|
60
|
-
fs.readdir(outputDir, function(err, files) {
|
61
|
-
expect(err).to.be(null);
|
62
|
-
|
63
|
-
var map = files.filter(function(file) {
|
64
|
-
return (file.indexOf('.map') !== -1);
|
65
|
-
});
|
66
|
-
|
67
|
-
expect(map).to.not.be.empty();
|
68
|
-
|
69
|
-
fs.readFile(path.resolve(outputDir, map[0]), function(err, data) {
|
70
|
-
expect(err).to.be(null);
|
71
|
-
expect(data.toString().indexOf('webpack:///')).to.not.equal(-1);
|
72
|
-
done();
|
73
|
-
});
|
74
|
-
|
75
|
-
});
|
76
|
-
});
|
77
|
-
});
|
78
|
-
|
79
|
-
it.skip('should output babel\'s sourcemap', function(done) {
|
80
|
-
|
81
|
-
var config = assign({}, globalConfig, {
|
82
|
-
entry: './test/fixtures/basic.js',
|
83
|
-
babel: {
|
84
|
-
sourceMap: true,
|
85
|
-
sourceMapName: './output/sourcemaps/babel.map',
|
86
|
-
},
|
87
|
-
module: {
|
88
|
-
loaders: [
|
89
|
-
{
|
90
|
-
test: /\.jsx?/,
|
91
|
-
loader: babelLoader,
|
92
|
-
exclude: /node_modules/,
|
93
|
-
},
|
94
|
-
],
|
95
|
-
},
|
96
|
-
});
|
97
|
-
|
98
|
-
webpack(config, function(err, stats) {
|
99
|
-
expect(err).to.be(null);
|
100
|
-
|
101
|
-
fs.readdir(outputDir, function(err, files) {
|
102
|
-
expect(err).to.be(null);
|
103
|
-
|
104
|
-
var map = files.filter(function(file) {
|
105
|
-
return (file.indexOf('.map') !== -1);
|
106
|
-
});
|
107
|
-
|
108
|
-
expect(map).to.not.be.empty();
|
109
|
-
|
110
|
-
fs.readFile(path.resolve(outputDir, map[0]), function(err, data) {
|
111
|
-
expect(err).to.be(null);
|
112
|
-
expect(data.toString().indexOf('webpack:///')).to.equal(-1);
|
113
|
-
done();
|
114
|
-
});
|
115
|
-
});
|
116
|
-
});
|
117
|
-
});
|
118
|
-
|
119
|
-
});
|