Skip to content

Commit 38db904

Browse files
author
Bret Ikehara
committed
rename option to maintainScope
1 parent 0b1ee63 commit 38db904

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ gulpLoadPlugins({
6868
rename: {}, // a mapping of plugins to rename
6969
renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works)
7070
postRequireTransforms: {}, // see documentation below
71-
scoped: true // loads all npm scopes like non-scoped packages
71+
maintainScope: true // toggles loadin all npm scopes like non-scoped packages
7272
});
7373
```
7474

@@ -137,19 +137,19 @@ Note that if you specify the `renameFn` options with your own custom rename func
137137

138138
## npm Scopes
139139

140-
`gulp-load-plugins` comes with [npm scope](https://docs.npmjs.com/misc/scope) support. By default, the scoped plugins are accessible through an object on `plugins` that represents the scope. When `scoped = false`, the plugins are availble in the top level just like any other non-scoped plugins.
140+
`gulp-load-plugins` comes with [npm scope](https://docs.npmjs.com/misc/scope) support. By default, the scoped plugins are accessible through an object on `plugins` that represents the scope. When `maintainScope = false`, the plugins are availble in the top level just like any other non-scoped plugins.
141141

142142
For example, if the plugin is `@myco/gulp-test-plugin` then you can access the plugin as shown in the following example:
143143

144144
```js
145145
var scoped = require('gulp-load-plugins')({
146-
scoped: true,
146+
maintainScope: true,
147147
});
148148

149149
scoped.myco.testPlugin();
150150

151151
var nonScoped = require('gulp-load-plugins')({
152-
scoped: false,
152+
maintainScope: false,
153153
});
154154

155155
nonScoped.testPlugin();

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = function(options) {
4545
var camelizePluginName = options.camelize !== false;
4646
var lazy = 'lazy' in options ? !!options.lazy : true;
4747
var renameObj = options.rename || {};
48-
var scoped = 'scoped' in options ? !!options.scoped : true;
48+
var maintainScope = 'maintainScope' in options ? !!options.maintainScope : true;
4949

5050
logDebug('Debug enabled with options: ' + JSON.stringify(options));
5151

@@ -143,7 +143,7 @@ module.exports = function(options) {
143143
var fObject = finalObject;
144144
if (scopeTest.test(name)) {
145145
decomposition = scopeDecomposition.exec(name);
146-
if (scoped) {
146+
if (maintainScope) {
147147
if (!fObject.hasOwnProperty(decomposition[1])) {
148148
finalObject[decomposition[1]] = {};
149149
}

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ var commonTests = function(lazy) {
181181
it('supports loading scopped package as a top-level reference', function() {
182182
var x = gulpLoadPlugins({
183183
lazy: lazy,
184-
scoped: false,
184+
maintainScope: false,
185185
config: { dependencies: { '@myco/gulp-test-plugin': '1.0.0' } }
186186
});
187187

0 commit comments

Comments
 (0)