PK!knitj/__init__.pyPK!YԞXX knitj/cell.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import hashlib import html from abc import ABCMeta, abstractmethod import asyncio import re import jinja2 from misaka import Markdown, HtmlRenderer import pygments from pygments.formatters import HtmlFormatter from pygments.lexers import PythonLexer from .jupyter_messaging.content import MIME from typing import Dict, Optional, Set _md = Markdown( HtmlRenderer(), extensions='fenced-code math math-explicit tables quote'.split() ) class Hash: def __init__(self, value: str) -> None: self._value = value def __eq__(self, other: object) -> bool: if not isinstance(other, Hash): return NotImplemented return self._value == other._value def __hash__(self) -> int: return hash(self._value) def __str__(self) -> str: return self._value[:6] def __repr__(self) -> str: return f'Hash({repr(self._value)})' @property def value(self) -> str: return self._value @classmethod def from_string(cls, s: str) -> 'Hash': return cls(hashlib.sha1(s.encode()).hexdigest()) class BaseCell(metaclass=ABCMeta): def __init__(self) -> None: self._html: Optional[str] = None self.hashid: Hash @property def html(self) -> str: if self._html is None: self._html = self._to_html() return self._html @abstractmethod def _to_html(self) -> str: ... class TextCell(BaseCell): def __init__(self, content: str) -> None: super().__init__() self.content = content self.hashid = Hash.from_string(content) self.hashid._value += '-text' # TODO this is a hack def __repr__(self) -> str: return f'' def _to_html(self) -> str: return f'
{_md(self.content)}
' def __eq__(self, other: object) -> bool: if not isinstance(other, BaseCell): return NotImplemented return type(self) is type(other) and self.hashid == other.hashid class CodeCell(BaseCell): def __init__(self, code: str) -> None: super().__init__() m = re.match(r'#\s*::', code) if m: try: modeline, code = code[m.end() :].split('\n', 1) except ValueError: modeline, code = code, '' modeline = re.sub(r'[^a-z]', '', modeline) self.flags = set(modeline.split()) else: self.flags = set() self.code = code self.hashid = Hash.from_string(code) self.hashid._value += '-code' # TODO this is a hack self._output: Optional[Dict[MIME, str]] = None self._error: Optional[str] = None self._stream = '' self._done = asyncio.get_event_loop().create_future() self._flags: Set[str] = set() def __repr__(self) -> str: return ( f'' ) def __eq__(self, other: object) -> bool: if not isinstance(other, CodeCell): return NotImplemented return super().__eq__(other) and self.flags == other.flags def update_flags(self, other: 'CodeCell') -> bool: update = self.flags != other.flags if update: self.flags = other.flags.copy() self._html = None return update def append_stream(self, s: str) -> None: if s[0] == '\r': self._stream = '\n'.join(self._stream.split('\n')[:-1]) s = s[1:] self._stream += s self._html = None def set_output(self, output: Optional[Dict[MIME, str]]) -> None: self._output = output self._html = None def set_error(self, error: str) -> None: self._error = error self._html = None def reset(self) -> None: self._output = None self._error = None self._stream = '' self._html = None self._flags.discard('done') self._done = asyncio.get_event_loop().create_future() def set_done(self) -> None: self._flags.discard('evaluating') self._flags.add('done') self._html = None if not self.done(): self._done.set_result(None) def done(self) -> bool: return self._done.done() async def wait_for(self) -> None: await self._done def _to_html(self) -> str: code = pygments.highlight(self.code, PythonLexer(), HtmlFormatter()) if self._output is None: output = '' elif MIME.IMAGE_SVG_XML in self._output: m = re.search(r'' ) elif MIME.TEXT_HTML in self._output: output = self._output[MIME.TEXT_HTML] elif MIME.TEXT_PLAIN in self._output: output = '
' + html.escape(self._output[MIME.TEXT_PLAIN]) + '
' else: assert False if self._error: output = '
' + self._error + '
' + output if self._stream: output = '
' + html.escape(self._stream) + '
' + output content = f'
{code}
{output}
' classes = [self.hashid.value, 'code-cell'] classes.extend(self.flags) classes.extend(self._flags) return f'
{content}
' PK!0$]u u knitj/cli.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import sys import argparse import asyncio from pathlib import Path import logging import concurrent.futures from contextlib import contextmanager import webbrowser from typing import Optional, Iterator, IO from .server import KnitjServer from .convert import convert logging.basicConfig( style='{', format='[{asctime}.{msecs:03.0f}] {levelname}:{name}: {message}', datefmt='%H:%M:%S', ) log = logging.getLogger('knitj') log.setLevel(logging.INFO) def parse_cli() -> argparse.Namespace: parser = argparse.ArgumentParser() arg = parser.add_argument arg('source', type=Path, metavar='FILE', nargs='?', help='input file') arg('-s', '--server', action='store_true', help='run in server mode') arg('-f', '--format', help='input format') arg('-o', '--output', type=Path, metavar='FILE', help='output HTML file') arg('-k', '--kernel', help='Jupyter kernel to use') arg( '-b', '--browser', type=webbrowser.get, default=webbrowser.get(), help='browser to open', ) arg( '-n', '--no-browser', dest='browser', action='store_false', help='do not open a browser', ) args = parser.parse_args() if args.server and args.source is None: parser.error('argument -s/--server: requires input file') return args def main() -> None: args = parse_cli() log.info('Entered Knitj') fmt: Optional[str] = None if args.format: fmt = args.format elif args.source: if args.source.suffix == '.py': fmt = 'python' elif args.source.suffix == '.md': fmt = 'markdown' if not fmt: raise RuntimeError('Cannot determine input format') loop = asyncio.get_event_loop() # hack to catch exceptions from kernel channels that run in threads executor = concurrent.futures.ThreadPoolExecutor() loop.set_default_executor(executor) if args.server: assert args.source if args.output: output = args.output else: output = args.source.with_suffix('.html') app = KnitjServer(args.source, output, fmt, args.browser, args.kernel) loop.run_until_complete(app.start()) try: loop.run_forever() except KeyboardInterrupt: pass loop.run_until_complete(app.cleanup()) else: with maybe_input(args.source) as source, maybe_output(args.output) as output: loop.run_until_complete(convert(source, output, fmt, args.kernel)) executor.shutdown(wait=True) loop.close() log.info('Leaving Knitj') @contextmanager def maybe_input(path: Optional[Path]) -> Iterator[IO[str]]: if path: with path.open() as f: yield f else: yield sys.stdin @contextmanager def maybe_output(path: Optional[Path]) -> Iterator[IO[str]]: if path: with path.open('w') as f: yield f else: yield sys.stdout PK!:,,knitj/client/.eslintrc{ "parserOptions": { "ecmaVersion": 2016 }, "extends": [ "airbnb" ], "rules": { "no-console": 0, "no-mixed-operators": 0, "no-param-reassign": 0, "space-infix-ops": 0, "no-alert": 0, "no-prototype-builtins": 0, "comma-dangle": ["error", { "arrays": "always-multiline", "objects": "always-multiline", "imports": "always-multiline", "exports": "always-multiline", "functions": "ignore", }] } } PK!!&Sknitj/client/.gitignore/node_modules/ PK!&ddknitj/client/package-lock.json{ "requires": true, "lockfileVersion": 1, "dependencies": { "acorn": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz", "integrity": "sha512-cJrKCNcr2kv8dlDnbw+JPUGjHZzo4myaxOLmpOX8a+rgX94YeTcTMv/LFJUSByRpc+i4GgVnnhLxvMu/2Y+rqw==", "dev": true }, "acorn-jsx": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { "acorn": "^3.0.4" }, "dependencies": { "acorn": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", "dev": true } } }, "ajv": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "dev": true, "requires": { "co": "^4.6.0", "json-stable-stringify": "^1.0.1" } }, "ajv-keywords": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", "dev": true }, "ansi-escapes": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", "dev": true }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, "aria-query": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-0.3.0.tgz", "integrity": "sha1-y4qZhOKGJxHIPICt5bj1yg3itGc=", "dev": true, "requires": { "ast-types-flow": "0.0.7" } }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { "array-uniq": "^1.0.1" } }, "array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", "dev": true }, "array.prototype.find": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.0.4.tgz", "integrity": "sha1-VWpcU2LAhkgyPdrrnenRS8GGTJA=", "dev": true, "requires": { "define-properties": "^1.1.2", "es-abstract": "^1.7.0" } }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, "ast-types-flow": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", "dev": true }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { "chalk": "^1.1.3", "esutils": "^2.0.2", "js-tokens": "^3.0.2" } }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, "caller-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { "callsites": "^0.2.0" } }, "callsites": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "dev": true }, "chalk": { "version": "1.1.3", "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { "ansi-styles": "^2.2.1", "escape-string-regexp": "^1.0.2", "has-ansi": "^2.0.0", "strip-ansi": "^3.0.0", "supports-color": "^2.0.0" } }, "circular-json": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", "dev": true }, "cli-cursor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", "dev": true, "requires": { "restore-cursor": "^1.0.1" } }, "cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": 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=", "dev": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "concat-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": 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=", "dev": true }, "d": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { "es5-ext": "^0.10.9" } }, "damerau-levenshtein": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz", "integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=", "dev": true }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { "ms": "2.0.0" } }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "requires": { "object-keys": "^1.0.12" } }, "del": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true, "requires": { "globby": "^5.0.0", "is-path-cwd": "^1.0.0", "is-path-in-cwd": "^1.0.0", "object-assign": "^4.0.1", "pify": "^2.0.0", "pinkie-promise": "^2.0.0", "rimraf": "^2.2.8" } }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { "esutils": "^2.0.2" } }, "emoji-regex": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz", "integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==", "dev": true }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { "is-arrayish": "^0.2.1" } }, "es-abstract": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", "dev": true, "requires": { "es-to-primitive": "^1.1.1", "function-bind": "^1.1.1", "has": "^1.0.1", "is-callable": "^1.1.3", "is-regex": "^1.0.4" } }, "es-to-primitive": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { "is-callable": "^1.1.1", "is-date-object": "^1.0.1", "is-symbol": "^1.0.1" } }, "es5-ext": { "version": "0.10.46", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", "integrity": "sha512-24XxRvJXNFwEMpJb3nOkiRJKRoupmjYmOPVlI65Qy2SrtxwOTB+g6ODjBKOtwEHbYrhWRty9xxOWLNdClT2djw==", "dev": true, "requires": { "es6-iterator": "~2.0.3", "es6-symbol": "~3.1.1", "next-tick": "1" } }, "es6-iterator": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { "d": "1", "es5-ext": "^0.10.35", "es6-symbol": "^3.1.1" } }, "es6-map": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", "dev": true, "requires": { "d": "1", "es5-ext": "~0.10.14", "es6-iterator": "~2.0.1", "es6-set": "~0.1.5", "es6-symbol": "~3.1.1", "event-emitter": "~0.3.5" } }, "es6-set": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", "dev": true, "requires": { "d": "1", "es5-ext": "~0.10.14", "es6-iterator": "~2.0.1", "es6-symbol": "3.1.1", "event-emitter": "~0.3.5" } }, "es6-symbol": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { "d": "1", "es5-ext": "~0.10.14" } }, "es6-weak-map": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { "d": "1", "es5-ext": "^0.10.14", "es6-iterator": "^2.0.1", "es6-symbol": "^3.1.1" } }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, "escope": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", "dev": true, "requires": { "es6-map": "^0.1.3", "es6-weak-map": "^2.0.1", "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } }, "eslint": { "version": "3.19.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", "dev": true, "requires": { "babel-code-frame": "^6.16.0", "chalk": "^1.1.3", "concat-stream": "^1.5.2", "debug": "^2.1.1", "doctrine": "^2.0.0", "escope": "^3.6.0", "espree": "^3.4.0", "esquery": "^1.0.0", "estraverse": "^4.2.0", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "glob": "^7.0.3", "globals": "^9.14.0", "ignore": "^3.2.0", "imurmurhash": "^0.1.4", "inquirer": "^0.12.0", "is-my-json-valid": "^2.10.0", "is-resolvable": "^1.0.0", "js-yaml": "^3.5.1", "json-stable-stringify": "^1.0.0", "levn": "^0.3.0", "lodash": "^4.0.0", "mkdirp": "^0.5.0", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.1", "pluralize": "^1.2.1", "progress": "^1.1.8", "require-uncached": "^1.0.2", "shelljs": "^0.7.5", "strip-bom": "^3.0.0", "strip-json-comments": "~2.0.1", "table": "^3.7.8", "text-table": "~0.2.0", "user-home": "^2.0.0" } }, "eslint-config-airbnb": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-14.1.0.tgz", "integrity": "sha1-NV0pAEC7+OAL+LSxn0twy+fCMX8=", "dev": true, "requires": { "eslint-config-airbnb-base": "^11.1.0" } }, "eslint-config-airbnb-base": { "version": "11.3.2", "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.3.2.tgz", "integrity": "sha512-/fhjt/VqzBA2SRsx7ErDtv6Ayf+XLw9LIOqmpBuHFCVwyJo2EtzGWMB9fYRFBoWWQLxmNmCpenNiH0RxyeS41w==", "dev": true, "requires": { "eslint-restricted-globals": "^0.1.1" } }, "eslint-import-resolver-node": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", "dev": true, "requires": { "debug": "^2.6.9", "resolve": "^1.5.0" } }, "eslint-module-utils": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", "dev": true, "requires": { "debug": "^2.6.8", "pkg-dir": "^1.0.0" } }, "eslint-plugin-import": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", "dev": true, "requires": { "contains-path": "^0.1.0", "debug": "^2.6.8", "doctrine": "1.5.0", "eslint-import-resolver-node": "^0.3.1", "eslint-module-utils": "^2.2.0", "has": "^1.0.1", "lodash": "^4.17.4", "minimatch": "^3.0.3", "read-pkg-up": "^2.0.0", "resolve": "^1.6.0" }, "dependencies": { "doctrine": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { "esutils": "^2.0.2", "isarray": "^1.0.0" } } } }, "eslint-plugin-jsx-a11y": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-4.0.0.tgz", "integrity": "sha1-d5uw/nsI2lZKQiYkkR3hAGHgSO4=", "dev": true, "requires": { "aria-query": "^0.3.0", "ast-types-flow": "0.0.7", "damerau-levenshtein": "^1.0.0", "emoji-regex": "^6.1.0", "jsx-ast-utils": "^1.0.0", "object-assign": "^4.0.1" } }, "eslint-plugin-react": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", "integrity": "sha1-xUNb6wZ3ThLH2y9qut3L+QDNP3g=", "dev": true, "requires": { "array.prototype.find": "^2.0.1", "doctrine": "^1.2.2", "has": "^1.0.1", "jsx-ast-utils": "^1.3.4", "object.assign": "^4.0.4" }, "dependencies": { "doctrine": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { "esutils": "^2.0.2", "isarray": "^1.0.0" } } } }, "eslint-restricted-globals": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", "dev": true }, "espree": { "version": "3.5.4", "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", "dev": true, "requires": { "acorn": "^5.5.0", "acorn-jsx": "^3.0.0" } }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", "dev": true, "requires": { "estraverse": "^4.0.0" } }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { "estraverse": "^4.1.0" } }, "estraverse": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", "dev": true }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, "event-emitter": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { "d": "1", "es5-ext": "~0.10.14" } }, "exit-hook": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", "dev": true }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { "escape-string-regexp": "^1.0.5", "object-assign": "^4.1.0" } }, "file-entry-cache": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { "flat-cache": "^1.2.1", "object-assign": "^4.0.1" } }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" } }, "flat-cache": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { "circular-json": "^0.3.1", "del": "^2.0.2", "graceful-fs": "^4.1.2", "write": "^0.2.1" } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, "generate-function": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", "dev": true, "requires": { "is-property": "^1.0.2" } }, "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=", "dev": true, "requires": { "is-property": "^1.0.0" } }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true }, "globby": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { "array-union": "^1.0.1", "arrify": "^1.0.0", "glob": "^7.0.3", "object-assign": "^4.0.1", "pify": "^2.0.0", "pinkie-promise": "^2.0.0" } }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { "function-bind": "^1.1.1" } }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { "ansi-regex": "^2.0.0" } }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "dev": true }, "hosted-git-info": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, "ignore": { "version": "3.3.10", "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "inquirer": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", "dev": true, "requires": { "ansi-escapes": "^1.1.0", "ansi-regex": "^2.0.0", "chalk": "^1.0.0", "cli-cursor": "^1.0.1", "cli-width": "^2.0.0", "figures": "^1.3.5", "lodash": "^4.3.0", "readline2": "^1.0.1", "run-async": "^0.1.0", "rx-lite": "^3.1.2", "string-width": "^1.0.1", "strip-ansi": "^3.0.0", "through": "^2.3.6" } }, "interpret": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "is-builtin-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { "builtin-modules": "^1.0.0" } }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", "dev": true }, "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", "dev": true }, "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=", "dev": true, "requires": { "number-is-nan": "^1.0.0" } }, "is-my-ip-valid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", "dev": true }, "is-my-json-valid": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", "dev": true, "requires": { "generate-function": "^2.0.0", "generate-object-property": "^1.1.0", "is-my-ip-valid": "^1.0.0", "jsonpointer": "^4.0.0", "xtend": "^4.0.0" } }, "is-path-cwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", "dev": true }, "is-path-in-cwd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { "is-path-inside": "^1.0.0" } }, "is-path-inside": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { "path-is-inside": "^1.0.1" } }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", "dev": true }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { "has": "^1.0.1" } }, "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, "is-symbol": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", "dev": true }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, "js-yaml": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, "json-stable-stringify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { "jsonify": "~0.0.0" } }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true }, "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", "dev": true }, "jsx-ast-utils": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", "dev": true }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", "strip-bom": "^3.0.0" } }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true, "requires": { "p-locate": "^2.0.0", "path-exists": "^3.0.0" }, "dependencies": { "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true } } }, "lodash": { "version": "4.17.10", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "dev": true }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" } }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "mute-stream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", "dev": true }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, "next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { "hosted-git-info": "^2.1.4", "is-builtin-module": "^1.0.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "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=", "dev": true }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, "object-keys": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true }, "object.assign": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { "define-properties": "^1.1.2", "function-bind": "^1.1.1", "has-symbols": "^1.0.0", "object-keys": "^1.0.11" } }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" } }, "onetime": { "version": "1.1.0", "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, "optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.4", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "wordwrap": "~1.0.0" } }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", "dev": true, "requires": { "p-try": "^1.0.0" } }, "p-locate": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true, "requires": { "p-limit": "^1.1.0" } }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { "error-ex": "^1.2.0" } }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "path-is-inside": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, "path-type": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true, "requires": { "pify": "^2.0.0" } }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", "dev": true }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { "pinkie": "^2.0.0" } }, "pkg-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { "find-up": "^1.0.0" } }, "pluralize": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", "dev": true }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": 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==", "dev": true }, "progress": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", "dev": true, "requires": { "load-json-file": "^2.0.0", "normalize-package-data": "^2.3.2", "path-type": "^2.0.0" } }, "read-pkg-up": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true, "requires": { "find-up": "^2.0.0", "read-pkg": "^2.0.0" }, "dependencies": { "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true, "requires": { "locate-path": "^2.0.0" } } } }, "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==", "dev": true, "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" } }, "readline2": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", "mute-stream": "0.0.5" } }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { "resolve": "^1.1.6" } }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", "dev": true, "requires": { "caller-path": "^0.1.0", "resolve-from": "^1.0.0" } }, "resolve": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", "dev": true, "requires": { "path-parse": "^1.0.5" } }, "resolve-from": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", "dev": true }, "restore-cursor": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", "dev": true, "requires": { "exit-hook": "^1.0.0", "onetime": "^1.0.0" } }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { "glob": "^7.0.5" } }, "run-async": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", "dev": true, "requires": { "once": "^1.3.0" } }, "rx-lite": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", "dev": true }, "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==", "dev": true }, "semver": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", "dev": true }, "shelljs": { "version": "0.7.8", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", "dev": true, "requires": { "glob": "^7.0.0", "interpret": "^1.0.0", "rechoir": "^0.6.2" } }, "slice-ansi": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", "dev": true }, "spdx-correct": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", "dev": true }, "spdx-expression-parse": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", "dev": true }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": 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==", "dev": true, "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=", "dev": true, "requires": { "ansi-regex": "^2.0.0" } }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, "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=", "dev": true }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, "table": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", "dev": true, "requires": { "ajv": "^4.7.0", "ajv-keywords": "^1.0.0", "chalk": "^1.1.1", "lodash": "^4.0.0", "slice-ansi": "0.0.4", "string-width": "^2.0.0" }, "dependencies": { "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { "ansi-regex": "^3.0.0" } } } }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { "prelude-ls": "~1.1.2" } }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, "user-home": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", "dev": true, "requires": { "os-homedir": "^1.0.0" } }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "write": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "dev": true, "requires": { "mkdirp": "^0.5.1" } }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true } } } PK!JnRknitj/client/package.json{ "devDependencies": { "eslint": "^3.19.0", "eslint-config-airbnb": "^14.1.0", "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-react": "^6.10.3" } } PK!qkknitj/client/static/client.js// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. /* eslint-env browser */ /* global renderMath */ function h(tagName, func) { const el = document.createElement(tagName); func(el); return el; } function elemFromHtml(html) { const div = document.createElement('div'); div.innerHTML = html; const el = div.childNodes[0]; Array.from(el.getElementsByTagName('script')).forEach((scr) => { const parentEl = scr.parentElement; const scrNew = document.createElement('script'); scrNew.textContent = scr.textContent; parentEl.insertBefore(scrNew, scr); parentEl.removeChild(scr); }); return el; } const ws = new WebSocket(`ws://${document.location.host}/ws`); let askedForRestart = false; function send(msg) { ws.send(JSON.stringify(msg)); } window.setInterval(() => { send({ kind: 'ping' }); }, 50000); function reevaluate(hashid) { Array.from(document.getElementsByClassName(hashid)).forEach((cell) => { cell.classList.add('evaluating'); cell.getElementsByClassName('output')[0].innerHTML = ''; }); send({ kind: 'reevaluate', hashids: [hashid] }); } function reevaluateFromHere(hashid) { const arr = Array.from(document.getElementById('cells').children); const idx = arr.findIndex(cell => cell.classList[0] === hashid); const hashids = []; arr.slice(idx).forEach((cell) => { if (cell.classList.contains('code-cell')) { cell.classList.add('evaluating'); cell.getElementsByClassName('output')[0].innerHTML = ''; hashids.push(cell.classList[0]); } }); send({ kind: 'reevaluate', hashids }); } function appendReevaluate(cell) { cell.appendChild(h('button', (button) => { button.onclick = () => { reevaluate(cell.classList[0]); }; button.textContent = 'Evaluate'; })); cell.appendChild(h('button', (button) => { button.onclick = () => { reevaluateFromHere(cell.classList[0]); }; button.textContent = 'Evaluate all from here'; })); cell.appendChild(h('button', (button) => { button.onclick = () => { send({ kind: 'interrupt_kernel' }); }; button.textContent = 'Interrupt kernel'; })); } function ensureVisible(elem) { const rect = elem.getBoundingClientRect(); const height = window.innerHeight || document.documentElement.clientHeight; if (rect.top < 0 || rect.top > height-20) { elem.scrollIntoView(); } } ws.onmessage = ({ data }) => { const msg = JSON.parse(data); if (msg.kind === 'cell') { const cell = elemFromHtml(msg.html); const arr = Array.from(document.getElementsByClassName(msg.hashid)); if (arr.length === 1) { appendReevaluate(cell); arr[0].replaceWith(cell); ensureVisible(cell); } else { let cloned; arr.forEach((origCell) => { cloned = cell.cloneNode(true); appendReevaluate(cloned); origCell.replaceWith(cloned); }); ensureVisible(cloned); } } else if (msg.kind === 'document') { const cellsEl = h('div', (div) => { div.id = 'cells'; }); msg.hashids.forEach((hashid) => { const html = msg.htmls[hashid]; let cell; if (html) { cell = elemFromHtml(html); if (cell.classList.contains('code-cell')) { appendReevaluate(cell); } else if (cell.classList.contains('text-cell')) { renderMath(cell); } } else { cell = document.getElementsByClassName(hashid)[0]; if (!cell) { cell = cellsEl.getElementsByClassName(hashid)[0].cloneNode(true); } } cellsEl.appendChild(cell); }); document.getElementById('cells').replaceWith(cellsEl); } else if (msg.kind === 'kernel_starting') { if (askedForRestart) { askedForRestart = false; window.alert('Kernel restarted'); } } }; Array.from(document.getElementsByClassName('code-cell')).forEach((cell) => { appendReevaluate(cell); }); document.body.insertBefore(h('button', (button) => { button.onclick = () => { askedForRestart = true; send({ kind: 'restart_kernel' }); }; button.textContent = 'Restart kernel'; }), document.body.firstChild); PK! !knitj/client/templates/index.html {{ title }}
{{ cells }}
{% if client %} {% endif %} PK!.sknitj/convert.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import logging from itertools import chain from pkg_resources import resource_string import ansi2html import jinja2 from pygments.formatters import HtmlFormatter from pygments.styles import get_style_by_name from .cell import CodeCell from .kernel import Kernel from .document import Document from .parser import Parser from typing import IO log = logging.getLogger('knitj.knitj') def render_index(title: str, cells: str, client: bool = True) -> str: index = resource_string('knitj', 'client/templates/index.html').decode() template = jinja2.Template(index) styles = '\n'.join( chain( [HtmlFormatter(style=get_style_by_name('trac')).get_style_defs()], map(str, ansi2html.style.get_styles()), ) ) return template.render(title=title, cells=cells, styles=styles, client=client) async def convert( source: IO[str], output: IO[str], fmt: str, kernel_name: str = None ) -> None: document = Document(Parser(fmt)) document.update_from_source(source.read()) kernel = Kernel(document.process_message, kernel_name) kernel.start() front, back = render_index('', '__CELLS__', client=False).split('__CELLS__') output.write(front) for _, cell in document.items(): if isinstance(cell, CodeCell): kernel.execute(cell.hashid, cell.code) log.info('Code cells submitted to kernel') for _, cell in document.items(): if isinstance(cell, CodeCell): await cell.wait_for() output.write(cell.html) output.write(back) await kernel.cleanup() PK!;(  knitj/document.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import logging from collections import OrderedDict import ansi2html from bs4 import BeautifulSoup from .parser import Parser from . import jupyter_messaging as jupy from .jupyter_messaging.content import MIME from typing import List, Optional, Tuple, Iterator, Dict from .cell import BaseCell, Hash, CodeCell ansi_convert = ansi2html.Ansi2HTMLConverter().convert log = logging.getLogger('knitj.document') class Document: def __init__(self, parser: Parser) -> None: self._parser = parser self._cells: Dict[Hash, BaseCell] = OrderedDict() def items(self) -> Iterator[Tuple[Hash, BaseCell]]: yield from self._cells.items() def __iter__(self) -> Iterator[BaseCell]: yield from self._cells.values() def __getitem__(self, hashid: Hash) -> BaseCell: return self._cells[hashid] def __len__(self) -> int: return len(self._cells) def hashes(self) -> List[Hash]: return list(self._cells) def process_message( # noqa: C901 self, msg: jupy.Message, hashid: Optional[Hash] ) -> Optional[BaseCell]: if not hashid: return None try: cell = self._cells[hashid] except KeyError: log.warning(f'{hashid}: Cell does not exist anymore') return None assert isinstance(cell, CodeCell) if isinstance(msg, jupy.EXECUTE_RESULT): log.info(f'{hashid}: Got an execution result') cell.set_output(msg.content.data) elif isinstance(msg, jupy.STREAM): cell.append_stream(msg.content.text) elif isinstance(msg, jupy.DISPLAY_DATA): log.info(f'{hashid}: Got a picture') cell.set_output(msg.content.data) elif isinstance(msg, jupy.EXECUTE_REPLY): if isinstance(msg.content, jupy.content.ERROR): log.info(f'{hashid}: Got an error execution reply') html = ansi_convert('\n'.join(msg.content.traceback), full=False) cell.set_error(html) elif isinstance(msg.content, jupy.content.OK): log.info(f'{hashid}: Got an execution reply') elif isinstance(msg, jupy.ERROR): log.info(f'{hashid}: Got an error') html = ansi_convert('\n'.join(msg.content.traceback), full=False) cell.set_error(html) elif isinstance(msg, jupy.STATUS): if msg.content.execution_state == jupy.content.State.IDLE: log.info(f'{hashid}: Cell done') cell.set_done() elif isinstance(msg, jupy.EXECUTE_INPUT): pass else: raise ValueError(f'Unknown message type: {type(msg)}') return cell def load_output_from_html(self, html: str) -> None: soup = BeautifulSoup(html, 'html.parser') cells_tag = soup.find(id='cells') if not cells_tag: return n_loaded = 0 for cell_tag in cells_tag.find_all('div', class_='code-cell'): hashid = Hash(cell_tag.attrs['class'][0]) if hashid in self._cells: n_loaded += 1 cell = self._cells[hashid] assert isinstance(cell, CodeCell) cell.set_output({MIME.TEXT_HTML: str(cell_tag.find(class_='output'))}) if 'done' in cell_tag.attrs['class']: cell.set_done() if 'hide' in cell_tag.attrs['class']: cell.flags.add('hide') log.info(f'{n_loaded} code cells loaded from output') def update_from_source(self, source: str) -> Tuple[List[BaseCell], List[BaseCell]]: cells = OrderedDict((cell.hashid, cell) for cell in self._parser.parse(source)) new_cells = [] cells_with_updated_flags: List[BaseCell] = [] for hashid, cell in cells.items(): if hashid in self._cells: old_cell = self._cells[cell.hashid] if isinstance(old_cell, CodeCell): assert isinstance(cell, CodeCell) if old_cell.update_flags(cell): cells_with_updated_flags.append(old_cell) else: new_cells.append(cell) n_dropped = sum(hashid not in cells for hashid in self._cells) log.info( f'File change: {len(new_cells)}/{len(self)} new cells, ' f'{n_dropped} dropped' ) cells = OrderedDict( (hashid, self._cells.get(hashid, cell)) for hashid, cell in cells.items() ) self._cells.clear() self._cells.update(cells) return new_cells, new_cells + cells_with_updated_flags PK!.#knitj/jupyter_messaging/__init__.pyfrom .message import ( UUID, BaseMessage as Message, ExecuteRequestMessage as EXECUTE_REQUEST, ExecuteReplyMessage as EXECUTE_REPLY, DisplayDataMessage as DISPLAY_DATA, StreamMessage as STREAM, ExecuteInputMessage as EXECUTE_INPUT, ExecuteResultMessage as EXECUTE_RESULT, ErrorMessage as ERROR, KernelStatusMessage as STATUS, ShutdownReplyMessage as SHUTDOWN_REPLY, parse, ) PK!*9*+knitj/jupyter_messaging/content/__init__.pyfrom .content import ( MIME, ExecuteReplyOkContent as OK, ExecuteReplyErrorContent as ERROR, ExecuteReplyAbortedContent as ABORTED, ExecutionState as State, ) PK!=*knitj/jupyter_messaging/content/content.py# Any copyright is dedicated to the Public Domain. # http://creativecommons.org/publicdomain/zero/1.0/ from enum import Enum from typing import Dict, List, cast, Any # flake8: noqa: B903 class Status(Enum): OK = 'ok' ERROR = 'error' ABORTED = 'aborted' class StreamName(Enum): STDOUT = 'stdout' STDERR = 'stderr' class MIME(Enum): TEXT_PLAIN = 'text/plain' TEXT_HTML = 'text/html' IMAGE_PNG = 'image/png' IMAGE_SVG_XML = 'image/svg+xml' class ExecutionState(Enum): BUSY = 'busy' IDLE = 'idle' STARTING = 'starting' class BaseContent: def __repr__(self) -> str: dct = vars(self).copy() if 'data' in dct: dct['data'] = { mime: data if len(data) <= 10 else f'{data[:7]}...' for mime, data in dct['data'].items() } if len(dct.get('code', '')) > 20: dct['code'] = f'{dct["code"][:17]}...' return repr(dct) class ExecuteRequestContent(BaseContent): def __init__( self, *, code: str, silent: bool, store_history: bool, user_expressions: Dict, allow_stdin: bool, stop_on_error: bool, ) -> None: self.code = code self.silent = silent self.store_history = store_history self.user_expressions = user_expressions self.allow_stdin = allow_stdin self.stop_on_error = stop_on_error class BaseExecuteReplyContent(BaseContent): pass class ExecuteReplyOkContent(BaseExecuteReplyContent): def __init__( self, *, status: str, execution_count: int, payload: List[Dict] = None, user_expressions: Dict = None, ) -> None: self.status = Status(status) self.execution_count = execution_count self.payload = payload self.user_expressions = user_expressions class ExecuteReplyErrorContent(BaseExecuteReplyContent): def __init__( self, *, status: str, ename: str, evalue: str, traceback: List[str], **kwargs: Any, ) -> None: self.status = Status(status) self.ename = ename self.evalue = evalue self.traceback = traceback class ExecuteReplyAbortedContent(BaseExecuteReplyContent): def __init__(self, *, status: str) -> None: self.status = Status(status) def parse_execute_reply(content: Dict) -> BaseExecuteReplyContent: status = Status(content['status']) if status == Status.OK: return ExecuteReplyOkContent(**content) if status == Status.ERROR: return ExecuteReplyErrorContent(**content) if status == Status.ABORTED: return ExecuteReplyAbortedContent(**content) assert False class StreamContent(BaseContent): def __init__(self, *, name: str, text: str) -> None: self.name = StreamName(name) self.text = text class DisplayDataContent(BaseContent): def __init__(self, *, data: Dict, metadata: Dict, transient: Dict = None) -> None: self.data = {MIME(k): cast(str, v) for k, v in data.items()} self.metadata = metadata self.transient = transient class ExecuteInputContent(BaseContent): def __init__(self, *, code: str, execution_count: int) -> None: self.code = code self.execution_count = execution_count class ExecuteResultContent(BaseContent): def __init__(self, *, execution_count: int, data: Dict, metadata: Dict) -> None: self.execution_count = execution_count self.data = {MIME(k): cast(str, v) for k, v in data.items()} self.metadata = metadata class KernelStatusContent(BaseContent): def __init__(self, *, execution_state: str) -> None: self.execution_state = ExecutionState(execution_state) class ShutdownReplyContent(BaseContent): def __init__(self, *, restart: bool, status: str) -> None: self.restart = restart self.status = status PK!z  "knitj/jupyter_messaging/message.py# Any copyright is dedicated to the Public Domain. # http://creativecommons.org/publicdomain/zero/1.0/ import datetime from enum import Enum from pprint import pformat from typing import NewType, Dict, Any, List from .content import content as cnt UUID = NewType('UUID', str) class MsgType(Enum): EXECUTE_REQUEST = 'execute_request' EXECUTE_REPLY = 'execute_reply' DISPLAY_DATA = 'display_data' STREAM = 'stream' EXECUTE_INPUT = 'execute_input' EXECUTE_RESULT = 'execute_result' ERROR = 'error' STATUS = 'status' SHUTDOWN_REPLY = 'shutdown_reply' SHUTDOWN_REQUEST = 'shutdown_request' def __str__(self) -> str: return colstr(self.name, _msg_colors[self]) _msg_colors = { MsgType.EXECUTE_REQUEST: 'bryellow', MsgType.EXECUTE_REPLY: 'yellow', MsgType.DISPLAY_DATA: 'blue', MsgType.STREAM: 'pink', MsgType.EXECUTE_INPUT: 'red', MsgType.EXECUTE_RESULT: 'cyan', MsgType.ERROR: 'red', MsgType.STATUS: 'green', MsgType.SHUTDOWN_REPLY: 'red', } class Header: def __init__( self, *, msg_id: UUID, username: str, session: UUID, date: datetime.datetime, msg_type: str, version: str, ) -> None: self.msg_id = msg_id self.username = username self.session = session self.date = date self.msg_type = MsgType(msg_type) self.version = version def __repr__(self) -> str: return f'(date={self.date} id={self.msg_id} session={self.session})' class BaseMessage: def __init__( self, *, header: Dict, parent_header: Dict, metadata: Dict, buffers: List, msg_id: UUID, msg_type: str, ) -> None: self.header = Header(**header) self.parent_header = Header(**parent_header) if parent_header else None self.metadata = metadata self.buffers = buffers assert msg_id == self.header.msg_id assert MsgType(msg_type) == self.header.msg_type assert not buffers def __repr__(self) -> str: return f'{self.msg_type!s}: {pformat(vars(self))}' @property def msg_id(self) -> UUID: return self.header.msg_id @property def msg_type(self) -> MsgType: return self.header.msg_type class ExecuteRequestMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.ExecuteRequestContent(**content) class ExecuteReplyMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.parse_execute_reply(content) class StreamMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.StreamContent(**content) class DisplayDataMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.DisplayDataContent(**content) class ExecuteInputMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.ExecuteInputContent(**content) class ExecuteResultMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.ExecuteResultContent(**content) class ErrorMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) content['status'] = 'error' self.content = cnt.ExecuteReplyErrorContent(**content) class KernelStatusMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.KernelStatusContent(**content) class ShutdownReplyMessage(BaseMessage): def __init__(self, *, content: Dict, **kwargs: Any) -> None: super().__init__(**kwargs) self.content = cnt.ShutdownReplyContent(**content) _msg_classes = { MsgType.EXECUTE_REQUEST: ExecuteRequestMessage, MsgType.EXECUTE_REPLY: ExecuteReplyMessage, MsgType.DISPLAY_DATA: DisplayDataMessage, MsgType.STREAM: StreamMessage, MsgType.EXECUTE_INPUT: ExecuteInputMessage, MsgType.EXECUTE_RESULT: ExecuteResultMessage, MsgType.ERROR: ErrorMessage, MsgType.STATUS: KernelStatusMessage, MsgType.SHUTDOWN_REPLY: ShutdownReplyMessage, } def parse(msg: Dict) -> BaseMessage: msg_type = MsgType(msg['msg_type']) return _msg_classes[msg_type](**msg) class colstr(str): colors = { 'red': '\x1b[31m', 'green': '\x1b[32m', 'yellow': '\x1b[33m', 'blue': '\x1b[34m', 'bryellow': '\x1b[93m', 'brblue': '\x1b[94m', 'pink': '\x1b[35m', 'cyan': '\x1b[36m', 'grey': '\x1b[37m', 'normal': '\x1b[0m', } def __new__(cls, s: Any, color: str) -> str: return str.__new__( # type: ignore cls, colstr.colors[color] + str(s) + colstr.colors['normal'] ) def __init__(self, s: Any, color: str) -> None: self.len = len(str(s)) self.orig = str(s) def __len__(self) -> int: return self.len PK! knitj/kernel.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import asyncio import logging from pprint import pformat import queue import jupyter_client from .cell import Hash from . import jupyter_messaging as jupy from .jupyter_messaging import UUID from typing import Dict, Callable, Optional log = logging.getLogger('knitj.kernel') class Kernel: def __init__( self, handler: Callable[[jupy.Message, Optional[Hash]], object], kernel: str = None, ) -> None: self._handler = handler self._kernel_name = kernel or 'python3' self._hashids: Dict[UUID, Hash] = {} self._msg_queue: 'asyncio.Queue[Dict]' = asyncio.Queue() self._loop = asyncio.get_event_loop() def start(self) -> None: log.info('Starting kernel...') self._kernel = jupyter_client.KernelManager(kernel_name=self._kernel_name) self._kernel.start_kernel() self._client = self._kernel.client() log.info('Kernel started') self._channels = asyncio.gather( self._receiver(), self._iopub_receiver(), self._shell_receiver() ) async def cleanup(self) -> None: self._kernel.shutdown_kernel() self._channels.cancel() try: await self._channels except asyncio.CancelledError: pass log.info('Kernel shut down') def restart(self) -> None: log.info('Restarting kernel') self._kernel.restart_kernel() def interrupt(self) -> None: log.info('Interrupting kernel') self._kernel.interrupt_kernel() def execute(self, hashid: Hash, code: str) -> None: msg_id = UUID(self._client.execute(code)) self._hashids[msg_id] = hashid async def _receiver(self) -> None: while True: dct = await self._msg_queue.get() try: msg = jupy.parse(dct) except (TypeError, ValueError): log.info(pformat(dct)) raise if msg.parent_header: hashid = self._hashids.get(msg.parent_header.msg_id) else: hashid = None self._handler(msg, hashid) async def _iopub_receiver(self) -> None: def partial() -> Dict: return self._client.get_iopub_msg(timeout=0.3) while True: try: dct = await self._loop.run_in_executor(None, partial) except queue.Empty: continue self._msg_queue.put_nowait(dct) async def _shell_receiver(self) -> None: def partial() -> Dict: return self._client.get_shell_msg(timeout=0.3) while True: try: dct = await self._loop.run_in_executor(None, partial) except queue.Empty: continue self._msg_queue.put_nowait(dct) PK!? knitj/parser.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import re from .cell import BaseCell, TextCell, CodeCell from typing import List class ParsingError(Exception): pass class Parser: def __init__(self, fmt: str) -> None: if fmt == 'markdown': self._parser = parse_markdown elif fmt == 'python': self._parser = parse_python else: raise ValueError(f'Unknown format: {fmt}') def parse(self, text: str) -> List[BaseCell]: return self._parser(text) def parse_markdown(text: str) -> List[BaseCell]: text = text.rstrip() cells: List[BaseCell] = [] buffer = '' while text: m = re.search(r'((?<=\n)|^)```python|', text) if not m: raise ParsingError('Unclosed HTML comment') buffer += text[: m.end()] text = text[m.end() :] return cells def parse_python(text: str) -> List[BaseCell]: text = text.rstrip() cells: List[BaseCell] = [] buffer = '' while text: m = re.search(r'((?<=\n)|^)#\s*::>|$', text) assert m buffer += text[: m.start()] buffer = buffer.strip() if buffer: buffer = re.sub(r'((?<=\n)|^)#\s*::%', '%', buffer) cells.append(CodeCell(buffer)) buffer = '' text = text[m.end() :] if m.group(0): m = re.search(r'(?<=\n)[^#]|$', text) if not m: raise ParsingError('Unclosed Markdown cell') md = text[: m.start()].strip() md = re.sub(r'((?<=\n)|^)# ?', '', md) cells.append(TextCell(md)) text = text[m.start() :] return cells PK!R^ZZknitj/server.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os from pathlib import Path import asyncio import webbrowser import json import logging from aiohttp import web from .kernel import Kernel from .source import SourceWatcher from .webserver import init_webapp from .parser import Parser from .document import Document from .cell import Hash, CodeCell from .convert import render_index from . import jupyter_messaging as jupy from typing import Set, Dict, List, Optional log = logging.getLogger('knitj.knitj') class Broadcaster: def __init__(self, wss: Set[web.WebSocketResponse]) -> None: self._wss = wss self._queue: 'asyncio.Queue[Dict]' = asyncio.Queue() def register_message(self, msg: Dict) -> None: self._queue.put_nowait(msg) async def run(self) -> None: log.info(f'Started broadcasting to browsers') while True: msg = await self._queue.get() data = json.dumps(msg) for ws in list(self._wss): try: await ws.send_str(data) except ConnectionResetError: self._wss.remove(ws) class KnitjServer: def __init__( self, source: os.PathLike, output: os.PathLike, fmt: str, browser: webbrowser.BaseBrowser = None, kernel: str = None, ) -> None: source, output = Path(source), Path(output) self._browser = browser self._kernel = Kernel(self._kernel_handler, kernel) app = init_webapp(self.get_index, self._ws_msg_handler) self._webrunner = web.AppRunner(app) self._broadcaster = Broadcaster(app['wss']) self._watcher = SourceWatcher(self._source_handler, source) self._document = Document(Parser(fmt)) if source.exists(): self._document.update_from_source(source.read_text()) if output.exists(): self._document.load_output_from_html(output.read_text()) self._output = output self._tasks: List[asyncio.Future] = [] async def start(self) -> None: await self._webrunner.setup() self._kernel.start() for port in range(8080, 8100): try: site = web.TCPSite(self._webrunner, 'localhost', port) await site.start() except OSError: pass else: break else: raise RuntimeError('No available port') log.info(f'Started web server on port {port}') if self._browser: self._browser.open(f'http://localhost:{port}') loop = asyncio.get_event_loop() self._tasks.extend( [ loop.create_task(self._broadcaster.run()), loop.create_task(self._watcher.run()), ] ) async def cleanup(self) -> None: await asyncio.gather(self._webrunner.cleanup(), self._kernel.cleanup()) for task in self._tasks: task.cancel() try: await task except asyncio.CancelledError: pass def update_all(self, msg: Dict) -> None: self._broadcaster.register_message(msg) self._output.write_text(self.get_index(client=False)) def get_index(self, client: bool = True) -> str: cells = '\n'.join(cell.html for cell in self._document) return render_index('', cells, client=client) def _kernel_handler(self, msg: jupy.Message, hashid: Optional[Hash]) -> None: if not hashid: if isinstance(msg, jupy.STATUS): if msg.content.execution_state == jupy.content.State.STARTING: self._broadcaster.register_message({'kind': 'kernel_starting'}) elif isinstance(msg, jupy.SHUTDOWN_REPLY): pass else: log.warn("Don't have parent message") log.info(msg) return cell = self._document.process_message(msg, hashid) if not cell: return self.update_all( {'kind': 'cell', 'hashid': cell.hashid.value, 'html': cell.html} ) def _ws_msg_handler(self, msg: Dict) -> None: if msg['kind'] == 'reevaluate': hashids = [Hash(hashid) for hashid in msg['hashids']] log.info(f'Will reevaluate cells: {", ".join(map(str, hashids))}') for hashid in hashids: cell = self._document[hashid] assert isinstance(cell, CodeCell) cell.reset() self._kernel.execute(hashid, cell.code) elif msg['kind'] == 'restart_kernel': self._kernel.restart() elif msg['kind'] == 'interrupt_kernel': self._kernel.interrupt() elif msg['kind'] == 'ping': pass else: raise ValueError(f'Unkonwn message: {msg["kind"]}') def _source_handler(self, src: str) -> None: doc = self._document new_cells, updated_cells = doc.update_from_source(src) for cell in new_cells: if isinstance(cell, CodeCell): cell._flags.add('evaluating') self.update_all( { 'kind': 'document', 'hashids': [hashid.value for hashid in doc.hashes()], 'htmls': {cell.hashid.value: cell.html for cell in updated_cells}, } ) for cell in new_cells: if isinstance(cell, CodeCell): self._kernel.execute(cell.hashid, cell.code) PK!=IIknitj/source.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os import logging from pathlib import Path import asyncio from asyncio import Queue from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler, FileSystemEvent from .cell import Hash # noqa from typing import Callable log = logging.getLogger('knitj.source') class FileChangedHandler(FileSystemEventHandler): def __init__(self, queue: 'Queue[str]') -> None: super().__init__() self._loop = asyncio.get_event_loop() self._queue = queue def _queue_modified(self, event: FileSystemEvent) -> None: # Must be done this way because watchdog doesn't support asyncio # and the on_modified, on_created functions are run in different thread self._loop.call_soon_threadsafe(self._queue.put_nowait, event.src_path) def on_modified(self, event: FileSystemEvent) -> None: self._queue_modified(event) def on_created(self, event: FileSystemEvent) -> None: self._queue_modified(event) class SourceWatcher: def __init__(self, handler: Callable[[str], None], path: os.PathLike) -> None: self._path = Path(path) self._handler = handler self._file_change: 'Queue[str]' = Queue() self._observer = Observer() self._observer.schedule( FileChangedHandler(queue=self._file_change), str(self._path.parent) ) async def run(self) -> None: self._observer.start() log.info(f'Started watching file {self._path} for changes') while True: file = Path(await self._file_change.get()) if file == self._path: self._handler(file.read_text()) PK!?Wknitj/webserver.py# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import logging from weakref import WeakSet from pkg_resources import resource_filename from aiohttp import web, WSCloseCode from typing import Callable, Dict log = logging.getLogger('knitj.webserver') async def on_shutdown(app: web.Application) -> None: log.info('Closing websockets') ws: web.WebSocketResponse for ws in set(app['wss']): await ws.close(code=WSCloseCode.GOING_AWAY, message='Server shutdown') async def handler(request: web.Request) -> web.Response: app = request.app if request.path == '/': return web.Response(text=app['get_index'](), content_type='text/html') if request.path == '/ws': ws = web.WebSocketResponse(autoclose=False) await ws.prepare(request) log.info(f'Browser connected: {id(ws)}') app['wss'].add(ws) async for msg in ws: app['ws_msg_handler'](msg.json()) log.info(f'Browser disconnected: {id(ws)}') app['wss'].remove(ws) return ws raise web.HTTPNotFound() def init_webapp( get_index: Callable[[], str], ws_msg_handler: Callable[[Dict], None] ) -> web.Application: app = web.Application() app['get_index'] = get_index app['ws_msg_handler'] = ws_msg_handler app['wss'] = WeakSet() app.router.add_static( '/static', resource_filename('knitj', 'client/static'), append_version=True ) app.router.add_get('/', handler) app.router.add_get('/ws', handler) app.on_shutdown.append(on_shutdown) return app PK!H뷍t&(&knitj-0.2.2.dist-info/entry_points.txtN+I/N.,(),ɲz9Vy\\PK!xFVAVAknitj-0.2.2.dist-info/LICENSEMozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. PK!H$TTknitj-0.2.2.dist-info/WHEEL = 0 нR \C HCoo~ \B"|lchлYh|hzWٓ7}|v }PK!H>E+& &knitj-0.2.2.dist-info/METADATAXrۺϧ@>S{F$%YDd8ΉO|i:6 I@]it iʑd2EgҔZiå~ iNp{4Q?(^an#j Wd!i^,Tt 4 xmVD1J ӰufRoTLT^ !I/Tda| ?K /e_ډ:/wSc3|f,`’4d8$;$sTFWbБF)'6nZӹw rc!}TrC@N4p=Fl#v^נƌOR : ]&9n[-wa j9h7 ހ9I)ы\!%6xu:$WLIís-3B !!klxTPm,[*]*"6'F-USb<5Z*_3__(2vpŠ?-:kI#Q$4VR'Upޏ{8t/Zfu-,g0և>:BCmآ+P _g_rq^|zrt|>:\2b2|1M,F/&waXbuHrB[ʦcQ8)/ ZWZ䑀nl6p抜UuGX$T [͠,h;Q\NQ6yKZ MSɉVR" d2JZc [*ISs}r5ā*'6@_ZSfhi`sLۯ~hw({d ZJ-+P 6h¶ G;FH (0^l6!ݲs.[}ނ`0'1DJ@W Z~-磥`FOCtOǺ<.`XkZ΁ QUL:YƐlAgMnMv!a"ep{/A;LN] Sm`T#=m0$ayn:KR- ŴSߗI'KrIqw$KJ/CvZ:ԁoup 7UA0vtH~w>)h#QЋwQ{w~hH~j!Zg`U('RXKJב5S2QM_<ƣ&r T~;>wYzOqVZzQ[do5O>Ӕ9)$2YvsUk\ ʉ82esN3ɝ˦x;P=gzXWLa NTZ!!ܡmdYm0\'~2k/:'2 r)Y-M6請lΰk4W`Ejqt*N:wwzZW8s'fh?DEճp?7uMKa+Ro;c4YU=eu.nX2:stA2>rvV[Lum28;z7;2e+\y(FN,nRQy6U,b$83m0-÷9pR8!(J-(P<NSgX̢+?orS恥q} ekB]\^oIޝ;ɛO+8 p/2Rzꊨ>\@vR  (U[d0 #I Œ-E9ӹl%dBkQ6FPz;,2xEŦjG#Gƣ,bʺDf[8!y PO a 1sPK!H}knitj-0.2.2.dist-info/RECORDIH{b_sPvQ !A~3mSqHeFdFdY=u uy_ [;#G0`ۃBȏ&UBp!NdzB\F##3.ZUdd&S>]A+a(n^51Hm= A !e7UEݷɓCCb9MdKUMIbٛ]wt$-oB=3!в/iX@].0]nL{+5zyf%?k8) Uo?Y0 NhipZSuƯPGu40_&s7J8OX lm^l̃eW""5['zD-k9v]uR.zG W~@Fq4=ު{Q`zk"ɹT,vH{AjLL-Q~M==㰷֓%q :wf;f\l@(M?I`Kta'eIFҁro D0e=h+8+Z*Q>oVuGN%UGa̾knitj/jupyter_messaging/__init__.pyPK!*9*+@knitj/jupyter_messaging/content/__init__.pyPK!=*Aknitj/jupyter_messaging/content/content.pyPK!z  "Qknitj/jupyter_messaging/message.pyPK! gknitj/kernel.pyPK!? sknitj/parser.pyPK!R^ZZ|knitj/server.pyPK!=IIknitj/source.pyPK!?Wknitj/webserver.pyPK!H뷍t&(&ԡknitj-0.2.2.dist-info/entry_points.txtPK!xFVAVA>knitj-0.2.2.dist-info/LICENSEPK!H$TTknitj-0.2.2.dist-info/WHEELPK!H>E+& &\knitj-0.2.2.dist-info/METADATAPK!H}knitj-0.2.2.dist-info/RECORDPK