Skip to content

Commit

Permalink
Change peerDep to @babel/core
Browse files Browse the repository at this point in the history
  • Loading branch information
hzoo committed Oct 31, 2017
1 parent b9f4d60 commit 738b957
Show file tree
Hide file tree
Showing 7 changed files with 604 additions and 290 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"presets": [
["env", { "loose": true, "targets": { "node": "4.2" } }]
["@babel/preset-env", {
"loose": true,
"targets": {
"node": "4.2"
}
}]
],
"env": {
"test": {
Expand Down
17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
"mkdirp": "^0.5.1"
},
"peerDependencies": {
"babel-core": "6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc",
"@babel/core": "7 || ^7.0.0-beta || ^7.0.0-rc",
"webpack": "2 || 3"
},
"devDependencies": {
"ava": "^0.23.0",
"babel-cli": "^6.18.0",
"babel-core": "^6.0.0",
"@babel/cli": "7.0.0-beta.5",
"@babel/core": "7.0.0-beta.5",
"@babel/preset-env": "7.0.0-beta.5",
"ava": "0.23.0",
"babel-eslint": "^8.0.0",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-react-intl": "^2.1.3",
"babel-preset-env": "^1.2.0",
"babel-register": "^6.18.0",
"cross-env": "^5.0.0",
"eslint": "^4.1.0",
"eslint-config-babel": "^7.0.0",
Expand Down Expand Up @@ -80,9 +79,6 @@
"text",
"json"
],
"require": [
"babel-register"
],
"sourceMap": false,
"instrument": false
},
Expand All @@ -94,8 +90,7 @@
],
"source": [
"src/**/*.js"
],
"babel": "inherit"
]
},
"lint-staged": {
"scripts/*.js": [
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const babel = require("babel-core");
const babel = require("@babel/core");
const loaderUtils = require("loader-utils");
const path = require("path");
const cache = require("./fs-cache.js");
Expand Down Expand Up @@ -131,8 +131,8 @@ module.exports = function(source, inputSourceMap) {
sourceRoot: process.cwd(),
filename: filename,
cacheIdentifier: JSON.stringify({
"babel-loader": pkg.version,
"babel-core": babel.version,
"@babel/loader": pkg.version,
"@babel/core": babel.version,
babelrc: babelrcPath ? read(fileSystem, babelrcPath) : null,
env:
loaderOptions.forceEnv ||
Expand Down
19 changes: 10 additions & 9 deletions test/cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test.cb("should output files to cache directory", t => {
exclude: /node_modules/,
query: {
cacheDirectory: t.context.cacheDirectory,
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down Expand Up @@ -93,7 +93,7 @@ test.cb.serial(
exclude: /node_modules/,
query: {
cacheDirectory: true,
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down Expand Up @@ -125,7 +125,7 @@ test.cb.serial(
loaders: [
{
test: /\.jsx?/,
loader: `${babelLoader}?cacheDirectory=true&presets[]=env`,
loader: `${babelLoader}?cacheDirectory=true&presets[]=@babel/preset-env`,
exclude: /node_modules/,
},
],
Expand All @@ -139,6 +139,7 @@ test.cb.serial(
files = files.filter(file => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file));

t.is(err, null);

t.true(files.length > 0);
t.end();
});
Expand All @@ -159,7 +160,7 @@ test.cb.skip("should read from cache directory if cached file exists", t => {
exclude: /node_modules/,
query: {
cacheDirectory: t.context.cacheDirectory,
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down Expand Up @@ -195,7 +196,7 @@ test.cb("should have one file per module", t => {
exclude: /node_modules/,
query: {
cacheDirectory: t.context.cacheDirectory,
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down Expand Up @@ -228,7 +229,7 @@ test.cb("should generate a new file if the identifier changes", t => {
query: {
cacheDirectory: t.context.cacheDirectory,
cacheIdentifier: "a",
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand All @@ -247,7 +248,7 @@ test.cb("should generate a new file if the identifier changes", t => {
query: {
cacheDirectory: t.context.cacheDirectory,
cacheIdentifier: "b",
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down Expand Up @@ -288,7 +289,7 @@ test.cb("should allow to specify the .babelrc file", t => {
query: {
cacheDirectory: t.context.cacheDirectory,
babelrc: path.join(__dirname, "fixtures/babelrc"),
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand All @@ -307,7 +308,7 @@ test.cb("should allow to specify the .babelrc file", t => {
exclude: /node_modules/,
query: {
cacheDirectory: t.context.cacheDirectory,
presets: ["env"],
presets: ["@babel/preset-env"],
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["env"]
"presets": ["@babel/preset-env"]
}
2 changes: 1 addition & 1 deletion test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const globalConfig = {
test: /\.jsx?/,
loader: babelLoader,
query: {
presets: ["env"],
presets: ["@babel/preset-env"],
},
exclude: /node_modules/,
},
Expand Down
Loading

0 comments on commit 738b957

Please sign in to comment.