rollup-plugin-multi-entry
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -6,10 +6,9 @@ 'use strict'; | ||
var entry = '\0rollup-plugin-multi-entry:entry-point'; | ||
function multiEntry() { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
var include = []; | ||
var exclude = []; | ||
var exporter = function exporter(path) { | ||
return 'export * from ' + JSON.stringify(path) + ';'; | ||
return `export * from ${JSON.stringify(path)};`; | ||
}; | ||
@@ -25,5 +24,6 @@ | ||
exclude = config.exclude || []; | ||
if (config.exports === false) { | ||
exporter = function exporter(path) { | ||
return 'import ' + JSON.stringify(path) + ';'; | ||
return `import ${JSON.stringify(path)};`; | ||
}; | ||
@@ -39,9 +39,11 @@ } | ||
return { | ||
options: function options(_options) { | ||
if (_options.input && _options.input !== entry) { | ||
configure(_options.input); | ||
options(options) { | ||
if (options.input && options.input !== entry) { | ||
configure(options.input); | ||
} | ||
_options.input = entry; | ||
options.input = entry; | ||
}, | ||
resolveId: function resolveId(id) { | ||
resolveId(id) { | ||
if (id === entry) { | ||
@@ -51,3 +53,4 @@ return entry; | ||
}, | ||
load: function load(id) { | ||
load(id) { | ||
if (id === entry) { | ||
@@ -57,6 +60,9 @@ if (!include.length) { | ||
} | ||
var patterns = include.concat(exclude.map(function (pattern) { | ||
return '!' + pattern; | ||
})); | ||
return matched.promise(patterns, { realpath: true }).then(function (paths) { | ||
return matched.promise(patterns, { | ||
realpath: true | ||
}).then(function (paths) { | ||
return paths.map(exporter).join('\n'); | ||
@@ -66,2 +72,3 @@ }); | ||
} | ||
}; | ||
@@ -68,0 +75,0 @@ } |
{ | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"name": "rollup-plugin-multi-entry", | ||
@@ -10,6 +10,6 @@ "description": "Allows specifying multiple entry points with rollup.", | ||
"build": "rm -rf dist && rollup -c", | ||
"pretest": "npm run flow && npm run build", | ||
"pretest": "yarn run flow && yarn run build", | ||
"test": "mocha", | ||
"prepublish": "npm test", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
"prepare": "yarn build", | ||
"prepublishOnly": "yarn test" | ||
}, | ||
@@ -33,17 +33,21 @@ "repository": { | ||
"dependencies": { | ||
"matched": "^0.4.4" | ||
"matched": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.14.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-es2015-rollup": "^1.2.0", | ||
"babel-register": "^6.14.0", | ||
"babelrc-rollup": "^3.0.0", | ||
"flow-bin": "^0.31.1", | ||
"mocha": "^3.0.2", | ||
"rollup": "^0.49.2", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"semantic-release": "^4.3.5" | ||
"@babel/core": "^7.2.0", | ||
"@babel/plugin-transform-flow-strip-types": "^7.2.0", | ||
"@babel/preset-env": "^7.2.0", | ||
"@babel/register": "^7.0.0", | ||
"@commitlint/config-conventional": "^7.1.2", | ||
"commitlint": "^7.2.1", | ||
"flow-bin": "^0.87.0", | ||
"globby": "^8.0.1", | ||
"husky": "^1.2.0", | ||
"lint-staged": "^8.1.0", | ||
"mocha": "^5.2.0", | ||
"prettier": "^1.9.2", | ||
"prettier-check": "^2.0.0", | ||
"rollup": "^0.67.4", | ||
"rollup-plugin-babel": "^4.0.3" | ||
} | ||
} | ||
} |
@@ -21,5 +21,10 @@ # rollup-plugin-multi-entry | ||
> _Note_: Default exports like `export default class Foo {...}` will not be exported, only named exports are allowed. | ||
## Install | ||
``` | ||
```shell | ||
# We use yarn: | ||
$ yarn add [--dev] rollup-plugin-multi-entry | ||
# But you can use npm if you prefer: | ||
$ npm install [--save-dev] rollup-plugin-multi-entry | ||
@@ -30,9 +35,9 @@ ``` | ||
This plugin requires at least v0.25.4 of rollup. In `rollup.config.js`: | ||
This plugin requires at least v0.48.0 of rollup. In `rollup.config.js`: | ||
```js | ||
import multiEntry from 'rollup-plugin-multi-entry'; | ||
import multiEntry from "rollup-plugin-multi-entry"; | ||
export default { | ||
input: 'test/**/*.js', | ||
input: "test/**/*.js", | ||
plugins: [multiEntry()] | ||
@@ -85,3 +90,3 @@ }; | ||
export default { | ||
input: 'src/*.js', | ||
input: "src/*.js", | ||
plugins: [multiEntry({ exports: false })] | ||
@@ -88,0 +93,0 @@ }; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6588
115
96
15
1
+ Addedexpand-tilde@2.0.2(transitive)
+ Addedglobal-modules@1.0.0(transitive)
+ Addedglobal-prefix@1.0.2(transitive)
+ Addedhas-glob@1.0.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.0(transitive)
+ Addedis-valid-glob@1.0.0(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedmatched@1.0.2(transitive)
+ Addedresolve-dir@1.0.1(transitive)
- Removedexpand-tilde@1.2.2(transitive)
- Removedextend-shallow@2.0.1(transitive)
- Removedfs-exists-sync@0.1.0(transitive)
- Removedglobal-modules@0.2.3(transitive)
- Removedglobal-prefix@0.1.5(transitive)
- Removedhas-glob@0.1.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-valid-glob@0.3.0(transitive)
- Removedis-windows@0.2.0(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@2.0.2(transitive)
- Removedmatched@0.4.4(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedresolve-dir@0.1.1(transitive)
- Removedset-getter@0.1.1(transitive)
- Removedto-object-path@0.3.0(transitive)
Updatedmatched@^1.0.2