.'
+ );
+ }
+ }
+ addAttr(el, name, JSON.stringify(value));
+ // #6887 firefox doesn't update muted state if set via attribute
+ // even immediately after element creation
+ if (!el.component &&
+ name === 'muted' &&
+ platformMustUseProp(el.tag, el.attrsMap.type, name)) {
+ addProp(el, name, 'true');
+ }
+ }
+ }
+}
+
+function checkInFor (el) {
+ var parent = el;
+ while (parent) {
+ if (parent.for !== undefined) {
+ return true
+ }
+ parent = parent.parent;
+ }
+ return false
+}
+
+function parseModifiers (name) {
+ var match = name.match(modifierRE);
+ if (match) {
+ var ret = {};
+ match.forEach(function (m) { ret[m.slice(1)] = true; });
+ return ret
+ }
+}
+
+function makeAttrsMap (attrs) {
+ var map = {};
+ for (var i = 0, l = attrs.length; i < l; i++) {
+ if (
+ "development" !== 'production' &&
+ map[attrs[i].name] && !isIE && !isEdge
+ ) {
+ warn$2('duplicate attribute: ' + attrs[i].name);
+ }
+ map[attrs[i].name] = attrs[i].value;
+ }
+ return map
+}
+
+// for script (e.g. type="x/template") or style, do not decode content
+function isTextTag (el) {
+ return el.tag === 'script' || el.tag === 'style'
+}
+
+function isForbiddenTag (el) {
+ return (
+ el.tag === 'style' ||
+ (el.tag === 'script' && (
+ !el.attrsMap.type ||
+ el.attrsMap.type === 'text/javascript'
+ ))
+ )
+}
+
+var ieNSBug = /^xmlns:NS\d+/;
+var ieNSPrefix = /^NS\d+:/;
+
+/* istanbul ignore next */
+function guardIESVGBug (attrs) {
+ var res = [];
+ for (var i = 0; i < attrs.length; i++) {
+ var attr = attrs[i];
+ if (!ieNSBug.test(attr.name)) {
+ attr.name = attr.name.replace(ieNSPrefix, '');
+ res.push(attr);
+ }
+ }
+ return res
+}
+
+function checkForAliasModel (el, value) {
+ var _el = el;
+ while (_el) {
+ if (_el.for && _el.alias === value) {
+ warn$2(
+ "<" + (el.tag) + " v-model=\"" + value + "\">: " +
+ "You are binding v-model directly to a v-for iteration alias. " +
+ "This will not be able to modify the v-for source array because " +
+ "writing to the alias is like modifying a function local variable. " +
+ "Consider using an array of objects and use v-model on an object property instead."
+ );
+ }
+ _el = _el.parent;
+ }
+}
+
+/* */
+
+/**
+ * Expand input[v-model] with dyanmic type bindings into v-if-else chains
+ * Turn this:
+ *
+ */
+
+function preTransformNode (el, options) {
+ if (el.tag === 'input') {
+ var map = el.attrsMap;
+ if (!map['v-model']) {
+ return
+ }
+
+ var typeBinding;
+ if (map[':type'] || map['v-bind:type']) {
+ typeBinding = getBindingAttr(el, 'type');
+ }
+ if (!map.type && !typeBinding && map['v-bind']) {
+ typeBinding = "(" + (map['v-bind']) + ").type";
+ }
+
+ if (typeBinding) {
+ var ifCondition = getAndRemoveAttr(el, 'v-if', true);
+ var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
+ var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
+ var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
+ // 1. checkbox
+ var branch0 = cloneASTElement(el);
+ // process for on the main node
+ processFor(branch0);
+ addRawAttr(branch0, 'type', 'checkbox');
+ processElement(branch0, options);
+ branch0.processed = true; // prevent it from double-processed
+ branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
+ addIfCondition(branch0, {
+ exp: branch0.if,
+ block: branch0
+ });
+ // 2. add radio else-if condition
+ var branch1 = cloneASTElement(el);
+ getAndRemoveAttr(branch1, 'v-for', true);
+ addRawAttr(branch1, 'type', 'radio');
+ processElement(branch1, options);
+ addIfCondition(branch0, {
+ exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
+ block: branch1
+ });
+ // 3. other
+ var branch2 = cloneASTElement(el);
+ getAndRemoveAttr(branch2, 'v-for', true);
+ addRawAttr(branch2, ':type', typeBinding);
+ processElement(branch2, options);
+ addIfCondition(branch0, {
+ exp: ifCondition,
+ block: branch2
+ });
+
+ if (hasElse) {
+ branch0.else = true;
+ } else if (elseIfCondition) {
+ branch0.elseif = elseIfCondition;
+ }
+
+ return branch0
+ }
+ }
+}
+
+function cloneASTElement (el) {
+ return createASTElement(el.tag, el.attrsList.slice(), el.parent)
+}
+
+var model$2 = {
+ preTransformNode: preTransformNode
+}
+
+var modules$1 = [
+ klass$1,
+ style$1,
+ model$2
+]
+
+/* */
+
+function text (el, dir) {
+ if (dir.value) {
+ addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
+ }
+}
+
+/* */
+
+function html (el, dir) {
+ if (dir.value) {
+ addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
+ }
+}
+
+var directives$1 = {
+ model: model,
+ text: text,
+ html: html
+}
+
+/* */
+
+var baseOptions = {
+ expectHTML: true,
+ modules: modules$1,
+ directives: directives$1,
+ isPreTag: isPreTag,
+ isUnaryTag: isUnaryTag,
+ mustUseProp: mustUseProp,
+ canBeLeftOpenTag: canBeLeftOpenTag,
+ isReservedTag: isReservedTag,
+ getTagNamespace: getTagNamespace,
+ staticKeys: genStaticKeys(modules$1)
+};
+
+/* */
+
+var isStaticKey;
+var isPlatformReservedTag;
+
+var genStaticKeysCached = cached(genStaticKeys$1);
+
+/**
+ * Goal of the optimizer: walk the generated template AST tree
+ * and detect sub-trees that are purely static, i.e. parts of
+ * the DOM that never needs to change.
+ *
+ * Once we detect these sub-trees, we can:
+ *
+ * 1. Hoist them into constants, so that we no longer need to
+ * create fresh nodes for them on each re-render;
+ * 2. Completely skip them in the patching process.
+ */
+function optimize (root, options) {
+ if (!root) { return }
+ isStaticKey = genStaticKeysCached(options.staticKeys || '');
+ isPlatformReservedTag = options.isReservedTag || no;
+ // first pass: mark all non-static nodes.
+ markStatic$1(root);
+ // second pass: mark static roots.
+ markStaticRoots(root, false);
+}
+
+function genStaticKeys$1 (keys) {
+ return makeMap(
+ 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
+ (keys ? ',' + keys : '')
+ )
+}
+
+function markStatic$1 (node) {
+ node.static = isStatic(node);
+ if (node.type === 1) {
+ // do not make component slot content static. this avoids
+ // 1. components not able to mutate slot nodes
+ // 2. static slot content fails for hot-reloading
+ if (
+ !isPlatformReservedTag(node.tag) &&
+ node.tag !== 'slot' &&
+ node.attrsMap['inline-template'] == null
+ ) {
+ return
+ }
+ for (var i = 0, l = node.children.length; i < l; i++) {
+ var child = node.children[i];
+ markStatic$1(child);
+ if (!child.static) {
+ node.static = false;
+ }
+ }
+ if (node.ifConditions) {
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
+ var block = node.ifConditions[i$1].block;
+ markStatic$1(block);
+ if (!block.static) {
+ node.static = false;
+ }
+ }
+ }
+ }
+}
+
+function markStaticRoots (node, isInFor) {
+ if (node.type === 1) {
+ if (node.static || node.once) {
+ node.staticInFor = isInFor;
+ }
+ // For a node to qualify as a static root, it should have children that
+ // are not just static text. Otherwise the cost of hoisting out will
+ // outweigh the benefits and it's better off to just always render it fresh.
+ if (node.static && node.children.length && !(
+ node.children.length === 1 &&
+ node.children[0].type === 3
+ )) {
+ node.staticRoot = true;
+ return
+ } else {
+ node.staticRoot = false;
+ }
+ if (node.children) {
+ for (var i = 0, l = node.children.length; i < l; i++) {
+ markStaticRoots(node.children[i], isInFor || !!node.for);
+ }
+ }
+ if (node.ifConditions) {
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
+ markStaticRoots(node.ifConditions[i$1].block, isInFor);
+ }
+ }
+ }
+}
+
+function isStatic (node) {
+ if (node.type === 2) { // expression
+ return false
+ }
+ if (node.type === 3) { // text
+ return true
+ }
+ return !!(node.pre || (
+ !node.hasBindings && // no dynamic bindings
+ !node.if && !node.for && // not v-if or v-for or v-else
+ !isBuiltInTag(node.tag) && // not a built-in
+ isPlatformReservedTag(node.tag) && // not a component
+ !isDirectChildOfTemplateFor(node) &&
+ Object.keys(node).every(isStaticKey)
+ ))
+}
+
+function isDirectChildOfTemplateFor (node) {
+ while (node.parent) {
+ node = node.parent;
+ if (node.tag !== 'template') {
+ return false
+ }
+ if (node.for) {
+ return true
+ }
+ }
+ return false
+}
+
+/* */
+
+var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
+var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
+
+// KeyboardEvent.keyCode aliases
+var keyCodes = {
+ esc: 27,
+ tab: 9,
+ enter: 13,
+ space: 32,
+ up: 38,
+ left: 37,
+ right: 39,
+ down: 40,
+ 'delete': [8, 46]
+};
+
+// KeyboardEvent.key aliases
+var keyNames = {
+ esc: 'Escape',
+ tab: 'Tab',
+ enter: 'Enter',
+ space: ' ',
+ // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
+ up: ['Up', 'ArrowUp'],
+ left: ['Left', 'ArrowLeft'],
+ right: ['Right', 'ArrowRight'],
+ down: ['Down', 'ArrowDown'],
+ 'delete': ['Backspace', 'Delete']
+};
+
+// #4868: modifiers that prevent the execution of the listener
+// need to explicitly return null so that we can determine whether to remove
+// the listener for .once
+var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
+
+var modifierCode = {
+ stop: '$event.stopPropagation();',
+ prevent: '$event.preventDefault();',
+ self: genGuard("$event.target !== $event.currentTarget"),
+ ctrl: genGuard("!$event.ctrlKey"),
+ shift: genGuard("!$event.shiftKey"),
+ alt: genGuard("!$event.altKey"),
+ meta: genGuard("!$event.metaKey"),
+ left: genGuard("'button' in $event && $event.button !== 0"),
+ middle: genGuard("'button' in $event && $event.button !== 1"),
+ right: genGuard("'button' in $event && $event.button !== 2")
+};
+
+function genHandlers (
+ events,
+ isNative,
+ warn
+) {
+ var res = isNative ? 'nativeOn:{' : 'on:{';
+ for (var name in events) {
+ res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
+ }
+ return res.slice(0, -1) + '}'
+}
+
+function genHandler (
+ name,
+ handler
+) {
+ if (!handler) {
+ return 'function(){}'
+ }
+
+ if (Array.isArray(handler)) {
+ return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
+ }
+
+ var isMethodPath = simplePathRE.test(handler.value);
+ var isFunctionExpression = fnExpRE.test(handler.value);
+
+ if (!handler.modifiers) {
+ if (isMethodPath || isFunctionExpression) {
+ return handler.value
+ }
+ /* istanbul ignore if */
+ return ("function($event){" + (handler.value) + "}") // inline statement
+ } else {
+ var code = '';
+ var genModifierCode = '';
+ var keys = [];
+ for (var key in handler.modifiers) {
+ if (modifierCode[key]) {
+ genModifierCode += modifierCode[key];
+ // left/right
+ if (keyCodes[key]) {
+ keys.push(key);
+ }
+ } else if (key === 'exact') {
+ var modifiers = (handler.modifiers);
+ genModifierCode += genGuard(
+ ['ctrl', 'shift', 'alt', 'meta']
+ .filter(function (keyModifier) { return !modifiers[keyModifier]; })
+ .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
+ .join('||')
+ );
+ } else {
+ keys.push(key);
+ }
+ }
+ if (keys.length) {
+ code += genKeyFilter(keys);
+ }
+ // Make sure modifiers like prevent and stop get executed after key filtering
+ if (genModifierCode) {
+ code += genModifierCode;
+ }
+ var handlerCode = isMethodPath
+ ? ("return " + (handler.value) + "($event)")
+ : isFunctionExpression
+ ? ("return (" + (handler.value) + ")($event)")
+ : handler.value;
+ /* istanbul ignore if */
+ return ("function($event){" + code + handlerCode + "}")
+ }
+}
+
+function genKeyFilter (keys) {
+ return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
+}
+
+function genFilterCode (key) {
+ var keyVal = parseInt(key, 10);
+ if (keyVal) {
+ return ("$event.keyCode!==" + keyVal)
+ }
+ var keyCode = keyCodes[key];
+ var keyName = keyNames[key];
+ return (
+ "_k($event.keyCode," +
+ (JSON.stringify(key)) + "," +
+ (JSON.stringify(keyCode)) + "," +
+ "$event.key," +
+ "" + (JSON.stringify(keyName)) +
+ ")"
+ )
+}
+
+/* */
+
+function on (el, dir) {
+ if ("development" !== 'production' && dir.modifiers) {
+ warn("v-on without argument does not support modifiers.");
+ }
+ el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
+}
+
+/* */
+
+function bind$1 (el, dir) {
+ el.wrapData = function (code) {
+ return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
+ };
+}
+
+/* */
+
+var baseDirectives = {
+ on: on,
+ bind: bind$1,
+ cloak: noop
+}
+
+/* */
+
+var CodegenState = function CodegenState (options) {
+ this.options = options;
+ this.warn = options.warn || baseWarn;
+ this.transforms = pluckModuleFunction(options.modules, 'transformCode');
+ this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
+ this.directives = extend(extend({}, baseDirectives), options.directives);
+ var isReservedTag = options.isReservedTag || no;
+ this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
+ this.onceId = 0;
+ this.staticRenderFns = [];
+};
+
+
+
+function generate (
+ ast,
+ options
+) {
+ var state = new CodegenState(options);
+ var code = ast ? genElement(ast, state) : '_c("div")';
+ return {
+ render: ("with(this){return " + code + "}"),
+ staticRenderFns: state.staticRenderFns
+ }
+}
+
+function genElement (el, state) {
+ if (el.staticRoot && !el.staticProcessed) {
+ return genStatic(el, state)
+ } else if (el.once && !el.onceProcessed) {
+ return genOnce(el, state)
+ } else if (el.for && !el.forProcessed) {
+ return genFor(el, state)
+ } else if (el.if && !el.ifProcessed) {
+ return genIf(el, state)
+ } else if (el.tag === 'template' && !el.slotTarget) {
+ return genChildren(el, state) || 'void 0'
+ } else if (el.tag === 'slot') {
+ return genSlot(el, state)
+ } else {
+ // component or element
+ var code;
+ if (el.component) {
+ code = genComponent(el.component, el, state);
+ } else {
+ var data = el.plain ? undefined : genData$2(el, state);
+
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
+ code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
+ }
+ // module transforms
+ for (var i = 0; i < state.transforms.length; i++) {
+ code = state.transforms[i](el, code);
+ }
+ return code
+ }
+}
+
+// hoist static sub-trees out
+function genStatic (el, state) {
+ el.staticProcessed = true;
+ state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
+ return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
+}
+
+// v-once
+function genOnce (el, state) {
+ el.onceProcessed = true;
+ if (el.if && !el.ifProcessed) {
+ return genIf(el, state)
+ } else if (el.staticInFor) {
+ var key = '';
+ var parent = el.parent;
+ while (parent) {
+ if (parent.for) {
+ key = parent.key;
+ break
+ }
+ parent = parent.parent;
+ }
+ if (!key) {
+ "development" !== 'production' && state.warn(
+ "v-once can only be used inside v-for that is keyed. "
+ );
+ return genElement(el, state)
+ }
+ return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
+ } else {
+ return genStatic(el, state)
+ }
+}
+
+function genIf (
+ el,
+ state,
+ altGen,
+ altEmpty
+) {
+ el.ifProcessed = true; // avoid recursion
+ return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
+}
+
+function genIfConditions (
+ conditions,
+ state,
+ altGen,
+ altEmpty
+) {
+ if (!conditions.length) {
+ return altEmpty || '_e()'
+ }
+
+ var condition = conditions.shift();
+ if (condition.exp) {
+ return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
+ } else {
+ return ("" + (genTernaryExp(condition.block)))
+ }
+
+ // v-if with v-once should generate code like (a)?_m(0):_m(1)
+ function genTernaryExp (el) {
+ return altGen
+ ? altGen(el, state)
+ : el.once
+ ? genOnce(el, state)
+ : genElement(el, state)
+ }
+}
+
+function genFor (
+ el,
+ state,
+ altGen,
+ altHelper
+) {
+ var exp = el.for;
+ var alias = el.alias;
+ var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
+ var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
+
+ if ("development" !== 'production' &&
+ state.maybeComponent(el) &&
+ el.tag !== 'slot' &&
+ el.tag !== 'template' &&
+ !el.key
+ ) {
+ state.warn(
+ "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
+ "v-for should have explicit keys. " +
+ "See https://vuejs.org/guide/list.html#key for more info.",
+ true /* tip */
+ );
+ }
+
+ el.forProcessed = true; // avoid recursion
+ return (altHelper || '_l') + "((" + exp + ")," +
+ "function(" + alias + iterator1 + iterator2 + "){" +
+ "return " + ((altGen || genElement)(el, state)) +
+ '})'
+}
+
+function genData$2 (el, state) {
+ var data = '{';
+
+ // directives first.
+ // directives may mutate the el's other properties before they are generated.
+ var dirs = genDirectives(el, state);
+ if (dirs) { data += dirs + ','; }
+
+ // key
+ if (el.key) {
+ data += "key:" + (el.key) + ",";
+ }
+ // ref
+ if (el.ref) {
+ data += "ref:" + (el.ref) + ",";
+ }
+ if (el.refInFor) {
+ data += "refInFor:true,";
+ }
+ // pre
+ if (el.pre) {
+ data += "pre:true,";
+ }
+ // record original tag name for components using "is" attribute
+ if (el.component) {
+ data += "tag:\"" + (el.tag) + "\",";
+ }
+ // module data generation functions
+ for (var i = 0; i < state.dataGenFns.length; i++) {
+ data += state.dataGenFns[i](el);
+ }
+ // attributes
+ if (el.attrs) {
+ data += "attrs:{" + (genProps(el.attrs)) + "},";
+ }
+ // DOM props
+ if (el.props) {
+ data += "domProps:{" + (genProps(el.props)) + "},";
+ }
+ // event handlers
+ if (el.events) {
+ data += (genHandlers(el.events, false, state.warn)) + ",";
+ }
+ if (el.nativeEvents) {
+ data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
+ }
+ // slot target
+ // only for non-scoped slots
+ if (el.slotTarget && !el.slotScope) {
+ data += "slot:" + (el.slotTarget) + ",";
+ }
+ // scoped slots
+ if (el.scopedSlots) {
+ data += (genScopedSlots(el.scopedSlots, state)) + ",";
+ }
+ // component v-model
+ if (el.model) {
+ data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
+ }
+ // inline-template
+ if (el.inlineTemplate) {
+ var inlineTemplate = genInlineTemplate(el, state);
+ if (inlineTemplate) {
+ data += inlineTemplate + ",";
+ }
+ }
+ data = data.replace(/,$/, '') + '}';
+ // v-bind data wrap
+ if (el.wrapData) {
+ data = el.wrapData(data);
+ }
+ // v-on data wrap
+ if (el.wrapListeners) {
+ data = el.wrapListeners(data);
+ }
+ return data
+}
+
+function genDirectives (el, state) {
+ var dirs = el.directives;
+ if (!dirs) { return }
+ var res = 'directives:[';
+ var hasRuntime = false;
+ var i, l, dir, needRuntime;
+ for (i = 0, l = dirs.length; i < l; i++) {
+ dir = dirs[i];
+ needRuntime = true;
+ var gen = state.directives[dir.name];
+ if (gen) {
+ // compile-time directive that manipulates AST.
+ // returns true if it also needs a runtime counterpart.
+ needRuntime = !!gen(el, dir, state.warn);
+ }
+ if (needRuntime) {
+ hasRuntime = true;
+ res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
+ }
+ }
+ if (hasRuntime) {
+ return res.slice(0, -1) + ']'
+ }
+}
+
+function genInlineTemplate (el, state) {
+ var ast = el.children[0];
+ if ("development" !== 'production' && (
+ el.children.length !== 1 || ast.type !== 1
+ )) {
+ state.warn('Inline-template components must have exactly one child element.');
+ }
+ if (ast.type === 1) {
+ var inlineRenderFns = generate(ast, state.options);
+ return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
+ }
+}
+
+function genScopedSlots (
+ slots,
+ state
+) {
+ return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
+ return genScopedSlot(key, slots[key], state)
+ }).join(',')) + "])")
+}
+
+function genScopedSlot (
+ key,
+ el,
+ state
+) {
+ if (el.for && !el.forProcessed) {
+ return genForScopedSlot(key, el, state)
+ }
+ var fn = "function(" + (String(el.slotScope)) + "){" +
+ "return " + (el.tag === 'template'
+ ? el.if
+ ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
+ : genChildren(el, state) || 'undefined'
+ : genElement(el, state)) + "}";
+ return ("{key:" + key + ",fn:" + fn + "}")
+}
+
+function genForScopedSlot (
+ key,
+ el,
+ state
+) {
+ var exp = el.for;
+ var alias = el.alias;
+ var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
+ var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
+ el.forProcessed = true; // avoid recursion
+ return "_l((" + exp + ")," +
+ "function(" + alias + iterator1 + iterator2 + "){" +
+ "return " + (genScopedSlot(key, el, state)) +
+ '})'
+}
+
+function genChildren (
+ el,
+ state,
+ checkSkip,
+ altGenElement,
+ altGenNode
+) {
+ var children = el.children;
+ if (children.length) {
+ var el$1 = children[0];
+ // optimize single v-for
+ if (children.length === 1 &&
+ el$1.for &&
+ el$1.tag !== 'template' &&
+ el$1.tag !== 'slot'
+ ) {
+ return (altGenElement || genElement)(el$1, state)
+ }
+ var normalizationType = checkSkip
+ ? getNormalizationType(children, state.maybeComponent)
+ : 0;
+ var gen = altGenNode || genNode;
+ return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
+ }
+}
+
+// determine the normalization needed for the children array.
+// 0: no normalization needed
+// 1: simple normalization needed (possible 1-level deep nested array)
+// 2: full normalization needed
+function getNormalizationType (
+ children,
+ maybeComponent
+) {
+ var res = 0;
+ for (var i = 0; i < children.length; i++) {
+ var el = children[i];
+ if (el.type !== 1) {
+ continue
+ }
+ if (needsNormalization(el) ||
+ (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
+ res = 2;
+ break
+ }
+ if (maybeComponent(el) ||
+ (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
+ res = 1;
+ }
+ }
+ return res
+}
+
+function needsNormalization (el) {
+ return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
+}
+
+function genNode (node, state) {
+ if (node.type === 1) {
+ return genElement(node, state)
+ } if (node.type === 3 && node.isComment) {
+ return genComment(node)
+ } else {
+ return genText(node)
+ }
+}
+
+function genText (text) {
+ return ("_v(" + (text.type === 2
+ ? text.expression // no need for () because already wrapped in _s()
+ : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
+}
+
+function genComment (comment) {
+ return ("_e(" + (JSON.stringify(comment.text)) + ")")
+}
+
+function genSlot (el, state) {
+ var slotName = el.slotName || '"default"';
+ var children = genChildren(el, state);
+ var res = "_t(" + slotName + (children ? ("," + children) : '');
+ var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
+ var bind$$1 = el.attrsMap['v-bind'];
+ if ((attrs || bind$$1) && !children) {
+ res += ",null";
+ }
+ if (attrs) {
+ res += "," + attrs;
+ }
+ if (bind$$1) {
+ res += (attrs ? '' : ',null') + "," + bind$$1;
+ }
+ return res + ')'
+}
+
+// componentName is el.component, take it as argument to shun flow's pessimistic refinement
+function genComponent (
+ componentName,
+ el,
+ state
+) {
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
+ return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
+}
+
+function genProps (props) {
+ var res = '';
+ for (var i = 0; i < props.length; i++) {
+ var prop = props[i];
+ /* istanbul ignore if */
+ {
+ res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
+ }
+ }
+ return res.slice(0, -1)
+}
+
+// #3895, #4268
+function transformSpecialNewlines (text) {
+ return text
+ .replace(/\u2028/g, '\\u2028')
+ .replace(/\u2029/g, '\\u2029')
+}
+
+/* */
+
+// these keywords should not appear inside expressions, but operators like
+// typeof, instanceof and in are allowed
+var prohibitedKeywordRE = new RegExp('\\b' + (
+ 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
+ 'super,throw,while,yield,delete,export,import,return,switch,default,' +
+ 'extends,finally,continue,debugger,function,arguments'
+).split(',').join('\\b|\\b') + '\\b');
+
+// these unary operators should not be used as property/method names
+var unaryOperatorsRE = new RegExp('\\b' + (
+ 'delete,typeof,void'
+).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
+
+// strip strings in expressions
+var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
+
+// detect problematic expressions in a template
+function detectErrors (ast) {
+ var errors = [];
+ if (ast) {
+ checkNode(ast, errors);
+ }
+ return errors
+}
+
+function checkNode (node, errors) {
+ if (node.type === 1) {
+ for (var name in node.attrsMap) {
+ if (dirRE.test(name)) {
+ var value = node.attrsMap[name];
+ if (value) {
+ if (name === 'v-for') {
+ checkFor(node, ("v-for=\"" + value + "\""), errors);
+ } else if (onRE.test(name)) {
+ checkEvent(value, (name + "=\"" + value + "\""), errors);
+ } else {
+ checkExpression(value, (name + "=\"" + value + "\""), errors);
+ }
+ }
+ }
+ }
+ if (node.children) {
+ for (var i = 0; i < node.children.length; i++) {
+ checkNode(node.children[i], errors);
+ }
+ }
+ } else if (node.type === 2) {
+ checkExpression(node.expression, node.text, errors);
+ }
+}
+
+function checkEvent (exp, text, errors) {
+ var stipped = exp.replace(stripStringRE, '');
+ var keywordMatch = stipped.match(unaryOperatorsRE);
+ if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
+ errors.push(
+ "avoid using JavaScript unary operator as property name: " +
+ "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
+ );
+ }
+ checkExpression(exp, text, errors);
+}
+
+function checkFor (node, text, errors) {
+ checkExpression(node.for || '', text, errors);
+ checkIdentifier(node.alias, 'v-for alias', text, errors);
+ checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
+ checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
+}
+
+function checkIdentifier (
+ ident,
+ type,
+ text,
+ errors
+) {
+ if (typeof ident === 'string') {
+ try {
+ new Function(("var " + ident + "=_"));
+ } catch (e) {
+ errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
+ }
+ }
+}
+
+function checkExpression (exp, text, errors) {
+ try {
+ new Function(("return " + exp));
+ } catch (e) {
+ var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
+ if (keywordMatch) {
+ errors.push(
+ "avoid using JavaScript keyword as property name: " +
+ "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
+ );
+ } else {
+ errors.push(
+ "invalid expression: " + (e.message) + " in\n\n" +
+ " " + exp + "\n\n" +
+ " Raw expression: " + (text.trim()) + "\n"
+ );
+ }
+ }
+}
+
+/* */
+
+function createFunction (code, errors) {
+ try {
+ return new Function(code)
+ } catch (err) {
+ errors.push({ err: err, code: code });
+ return noop
+ }
+}
+
+function createCompileToFunctionFn (compile) {
+ var cache = Object.create(null);
+
+ return function compileToFunctions (
+ template,
+ options,
+ vm
+ ) {
+ options = extend({}, options);
+ var warn$$1 = options.warn || warn;
+ delete options.warn;
+
+ /* istanbul ignore if */
+ {
+ // detect possible CSP restriction
+ try {
+ new Function('return 1');
+ } catch (e) {
+ if (e.toString().match(/unsafe-eval|CSP/)) {
+ warn$$1(
+ 'It seems you are using the standalone build of Vue.js in an ' +
+ 'environment with Content Security Policy that prohibits unsafe-eval. ' +
+ 'The template compiler cannot work in this environment. Consider ' +
+ 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
+ 'templates into render functions.'
+ );
+ }
+ }
+ }
+
+ // check cache
+ var key = options.delimiters
+ ? String(options.delimiters) + template
+ : template;
+ if (cache[key]) {
+ return cache[key]
+ }
+
+ // compile
+ var compiled = compile(template, options);
+
+ // check compilation errors/tips
+ {
+ if (compiled.errors && compiled.errors.length) {
+ warn$$1(
+ "Error compiling template:\n\n" + template + "\n\n" +
+ compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
+ vm
+ );
+ }
+ if (compiled.tips && compiled.tips.length) {
+ compiled.tips.forEach(function (msg) { return tip(msg, vm); });
+ }
+ }
+
+ // turn code into functions
+ var res = {};
+ var fnGenErrors = [];
+ res.render = createFunction(compiled.render, fnGenErrors);
+ res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
+ return createFunction(code, fnGenErrors)
+ });
+
+ // check function generation errors.
+ // this should only happen if there is a bug in the compiler itself.
+ // mostly for codegen development use
+ /* istanbul ignore if */
+ {
+ if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
+ warn$$1(
+ "Failed to generate render function:\n\n" +
+ fnGenErrors.map(function (ref) {
+ var err = ref.err;
+ var code = ref.code;
+
+ return ((err.toString()) + " in\n\n" + code + "\n");
+ }).join('\n'),
+ vm
+ );
+ }
+ }
+
+ return (cache[key] = res)
+ }
+}
+
+/* */
+
+function createCompilerCreator (baseCompile) {
+ return function createCompiler (baseOptions) {
+ function compile (
+ template,
+ options
+ ) {
+ var finalOptions = Object.create(baseOptions);
+ var errors = [];
+ var tips = [];
+ finalOptions.warn = function (msg, tip) {
+ (tip ? tips : errors).push(msg);
+ };
+
+ if (options) {
+ // merge custom modules
+ if (options.modules) {
+ finalOptions.modules =
+ (baseOptions.modules || []).concat(options.modules);
+ }
+ // merge custom directives
+ if (options.directives) {
+ finalOptions.directives = extend(
+ Object.create(baseOptions.directives || null),
+ options.directives
+ );
+ }
+ // copy other options
+ for (var key in options) {
+ if (key !== 'modules' && key !== 'directives') {
+ finalOptions[key] = options[key];
+ }
+ }
+ }
+
+ var compiled = baseCompile(template, finalOptions);
+ {
+ errors.push.apply(errors, detectErrors(compiled.ast));
+ }
+ compiled.errors = errors;
+ compiled.tips = tips;
+ return compiled
+ }
+
+ return {
+ compile: compile,
+ compileToFunctions: createCompileToFunctionFn(compile)
+ }
+ }
+}
+
+/* */
+
+// `createCompilerCreator` allows creating compilers that use alternative
+// parser/optimizer/codegen, e.g the SSR optimizing compiler.
+// Here we just export a default compiler using the default parts.
+var createCompiler = createCompilerCreator(function baseCompile (
+ template,
+ options
+) {
+ var ast = parse(template.trim(), options);
+ if (options.optimize !== false) {
+ optimize(ast, options);
+ }
+ var code = generate(ast, options);
+ return {
+ ast: ast,
+ render: code.render,
+ staticRenderFns: code.staticRenderFns
+ }
+});
+
+/* */
+
+var ref$1 = createCompiler(baseOptions);
+var compileToFunctions = ref$1.compileToFunctions;
+
+/* */
+
+// check whether current browser encodes a char inside attribute values
+var div;
+function getShouldDecode (href) {
+ div = div || document.createElement('div');
+ div.innerHTML = href ? "
" : "";
+ return div.innerHTML.indexOf('
') > 0
+}
+
+// #3663: IE encodes newlines inside attribute values while other browsers don't
+var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
+// #6828: chrome encodes content in a[href]
+var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
+
+/* */
+
+var idToTemplate = cached(function (id) {
+ var el = query(id);
+ return el && el.innerHTML
+});
+
+var mount = Vue.prototype.$mount;
+Vue.prototype.$mount = function (
+ el,
+ hydrating
+) {
+ el = el && query(el);
+
+ /* istanbul ignore if */
+ if (el === document.body || el === document.documentElement) {
+ "development" !== 'production' && warn(
+ "Do not mount Vue to or - mount to normal elements instead."
+ );
+ return this
+ }
+
+ var options = this.$options;
+ // resolve template/el and convert to render function
+ if (!options.render) {
+ var template = options.template;
+ if (template) {
+ if (typeof template === 'string') {
+ if (template.charAt(0) === '#') {
+ template = idToTemplate(template);
+ /* istanbul ignore if */
+ if ("development" !== 'production' && !template) {
+ warn(
+ ("Template element not found or is empty: " + (options.template)),
+ this
+ );
+ }
+ }
+ } else if (template.nodeType) {
+ template = template.innerHTML;
+ } else {
+ {
+ warn('invalid template option:' + template, this);
+ }
+ return this
+ }
+ } else if (el) {
+ template = getOuterHTML(el);
+ }
+ if (template) {
+ /* istanbul ignore if */
+ if ("development" !== 'production' && config.performance && mark) {
+ mark('compile');
+ }
+
+ var ref = compileToFunctions(template, {
+ shouldDecodeNewlines: shouldDecodeNewlines,
+ shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
+ delimiters: options.delimiters,
+ comments: options.comments
+ }, this);
+ var render = ref.render;
+ var staticRenderFns = ref.staticRenderFns;
+ options.render = render;
+ options.staticRenderFns = staticRenderFns;
+
+ /* istanbul ignore if */
+ if ("development" !== 'production' && config.performance && mark) {
+ mark('compile end');
+ measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
+ }
+ }
+ }
+ return mount.call(this, el, hydrating)
+};
+
+/**
+ * Get outerHTML of elements, taking care
+ * of SVG elements in IE as well.
+ */
+function getOuterHTML (el) {
+ if (el.outerHTML) {
+ return el.outerHTML
+ } else {
+ var container = document.createElement('div');
+ container.appendChild(el.cloneNode(true));
+ return container.innerHTML
+ }
+}
+
+Vue.compile = compileToFunctions;
+
+return Vue;
+
+})));
diff --git a/lib/cli-common.js b/lib/cli-common.js
index 9b04c18..a746882 100644
--- a/lib/cli-common.js
+++ b/lib/cli-common.js
@@ -9,7 +9,7 @@ var fs = require('fs');
var mkdirp = require('mkdirp');
var os = require('os');
var homedir = os.homedir();
-var urequest = require('@coolaj86/urequest');
+var urequest = require('@root/request');
common._NOTIFICATIONS = {
'newsletter': [ 'newsletter', 'communityMember' ]
@@ -118,7 +118,7 @@ common.otp = function getOtp() {
return Math.round(Math.random() * 9999).toString().padStart(4, '0');
};
common.signToken = function (state) {
- var jwt = require('jsonwebtoken');
+ var JWT = require('./jwt.js');
var tokenData = {
domains: Object.keys(state.config.servernames || {}).filter(function (name) {
return /\./.test(name);
@@ -131,7 +131,7 @@ common.signToken = function (state) {
, iss: Math.round(Date.now() / 1000)
};
- return jwt.sign(tokenData, state.config.secret);
+ return JWT.sign(tokenData, state.config.secret);
};
common.api = {};
common.api.directory = function (state, next) {
diff --git a/lib/remote.js b/lib/daemon/index.js
similarity index 98%
rename from lib/remote.js
rename to lib/daemon/index.js
index 0f59c7b..22fcd7b 100644
--- a/lib/remote.js
+++ b/lib/daemon/index.js
@@ -28,6 +28,7 @@ function TelebitRemote(state) {
EventEmitter.call(this);
var me = this;
var priv = {};
+ var path = require('path');
//var defaultHttpTimeout = (2 * 60);
//var activityTimeout = state.activityTimeout || (defaultHttpTimeout - 5) * 1000;
@@ -39,8 +40,9 @@ function TelebitRemote(state) {
priv.tokens = [];
var auth;
if(!state.sortingHat) {
- state.sortingHat = "./sorting-hat.js";
+ state.sortingHat = path.join(__dirname, '../sorting-hat.js');
}
+ state._connectionHandler = require(state.sortingHat);
if (state.token) {
if ('undefined' === state.token) {
throw new Error("passed string 'undefined' as token");
@@ -349,7 +351,7 @@ function TelebitRemote(state) {
// TODO use readable streams instead
wstunneler._socket.pause();
- require(state.sortingHat).assign(state, tun, function (err, conn) {
+ state._connectionHandler.assign(state, tun, function (err, conn) {
if (err) {
err.message = err.message.replace(/:tun_id/, tun._id);
packerHandlers._onConnectError(cid, tun, err);
@@ -472,12 +474,12 @@ function TelebitRemote(state) {
priv.timeoutId = null;
var machine = Packer.create(packerHandlers);
- console.info("[telebit:lib/remote.js] [connect] '" + (state.wss || state.relay) + "'");
+ console.info("[telebit:lib/daemon.js] [connect] '" + (state.wss || state.relay) + "'");
var tunnelUrl = (state.wss || state.relay).replace(/\/$/, '') + '/'; // + auth;
wstunneler = new WebSocket(tunnelUrl, { rejectUnauthorized: !state.insecure });
// XXXXXX
wstunneler.on('open', function () {
- console.info("[telebit:lib/remote.js] [open] connected to '" + (state.wss || state.relay) + "'");
+ console.info("[telebit:lib/daemon.js] [open] connected to '" + (state.wss || state.relay) + "'");
me.emit('connect');
priv.refreshTimeout();
priv.timeoutId = setTimeout(priv.checkTimeout, activityTimeout);
diff --git a/lib/eggspress.js b/lib/eggspress.js
new file mode 100644
index 0000000..e0e29aa
--- /dev/null
+++ b/lib/eggspress.js
@@ -0,0 +1,120 @@
+'use strict';
+
+function eggSend(obj) {
+ /*jslint validthis: true*/
+ var me = this;
+ if (!me.getHeader('content-type')) {
+ me.setHeader('Content-Type', 'application/json');
+ }
+ me.end(JSON.stringify(obj));
+}
+
+module.exports = function eggspress() {
+ //var patternsMap = {};
+ var allPatterns = [];
+ var app = function (req, res) {
+ var patterns = allPatterns.slice(0).reverse();
+ function next(err) {
+ if (err) {
+ req.end(err.message);
+ return;
+ }
+ var todo = patterns.pop();
+ if (!todo) {
+ console.log('[eggspress] Did not match any patterns', req.url);
+ require('finalhandler')(req, res)();
+ return;
+ }
+
+ // '', GET, POST, DELETE
+ if (todo[2] && req.method.toLowerCase() !== todo[2]) {
+ //console.log("[eggspress] HTTP method doesn't match", req.url);
+ next();
+ return;
+ }
+
+ var urlstr = (req.url.replace(/\/$/, '') + '/');
+ var match = urlstr.match(todo[0]);
+ if (!match) {
+ //console.log("[eggspress] pattern doesn't match", todo[0], req.url);
+ next();
+ return;
+ } else if ('string' === typeof todo[0] && 0 !== match.index) {
+ //console.log("[eggspress] string pattern is not the start", todo[0], req.url);
+ next();
+ return;
+ }
+
+ function fail(e) {
+ console.error("[eggspress] error", todo[2], todo[0], req.url);
+ console.error(e);
+ // TODO make a nice error message
+ res.end(e.message);
+ }
+
+ console.log("[eggspress] matched pattern", todo[0], req.url);
+ if ('function' === typeof todo[1]) {
+ // TODO this is prep-work
+ todo[1] = [todo[1]];
+ }
+
+ var fns = todo[1].slice(0);
+ req.params = match.slice(1);
+
+ function nextTodo(err) {
+ if (err) { fail(err); return; }
+ var fn = fns.shift();
+ if (!fn) { next(err); return; }
+ try {
+ var p = fn(req, res, nextTodo);
+ if (p && p.catch) {
+ p.catch(fail);
+ }
+ } catch(e) {
+ fail(e);
+ return;
+ }
+ }
+ nextTodo();
+ }
+
+ res.send = eggSend;
+
+ next();
+ };
+
+ app.use = function (pattern) {
+ var fns = Array.prototype.slice.call(arguments, 1);
+ return app._use('', pattern, fns);
+ };
+ [ 'HEAD', 'GET', 'POST', 'DELETE' ].forEach(function (method) {
+ app[method.toLowerCase()] = function (pattern) {
+ var fns = Array.prototype.slice.call(arguments, 1);
+ return app._use(method, pattern, fns);
+ };
+ });
+
+ app.post = function (pattern) {
+ var fns = Array.prototype.slice.call(arguments, 1);
+ return app._use('POST', pattern, fns);
+ };
+ app._use = function (method, pattern, fns) {
+ // always end in a slash, for now
+ if ('string' === typeof pattern) {
+ pattern = pattern.replace(/\/$/, '') + '/';
+ }
+ /*
+ if (!patternsMap[pattern]) {
+ patternsMap[pattern] = [];
+ }
+ patternsMap[pattern].push(fn);
+ patterns = Object.keys(patternsMap).sort(function (a, b) {
+ return b.length - a.length;
+ });
+ */
+ allPatterns.push([pattern, fns, method.toLowerCase()]);
+ return app;
+ };
+
+ return app;
+};
diff --git a/lib/en-us.toml b/lib/en-us.toml
index 21d77e7..161d6c9 100644
--- a/lib/en-us.toml
+++ b/lib/en-us.toml
@@ -476,5 +476,13 @@ By using Telebit you agree to:
Enter your email to agree and login/create your account:
"
+fail_relay_check = "===================
+ WARNING
+===================
+
+[{{status_code}}] '{{url}}'
+This server does not describe a current telebit version (but it may still work).
+"
+
[daemon]
version = "telebit daemon v{version}"
diff --git a/lib/jwt-test.js b/lib/jwt-test.js
new file mode 100644
index 0000000..37f95a7
--- /dev/null
+++ b/lib/jwt-test.js
@@ -0,0 +1,19 @@
+'use strict';
+
+var crypto = require('crypto');
+var FAT = require('jsonwebtoken');
+var JWT = require('./jwt.js');
+
+var key = "justanothersecretsecret";
+var keyid = crypto.createHash('sha256').update(key).digest('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
+
+var tok1 = FAT.sign({ foo: "hello" }, key, { keyid: keyid });
+var tok2 = JWT.sign({ foo: "hello" }, key);
+
+if (tok1 !== tok2) {
+ console.error(JWT.decode(tok1));
+ console.error(JWT.decode(tok2));
+ throw new Error("our jwt doesn't match auth0/jsonwebtoken");
+}
+
+console.info('Pass');
diff --git a/lib/jwt.js b/lib/jwt.js
new file mode 100644
index 0000000..c7d16fe
--- /dev/null
+++ b/lib/jwt.js
@@ -0,0 +1,43 @@
+'use strict';
+
+var crypto = require('crypto');
+var JWT = module.exports;
+
+JWT.decode = function (jwt) {
+ var parts;
+
+ try {
+ parts = jwt.split('.');
+ return {
+ header: JSON.parse(Buffer.from(parts[0], 'base64'))
+ , payload: JSON.parse(Buffer.from(parts[1], 'base64'))
+ , signature: parts[2] //Buffer.from(parts[2], 'base64')
+ };
+ } catch(e) {
+ throw new Error("JWT Parse Error: could not split, base64 decode, and JSON.parse token " + jwt);
+ }
+};
+
+JWT.verify = function (jwt) {
+ var decoded = JWT.decode(jwt);
+ throw new Error("not implemented yet");
+};
+
+function base64ToUrlSafe(str) {
+ return str
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=/g, '')
+ ;
+}
+
+JWT.sign = function (claims, key) {
+ if (!claims.iat && false !== claims.iat) {
+ claims.iat = Math.round(Date.now()/1000);
+ }
+ var thumb = base64ToUrlSafe(crypto.createHash('sha256').update(key).digest('base64'));
+ var protect = base64ToUrlSafe(Buffer.from(JSON.stringify({ alg: 'HS256', typ: 'JWT', kid: thumb })).toString('base64'));
+ var payload = base64ToUrlSafe(Buffer.from(JSON.stringify(claims)).toString('base64'));
+ var signature = base64ToUrlSafe(crypto.createHmac('sha256', key).update(protect + '.' + payload).digest('base64'));
+ return protect + '.' + payload + '.' + signature;
+};
diff --git a/lib/keystore-fallback.js b/lib/keystore-fallback.js
new file mode 100644
index 0000000..46e541e
--- /dev/null
+++ b/lib/keystore-fallback.js
@@ -0,0 +1,39 @@
+'use strict';
+/*global Promise*/
+
+var fs = require('fs').promises;
+var path = require('path');
+
+module.exports.create = function (opts) {
+ var keyext = '.key';
+ return {
+ getPassword: function (service, name) {
+ var f = path.join(opts.configDir, name + keyext);
+ return fs.readFile(f, 'utf8').catch(function (err) {
+ if ('ENOEXIST' === err.code) {
+ return;
+ }
+ });
+ }
+ , setPassword: function (service, name, key) {
+ var f = path.join(opts.configDir, name + keyext);
+ return fs.writeFile(f, key, 'utf8');
+ }
+ , deletePassword: function (service, name) {
+ var f = path.join(opts.configDir, name + keyext);
+ return fs.unlink(f);
+ }
+ , findCredentials: function (/*service*/) {
+ return fs.readdir(opts.configDir).then(function (nodes) {
+ return Promise.all(nodes.filter(function (node) {
+ return keyext === node.slice(-4);
+ }).map(function (node) {
+ return fs.readFile(path.join(opts.configDir, node), 'utf8').then(function (data) {
+ return { password: data };
+ });
+ }));
+ });
+ }
+ , insecure: true
+ };
+};
diff --git a/lib/keystore-test.js b/lib/keystore-test.js
new file mode 100644
index 0000000..3a288cc
--- /dev/null
+++ b/lib/keystore-test.js
@@ -0,0 +1,29 @@
+(function () {
+'use strict';
+
+var keystore = require('./keystore.js').create({
+ configDir: require('path').join(require('os').homedir(), '.config/telebit/')
+, fallback: true
+});
+
+var name = "testy-mctestface-1";
+return keystore.get(name).then(function (jwk) {
+ console.log("get1", typeof jwk, jwk);
+ if (!jwk || !jwk.kty) {
+ return require('keypairs').generate().then(function (jwk) {
+ var json = JSON.stringify(jwk.private);
+ return keystore.set(name, json).then(function () {
+ return keystore.all().then(function (vals) {
+ console.log("All", vals);
+ return keystore.get(name).then(function (val2) {
+ console.log("get2", val2);
+ });
+ });
+ }).catch(function (err) {
+ console.log('badness', err);
+ });
+ });
+ }
+ return jwk;
+});
+}());
diff --git a/lib/keystore.js b/lib/keystore.js
new file mode 100644
index 0000000..b142ac2
--- /dev/null
+++ b/lib/keystore.js
@@ -0,0 +1,52 @@
+'use strict';
+
+module.exports.create = function (opts) {
+ var service = opts.name || "Telebit";
+ var keytar;
+ try {
+ if (opts.fallback) {
+ throw new Error("forced fallback");
+ }
+ keytar = require('keytar');
+ // TODO test that long "passwords" (JWTs and JWKs) can be stored in all OSes
+ } catch(e) {
+ console.warn("Could not load native key management. Keys will be stored in plain text.");
+ keytar = require('./keystore-fallback.js').create(opts);
+ keytar.insecure = true;
+ }
+
+ return {
+ get: function (name) {
+ return keytar.getPassword(service, name).then(maybeParse);
+ }
+ , set: function (name, value) {
+ return keytar.setPassword(service, name, maybeStringify(value));
+ }
+ , delete: function (name) {
+ return keytar.deletePassword(service, name);
+ }
+ , all: function () {
+ return keytar.findCredentials(service).then(function (list) {
+ return list.map(function (el) {
+ el.password = maybeParse(el.password);
+ return el;
+ });
+ });
+ }
+ , insecure: keytar.insecure
+ };
+};
+
+function maybeParse(str) {
+ if (str && '{' === str[0]) {
+ return JSON.parse(str);
+ }
+ return str;
+}
+
+function maybeStringify(obj) {
+ if ('string' !== typeof obj && 'object' === typeof obj) {
+ return JSON.stringify(obj);
+ }
+ return obj;
+}
diff --git a/lib/rc/index.js b/lib/rc/index.js
new file mode 100644
index 0000000..f3c8d88
--- /dev/null
+++ b/lib/rc/index.js
@@ -0,0 +1,196 @@
+'use strict';
+
+var os = require('os');
+var path = require('path');
+var http = require('http');
+var keypairs = require('keypairs');
+
+var common = require('../cli-common.js');
+
+/*
+function packConfig(config) {
+ return Object.keys(config).map(function (key) {
+ var val = config[key];
+ if ('undefined' === val) {
+ throw new Error("'undefined' used as a string value");
+ }
+ if ('undefined' === typeof val) {
+ //console.warn('[DEBUG]', key, 'is present but undefined');
+ return;
+ }
+ if (val && 'object' === typeof val && !Array.isArray(val)) {
+ val = JSON.stringify(val);
+ }
+ return key + ':' + val; // converts arrays to strings with ,
+ });
+}
+*/
+
+module.exports.create = function (state) {
+ common._init(
+ // make a default working dir and log dir
+ state._clientConfig.root || path.join(os.homedir(), '.local/share/telebit')
+ , (state._clientConfig.root && path.join(state._clientConfig.root, 'etc'))
+ || path.resolve(common.DEFAULT_CONFIG_PATH, '..')
+ );
+ state._ipc = common.pipename(state._clientConfig, true);
+
+ function makeResponder(service, resp, fn) {
+ var body = '';
+
+ function finish() {
+ var err;
+
+ if (200 !== resp.statusCode) {
+ err = new Error(body || ('get ' + service + ' failed'));
+ err.statusCode = resp.statusCode;
+ err.code = "E_REQUEST";
+ }
+
+ if (body) {
+ try {
+ body = JSON.parse(body);
+ } catch(e) {
+ console.error('Error:', err);
+ // ignore
+ }
+ }
+
+ fn(err, body);
+ }
+
+ if (!resp.headers['content-length'] && !resp.headers['content-type']) {
+ finish();
+ return;
+ }
+
+ // TODO use readable
+ resp.on('data', function (chunk) {
+ body += chunk.toString();
+ });
+ resp.on('end', finish);
+ }
+
+ var RC = {};
+ RC.resolve = function (pathstr) {
+ // TODO use real hostname and return reqOpts rather than string?
+ return 'http://localhost:' + (RC.port({}).port||'1').toString() + '/' + pathstr.replace(/^\//, '');
+ };
+ RC.port = function (reqOpts) {
+ var fs = require('fs');
+ var portFile = path.join(path.dirname(state._ipc.path), 'telebit.port');
+ if (fs.existsSync(portFile)) {
+ reqOpts.host = 'localhost';
+ reqOpts.port = parseInt(fs.readFileSync(portFile, 'utf8').trim(), 10);
+ if (!state.ipc) {
+ state.ipc = {};
+ }
+ state.ipc.type = 'port';
+ state.ipc.path = path.dirname(state._ipc.path);
+ state.ipc.port = reqOpts.port;
+ } else {
+ reqOpts.socketPath = state._ipc.path;
+ }
+ return reqOpts;
+ };
+ RC.createRelauncher = function (replay, opts, cb) {
+ return function (err) {
+ /*global Promise*/
+ var p = new Promise(function (resolve, reject) {
+ // ENOENT - never started, cleanly exited last start, or creating socket at a different path
+ // ECONNREFUSED - leftover socket just needs to be restarted
+ if ('ENOENT' !== err.code && 'ECONNREFUSED' !== err.code) {
+ reject(err);
+ return;
+ }
+
+ // retried and failed again: quit
+ if (opts._taketwo) {
+ reject(err);
+ return;
+ }
+
+ require('../../usr/share/install-launcher.js').install({ env: process.env }, function (err) {
+ if (err) { reject(err); return; }
+ opts._taketwo = true;
+ setTimeout(function () {
+ if (replay.length <= 1) {
+ replay(opts).then(resolve).catch(reject);
+ return;
+ } else {
+ replay(opts, function (err, res) {
+ if (err) { reject(err); }
+ else { resolve(res); }
+ });
+ return;
+ }
+ }, 2500);
+ });
+ return;
+ });
+ if (cb) {
+ p.then(function () { cb(null); }).catch(function (err) { cb(err); });
+ }
+ return p;
+ };
+ };
+ RC.request = function request(opts, fn) {
+ if (!opts) { opts = {}; }
+ var service = opts.service || 'config';
+ /*
+ var args = opts.data;
+ if (args && 'control' === service) {
+ args = packConfig(args);
+ }
+ var json = JSON.stringify(opts.data);
+ */
+ var url = '/rpc/' + service;
+ /*
+ if (json) {
+ url += ('?_body=' + encodeURIComponent(json));
+ }
+ */
+ var method = opts.method || (opts.data && 'POST') || 'GET';
+ var reqOpts = {
+ method: method
+ , path: url
+ };
+ reqOpts = RC.port(reqOpts);
+ var req = http.request(reqOpts, function (resp) {
+ makeResponder(service, resp, fn);
+ });
+
+ var errHandler = RC.createRelauncher(RC.request, opts, fn);
+ req.on('error', errHandler);
+
+ // Simple GET
+ if ('POST' !== method || !opts.data) {
+ return keypairs.signJwt({
+ jwk: state.key
+ , claims: { iss: false, exp: Math.round(Date.now()/1000) + (15 * 60) }
+ //TODO , exp: '15m'
+ }).then(function (jwt) {
+ req.setHeader("Authorization", 'Bearer ' + jwt);
+ req.end();
+ });
+ }
+
+ return keypairs.signJws({
+ jwk: state.key
+ , protected: {
+ // alg will be filled out automatically
+ jwk: state.pub
+ , kid: false
+ , nonce: require('crypto').randomBytes(16).toString('hex') // TODO get from server
+ // TODO make localhost exceptional
+ , url: RC.resolve(reqOpts.path)
+ }
+ , payload: JSON.stringify(opts.data)
+ }).then(function (jws) {
+ req.setHeader("Content-Type", 'application/jose+json');
+ req.write(JSON.stringify(jws));
+ req.end();
+ });
+ };
+ return RC;
+};
diff --git a/lib/ssh.js b/lib/ssh.js
new file mode 100644
index 0000000..8d761ab
--- /dev/null
+++ b/lib/ssh.js
@@ -0,0 +1,76 @@
+'use strict';
+
+/*global Promise*/
+var PromiseA = Promise;
+var crypto = require('crypto');
+var util = require('util');
+var readFile = util.promisify(require('fs').readFile);
+var exec = require('child_process').exec;
+
+function sshAllowsPassword(user) {
+ // SSH on Windows is a thing now (beta 2015, standard 2018)
+ // https://stackoverflow.com/questions/313111/is-there-a-dev-null-on-windows
+ var nullfile = '/dev/null';
+ if (/^win/i.test(process.platform)) {
+ nullfile = 'NUL';
+ }
+ var args = [
+ 'ssh', '-v', '-n'
+ , '-o', 'Batchmode=yes'
+ , '-o', 'StrictHostKeyChecking=no'
+ , '-o', 'UserKnownHostsFile=' + nullfile
+ , user + '@localhost'
+ , '| true'
+ ];
+ return new PromiseA(function (resolve) {
+ // not using promisify because all 3 arguments convey information
+ exec(args.join(' '), function (err, stdout, stderr) {
+ stdout = (stdout||'').toString('utf8');
+ stderr = (stderr||'').toString('utf8');
+ if (/\bpassword\b/.test(stdout) || /\bpassword\b/.test(stderr)) {
+ resolve('yes');
+ return;
+ }
+ if (/\bAuthentications\b/.test(stdout) || /\bAuthentications\b/.test(stderr)) {
+ resolve('no');
+ return;
+ }
+ resolve('maybe');
+ });
+ });
+}
+
+module.exports.checkSecurity = function () {
+ var conf = {};
+ var noRootPasswordRe = /(?:^|[\r\n]+)\s*PermitRootLogin\s+(prohibit-password|without-password|no)\s*/i;
+ var noPasswordRe = /(?:^|[\r\n]+)\s*PasswordAuthentication\s+(no)\s*/i;
+ var sshdConf = '/etc/ssh/sshd_config';
+ if (/^win/i.test(process.platform)) {
+ // TODO use %PROGRAMDATA%\ssh\sshd_config
+ sshdConf = 'C:\\ProgramData\\ssh\\sshd_config';
+ }
+ return readFile(sshdConf, null).then(function (sshd) {
+ sshd = sshd.toString('utf8');
+ var match;
+ match = sshd.match(noRootPasswordRe);
+ conf.permit_root_login = match ? match[1] : 'yes';
+ match = sshd.match(noPasswordRe);
+ conf.password_authentication = match ? match[1] : 'yes';
+ }).catch(function () {
+ // ignore error as that might not be the correct sshd_config location
+ }).then(function () {
+ var doesntExist = crypto.randomBytes(16).toString('hex');
+ return sshAllowsPassword(doesntExist).then(function (maybe) {
+ conf.requests_password = maybe;
+ });
+ }).then(function () {
+ return conf;
+ });
+};
+
+if (require.main === module) {
+ module.exports.checkSecurity().then(function (conf) {
+ console.log(conf);
+ return conf;
+ });
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..4d43f49
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1147 @@
+{
+ "name": "telebit",
+ "version": "0.21.0-wip.1",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@coolaj86/urequest": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/@coolaj86/urequest/-/urequest-1.3.6.tgz",
+ "integrity": "sha512-9rBXLFSb5D19opGeXdD/WuiFJsA4Pk2r8VUGEAeUZUxB1a2zB47K85BKAx3Gy9i4nZwg22ejlJA+q9DVrpQlbA=="
+ },
+ "@root/request": {
+ "version": "1.3.10",
+ "resolved": "https://registry.npmjs.org/@root/request/-/request-1.3.10.tgz",
+ "integrity": "sha512-GSn8dfsGp0juJyXS9k7B/DjYm7Axe85wiCHfPs30eQ+/V6p2aqey45e1czb3ZwP+iPmzWCKXahhWnZhSDIil6w=="
+ },
+ "accepts": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
+ "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
+ "requires": {
+ "mime-types": "~2.1.18",
+ "negotiator": "0.6.1"
+ }
+ },
+ "acme": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/acme/-/acme-1.2.0.tgz",
+ "integrity": "sha512-lG9Wq0Ol2OLpVrusq5OQ+KCT06rXaGjbHcDhKtNO6Hr3J3swISaCYi0slwLpEA9DGV+QhDkAnZ6qsXAo86SM5Q==",
+ "requires": {
+ "acme-v2": "^1.3.1"
+ }
+ },
+ "acme-v2": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/acme-v2/-/acme-v2-1.5.2.tgz",
+ "integrity": "sha512-Ux0cFCxHeaGGeGyPGMLHBLIGF05OYaxuh4TvaVzwkVVRib/gPpioa50CGj2pnQimH/MRkg0VtWCEdfE45MV/0g==",
+ "requires": {
+ "@coolaj86/urequest": "^1.3.6",
+ "rsa-compat": "^1.9.2"
+ }
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "optional": true
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "optional": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
+ "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
+ "optional": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "async-limiter": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
+ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
+ },
+ "batch": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
+ "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY="
+ },
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "bl": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
+ "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==",
+ "optional": true,
+ "requires": {
+ "readable-stream": "^2.3.5",
+ "safe-buffer": "^5.1.1"
+ }
+ },
+ "bluebird": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
+ "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
+ },
+ "buffer-alloc": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
+ "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
+ "requires": {
+ "buffer-alloc-unsafe": "^1.1.0",
+ "buffer-fill": "^1.0.0"
+ }
+ },
+ "buffer-alloc-unsafe": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
+ "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="
+ },
+ "buffer-fill": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
+ "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
+ },
+ "buffer-from": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",
+ "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ=="
+ },
+ "cert-info": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/cert-info/-/cert-info-1.5.0.tgz",
+ "integrity": "sha512-3fE0DDJJ7FWwMsUqLqBd+FY5LQACK24R1p129BTCYMEe00Nql2Q9Dkr6TEBlZ8XJnNaSbjzf3qBLjLrD8KLutw=="
+ },
+ "chownr": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz",
+ "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
+ "optional": true
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "optional": true
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
+ "optional": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+ },
+ "csv-parser": {
+ "version": "1.12.1",
+ "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-1.12.1.tgz",
+ "integrity": "sha512-r45M92nLnGP246ot0Yo5RvbiiMF5Bw/OTIdWJ3OQ4Vbv4hpOeoXVIPxdSmUw+fPJlQOseY+iigJyLSfPMIrddQ==",
+ "requires": {
+ "buffer-alloc": "^1.1.0",
+ "buffer-from": "^1.0.0",
+ "generate-function": "^1.0.1",
+ "generate-object-property": "^1.0.0",
+ "inherits": "^2.0.1",
+ "minimist": "^1.2.0",
+ "ndjson": "^1.4.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
+ }
+ }
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "decompress-response": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
+ "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
+ "optional": true,
+ "requires": {
+ "mimic-response": "^1.0.0"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "optional": true
+ },
+ "delegates": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
+ "optional": true
+ },
+ "depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
+ },
+ "destroy": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
+ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
+ },
+ "detect-libc": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
+ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
+ "optional": true
+ },
+ "eckles": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/eckles/-/eckles-1.4.1.tgz",
+ "integrity": "sha512-auWyk/k8oSkVHaD4RxkPadKsLUcIwKgr/h8F7UZEueFDBO7BsE4y+H6IMUDbfqKIFPg/9MxV6KcBdJCmVVcxSA=="
+ },
+ "ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
+ },
+ "encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
+ },
+ "end-of-stream": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
+ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
+ "optional": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+ },
+ "etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
+ },
+ "expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "optional": true
+ },
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "optional": true
+ },
+ "finalhandler": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
+ "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
+ "requires": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.2",
+ "statuses": "~1.4.0",
+ "unpipe": "~1.0.0"
+ }
+ },
+ "fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
+ },
+ "from2": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
+ "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=",
+ "requires": {
+ "inherits": "^2.0.1",
+ "readable-stream": "^2.0.0"
+ }
+ },
+ "fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "optional": true
+ },
+ "gauge": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
+ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
+ "optional": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ }
+ },
+ "generate-function": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-1.1.0.tgz",
+ "integrity": "sha1-VMIbCAGSsW2Yd3ecW7gWZudyNl8="
+ },
+ "generate-object-property": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
+ "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
+ "requires": {
+ "is-property": "^1.0.0"
+ }
+ },
+ "get-stream": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
+ "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=",
+ "requires": {
+ "object-assign": "^4.0.1",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=",
+ "optional": true
+ },
+ "greenlock": {
+ "version": "2.6.7",
+ "resolved": "https://registry.npmjs.org/greenlock/-/greenlock-2.6.7.tgz",
+ "integrity": "sha512-cN8PU0tbpTyd0JiNhP78n6ZUYWhQs9fh4cuLjusKt0TjX0limP/u26wYGNK1cbgb9NsOeiox/wRhpGPh6EBocg==",
+ "requires": {
+ "acme": "^1.2.0",
+ "acme-v2": "^1.5.0",
+ "cert-info": "^1.5.0",
+ "le-challenge-fs": "^2.0.2",
+ "le-sni-auto": "^2.1.3",
+ "le-store-certbot": "^2.1.7",
+ "rsa-compat": "^1.9.2"
+ }
+ },
+ "has-unicode": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+ "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
+ "optional": true
+ },
+ "http-errors": {
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
+ "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.0",
+ "statuses": ">= 1.4.0 < 2"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+ },
+ "ini": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
+ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "optional": true
+ },
+ "into-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-2.0.1.tgz",
+ "integrity": "sha1-25sANpRFPq4JHYpchMwRUHt4HTE=",
+ "requires": {
+ "from2": "^2.1.1"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "optional": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "is-property": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
+ "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ="
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ },
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
+ },
+ "keyfetch": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/keyfetch/-/keyfetch-1.1.8.tgz",
+ "integrity": "sha512-a8E1E25mHiv2zZnrBM6WNfQi4hG43TgVg1JG/D61WiTBAM07OJzSuy3j00H2pWPF6MCofBmA+KTzSu145nZWuA==",
+ "requires": {
+ "@coolaj86/urequest": "^1.3.6",
+ "eckles": "^1.4.0",
+ "rasha": "^1.2.1"
+ }
+ },
+ "keypairs": {
+ "version": "1.2.14",
+ "resolved": "https://registry.npmjs.org/keypairs/-/keypairs-1.2.14.tgz",
+ "integrity": "sha512-ZoZfZMygyB0QcjSlz7Rh6wT2CJasYEHBPETtmHZEfxuJd7bnsOG5AdtPZqHZBT+hoHvuWCp/4y8VmvTvH0Y9uA==",
+ "requires": {
+ "eckles": "^1.4.1",
+ "rasha": "^1.2.4"
+ }
+ },
+ "keytar": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/keytar/-/keytar-4.6.0.tgz",
+ "integrity": "sha512-8wWWTC62QHvUvgW/QYyJv7X0GFZfp2Ykr5n3PuXKADro0Sv2RKvuYxbkzoZvsw33EDNAKnUTSA0/KLGN/MbwDw==",
+ "optional": true,
+ "requires": {
+ "nan": "2.13.2",
+ "prebuild-install": "5.3.0"
+ },
+ "dependencies": {
+ "nan": {
+ "version": "2.13.2",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz",
+ "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==",
+ "optional": true
+ }
+ }
+ },
+ "le-challenge-fs": {
+ "version": "2.0.8",
+ "resolved": "https://registry.npmjs.org/le-challenge-fs/-/le-challenge-fs-2.0.8.tgz",
+ "integrity": "sha1-ttRYo38JfoffPYtf9nATc3q51aI=",
+ "requires": {
+ "mkdirp": "^0.5.1"
+ }
+ },
+ "le-sni-auto": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/le-sni-auto/-/le-sni-auto-2.1.6.tgz",
+ "integrity": "sha512-LcfkF2yQ1nrep+ZfyG+SfR3pHphKFD3zMZ9FKervGfTfvgScCv/XGbX+vxsGZEKZjvzxKbFZ/5LdSCXuLXUU6A==",
+ "requires": {
+ "bluebird": "^3.5.1"
+ }
+ },
+ "le-store-certbot": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/le-store-certbot/-/le-store-certbot-2.2.1.tgz",
+ "integrity": "sha512-BhljZjTULhbNBAT6RBiv4TeZegFraMxURYEvh3WRUI048zmXf4ZfC8gwbdu5fnD2tTCsS9fbsCOAQyrFBl4jlA==",
+ "requires": {
+ "mkdirp": "^0.5.1",
+ "pyconf": "^1.1.5",
+ "safe-replace": "^1.0.3"
+ }
+ },
+ "mime": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
+ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
+ },
+ "mime-db": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
+ "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
+ },
+ "mime-types": {
+ "version": "2.1.18",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
+ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
+ "requires": {
+ "mime-db": "~1.33.0"
+ }
+ },
+ "mimic-response": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
+ "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
+ "optional": true
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+ },
+ "nan": {
+ "version": "2.12.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz",
+ "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==",
+ "optional": true
+ },
+ "napi-build-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.1.tgz",
+ "integrity": "sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==",
+ "optional": true
+ },
+ "ndjson": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-1.5.0.tgz",
+ "integrity": "sha1-rmA7NrE0vOw0e0UkIrC/mNWDLsg=",
+ "requires": {
+ "json-stringify-safe": "^5.0.1",
+ "minimist": "^1.2.0",
+ "split2": "^2.1.0",
+ "through2": "^2.0.3"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
+ }
+ }
+ },
+ "neat-csv": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/neat-csv/-/neat-csv-2.1.0.tgz",
+ "integrity": "sha1-BvWDYMTDuVW9Rn3cha5FEaOQekw=",
+ "requires": {
+ "csv-parser": "^1.6.0",
+ "get-stream": "^2.1.0",
+ "into-stream": "^2.0.0"
+ }
+ },
+ "negotiator": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
+ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
+ },
+ "node-abi": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.8.0.tgz",
+ "integrity": "sha512-1/aa2clS0pue0HjckL62CsbhWWU35HARvBDXcJtYKbYR7LnIutmpxmXbuDMV9kEviD2lP/wACOgWmmwljghHyQ==",
+ "optional": true,
+ "requires": {
+ "semver": "^5.4.1"
+ }
+ },
+ "node-forge": {
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz",
+ "integrity": "sha512-sol30LUpz1jQFBjOKwbjxijiE3b6pjd74YwfD0fJOKPjF+fONKb2Yg8rYgS6+bK6VDl+/wfr4IYpC7jDzLUIfw==",
+ "optional": true
+ },
+ "noop-logger": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz",
+ "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=",
+ "optional": true
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
+ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
+ "optional": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "optional": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
+ "requires": {
+ "ee-first": "1.1.1"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "optional": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
+ "optional": true
+ },
+ "parseurl": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
+ "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "prebuild-install": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.0.tgz",
+ "integrity": "sha512-aaLVANlj4HgZweKttFNUVNRxDukytuIuxeK2boIMHjagNJCiVKWFsKF4tCE3ql3GbrD2tExPQ7/pwtEJcHNZeg==",
+ "optional": true,
+ "requires": {
+ "detect-libc": "^1.0.3",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.0",
+ "mkdirp": "^0.5.1",
+ "napi-build-utils": "^1.0.1",
+ "node-abi": "^2.7.0",
+ "noop-logger": "^0.1.1",
+ "npmlog": "^4.0.1",
+ "os-homedir": "^1.0.1",
+ "pump": "^2.0.1",
+ "rc": "^1.2.7",
+ "simple-get": "^2.7.0",
+ "tar-fs": "^1.13.0",
+ "tunnel-agent": "^0.6.0",
+ "which-pm-runs": "^1.0.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "optional": true
+ }
+ }
+ },
+ "process-nextick-args": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
+ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
+ },
+ "proxy-packer": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/proxy-packer/-/proxy-packer-2.0.2.tgz",
+ "integrity": "sha512-EQxdOMAYc8zINq9MsV7Vm55hjuNo4eC9z6GlqizCkeE5HldvnOCjsYJnwul+feey6RAJzp34klkD+9+0h2sXLQ=="
+ },
+ "ps-list": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ps-list/-/ps-list-5.0.0.tgz",
+ "integrity": "sha512-EnMjo990nDlzBVoV/m2Vo2+Ja3sO1Ikgo3TcLF2KI1DVW3SYEt8zouS40X4Z/tfULam5R3ig8a/rhmvE3mRq5w==",
+ "requires": {
+ "pify": "^3.0.0",
+ "tasklist": "^3.1.0"
+ }
+ },
+ "pump": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
+ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
+ "optional": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "pyconf": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/pyconf/-/pyconf-1.1.6.tgz",
+ "integrity": "sha512-4ujjwqch6nViWduSLc3/QFrDdJJAvAE7NRBarSGLANwh0tNW0MbXeJE8ZziJZvzRnUEN5scYwsS+ItYU1uj6dQ==",
+ "requires": {
+ "safe-replace": "^1.0.2"
+ }
+ },
+ "range-parser": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
+ "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
+ },
+ "rasha": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/rasha/-/rasha-1.2.4.tgz",
+ "integrity": "sha512-GsIwKv+hYSumJyK9wkTDaERLwvWaGYh1WuI7JMTBISfYt13TkKFU/HFzlY4n72p8VfXZRUYm0AqaYhkZVxOC3Q=="
+ },
+ "rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "optional": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "optional": true
+ }
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "recase": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/recase/-/recase-1.0.4.tgz",
+ "integrity": "sha1-asoF8GFV5u0bY2LmIQUKEdvZ+FE="
+ },
+ "redirect-https": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/redirect-https/-/redirect-https-1.1.5.tgz",
+ "integrity": "sha512-40okBDSPOoK3E8ttlKxG60vBJMmxT+UPS43zrIkWo6QlNrRgvj/jY/trvATXpCN4XpuySdYsQnXxgfB8QBsBHg==",
+ "requires": {
+ "escape-html": "^1.0.3"
+ }
+ },
+ "rsa-compat": {
+ "version": "1.9.2",
+ "resolved": "https://registry.npmjs.org/rsa-compat/-/rsa-compat-1.9.2.tgz",
+ "integrity": "sha512-XY4I/74W+QENMd99zVsyHQcxYxWTXd0EihVXsI4oeb1bz7DYxEKasQrjyzYPnR1tZT7fTPu5HP/vTKfs9lzdGA==",
+ "requires": {
+ "node-forge": "^0.7.6",
+ "ursa-optional": "^0.9.10"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safe-replace": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/safe-replace/-/safe-replace-1.1.0.tgz",
+ "integrity": "sha512-9/V2E0CDsKs9DWOOwJH7jYpSl9S3N05uyevNjvsnDauBqRowBPOyot1fIvV5N2IuZAbYyvrTXrYFVG0RZInfFw=="
+ },
+ "sclient": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/sclient/-/sclient-1.4.1.tgz",
+ "integrity": "sha512-IsSIlWg9MjqknF3YtT6+ewCszAUeZfwLu2bNLSzbqoduc6t73K+zs/L2L5wmmgDL6BapBxqgwqBBchhizxS0JA=="
+ },
+ "sec": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/sec/-/sec-1.0.0.tgz",
+ "integrity": "sha1-Az1go60g7PLgCUDRT5eCNGV3QzU="
+ },
+ "semver": {
+ "version": "5.7.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
+ "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
+ "optional": true
+ },
+ "send": {
+ "version": "0.16.2",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
+ "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
+ "requires": {
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "destroy": "~1.0.4",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "~1.6.2",
+ "mime": "1.4.1",
+ "ms": "2.0.0",
+ "on-finished": "~2.3.0",
+ "range-parser": "~1.2.0",
+ "statuses": "~1.4.0"
+ }
+ },
+ "serve-index": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
+ "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=",
+ "requires": {
+ "accepts": "~1.3.4",
+ "batch": "0.6.1",
+ "debug": "2.6.9",
+ "escape-html": "~1.0.3",
+ "http-errors": "~1.6.2",
+ "mime-types": "~2.1.17",
+ "parseurl": "~1.3.2"
+ }
+ },
+ "serve-static": {
+ "version": "1.13.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
+ "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
+ "requires": {
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.2",
+ "send": "0.16.2"
+ }
+ },
+ "serve-tpl-attachment": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/serve-tpl-attachment/-/serve-tpl-attachment-1.0.4.tgz",
+ "integrity": "sha512-lv0t/G/x/Ikk780y+RChulnp42Q3xWStmgU4Yz2HXzO2uE+vJXfG7ntAzffgpuJSY29/arbAaqfEuI/NI5hNnA==",
+ "requires": {
+ "accepts": "^1.3.5",
+ "batch": "^0.6.1",
+ "mime-types": "^2.1.19"
+ },
+ "dependencies": {
+ "mime-db": {
+ "version": "1.35.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz",
+ "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg=="
+ },
+ "mime-types": {
+ "version": "2.1.19",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz",
+ "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==",
+ "requires": {
+ "mime-db": "~1.35.0"
+ }
+ }
+ }
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "optional": true
+ },
+ "setprototypeof": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "optional": true
+ },
+ "simple-concat": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz",
+ "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=",
+ "optional": true
+ },
+ "simple-get": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz",
+ "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==",
+ "optional": true,
+ "requires": {
+ "decompress-response": "^3.3.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
+ "sni": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/sni/-/sni-1.0.0.tgz",
+ "integrity": "sha1-b6Qr35d23i43zsYBIua+yD3wBvU="
+ },
+ "socket-pair": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/socket-pair/-/socket-pair-1.0.4.tgz",
+ "integrity": "sha512-OEjlBOVBZpGBDvcjyYwFLZLGwNc8yMewKMirtoaR1WnX/XI2jo8ylsCEH4C6eXmcj5blQisECacN7yc3xlrwAA==",
+ "requires": {
+ "bluebird": "^3.5.1"
+ }
+ },
+ "split2": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz",
+ "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==",
+ "requires": {
+ "through2": "^2.0.2"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ },
+ "statuses": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
+ "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "optional": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "optional": true
+ },
+ "tar-fs": {
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz",
+ "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==",
+ "optional": true,
+ "requires": {
+ "chownr": "^1.0.1",
+ "mkdirp": "^0.5.1",
+ "pump": "^1.0.0",
+ "tar-stream": "^1.1.2"
+ },
+ "dependencies": {
+ "pump": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz",
+ "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==",
+ "optional": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ }
+ }
+ },
+ "tar-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
+ "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
+ "optional": true,
+ "requires": {
+ "bl": "^1.0.0",
+ "buffer-alloc": "^1.2.0",
+ "end-of-stream": "^1.0.0",
+ "fs-constants": "^1.0.0",
+ "readable-stream": "^2.3.0",
+ "to-buffer": "^1.1.1",
+ "xtend": "^4.0.0"
+ }
+ },
+ "tasklist": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/tasklist/-/tasklist-3.1.0.tgz",
+ "integrity": "sha1-hzqYpORcvez6LC7hiGU1MFfmNpY=",
+ "requires": {
+ "neat-csv": "^2.1.0",
+ "pify": "^2.2.0",
+ "sec": "^1.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
+ }
+ }
+ },
+ "through2": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
+ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
+ "requires": {
+ "readable-stream": "^2.1.5",
+ "xtend": "~4.0.1"
+ }
+ },
+ "to-buffer": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
+ "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==",
+ "optional": true
+ },
+ "toml": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/toml/-/toml-0.4.1.tgz",
+ "integrity": "sha1-Iv5QHFe+WpV9o4JcHd5YS7LmL3M="
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "optional": true,
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
+ },
+ "ursa-optional": {
+ "version": "0.9.10",
+ "resolved": "https://registry.npmjs.org/ursa-optional/-/ursa-optional-0.9.10.tgz",
+ "integrity": "sha512-RvEbhnxlggX4MXon7KQulTFiJQtLJZpSb9ZSa7ZTkOW0AzqiVTaLjI4vxaSzJBDH9dwZ3ltZadFiBaZslp6haA==",
+ "optional": true,
+ "requires": {
+ "bindings": "^1.3.0",
+ "nan": "^2.11.1"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "which-pm-runs": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz",
+ "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=",
+ "optional": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
+ "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
+ "optional": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "optional": true
+ },
+ "ws": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-6.0.0.tgz",
+ "integrity": "sha512-c2UlYcAZp1VS8AORtpq6y4RJIkJ9dQz18W32SpR/qXGfLDZ2jU4y4wKvvZwqbi7U6gxFQTeE+urMbXU/tsDy4w==",
+ "requires": {
+ "async-limiter": "~1.0.0"
+ }
+ },
+ "xtend": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
+ }
+ }
+}
diff --git a/package.json b/package.json
index 5457a41..b0d7402 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
{
"name": "telebit",
- "version": "0.20.8",
+ "version": "0.21.0-wip.1",
"description": "Break out of localhost. Connect to any device from anywhere over any tcp port or securely in a browser. A secure tunnel. A poor man's reverse VPN.",
- "main": "lib/remote.js",
+ "main": "lib/daemon/index.js",
"files": [
"bin",
"lib",
@@ -53,11 +53,12 @@
},
"homepage": "https://git.coolaj86.com/coolaj86/telebit.js#readme",
"dependencies": {
- "@coolaj86/urequest": "^1.3.5",
+ "@root/request": "^1.3.10",
"finalhandler": "^1.1.1",
- "greenlock": "^2.3.1",
- "js-yaml": "^3.11.0",
- "jsonwebtoken": "^7.1.9",
+ "greenlock": "^2.6.7",
+ "js-yaml": "^3.13.1",
+ "keyfetch": "^1.1.8",
+ "keypairs": "^1.2.14",
"mkdirp": "^0.5.1",
"proxy-packer": "^2.0.2",
"ps-list": "^5.0.0",
@@ -72,6 +73,9 @@
"toml": "^0.4.1",
"ws": "^6.0.0"
},
+ "optionalDependencies": {
+ "keytar": "^4.6.0"
+ },
"trulyOptionalDependencies": {
"bluebird": "^3.5.1"
},
diff --git a/tests/pair-request.js b/tests/pair-request.js
index 4f1dba6..61cd87e 100644
--- a/tests/pair-request.js
+++ b/tests/pair-request.js
@@ -5,7 +5,7 @@ var pin = Math.round(Math.random() * 999999).toString().padStart(6, '0'); // '32
console.log('Pair Code:', pin);
-var urequest = require('@coolaj86/urequest');
+var urequest = require('@root/request');
var req = {
url: 'https://api.telebit.ppl.family/api/telebit.cloud/pair_request'
, method: 'POST'
diff --git a/tests/pair-state.js b/tests/pair-state.js
index 53752c1..5dde7d4 100644
--- a/tests/pair-state.js
+++ b/tests/pair-state.js
@@ -2,7 +2,7 @@
var stateUrl = 'https://api.telebit.ppl.family/api/telebit.cloud/pair_state/bca27428719e9c67805359f1';
-var urequest = require('@coolaj86/urequest');
+var urequest = require('@root/request');
var req = {
url: stateUrl
, method: 'GET'
diff --git a/usr/share/install-launcher.js b/usr/share/install-launcher.js
index 8e04fad..a837844 100644
--- a/usr/share/install-launcher.js
+++ b/usr/share/install-launcher.js
@@ -11,7 +11,7 @@ Launcher._killAll = function (fn) {
var psList = require('ps-list');
psList().then(function (procs) {
procs.forEach(function (proc) {
- if ('node' === proc.name && /\btelebitd\b/i.test(proc.cmd)) {
+ if ('node' === proc.name && /\btelebit(d| daemon)\b/i.test(proc.cmd)) {
console.log(proc);
process.kill(proc.pid);
return true;
@@ -45,37 +45,7 @@ Launcher._detect = function (things, fn) {
}
}
- // could have used "command-exists" but I'm trying to stay low-dependency
- // os.platform(), os.type()
- if (!/^win/i.test(os.platform())) {
- if (/^darwin/i.test(os.platform())) {
- exec('command -v launchctl', things._execOpts, function (err, stdout, stderr) {
- err = Launcher._getError(err, stderr);
- fn(err, 'launchctl');
- });
- } else {
- exec('command -v systemctl', things._execOpts, function (err, stdout, stderr) {
- err = Launcher._getError(err, stderr);
- fn(err, 'systemctl');
- });
- }
- } else {
- // https://stackoverflow.com/questions/17908789/how-to-add-an-item-to-registry-to-run-at-startup-without-uac
- // wininit? regedit? SCM?
- // REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "My App" /t REG_SZ /F /D "C:\MyAppPath\MyApp.exe"
- // https://www.microsoft.com/developerblog/2015/11/09/reading-and-writing-to-the-windows-registry-in-process-from-node-js/
- // https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/reg-add
- // https://social.msdn.microsoft.com/Forums/en-US/5b318f44-281e-4098-8dee-3ba8435fa391/add-registry-key-for-autostart-of-app-in-ice?forum=quebectools
- // utils.elevate
- // https://github.com/CatalystCode/windows-registry-node
- exec('where reg.exe', things._execOpts, function (err, stdout, stderr) {
- //console.log((stdout||'').trim());
- if (stderr) {
- console.error(stderr);
- }
- fn(err, 'reg.exe');
- });
- }
+ require('./which.js').launcher(things._execOpts, fn);
};
Launcher.install = function (things, fn) {
if (!fn) { fn = function (err) { if (err) { console.error(err); } }; }
diff --git a/usr/share/which.js b/usr/share/which.js
new file mode 100644
index 0000000..dc23027
--- /dev/null
+++ b/usr/share/which.js
@@ -0,0 +1,63 @@
+'use strict';
+
+var os = require('os');
+var exec = require('child_process').exec;
+
+var which = module.exports;
+
+which._getError = function getError(err, stderr) {
+ if (err) { return err; }
+ if (stderr) {
+ err = new Error(stderr);
+ err.code = 'EWHICH';
+ return err;
+ }
+};
+
+module.exports.which = function (cmd, execOpts, fn) {
+ return module.exports._which({
+ mac: cmd
+ , linux: cmd
+ , win: cmd
+ }, execOpts, fn);
+};
+module.exports.launcher = function (execOpts, fn) {
+ return module.exports._which({
+ mac: 'launchctl'
+ , linux: 'systemctl'
+ , win: 'reg.exe'
+ }, execOpts, fn);
+};
+module.exports._which = function (progs, execOpts, fn) {
+ // could have used "command-exists" but I'm trying to stay low-dependency
+ // os.platform(), os.type()
+ if (!/^win/i.test(os.platform())) {
+ if (/^darwin/i.test(os.platform())) {
+ exec('command -v ' + progs.mac, execOpts, function (err, stdout, stderr) {
+ err = which._getError(err, stderr);
+ fn(err, progs.mac);
+ });
+ } else {
+ exec('command -v ' + progs.linux, execOpts, function (err, stdout, stderr) {
+ err = which._getError(err, stderr);
+ fn(err, progs.linux);
+ });
+ }
+ } else {
+ // https://stackoverflow.com/questions/17908789/how-to-add-an-item-to-registry-to-run-at-startup-without-uac
+ // wininit? regedit? SCM?
+ // REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "My App" /t REG_SZ /F /D "C:\MyAppPath\MyApp.exe"
+ // https://www.microsoft.com/developerblog/2015/11/09/reading-and-writing-to-the-windows-registry-in-process-from-node-js/
+ // https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/reg-add
+ // https://social.msdn.microsoft.com/Forums/en-US/5b318f44-281e-4098-8dee-3ba8435fa391/add-registry-key-for-autostart-of-app-in-ice?forum=quebectools
+ // utils.elevate
+ // https://github.com/CatalystCode/windows-registry-node
+ exec('where ' + progs.win, execOpts, function (err, stdout, stderr) {
+ //console.log((stdout||'').trim());
+ if (stderr) {
+ console.error(stderr);
+ }
+ fn(err, progs.win);
+ });
+ }
+};