Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2018-03-16 12:32:18 +0300
committerRebecca Turner <me@re-becca.org>2018-04-11 04:18:21 +0300
commitf2fbd857797cf5c12a68a6fb0ff0609d373198b3 (patch)
treed80f7b6e69bc7ff42310af89df53e39453ffc531 /node_modules
parent834b46ff48ade4ab4e557566c10e83199d8778c6 (diff)
figgy-pudding@2.0.1
PR-URL: https://github.com/npm/npm/pull/20256 Credit: @zkat Reviewed-By: @iarna
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/figgy-pudding/CHANGELOG.md29
-rw-r--r--node_modules/figgy-pudding/LICENSE.md16
-rw-r--r--node_modules/figgy-pudding/README.md121
-rw-r--r--node_modules/figgy-pudding/index.js60
-rw-r--r--node_modules/figgy-pudding/package.json71
5 files changed, 297 insertions, 0 deletions
diff --git a/node_modules/figgy-pudding/CHANGELOG.md b/node_modules/figgy-pudding/CHANGELOG.md
new file mode 100644
index 000000000..f70e02d71
--- /dev/null
+++ b/node_modules/figgy-pudding/CHANGELOG.md
@@ -0,0 +1,29 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="2.0.1"></a>
+## [2.0.1](https://github.com/zkat/figgy-pudding/compare/v2.0.0...v2.0.1) (2018-03-16)
+
+
+### Bug Fixes
+
+* **opts:** ignore non-object providers ([7b9c0f8](https://github.com/zkat/figgy-pudding/commit/7b9c0f8))
+
+
+
+<a name="2.0.0"></a>
+# [2.0.0](https://github.com/zkat/figgy-pudding/compare/v1.0.0...v2.0.0) (2018-03-16)
+
+
+### Features
+
+* **api:** overhauled API with new opt handling concept ([e6cc929](https://github.com/zkat/figgy-pudding/commit/e6cc929))
+* **license:** relicense to ISC ([87479aa](https://github.com/zkat/figgy-pudding/commit/87479aa))
+
+
+### BREAKING CHANGES
+
+* **license:** the license has been changed from CC0-1.0 to ISC.
+* **api:** this is a completely different approach than previously
+used by this library. See the readme for the new API and an explanation.
diff --git a/node_modules/figgy-pudding/LICENSE.md b/node_modules/figgy-pudding/LICENSE.md
new file mode 100644
index 000000000..8d28acf86
--- /dev/null
+++ b/node_modules/figgy-pudding/LICENSE.md
@@ -0,0 +1,16 @@
+ISC License
+
+Copyright (c) npm, Inc.
+
+Permission to use, copy, modify, and/or distribute this software for
+any purpose with or without fee is hereby granted, provided that the
+above copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
+ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/figgy-pudding/README.md b/node_modules/figgy-pudding/README.md
new file mode 100644
index 000000000..3cdec3f81
--- /dev/null
+++ b/node_modules/figgy-pudding/README.md
@@ -0,0 +1,121 @@
+# figgy-pudding [![npm version](https://img.shields.io/npm/v/figgy-pudding.svg)](https://npm.im/figgy-pudding) [![license](https://img.shields.io/npm/l/figgy-pudding.svg)](https://npm.im/figgy-pudding) [![Travis](https://img.shields.io/travis/zkat/figgy-pudding.svg)](https://travis-ci.org/zkat/figgy-pudding) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/figgy-pudding?svg=true)](https://ci.appveyor.com/project/zkat/figgy-pudding) [![Coverage Status](https://coveralls.io/repos/github/zkat/figgy-pudding/badge.svg?branch=latest)](https://coveralls.io/github/zkat/figgy-pudding?branch=latest)
+
+# Death to the God Object! Now Bring Us Some Figgy Pudding!
+
+[`figgy-pudding`](https://github.com/zkat/figgy-pudding) is a simple JavaScript library for managing and composing cascading options objects -- hiding what needs to be hidden from each layer, without having to do a lot of manual munging and passing of options.
+
+## Install
+
+`$ npm install figgy-pudding`
+
+## Table of Contents
+
+* [Example](#example)
+* [Features](#features)
+* [API](#api)
+ * [`figgyPudding(spec)`](#figgy-pudding)
+ * [`Opts(values)`](#opts)
+
+### Example
+
+```javascript
+const puddin = require('figgyPudding')
+
+const RequestOpts = puddin({
+ follow: {
+ default: true
+ },
+ streaming: {
+ default: false
+ },
+ log: {
+ default: require('npmlog')
+ }
+})
+
+const MyAppOpts = puddin({
+ log: {
+ default: require('npmlog')
+ },
+ cache: {
+ default: './cache'
+ }
+})
+
+function start (opts) {
+ opts = MyAppOpts(opts)
+ initCache(opts.get('cache'))
+ opts.get('streaming') // => undefined
+ reqStuff('https://npm.im/figgy-pudding', opts)
+}
+
+function reqStuff (uri, opts) {
+ opts = RequestOpts(opts)
+ require('request').get(uri, opts) // can't see `cache`
+}
+```
+
+### Features
+
+* Hide options from layer that didn't ask for it
+* Shared multi-layer options
+
+### API
+
+#### <a name="figgy-pudding"></a> `> figgyPudding({ key: { default: val } | String }, [opts])`
+
+Defines an Options constructor that can be used to collect only the needed
+options.
+
+An optional `default` property for specs can be used to specify default values
+if nothing was passed in.
+
+If the value for a spec is a string, it will be treated as an alias to that
+other key.
+
+##### Example
+
+```javascript
+const MyAppOpts = figgyPudding({
+ lg: 'log',
+ log: {
+ default: () => require('npmlog')
+ },
+ cache: {}
+})
+```
+
+#### <a name="opts"></a> `> Opts(...providers)`
+
+Instantiates an options object defined by `figgyPudding()`, which uses
+`providers`, in order, to find requested properties.
+
+Each provider can be either a plain object, a `Map`-like object (that is, one
+with a `.get()` method) or another figgyPudding `Opts` object.
+
+When nesting `Opts` objects, their properties will not become available to the
+new object, but any further nested `Opts` that reference that property _will_ be
+able to read from their grandparent, as long as they define that key. Default
+values for nested `Opts` parents will be used, if found.
+
+##### Example
+
+```javascript
+const ReqOpts = figgyPudding({
+ follow: {}
+})
+
+const opts = ReqOpts({
+ follow: true,
+ log: require('npmlog')
+})
+
+opts.get('follow') // => true
+opts.get('log') // => Error: ReqOpts does not define `log`
+
+const MoreOpts = figgyPudding({
+ log: {}
+})
+MoreOpts(opts).log // => npmlog object (passed in from original plain obj)
+MoreOpts(opts).get('follow') // => Error: MoreOpts does not define `follow`
+```
diff --git a/node_modules/figgy-pudding/index.js b/node_modules/figgy-pudding/index.js
new file mode 100644
index 000000000..c13d14386
--- /dev/null
+++ b/node_modules/figgy-pudding/index.js
@@ -0,0 +1,60 @@
+'use strict'
+
+class FiggyPudding {
+ constructor (specs, opts, providers) {
+ this.specs = specs || {}
+ this.opts = opts || (() => false)
+ this.providers = providers
+ this.isFiggyPudding = true
+ }
+ get (key) {
+ return pudGet(this, key, true)
+ }
+}
+
+function pudGet (pud, key, validate) {
+ let spec = pud.specs[key]
+ if (typeof spec === 'string') {
+ key = spec
+ spec = pud.specs[key]
+ }
+ if (validate && !spec && (!pud.opts.other || !pud.opts.other(key))) {
+ throw new Error(`invalid config key requested: ${key}`)
+ } else {
+ if (!spec) { spec = {} }
+ let ret
+ for (let p of pud.providers) {
+ if (p.isFiggyPudding) {
+ ret = pudGet(p, key, false)
+ } else if (typeof p.get === 'function') {
+ ret = p.get(key)
+ } else {
+ ret = p[key]
+ }
+ if (ret !== undefined) {
+ break
+ }
+ }
+ if (ret === undefined && spec.default !== undefined) {
+ if (typeof spec.default === 'function') {
+ return spec.default()
+ } else {
+ return spec.default
+ }
+ } else {
+ return ret
+ }
+ }
+}
+
+module.exports = figgyPudding
+function figgyPudding (specs, opts) {
+ function factory () {
+ return new FiggyPudding(
+ specs,
+ opts,
+ [].slice.call(arguments).filter(x => x != null && typeof x === 'object')
+ )
+ }
+ return factory
+}
diff --git a/node_modules/figgy-pudding/package.json b/node_modules/figgy-pudding/package.json
new file mode 100644
index 000000000..c11123412
--- /dev/null
+++ b/node_modules/figgy-pudding/package.json
@@ -0,0 +1,71 @@
+{
+ "_from": "figgy-pudding",
+ "_id": "figgy-pudding@2.0.1",
+ "_inBundle": false,
+ "_integrity": "sha512-yIJPhIBi/oFdU/P+GSXjmk/rmGjuZkm7A5LTXZxNrEprXJXRK012FiI1BR1Pga+0d/d6taWWD+B5d2ozqaxHig==",
+ "_location": "/figgy-pudding",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "tag",
+ "registry": true,
+ "raw": "figgy-pudding",
+ "name": "figgy-pudding",
+ "escapedName": "figgy-pudding",
+ "rawSpec": "",
+ "saveSpec": null,
+ "fetchSpec": "latest"
+ },
+ "_requiredBy": [
+ "#USER",
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-2.0.1.tgz",
+ "_shasum": "56c8fc878e06e1090799b9bcc91cbd85c2c92278",
+ "_spec": "figgy-pudding",
+ "_where": "/Users/zkat/Documents/code/npm",
+ "author": {
+ "name": "Kat Marchán",
+ "email": "kzm@sykosomatic.org"
+ },
+ "bugs": {
+ "url": "https://github.com/zkat/figgy-pudding/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "Delicious, festive, cascading config/opts definitions",
+ "devDependencies": {
+ "standard": "^11.0.1",
+ "standard-version": "^4.3.0",
+ "tap": "^11.1.2",
+ "weallbehave": "^1.2.0",
+ "weallcontribute": "^1.0.8"
+ },
+ "files": [
+ "*.js",
+ "lib"
+ ],
+ "homepage": "https://github.com/zkat/figgy-pudding#readme",
+ "keywords": [
+ "config",
+ "options",
+ "yummy"
+ ],
+ "license": "ISC",
+ "main": "index.js",
+ "name": "figgy-pudding",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/zkat/figgy-pudding.git"
+ },
+ "scripts": {
+ "postrelease": "npm publish && git push --follow-tags",
+ "prerelease": "npm t",
+ "pretest": "standard",
+ "release": "standard-version -s",
+ "test": "tap -J --coverage test/*.js",
+ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
+ "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
+ },
+ "version": "2.0.1"
+}