babel-loader 8.2.3 → 8.2.4

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/README.md CHANGED
@@ -252,7 +252,7 @@ You will need to exclude them form `babel-loader`.
252
252
 
253
253
  ### Top level function (IIFE) is still arrow (on Webpack 5)
254
254
 
255
- That function is injected by Webpack itself _after_ running `babel-loader`. By default Webpack asumes that your target environment supports some ES2015 features, but you can overwrite this behavior using the `output.environment` Webpack option ([documentation]((https://webpack.js.org/configuration/output/#outputenvironment)).
255
+ That function is injected by Webpack itself _after_ running `babel-loader`. By default Webpack asumes that your target environment supports some ES2015 features, but you can overwrite this behavior using the `output.environment` Webpack option ([documentation](https://webpack.js.org/configuration/output/#outputenvironment)).
256
256
 
257
257
  To avoid the top-level arrow function, you can use `output.environment.arrowFunction`:
258
258
 
package/lib/cache.js CHANGED
@@ -33,6 +33,14 @@ const transform = require("./transform"); // Lazily instantiated when needed
33
33
 
34
34
 
35
35
  let defaultCacheDirectory = null;
36
+ let hashType = "md4"; // use md5 hashing if md4 is not available
37
+
38
+ try {
39
+ crypto.createHash(hashType);
40
+ } catch (err) {
41
+ hashType = "md5";
42
+ }
43
+
36
44
  const readFile = promisify(fs.readFile);
37
45
  const writeFile = promisify(fs.writeFile);
38
46
  const gunzip = promisify(zlib.gunzip);
@@ -91,14 +99,6 @@ const write = /*#__PURE__*/function () {
91
99
 
92
100
 
93
101
  const filename = function (source, identifier, options) {
94
- // md4 hashing is not supported starting with node v17.0.0
95
- const majorNodeVersion = parseInt(process.versions.node.split(".")[0], 10);
96
- let hashType = "md4";
97
-
98
- if (majorNodeVersion >= 17) {
99
- hashType = "md5";
100
- }
101
-
102
102
  const hash = crypto.createHash(hashType);
103
103
  const contents = JSON.stringify({
104
104
  source,
package/lib/index.js CHANGED
@@ -67,7 +67,7 @@ function loader(_x, _x2, _x3) {
67
67
  function _loader() {
68
68
  _loader = _asyncToGenerator(function* (source, inputSourceMap, overrides) {
69
69
  const filename = this.resourcePath;
70
- let loaderOptions = loaderUtils.getOptions(this) || {};
70
+ let loaderOptions = loaderUtils.getOptions(this);
71
71
  validateOptions(schema, loaderOptions, {
72
72
  name: "Babel loader"
73
73
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-loader",
3
- "version": "8.2.3",
3
+ "version": "8.2.4",
4
4
  "description": "babel module loader for webpack",
5
5
  "files": [
6
6
  "lib"
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "find-cache-dir": "^3.3.1",
14
- "loader-utils": "^1.4.0",
14
+ "loader-utils": "^2.0.0",
15
15
  "make-dir": "^3.1.0",
16
16
  "schema-utils": "^2.6.5"
17
17
  },