From f5db6b88cf86bbb800443d01f540d0298194129a Mon Sep 17 00:00:00 2001 From: Bret Ikehara Date: Tue, 25 Oct 2016 12:00:40 -0700 Subject: [PATCH] rename option to maintainScope --- README.md | 8 ++++---- index.js | 4 ++-- test/index.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index af2bada..2a435cf 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ gulpLoadPlugins({ rename: {}, // a mapping of plugins to rename renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works) postRequireTransforms: {}, // see documentation below - scoped: true // loads all npm scopes like non-scoped packages + maintainScope: true // toggles loadin all npm scopes like non-scoped packages }); ``` @@ -118,19 +118,19 @@ Note that if you specify the `renameFn` options with your own custom rename func ## npm Scopes -`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. +`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. For example, if the plugin is `@myco/gulp-test-plugin` then you can access the plugin as shown in the following example: ```js var scoped = require('gulp-load-plugins')({ - scoped: true, + maintainScope: true, }); scoped.myco.testPlugin(); var nonScoped = require('gulp-load-plugins')({ - scoped: false, + maintainScope: false, }); nonScoped.testPlugin(); diff --git a/index.js b/index.js index b3aabdb..d7ab436 100644 --- a/index.js +++ b/index.js @@ -45,7 +45,7 @@ module.exports = function(options) { var camelizePluginName = options.camelize !== false; var lazy = 'lazy' in options ? !!options.lazy : true; var renameObj = options.rename || {}; - var scoped = 'scoped' in options ? !!options.scoped : true; + var maintainScope = 'maintainScope' in options ? !!options.maintainScope : true; logDebug('Debug enabled with options: ' + JSON.stringify(options)); @@ -143,7 +143,7 @@ module.exports = function(options) { var fObject = finalObject; if (scopeTest.test(name)) { decomposition = scopeDecomposition.exec(name); - if (scoped) { + if (maintainScope) { if (!fObject.hasOwnProperty(decomposition[1])) { finalObject[decomposition[1]] = {}; } diff --git a/test/index.js b/test/index.js index baf21b2..24397c3 100644 --- a/test/index.js +++ b/test/index.js @@ -181,7 +181,7 @@ var commonTests = function(lazy) { it('supports loading scopped package as a top-level reference', function() { var x = gulpLoadPlugins({ lazy: lazy, - scoped: false, + maintainScope: false, config: { dependencies: { '@myco/gulp-test-plugin': '1.0.0' } } });