aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/update-notifier/node_modules/import-lazy
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/update-notifier/node_modules/import-lazy')
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/import-lazy/index.js53
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/import-lazy/license21
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/import-lazy/package.json76
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/import-lazy/readme.md64
4 files changed, 214 insertions, 0 deletions
diff --git a/deps/npm/node_modules/update-notifier/node_modules/import-lazy/index.js b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/index.js
new file mode 100644
index 0000000000..307f08f393
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/index.js
@@ -0,0 +1,53 @@
+'use strict';
+const lazy = (mod, fn, id) => mod === undefined ? fn(id) : mod;
+
+module.exports = fn => {
+ return id => {
+ let mod;
+
+ return function () {
+ if (arguments.length === 0) {
+ mod = lazy(mod, fn, id);
+ return mod;
+ }
+
+ const ret = {};
+
+ [].forEach.call(arguments, prop => {
+ Object.defineProperty(ret, prop, {
+ get: () => {
+ mod = lazy(mod, fn, id);
+ if (typeof mod[prop] === 'function') {
+ return function () {
+ return mod[prop].apply(mod, arguments);
+ };
+ }
+
+ return mod[prop];
+ }
+ });
+ });
+
+ return ret;
+ };
+ };
+};
+
+module.exports.proxy = fn => {
+ return id => {
+ let mod;
+
+ const handler = {
+ get: (target, property) => {
+ mod = lazy(mod, fn, id);
+ return Reflect.get(mod, property);
+ },
+ apply: (target, thisArg, argumentsList) => {
+ mod = lazy(mod, fn, id);
+ return Reflect.apply(mod, thisArg, argumentsList);
+ }
+ };
+
+ return new Proxy(() => {}, handler);
+ };
+};
diff --git a/deps/npm/node_modules/update-notifier/node_modules/import-lazy/license b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/license
new file mode 100644
index 0000000000..654d0bfe94
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/update-notifier/node_modules/import-lazy/package.json b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/package.json
new file mode 100644
index 0000000000..404284f9ff
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/package.json
@@ -0,0 +1,76 @@
+{
+ "_from": "import-lazy@^2.1.0",
+ "_id": "import-lazy@2.1.0",
+ "_inBundle": false,
+ "_integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=",
+ "_location": "/update-notifier/import-lazy",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "import-lazy@^2.1.0",
+ "name": "import-lazy",
+ "escapedName": "import-lazy",
+ "rawSpec": "^2.1.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.1.0"
+ },
+ "_requiredBy": [
+ "/update-notifier"
+ ],
+ "_resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz",
+ "_shasum": "05698e3d45c88e8d7e9d92cb0584e77f096f3e43",
+ "_spec": "import-lazy@^2.1.0",
+ "_where": "/Users/rebecca/code/npm/node_modules/update-notifier",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/import-lazy/issues"
+ },
+ "bundleDependencies": false,
+ "contributors": [
+ {
+ "name": "Jorge Bucaran",
+ "email": "jbucaran@me.com"
+ }
+ ],
+ "deprecated": false,
+ "description": "Import modules lazily",
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/import-lazy#readme",
+ "keywords": [
+ "import",
+ "require",
+ "load",
+ "module",
+ "modules",
+ "lazy",
+ "lazily",
+ "defer",
+ "deferred",
+ "proxy",
+ "proxies"
+ ],
+ "license": "MIT",
+ "name": "import-lazy",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/import-lazy.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "2.1.0"
+}
diff --git a/deps/npm/node_modules/update-notifier/node_modules/import-lazy/readme.md b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/readme.md
new file mode 100644
index 0000000000..233e42e23b
--- /dev/null
+++ b/deps/npm/node_modules/update-notifier/node_modules/import-lazy/readme.md
@@ -0,0 +1,64 @@
+# import-lazy [![Build Status](https://travis-ci.org/sindresorhus/import-lazy.svg?branch=master)](https://travis-ci.org/sindresorhus/import-lazy)
+
+> Import modules lazily
+
+
+## Install
+
+```
+$ npm install --save import-lazy
+```
+
+
+## Usage
+
+```js
+// Pass in `require` or a custom import function
+const importLazy = require('import-lazy')(require);
+const _ = importLazy('lodash');
+
+// Where you would normally do
+_.isNumber(2);
+
+// You now instead call it as a function
+_().isNumber(2);
+
+// It's cached on consecutive calls
+_().isString('unicorn');
+
+// Extract lazy variations of the props you need
+const members = importLazy('lodash')('isNumber', 'isString');
+
+// Useful when using destructuring assignment in ES2015
+const {isNumber, isString} = importLazy('lodash')('isNumber', 'isString');
+
+// Works out of the box for functions and regular properties
+const stuff = importLazy('./math-lib')('sum', 'PHI');
+console.log(stuff.sum(1, 2)); // => 3
+console.log(stuff.PHI); // => 1.618033
+```
+
+### Proxy support in Node.js 6 or later
+
+If you use Node.js 6 or later, you can take advantage of ES2015 proxies and don't need to call it as a function.
+
+```js
+const importLazy = require('import-lazy').proxy(require);
+const _ = importLazy('lodash');
+
+// No need to call it as a function but still lazily imported
+_.isNumber(2);
+```
+
+## Related
+
+- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
+- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
+- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
+- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value
+- [define-lazy-prop](https://github.com/sindresorhus/define-lazy-prop) - Define a lazily evaluated property on an object
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)