Skip to content

Commit

Permalink
v0.2.2 fix test
Browse files Browse the repository at this point in the history
Silly error with symbolic links
  • Loading branch information
amarcruz committed Oct 13, 2016
1 parent 4aa3de4 commit 5526415
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "rm -rf dist/* && npm run build:cjs && npm run build:es6",
"build:cjs": "rollup -c -f cjs -o dist/rollup-plugin-jscc.js",
"build:es6": "rollup -c -f es -o dist/rollup-plugin-jscc.es.js",
"prepublish": "npm test && npm run build"
"prepublish": "npm run lint && npm test && npm run build"
},
"files": [
"dist",
Expand Down Expand Up @@ -60,6 +60,6 @@
"mocha": "^3.0.2",
"rollup": "^0.36.0",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-node-resolve": "^1.7.3"
"rollup-plugin-node-resolve": "^2.0.0"
}
}
1 change: 0 additions & 1 deletion src/filter.js

This file was deleted.

29 changes: 29 additions & 0 deletions src/filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import { createFilter } from 'rollup-pluginutils'
import { extname } from 'path'

/**
* Creates a filter for the options `include`, `exclude`, and `extensions`.
* It filter out names starting with `\0`.
* Since `extensions` is not a rollup option, I think is widely used.
*
* @param {object} opts - The user options
* @param {array|string} exts - Default extensions
* @returns {function} Filter function that returns true if a given
* file matches the filter.
*/
export default function _createFilter (opts, exts) {
if (!opts) opts = {}

const filt = createFilter(opts.include, opts.exclude)

exts = opts.extensions || exts || '*'
if (exts !== '*') {
if (!Array.isArray(exts)) exts = [exts]
exts = exts.map((e) => { return e[0] !== '.' ? `.${e}` : e })
}

return function (id) {
return filt(id) && (exts === '*' || exts.indexOf(extname(id)) > -1)
}
}

0 comments on commit 5526415

Please sign in to comment.