Skip to content

Commit f5db6b8

Browse files
author
Bret Ikehara
committed
rename option to maintainScope
1 parent 38cfe62 commit f5db6b8

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

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

119119
## npm Scopes
120120

121-
`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.
121+
`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.
122122

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

125125
```js
126126
var scoped = require('gulp-load-plugins')({
127-
scoped: true,
127+
maintainScope: true,
128128
});
129129

130130
scoped.myco.testPlugin();
131131

132132
var nonScoped = require('gulp-load-plugins')({
133-
scoped: false,
133+
maintainScope: false,
134134
});
135135

136136
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)