This commit is contained in:
15
vscode-server-linux-x64-web/node_modules/rc/LICENSE.APACHE2
generated
vendored
Normal file
15
vscode-server-linux-x64-web/node_modules/rc/LICENSE.APACHE2
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
26
vscode-server-linux-x64-web/node_modules/rc/LICENSE.BSD
generated
vendored
Normal file
26
vscode-server-linux-x64-web/node_modules/rc/LICENSE.BSD
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright (c) 2013, Dominic Tarr
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
24
vscode-server-linux-x64-web/node_modules/rc/LICENSE.MIT
generated
vendored
Normal file
24
vscode-server-linux-x64-web/node_modules/rc/LICENSE.MIT
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
7
vscode-server-linux-x64-web/node_modules/rc/browser.js
generated
vendored
Normal file
7
vscode-server-linux-x64-web/node_modules/rc/browser.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
// when this is loaded into the browser,
|
||||
// just use the defaults...
|
||||
|
||||
module.exports = function (name, defaults) {
|
||||
return defaults
|
||||
}
|
4
vscode-server-linux-x64-web/node_modules/rc/cli.js
generated
vendored
Executable file
4
vscode-server-linux-x64-web/node_modules/rc/cli.js
generated
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
#! /usr/bin/env node
|
||||
var rc = require('./index')
|
||||
|
||||
console.log(JSON.stringify(rc(process.argv[2]), false, 2))
|
53
vscode-server-linux-x64-web/node_modules/rc/index.js
generated
vendored
Executable file
53
vscode-server-linux-x64-web/node_modules/rc/index.js
generated
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
var cc = require('./lib/utils')
|
||||
var join = require('path').join
|
||||
var deepExtend = require('deep-extend')
|
||||
var etc = '/etc'
|
||||
var win = process.platform === "win32"
|
||||
var home = win
|
||||
? process.env.USERPROFILE
|
||||
: process.env.HOME
|
||||
|
||||
module.exports = function (name, defaults, argv, parse) {
|
||||
if('string' !== typeof name)
|
||||
throw new Error('rc(name): name *must* be string')
|
||||
if(!argv)
|
||||
argv = require('minimist')(process.argv.slice(2))
|
||||
defaults = (
|
||||
'string' === typeof defaults
|
||||
? cc.json(defaults) : defaults
|
||||
) || {}
|
||||
|
||||
parse = parse || cc.parse
|
||||
|
||||
var env = cc.env(name + '_')
|
||||
|
||||
var configs = [defaults]
|
||||
var configFiles = []
|
||||
function addConfigFile (file) {
|
||||
if (configFiles.indexOf(file) >= 0) return
|
||||
var fileConfig = cc.file(file)
|
||||
if (fileConfig) {
|
||||
configs.push(parse(fileConfig))
|
||||
configFiles.push(file)
|
||||
}
|
||||
}
|
||||
|
||||
// which files do we look at?
|
||||
if (!win)
|
||||
[join(etc, name, 'config'),
|
||||
join(etc, name + 'rc')].forEach(addConfigFile)
|
||||
if (home)
|
||||
[join(home, '.config', name, 'config'),
|
||||
join(home, '.config', name),
|
||||
join(home, '.' + name, 'config'),
|
||||
join(home, '.' + name + 'rc')].forEach(addConfigFile)
|
||||
addConfigFile(cc.find('.'+name+'rc'))
|
||||
if (env.config) addConfigFile(env.config)
|
||||
if (argv.config) addConfigFile(argv.config)
|
||||
|
||||
return deepExtend.apply(null, configs.concat([
|
||||
env,
|
||||
argv,
|
||||
configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
|
||||
]))
|
||||
}
|
104
vscode-server-linux-x64-web/node_modules/rc/lib/utils.js
generated
vendored
Normal file
104
vscode-server-linux-x64-web/node_modules/rc/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
var fs = require('fs')
|
||||
var ini = require('ini')
|
||||
var path = require('path')
|
||||
var stripJsonComments = require('strip-json-comments')
|
||||
|
||||
var parse = exports.parse = function (content) {
|
||||
|
||||
//if it ends in .json or starts with { then it must be json.
|
||||
//must be done this way, because ini accepts everything.
|
||||
//can't just try and parse it and let it throw if it's not ini.
|
||||
//everything is ini. even json with a syntax error.
|
||||
|
||||
if(/^\s*{/.test(content))
|
||||
return JSON.parse(stripJsonComments(content))
|
||||
return ini.parse(content)
|
||||
|
||||
}
|
||||
|
||||
var file = exports.file = function () {
|
||||
var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
|
||||
|
||||
//path.join breaks if it's a not a string, so just skip this.
|
||||
for(var i in args)
|
||||
if('string' !== typeof args[i])
|
||||
return
|
||||
|
||||
var file = path.join.apply(null, args)
|
||||
var content
|
||||
try {
|
||||
return fs.readFileSync(file,'utf-8')
|
||||
} catch (err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var json = exports.json = function () {
|
||||
var content = file.apply(null, arguments)
|
||||
return content ? parse(content) : null
|
||||
}
|
||||
|
||||
var env = exports.env = function (prefix, env) {
|
||||
env = env || process.env
|
||||
var obj = {}
|
||||
var l = prefix.length
|
||||
for(var k in env) {
|
||||
if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
||||
|
||||
var keypath = k.substring(l).split('__')
|
||||
|
||||
// Trim empty strings from keypath array
|
||||
var _emptyStringIndex
|
||||
while ((_emptyStringIndex=keypath.indexOf('')) > -1) {
|
||||
keypath.splice(_emptyStringIndex, 1)
|
||||
}
|
||||
|
||||
var cursor = obj
|
||||
keypath.forEach(function _buildSubObj(_subkey,i){
|
||||
|
||||
// (check for _subkey first so we ignore empty strings)
|
||||
// (check for cursor to avoid assignment to primitive objects)
|
||||
if (!_subkey || typeof cursor !== 'object')
|
||||
return
|
||||
|
||||
// If this is the last key, just stuff the value in there
|
||||
// Assigns actual value from env variable to final key
|
||||
// (unless it's just an empty string- in that case use the last valid key)
|
||||
if (i === keypath.length-1)
|
||||
cursor[_subkey] = env[k]
|
||||
|
||||
|
||||
// Build sub-object if nothing already exists at the keypath
|
||||
if (cursor[_subkey] === undefined)
|
||||
cursor[_subkey] = {}
|
||||
|
||||
// Increment cursor used to track the object at the current depth
|
||||
cursor = cursor[_subkey]
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
var find = exports.find = function () {
|
||||
var rel = path.join.apply(null, [].slice.call(arguments))
|
||||
|
||||
function find(start, rel) {
|
||||
var file = path.join(start, rel)
|
||||
try {
|
||||
fs.statSync(file)
|
||||
return file
|
||||
} catch (err) {
|
||||
if(path.dirname(start) !== start) // root
|
||||
return find(path.dirname(start), rel)
|
||||
}
|
||||
}
|
||||
return find(process.cwd(), rel)
|
||||
}
|
||||
|
||||
|
29
vscode-server-linux-x64-web/node_modules/rc/package.json
generated
vendored
Normal file
29
vscode-server-linux-x64-web/node_modules/rc/package.json
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "rc",
|
||||
"version": "1.2.8",
|
||||
"description": "hardwired configuration loader",
|
||||
"main": "index.js",
|
||||
"browser": "browser.js",
|
||||
"scripts": {
|
||||
"test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dominictarr/rc.git"
|
||||
},
|
||||
"license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
|
||||
"keywords": [
|
||||
"config",
|
||||
"rc",
|
||||
"unix",
|
||||
"defaults"
|
||||
],
|
||||
"bin": "./cli.js",
|
||||
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
|
||||
"dependencies": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user