babel-loader 7.0.0-beta.1 โ†’ 7.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ For changes in version v7.0.0 and up please go to [release](https://github.com/babel/babel-loader/releases)
4
+
5
+ # Old Changelog
6
+
3
7
  ## v6.4.1
4
8
 
5
9
  ### ๐Ÿ› Bug Fix
@@ -38,7 +42,7 @@ Allow to override BABEL_ENV/NODE_ENV at loader-level. Useful for isomorphic appl
38
42
 
39
43
  ### ๐Ÿ’… Polish
40
44
 
41
- - Improve FS caching to do less sync calls which improves performance slightly (#375) @akx
45
+ - Improve FS caching to do less sync calls which improves performance slightly (#375) @akx
42
46
 
43
47
  ## v6.2.10
44
48
 
package/README.md CHANGED
@@ -19,6 +19,10 @@ __Notes:__ Issues with the output should be reported on the babel [issue tracker
19
19
 
20
20
  <h2 align="center">Install</h2>
21
21
 
22
+ > webpack 1.x | babel-loader <= 6.x
23
+ >
24
+ > webpack 2.x |ย babel-loader >= 7.x (recommended) (^6.2.10 will also work, but with deprecation warnings)
25
+
22
26
  ```bash
23
27
  yarn add babel-loader babel-core babel-preset-env webpack --dev
24
28
  ```
@@ -56,6 +60,7 @@ module: {
56
60
 
57
61
  See the `babel` [options](https://babeljs.io/docs/usage/api/#options).
58
62
 
63
+
59
64
  You can pass options to the loader by using the [options property](https://webpack.js.org/configuration/module/#rule-options-rule-query):
60
65
 
61
66
  ```javascript
package/lib/fs-cache.js CHANGED
@@ -28,16 +28,12 @@ var defaultCacheDirectory = null; // Lazily instantiated when needed
28
28
  */
29
29
  var read = function read(filename, callback) {
30
30
  return fs.readFile(filename, function (err, data) {
31
- if (err) {
32
- return callback(err);
33
- }
31
+ if (err) return callback(err);
34
32
 
35
33
  return zlib.gunzip(data, function (err, content) {
36
- var result = {};
34
+ if (err) return callback(err);
37
35
 
38
- if (err) {
39
- return callback(err);
40
- }
36
+ var result = {};
41
37
 
42
38
  try {
43
39
  result = JSON.parse(content);
@@ -62,9 +58,7 @@ var write = function write(filename, result, callback) {
62
58
  var content = JSON.stringify(result);
63
59
 
64
60
  return zlib.gzip(content, function (err, data) {
65
- if (err) {
66
- return callback(err);
67
- }
61
+ if (err) return callback(err);
68
62
 
69
63
  return fs.writeFile(filename, data, callback);
70
64
  });
@@ -13,12 +13,9 @@ module.exports = function (cache) {
13
13
  cache = cache || {};
14
14
 
15
15
  return function (filename) {
16
+ if (!filename) return false;
16
17
 
17
- if (!filename) {
18
- return false;
19
- }
20
-
21
- cache[filename] = cache[filename] || fs.existsSync(filename);
18
+ cache[filename] = cache[filename] || fs.existsSync(filename) && fs.statSync(filename).isFile();
22
19
 
23
20
  return cache[filename];
24
21
  };
package/lib/utils/read.js CHANGED
@@ -13,7 +13,6 @@ module.exports = function (cache) {
13
13
  cache = cache || {};
14
14
 
15
15
  return function (filename) {
16
-
17
16
  if (!filename) {
18
17
  throw new Error("filename must be a string");
19
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-loader",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0",
4
4
  "description": "babel module loader for webpack",
5
5
  "files": [
6
6
  "lib"
@@ -19,7 +19,7 @@
19
19
  "webpack": "2"
20
20
  },
21
21
  "devDependencies": {
22
- "ava": "^0.18.0",
22
+ "ava": "^0.19.0",
23
23
  "babel-cli": "^6.18.0",
24
24
  "babel-core": "^6.0.0",
25
25
  "babel-eslint": "^7.1.0",
@@ -27,12 +27,14 @@
27
27
  "babel-plugin-react-intl": "^2.1.3",
28
28
  "babel-preset-env": "^1.2.0",
29
29
  "babel-register": "^6.18.0",
30
- "codecov": "^1.0.1",
31
- "cross-env": "^3.1.4",
30
+ "cross-env": "^4.0.0",
32
31
  "eslint": "^3.8.1",
33
32
  "eslint-config-babel": "^6.0.0",
34
33
  "eslint-plugin-flowtype": "^2.25.0",
34
+ "husky": "^0.13.2",
35
+ "lint-staged": "^3.3.1",
35
36
  "nyc": "^10.0.0",
37
+ "prettier": "^1.2.2",
36
38
  "react": "^15.1.0",
37
39
  "react-intl": "^2.1.2",
38
40
  "react-intl-webpack-plugin": "^0.0.3",
@@ -42,12 +44,12 @@
42
44
  "scripts": {
43
45
  "clean": "rimraf lib/",
44
46
  "build": "babel src/ --out-dir lib/",
45
- "coverage": "nyc report --reporter=json && codecov -f coverage/coverage-final.json",
47
+ "format": "prettier --write --trailing-comma all \"src/**/*.js\" \"test/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"",
46
48
  "lint": "eslint src test",
47
- "preversion": "yarn run test",
49
+ "precommit": "lint-staged",
48
50
  "prepublish": "yarn run clean && yarn run build",
51
+ "preversion": "yarn run test",
49
52
  "test": "yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only",
50
- "test-ci": "cross-env BABEL_ENV=test yarn run build && yarn run test-only",
51
53
  "test-only": "nyc ava"
52
54
  },
53
55
  "repository": {
@@ -73,6 +75,10 @@
73
75
  "include": [
74
76
  "src/**/*.js"
75
77
  ],
78
+ "reporter": [
79
+ "text",
80
+ "json"
81
+ ],
76
82
  "require": [
77
83
  "babel-register"
78
84
  ],
@@ -89,5 +95,27 @@
89
95
  "src/**/*.js"
90
96
  ],
91
97
  "babel": "inherit"
98
+ },
99
+ "lint-staged": {
100
+ "scripts/*.js": [
101
+ "prettier --trailing-comma es5 --write",
102
+ "git add"
103
+ ],
104
+ "src/**/*.js": [
105
+ "prettier --trailing-comma all --write",
106
+ "git add"
107
+ ],
108
+ "test/**/*.test.js": [
109
+ "prettier --trailing-comma all --write",
110
+ "git add"
111
+ ],
112
+ "test/helpers/*.js": [
113
+ "prettier --trailing-comma all --write",
114
+ "git add"
115
+ ],
116
+ "package.json": [
117
+ "node ./scripts/yarn-install.js",
118
+ "git add yarn.lock"
119
+ ]
92
120
  }
93
121
  }