Skip to content

Commit

Permalink
Use babel to compile babel-loader (babel#319)
Browse files Browse the repository at this point in the history
move lib to src and have lib the destination of babel
  • Loading branch information
danez authored and Ognian committed Feb 27, 2017
1 parent 3ac773f commit 73da86e
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
["latest", { "es2015": { "loose": true } }]
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib
node_modules
test/output
coverage
Expand Down
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"preset": "node-style-guide",
"fileExtensions": [ ".js", "jscs" ],
"excludeFiles": [
"lib/**",
"test/fixtures/**",
"test/output/**",
"node_modules/**"
Expand Down
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib
test/fixtures
test/output
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"strict": true,
"strict": false,
"node": true,
"mocha": true
}
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
sudo: false
language: node_js
os:
- linux
- osx
node_js:
- node
- "6"
- "5"
- "4"
- "0.12"
- "0.10"
env:
- export WEBPACK_VERSION="2.1.0-beta.22"
- export WEBPACK_VERSION="1"
matrix:
fast_finish: true
allow_failures:
- os: osx
before_install:
- nvm --version
- node --version
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "6.2.7",
"description": "babel module loader for webpack",
"files": [
"index.js",
"lib"
],
"main": "lib/index.js",
"dependencies": {
"find-cache-dir": "^0.1.1",
"loader-utils": "^0.2.11",
Expand All @@ -17,7 +17,9 @@
"webpack": "1 || ^2.1.0-beta"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.0.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-es2015": "^6.0.0",
"expect.js": "^0.3.1",
"istanbul": "^0.4.0",
Expand All @@ -27,12 +29,14 @@
"rimraf": "^2.4.3"
},
"scripts": {
"test": "npm run hint && npm run cs && npm run cover",
"travis": "npm run cover -- --report lcovonly",
"build": "babel src/ --out-dir lib/",
"test": "npm run build && npm run hint && npm run cs && npm run cover",
"travis": "npm run build && npm run cover -- --report lcovonly",
"cover": "istanbul cover ./node_modules/.bin/_mocha -- test/*.test.js",
"postcover": "npm run hint && npm run cs",
"hint": "jshint --config .jshintrc index.js lib/* test/*",
"cs": "jscs --config .jscsrc index.js lib/* test/*"
"prepublish": "npm run build",
"hint": "jshint --config .jshintrc src/* test/*",
"cs": "jscs --config .jscsrc src/* test/*"
},
"repository": {
"type": "git",
Expand Down
2 changes: 0 additions & 2 deletions lib/fs-cache.js → src/fs-cache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/**
* Filesystem cache
*
Expand Down
2 changes: 0 additions & 2 deletions lib/helpers/exists.js → src/helpers/exists.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

var fs = require('fs');
/**
* Check if file exists and cache the result
Expand Down
2 changes: 0 additions & 2 deletions lib/helpers/read.js → src/helpers/read.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

var fs = require('fs');
/**
* Read the file and cache the result
Expand Down
12 changes: 5 additions & 7 deletions index.js → src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use strict';

var assign = require('object-assign');
var babel = require('babel-core');
var loaderUtils = require('loader-utils');
var cache = require('./lib/fs-cache.js');
var exists = require('./lib/helpers/exists')();
var read = require('./lib/helpers/read')();
var resolveRc = require('./lib/resolve-rc.js');
var pkg = require('./package.json');
var path = require('path');
var cache = require('./fs-cache.js');
var exists = require('./helpers/exists')();
var read = require('./helpers/read')();
var resolveRc = require('./resolve-rc.js');
var pkg = require('./../package.json');

/**
* Error thrown by Babel formatted to conform to Webpack reporting.
Expand Down
2 changes: 0 additions & 2 deletions lib/resolve-rc.js → src/resolve-rc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/**
* The purpose of this module, is to find the project's .babelrc and
* use its contents to bust the babel-loader's internal cache whenever an option
Expand Down

0 comments on commit 73da86e

Please sign in to comment.