From 01e8a3a8d53a08e3838a0ab11122e8ead0d0a886 Mon Sep 17 00:00:00 2001 From: "Jesse W. Collins" Date: Thu, 8 Nov 2018 08:55:28 -0500 Subject: [PATCH 001/316] stream: change comment on duplex stream options 'options.XXX' did not convey to me how to use camelCase for different readable and writable options on a duplex stream. Give an example instead. PR-URL: https://github.com/nodejs/node/pull/24247 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- lib/_stream_writable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index d62c95ad800567..022dcffdd78e28 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -57,8 +57,8 @@ function WritableState(options, stream, isDuplex) { // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Stream.Duplex; From bc5a0d3c058232daaf262157e35d84eecd6e4e07 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Fri, 2 Nov 2018 21:08:30 +0800 Subject: [PATCH 002/316] lib: gather all errors constant in the same place for consistency PR-URL: https://github.com/nodejs/node/pull/24038 Reviewed-By: Joyee Cheung Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- lib/net.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/net.js b/lib/net.js index 9b139d28597b5c..3291ac92fb664a 100644 --- a/lib/net.js +++ b/lib/net.js @@ -64,19 +64,23 @@ const { onStreamRead, kUpdateTimer } = require('internal/stream_base_commons'); -const errors = require('internal/errors'); const { - ERR_INVALID_ADDRESS_FAMILY, - ERR_INVALID_ARG_TYPE, - ERR_INVALID_ARG_VALUE, - ERR_INVALID_FD_TYPE, - ERR_INVALID_IP_ADDRESS, - ERR_INVALID_OPT_VALUE, - ERR_SERVER_ALREADY_LISTEN, - ERR_SERVER_NOT_RUNNING, - ERR_SOCKET_BAD_PORT, - ERR_SOCKET_CLOSED -} = errors.codes; + codes: { + ERR_INVALID_ADDRESS_FAMILY, + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, + ERR_INVALID_FD_TYPE, + ERR_INVALID_IP_ADDRESS, + ERR_INVALID_OPT_VALUE, + ERR_SERVER_ALREADY_LISTEN, + ERR_SERVER_NOT_RUNNING, + ERR_SOCKET_BAD_PORT, + ERR_SOCKET_CLOSED + }, + errnoException, + exceptionWithHostPort, + uvExceptionWithHostPort +} = require('internal/errors'); const { validateInt32, validateString } = require('internal/validators'); const kLastWriteQueueSize = Symbol('lastWriteQueueSize'); @@ -84,12 +88,6 @@ const kLastWriteQueueSize = Symbol('lastWriteQueueSize'); let cluster; let dns; -const { - errnoException, - exceptionWithHostPort, - uvExceptionWithHostPort -} = errors; - const { kTimeout, setUnrefTimeout, From 06c28b9d75c4ae57a3cb6ddbbdcb828745b54fa0 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 12 Nov 2018 23:59:52 -0500 Subject: [PATCH 003/316] deps: upgrade to libuv 1.24.0 PR-URL: https://github.com/nodejs/node/pull/24332 Reviewed-By: Refael Ackermann Reviewed-By: Santiago Gimeno Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Trivikram Kamat --- deps/uv/AUTHORS | 4 + deps/uv/CMakeLists.txt | 4 +- deps/uv/ChangeLog | 57 ++++ deps/uv/MAINTAINERS.md | 1 + deps/uv/Makefile.am | 13 + deps/uv/configure.ac | 6 +- deps/uv/docs/src/fs.rst | 11 + deps/uv/docs/src/process.rst | 18 +- deps/uv/include/uv.h | 15 +- deps/uv/include/uv/unix.h | 2 + deps/uv/include/uv/version.h | 4 +- deps/uv/include/uv/win.h | 8 + deps/uv/src/idna.c | 291 ++++++++++++++++++ deps/uv/src/idna.h | 31 ++ deps/uv/src/unix/aix-common.c | 11 +- deps/uv/src/unix/aix.c | 12 +- deps/uv/src/unix/bsd-ifaddrs.c | 17 +- deps/uv/src/unix/bsd-proctitle.c | 93 ++++++ deps/uv/src/unix/core.c | 21 -- deps/uv/src/unix/darwin-proctitle.c | 148 +++++---- deps/uv/src/unix/freebsd.c | 79 ----- deps/uv/src/unix/fs.c | 47 ++- deps/uv/src/unix/getaddrinfo.c | 20 ++ deps/uv/src/unix/internal.h | 1 - deps/uv/src/unix/linux-core.c | 18 +- deps/uv/src/unix/netbsd.c | 68 ---- deps/uv/src/unix/openbsd.c | 69 ----- deps/uv/src/unix/os390.c | 17 +- deps/uv/src/unix/proctitle.c | 4 + deps/uv/src/unix/sunos.c | 12 +- deps/uv/src/uv-common.c | 9 +- deps/uv/src/win/dl.c | 3 +- deps/uv/src/win/fs.c | 72 ++++- deps/uv/src/win/getaddrinfo.c | 14 +- deps/uv/src/win/process.c | 9 +- deps/uv/src/win/signal.c | 2 +- deps/uv/src/win/tcp.c | 4 +- deps/uv/src/win/tty.c | 11 +- deps/uv/src/win/util.c | 3 + deps/uv/test/echo-server.c | 4 + deps/uv/test/run-tests.c | 15 + deps/uv/test/runner-unix.c | 107 +++++-- deps/uv/test/runner-win.c | 5 + deps/uv/test/runner.c | 3 - deps/uv/test/task.h | 6 + deps/uv/test/test-fs.c | 54 ++++ deps/uv/test/test-idna.c | 195 ++++++++++++ .../test-ipc-heavy-traffic-deadlock-bug.c | 1 + deps/uv/test/test-ipc-send-recv.c | 1 + deps/uv/test/test-ipc.c | 1 + deps/uv/test/test-list.h | 12 + deps/uv/test/test-process-title-threadsafe.c | 6 +- deps/uv/test/test-spawn.c | 1 + deps/uv/test/test-stdio-over-pipes.c | 1 + deps/uv/test/test.gyp | 1 + deps/uv/uv.gyp | 7 +- 56 files changed, 1242 insertions(+), 407 deletions(-) create mode 100644 deps/uv/src/idna.c create mode 100644 deps/uv/src/idna.h create mode 100644 deps/uv/src/unix/bsd-proctitle.c create mode 100644 deps/uv/test/test-idna.c diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 2fdfbcd5322e5e..2f93bd8dffefa4 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -352,3 +352,7 @@ Andy Zhang dmabupt Ryan Liptak Ali Ijaz Sheikh +hitesh +Svante Signell +Samuel Thibault +Jeremy Studer diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index 6a631a87c1cb39..8cd862715aef9d 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -13,6 +13,7 @@ endif() set(uv_sources src/fs-poll.c + src/idna.c src/inet.c src/threadpool.c src/timer.c @@ -64,6 +65,7 @@ set(uv_test_sources test/test-homedir.c test/test-hrtime.c test/test-idle.c + test/test-idna.c test/test-ip4-addr.c test/test-ip6-addr.c test/test-ip6-addr.c @@ -260,7 +262,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD") endif() if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") - list(APPEND uv_sources src/unix/posix-hrtime.c) + list(APPEND uv_sources src/unix/posix-hrtime.c src/unix/bsd-proctitle.c) list(APPEND uv_libraries kvm) endif() diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 7cb675238d3e08..3376481d62d1f0 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,60 @@ +2018.11.14, Version 1.24.0 (Stable), 2d427ee0083d1baf995df4ebf79a3f8890e9a3e1 + +Changes since version 1.23.2: + +* unix: do not require PATH_MAX to be defined (Brad King) + +* win,doc: path encoding in uv_fs_XX is UTF-8 (hitesh) + +* unix: add missing link dependency on kFreeBSD (Svante Signell) + +* unix: add support for GNU/Hurd (Samuel Thibault) + +* test: avoid memory leak for test_output (Carlo Marcelo Arenas Belón) + +* zos: avoid UB with NULL pointer arithmetic (Carlo Marcelo Arenas Belón) + +* doc: add vtjnash to maintainers (Jameson Nash) + +* unix: restore skipping of phys_addr copy (cjihrig) + +* unix,win: make uv_interface_addresses() consistent (cjihrig) + +* unix: remove unnecessary linebreaks (cjihrig) + +* unix,win: handle zero-sized allocations uniformly (Ben Noordhuis) + +* unix: remove unused uv__dup() function (Ben Noordhuis) + +* core,bsd: refactor process_title functions (Santiago Gimeno) + +* win: Redefine NSIG to consider SIGWINCH (Jeremy Studer) + +* test: make sure that reading a directory fails (Sakthipriyan Vairamani) + +* win, tty: remove zero-size read callbacks (Bartosz Sosnowski) + +* test: fix test runner getenv async-signal-safety (Ben Noordhuis) + +* test: fix test runner execvp async-signal-safety (Ben Noordhuis) + +* test,unix: fix race in test runner (Ben Noordhuis) + +* unix,win: support IDNA 2008 in uv_getaddrinfo() (Ben Noordhuis) + +* win, tcp: avoid starving the loop (Bartosz Sosnowski) + +* win, dl: proper error messages on some systems (Bartosz Sosnowski) + +* win,fs: retry if uv_fs_rename fails (Bartosz Sosnowski) + +* darwin: speed up uv_set_process_title() (Ben Noordhuis) + +* aix: fix race in uv_get_process_title() (Gireesh Punathil) + +* win: support more fine-grained windows hiding (Bartosz Sosnowski) + + 2018.10.09, Version 1.23.2 (Stable), 34c12788d2e7308f3ac506c0abcbf74c0d6abd20 Changes since version 1.23.1: diff --git a/deps/uv/MAINTAINERS.md b/deps/uv/MAINTAINERS.md index 543dc3cda7bce2..a5a11c8dfff16c 100644 --- a/deps/uv/MAINTAINERS.md +++ b/deps/uv/MAINTAINERS.md @@ -15,6 +15,7 @@ libuv is currently managed by the following individuals: - GPG key: AF2E EA41 EC34 47BF DD86 FED9 D706 3CCE 19B7 E890 (pubkey-indutny) * **Imran Iqbal** ([@imran-iq](https://github.com/imran-iq)) - GPG key: 9DFE AA5F 481B BF77 2D90 03CE D592 4925 2F8E C41A (pubkey-iwuzhere) +* **Jameson Nash** ([@vtjnash](https://github.com/vtjnash)) * **John Barboza** ([@jbarz](https://github.com/jbarz)) * **Santiago Gimeno** ([@santigimeno](https://github.com/santigimeno)) - GPG key: 612F 0EAD 9401 6223 79DF 4402 F28C 3C8D A33C 03BE (pubkey-santigimeno) diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 2381425403c376..098d2f57931d18 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -29,6 +29,7 @@ libuv_la_CFLAGS = @CFLAGS@ libuv_la_LDFLAGS = -no-undefined -version-info 1:0:0 libuv_la_SOURCES = src/fs-poll.c \ src/heap-inl.h \ + src/idna.c \ src/inet.c \ src/queue.h \ src/threadpool.c \ @@ -189,6 +190,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-homedir.c \ test/test-hrtime.c \ test/test-idle.c \ + test/test-idna.c \ test/test-ip4-addr.c \ test/test-ip6-addr.c \ test/test-ipc-heavy-traffic-deadlock-bug.c \ @@ -374,6 +376,7 @@ endif if DRAGONFLY uvinclude_HEADERS += include/uv/bsd.h libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ + src/unix/bsd-proctitle.c \ src/unix/freebsd.c \ src/unix/kqueue.c \ src/unix/posix-hrtime.c @@ -383,12 +386,20 @@ endif if FREEBSD uvinclude_HEADERS += include/uv/bsd.h libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ + src/unix/bsd-proctitle.c \ src/unix/freebsd.c \ src/unix/kqueue.c \ src/unix/posix-hrtime.c test_run_tests_LDFLAGS += -lutil endif +if HURD +uvinclude_HEADERS += include/uv/posix.h +libuv_la_SOURCES += src/unix/no-fsevents.c \ + src/unix/posix-hrtime.c \ + src/unix/posix-poll.c +endif + if LINUX uvinclude_HEADERS += include/uv/linux.h libuv_la_CFLAGS += -D_GNU_SOURCE @@ -419,6 +430,7 @@ endif if NETBSD uvinclude_HEADERS += include/uv/bsd.h libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ + src/unix/bsd-proctitle.c \ src/unix/kqueue.c \ src/unix/netbsd.c \ src/unix/posix-hrtime.c @@ -428,6 +440,7 @@ endif if OPENBSD uvinclude_HEADERS += include/uv/bsd.h libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ + src/unix/bsd-proctitle.c \ src/unix/kqueue.c \ src/unix/openbsd.c \ src/unix/posix-hrtime.c diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index 0d9066bb0225a5..68939c699e4a32 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.23.2], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.24.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) @@ -56,6 +56,7 @@ AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false]) AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])]) AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])]) AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[*freebsd*], [true], [false])]) +AM_CONDITIONAL([HURD], [AS_CASE([$host_os],[gnu*], [true], [false])]) AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])]) AM_CONDITIONAL([MSYS], [AS_CASE([$host_os],[msys*], [true], [false])]) AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])]) @@ -67,6 +68,9 @@ AS_CASE([$host_os],[mingw*], [ LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -luser32" ]) AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])]) +AS_CASE([$host_os], [kfreebsd*], [ + LIBS="$LIBS -lfreebsd-glue" +]) AC_CHECK_HEADERS([sys/ahafs_evProds.h]) AC_CONFIG_FILES([Makefile libuv.pc]) AC_OUTPUT diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index fcf70a35a1f66d..21f9e27cb40727 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -12,6 +12,8 @@ otherwise it will be performed asynchronously. All file operations are run on the threadpool. See :ref:`threadpool` for information on the threadpool size. +.. note:: + On Windows `uv_fs_*` functions use utf-8 encoding. Data types ---------- @@ -231,6 +233,15 @@ API Equivalent to :man:`rename(2)`. + .. note:: + On Windows if this function fails with ``UV_EBUSY``, ``UV_EPERM`` or + ``UV_EACCES``, it will retry to rename the file up to four times with + 250ms wait between attempts before giving up. If both `path` and + `new_path` are existing directories this function will work only if + target directory is empty. + + .. versionchanged:: 1.24.0 Added retrying and directory move support on Windows. + .. c:function:: int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) Equivalent to :man:`fsync(2)`. diff --git a/deps/uv/docs/src/process.rst b/deps/uv/docs/src/process.rst index bc968554e149f2..f2b3be219bf299 100644 --- a/deps/uv/docs/src/process.rst +++ b/deps/uv/docs/src/process.rst @@ -70,11 +70,22 @@ Data types */ UV_PROCESS_DETACHED = (1 << 3), /* - * Hide the subprocess console window that would normally be created. This + * Hide the subprocess window that would normally be created. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4), + /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), + /* + * Hide the subprocess GUI window that would normally be created. This * option is only meaningful on Windows systems. On Unix it is silently * ignored. */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4) + UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) }; .. c:type:: uv_stdio_container_t @@ -217,6 +228,9 @@ API setgid specified, or not having enough memory to allocate for the new process. + .. versionchanged:: 1.24.0 Added `UV_PROCESS_WINDOWS_HIDE_CONSOLE` and + `UV_PROCESS_WINDOWS_HIDE_GUI` flags. + .. c:function:: int uv_process_kill(uv_process_t* handle, int signum) Sends the specified signal to the given process handle. Check the documentation diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 717c2e570b9eb9..86a2ecc2d74469 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -963,11 +963,22 @@ enum uv_process_flags { */ UV_PROCESS_DETACHED = (1 << 3), /* - * Hide the subprocess console window that would normally be created. This + * Hide the subprocess window that would normally be created. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4), + /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), + /* + * Hide the subprocess GUI window that would normally be created. This * option is only meaningful on Windows systems. On Unix it is silently * ignored. */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4) + UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) }; /* diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h index 7208557b560ce8..9de9efecff14c4 100644 --- a/deps/uv/include/uv/unix.h +++ b/deps/uv/include/uv/unix.h @@ -64,6 +64,8 @@ # include "uv/bsd.h" #elif defined(__CYGWIN__) || defined(__MSYS__) # include "uv/posix.h" +#elif defined(__GNU__) +# include "uv/posix.h" #endif #ifndef NI_MAXHOST diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index cc064e2fd87ce8..105e9a2615f4a6 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 23 -#define UV_VERSION_PATCH 2 +#define UV_VERSION_MINOR 24 +#define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/include/uv/win.h b/deps/uv/include/uv/win.h index d6b8b3a7f7b9a2..bb9477c8346bdc 100644 --- a/deps/uv/include/uv/win.h +++ b/deps/uv/include/uv/win.h @@ -86,6 +86,14 @@ typedef struct pollfd { #define SIGKILL 9 #define SIGWINCH 28 +/* Redefine NSIG to take SIGWINCH into consideration */ +#if defined(NSIG) && NSIG <= SIGWINCH +# undef NSIG +#endif +#ifndef NSIG +# define NSIG SIGWINCH + 1 +#endif + /* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like * platforms. However MinGW doesn't define it, so we do. */ #ifndef SIGABRT_COMPAT diff --git a/deps/uv/src/idna.c b/deps/uv/src/idna.c new file mode 100644 index 00000000000000..13ffac6be8142d --- /dev/null +++ b/deps/uv/src/idna.c @@ -0,0 +1,291 @@ +/* Copyright (c) 2011, 2018 Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* Derived from https://github.com/bnoordhuis/punycode + * but updated to support IDNA 2008. + */ + +#include "uv.h" +#include "idna.h" +#include + +static unsigned uv__utf8_decode1_slow(const char** p, + const char* pe, + unsigned a) { + unsigned b; + unsigned c; + unsigned d; + unsigned min; + + if (a > 0xF7) + return -1; + + switch (*p - pe) { + default: + if (a > 0xEF) { + min = 0x10000; + a = a & 7; + b = (unsigned char) *(*p)++; + c = (unsigned char) *(*p)++; + d = (unsigned char) *(*p)++; + break; + } + /* Fall through. */ + case 2: + if (a > 0xDF) { + min = 0x800; + b = 0x80 | (a & 15); + c = (unsigned char) *(*p)++; + d = (unsigned char) *(*p)++; + a = 0; + break; + } + /* Fall through. */ + case 1: + if (a > 0xBF) { + min = 0x80; + b = 0x80; + c = 0x80 | (a & 31); + d = (unsigned char) *(*p)++; + a = 0; + break; + } + return -1; /* Invalid continuation byte. */ + } + + if (0x80 != (0xC0 & (b ^ c ^ d))) + return -1; /* Invalid sequence. */ + + b &= 63; + c &= 63; + d &= 63; + a = (a << 18) | (b << 12) | (c << 6) | d; + + if (a < min) + return -1; /* Overlong sequence. */ + + if (a > 0x10FFFF) + return -1; /* Four-byte sequence > U+10FFFF. */ + + if (a >= 0xD800 && a <= 0xDFFF) + return -1; /* Surrogate pair. */ + + return a; +} + +unsigned uv__utf8_decode1(const char** p, const char* pe) { + unsigned a; + + a = (unsigned char) *(*p)++; + + if (a < 128) + return a; /* ASCII, common case. */ + + return uv__utf8_decode1_slow(p, pe, a); +} + +#define foreach_codepoint(c, p, pe) \ + for (; (void) (*p <= pe && (c = uv__utf8_decode1(p, pe))), *p <= pe;) + +static int uv__idna_toascii_label(const char* s, const char* se, + char** d, char* de) { + static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789"; + const char* ss; + unsigned c; + unsigned h; + unsigned k; + unsigned n; + unsigned m; + unsigned q; + unsigned t; + unsigned x; + unsigned y; + unsigned bias; + unsigned delta; + unsigned todo; + int first; + + h = 0; + ss = s; + todo = 0; + + foreach_codepoint(c, &s, se) { + if (c < 128) + h++; + else if (c == (unsigned) -1) + return UV_EINVAL; + else + todo++; + } + + if (todo > 0) { + if (*d < de) *(*d)++ = 'x'; + if (*d < de) *(*d)++ = 'n'; + if (*d < de) *(*d)++ = '-'; + if (*d < de) *(*d)++ = '-'; + } + + x = 0; + s = ss; + foreach_codepoint(c, &s, se) { + if (c > 127) + continue; + + if (*d < de) + *(*d)++ = c; + + if (++x == h) + break; /* Visited all ASCII characters. */ + } + + if (todo == 0) + return h; + + /* Only write separator when we've written ASCII characters first. */ + if (h > 0) + if (*d < de) + *(*d)++ = '-'; + + n = 128; + bias = 72; + delta = 0; + first = 1; + + while (todo > 0) { + m = -1; + s = ss; + foreach_codepoint(c, &s, se) + if (c >= n) + if (c < m) + m = c; + + x = m - n; + y = h + 1; + + if (x > ~delta / y) + return UV_E2BIG; /* Overflow. */ + + delta += x * y; + n = m; + + s = ss; + foreach_codepoint(c, &s, se) { + if (c < n) + if (++delta == 0) + return UV_E2BIG; /* Overflow. */ + + if (c != n) + continue; + + for (k = 36, q = delta; /* empty */; k += 36) { + t = 1; + + if (k > bias) + t = k - bias; + + if (t > 26) + t = 26; + + if (q < t) + break; + + /* TODO(bnoordhuis) Since 1 <= t <= 26 and therefore + * 10 <= y <= 35, we can optimize the long division + * into a table-based reciprocal multiplication. + */ + x = q - t; + y = 36 - t; /* 10 <= y <= 35 since 1 <= t <= 26. */ + q = x / y; + t = t + x % y; /* 1 <= t <= 35 because of y. */ + + if (*d < de) + *(*d)++ = alphabet[t]; + } + + if (*d < de) + *(*d)++ = alphabet[q]; + + delta /= 2; + + if (first) { + delta /= 350; + first = 0; + } + + /* No overflow check is needed because |delta| was just + * divided by 2 and |delta+delta >= delta + delta/h|. + */ + h++; + delta += delta / h; + + for (bias = 0; delta > 35 * 26 / 2; bias += 36) + delta /= 35; + + bias += 36 * delta / (delta + 38); + delta = 0; + todo--; + } + + delta++; + n++; + } + + return 0; +} + +#undef foreach_codepoint + +long uv__idna_toascii(const char* s, const char* se, char* d, char* de) { + const char* si; + const char* st; + unsigned c; + char* ds; + int rc; + + ds = d; + + for (si = s; si < se; /* empty */) { + st = si; + c = uv__utf8_decode1(&si, se); + + if (c != '.') + if (c != 0x3002) /* 。 */ + if (c != 0xFF0E) /* . */ + if (c != 0xFF61) /* 。 */ + continue; + + rc = uv__idna_toascii_label(s, st, &d, de); + + if (rc < 0) + return rc; + + if (d < de) + *d++ = '.'; + + s = si; + } + + if (s < se) { + rc = uv__idna_toascii_label(s, se, &d, de); + + if (rc < 0) + return rc; + } + + if (d < de) + *d++ = '\0'; + + return d - ds; /* Number of bytes written. */ +} diff --git a/deps/uv/src/idna.h b/deps/uv/src/idna.h new file mode 100644 index 00000000000000..8e0c592fe139e5 --- /dev/null +++ b/deps/uv/src/idna.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2011, 2018 Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef UV_SRC_IDNA_H_ +#define UV_SRC_IDNA_H_ + +/* Decode a single codepoint. Returns the codepoint or UINT32_MAX on error. + * |p| is updated on success _and_ error, i.e., bad multi-byte sequences are + * skipped in their entirety, not just the first bad byte. + */ +unsigned uv__utf8_decode1(const char** p, const char* pe); + +/* Convert a UTF-8 domain name to IDNA 2008 / Punycode. A return value >= 0 + * is the number of bytes written to |d|, including the trailing nul byte. + * A return value < 0 is a libuv error code. |s| and |d| can not overlap. + */ +long uv__idna_toascii(const char* s, const char* se, char* d, char* de); + +#endif /* UV_SRC_IDNA_H_ */ diff --git a/deps/uv/src/unix/aix-common.c b/deps/uv/src/unix/aix-common.c index e17e449481836a..63ac16a03431e6 100644 --- a/deps/uv/src/unix/aix-common.c +++ b/deps/uv/src/unix/aix-common.c @@ -166,8 +166,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { } -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { uv_interface_address_t* address; int sockfd, inet6, size = 1; struct ifconf ifc; @@ -175,6 +174,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, struct sockaddr_dl* sa_addr; *count = 0; + *addresses = NULL; if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { return UV__ERR(errno); @@ -217,6 +217,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, (*count)++; } + if (*count == 0) { + uv__close(sockfd); + return 0; + } + /* Alloc the return interface structs */ *addresses = uv__malloc(*count * sizeof(uv_interface_address_t)); if (!(*addresses)) { @@ -289,4 +294,4 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses, } uv__free(addresses); -} \ No newline at end of file +} diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c index 92de8148341e10..baac8e6c0067d7 100644 --- a/deps/uv/src/unix/aix.c +++ b/deps/uv/src/unix/aix.c @@ -886,16 +886,20 @@ int uv_set_process_title(const char* title) { int uv_get_process_title(char* buffer, size_t size) { size_t len; - len = strlen(process_argv[0]); if (buffer == NULL || size == 0) return UV_EINVAL; - else if (size <= len) - return UV_ENOBUFS; uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); - memcpy(buffer, process_argv[0], len + 1); + len = strlen(process_argv[0]); + if (size <= len) { + uv_mutex_unlock(&process_title_mutex); + return UV_ENOBUFS; + } + + memcpy(buffer, process_argv[0], len); + buffer[len] = '\0'; uv_mutex_unlock(&process_title_mutex); diff --git a/deps/uv/src/unix/bsd-ifaddrs.c b/deps/uv/src/unix/bsd-ifaddrs.c index 9825b1c4db4865..2f2201f9ed024a 100644 --- a/deps/uv/src/unix/bsd-ifaddrs.c +++ b/deps/uv/src/unix/bsd-ifaddrs.c @@ -69,11 +69,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { uv_interface_address_t* address; int i; + *count = 0; + *addresses = NULL; + if (getifaddrs(&addrs) != 0) return UV__ERR(errno); - *count = 0; - /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent, UV__EXCLUDE_IFADDR)) @@ -81,6 +82,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + freeifaddrs(addrs); + return 0; + } + *addresses = uv__malloc(*count * sizeof(**addresses)); if (*addresses == NULL) { @@ -119,14 +125,19 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { continue; address = *addresses; - memset(address->phys_addr, 0, sizeof(address->phys_addr)); for (i = 0; i < *count; i++) { +#if defined(__CYGWIN__) || defined(__MSYS__) + memset(address->phys_addr, 0, sizeof(address->phys_addr)); +#else if (strcmp(address->name, ent->ifa_name) == 0) { struct sockaddr_dl* sa_addr; sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + } else { + memset(address->phys_addr, 0, sizeof(address->phys_addr)); } +#endif address++; } } diff --git a/deps/uv/src/unix/bsd-proctitle.c b/deps/uv/src/unix/bsd-proctitle.c new file mode 100644 index 00000000000000..0ce47c8f64e25d --- /dev/null +++ b/deps/uv/src/unix/bsd-proctitle.c @@ -0,0 +1,93 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include + + +static uv_mutex_t process_title_mutex; +static uv_once_t process_title_mutex_once = UV_ONCE_INIT; +static char* process_title; + + +static void init_process_title_mutex_once(void) { + if (uv_mutex_init(&process_title_mutex)) + abort(); +} + + +char** uv_setup_args(int argc, char** argv) { + process_title = argc > 0 ? uv__strdup(argv[0]) : NULL; + return argv; +} + + +int uv_set_process_title(const char* title) { + char* new_title; + + new_title = uv__strdup(title); + if (new_title == NULL) + return UV_ENOMEM; + + uv_once(&process_title_mutex_once, init_process_title_mutex_once); + uv_mutex_lock(&process_title_mutex); + + uv__free(process_title); + process_title = new_title; + setproctitle("%s", title); + + uv_mutex_unlock(&process_title_mutex); + + return 0; +} + + +int uv_get_process_title(char* buffer, size_t size) { + size_t len; + + if (buffer == NULL || size == 0) + return UV_EINVAL; + + uv_once(&process_title_mutex_once, init_process_title_mutex_once); + uv_mutex_lock(&process_title_mutex); + + if (process_title != NULL) { + len = strlen(process_title) + 1; + + if (size < len) { + uv_mutex_unlock(&process_title_mutex); + return UV_ENOBUFS; + } + + memcpy(buffer, process_title, len); + } else { + len = 0; + } + + uv_mutex_unlock(&process_title_mutex); + + buffer[len] = '\0'; + + return 0; +} diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index f92446ff42b86b..0830c74a168e92 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -636,27 +636,6 @@ int uv__cloexec_fcntl(int fd, int set) { } -/* This function is not execve-safe, there is a race window - * between the call to dup() and fcntl(FD_CLOEXEC). - */ -int uv__dup(int fd) { - int err; - - fd = dup(fd); - - if (fd == -1) - return UV__ERR(errno); - - err = uv__cloexec(fd, 1); - if (err) { - uv__close(fd); - return err; - } - - return fd; -} - - ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) { struct cmsghdr* cmsg; ssize_t rc; diff --git a/deps/uv/src/unix/darwin-proctitle.c b/deps/uv/src/unix/darwin-proctitle.c index dabde2239ccab3..92d46b7466d43b 100644 --- a/deps/uv/src/unix/darwin-proctitle.c +++ b/deps/uv/src/unix/darwin-proctitle.c @@ -33,61 +33,56 @@ # include #endif +#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) -static int uv__pthread_setname_np(const char* name) { - int (*dynamic_pthread_setname_np)(const char* name); - char namebuf[64]; /* MAXTHREADNAMESIZE */ - int err; - - /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ - *(void **)(&dynamic_pthread_setname_np) = - dlsym(RTLD_DEFAULT, "pthread_setname_np"); - - if (dynamic_pthread_setname_np == NULL) - return UV_ENOSYS; - - strncpy(namebuf, name, sizeof(namebuf) - 1); - namebuf[sizeof(namebuf) - 1] = '\0'; - err = dynamic_pthread_setname_np(namebuf); - if (err) - return UV__ERR(err); +static int (*dynamic_pthread_setname_np)(const char* name); +#if !TARGET_OS_IPHONE +static CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, + const char*, + CFStringEncoding); +static CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); +static void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); +static void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); +static CFTypeRef (*pLSGetCurrentApplicationASN)(void); +static OSStatus (*pLSSetApplicationInformationItem)(int, + CFTypeRef, + CFStringRef, + CFStringRef, + CFDictionaryRef*); +static void* application_services_handle; +static void* core_foundation_handle; +static CFBundleRef launch_services_bundle; +static CFStringRef* display_name_key; +static CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); +static CFBundleRef (*pCFBundleGetMainBundle)(void); +static CFBundleRef hi_services_bundle; +static OSStatus (*pSetApplicationIsDaemon)(int); +static CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); +static void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, + void*); + + +UV_DESTRUCTOR(static void uv__set_process_title_platform_fini(void)) { + if (core_foundation_handle != NULL) { + dlclose(core_foundation_handle); + core_foundation_handle = NULL; + } - return 0; + if (application_services_handle != NULL) { + dlclose(application_services_handle); + application_services_handle = NULL; + } } +#endif /* !TARGET_OS_IPHONE */ -int uv__set_process_title(const char* title) { -#if TARGET_OS_IPHONE - return uv__pthread_setname_np(title); -#else - CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, - const char*, - CFStringEncoding); - CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); - void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); - void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); - CFTypeRef (*pLSGetCurrentApplicationASN)(void); - OSStatus (*pLSSetApplicationInformationItem)(int, - CFTypeRef, - CFStringRef, - CFStringRef, - CFDictionaryRef*); - void* application_services_handle; - void* core_foundation_handle; - CFBundleRef launch_services_bundle; - CFStringRef* display_name_key; - CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); - CFBundleRef (*pCFBundleGetMainBundle)(void); - CFBundleRef hi_services_bundle; - OSStatus (*pSetApplicationIsDaemon)(int); - CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); - void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, - void*); - CFTypeRef asn; - int err; - - err = UV_ENOENT; +void uv__set_process_title_platform_init(void) { + /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ + *(void **)(&dynamic_pthread_setname_np) = + dlsym(RTLD_DEFAULT, "pthread_setname_np"); + +#if !TARGET_OS_IPHONE application_services_handle = dlopen("/System/Library/Frameworks/" "ApplicationServices.framework/" "Versions/A/ApplicationServices", @@ -116,8 +111,6 @@ int uv__set_process_title(const char* title) { goto out; } -#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) - launch_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); @@ -148,13 +141,14 @@ int uv__set_process_title(const char* title) { "CFBundleGetInfoDictionary"); *(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle, "CFBundleGetMainBundle"); + if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) goto out; /* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ hi_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); - err = UV_ENOENT; + if (hi_services_bundle == NULL) goto out; @@ -168,42 +162,38 @@ int uv__set_process_title(const char* title) { pCFBundleGetFunctionPointerForName( launch_services_bundle, S("_LSSetApplicationLaunchServicesServerConnectionStatus")); + if (pSetApplicationIsDaemon == NULL || pLSApplicationCheckIn == NULL || pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { goto out; } - if (pSetApplicationIsDaemon(1) != noErr) - goto out; - - pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); - - /* Check into process manager?! */ - pLSApplicationCheckIn(-2, - pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); - - asn = pLSGetCurrentApplicationASN(); - - err = UV_EINVAL; - if (pLSSetApplicationInformationItem(-2, /* Magic value. */ - asn, - *display_name_key, - S(title), - NULL) != noErr) { - goto out; - } - - uv__pthread_setname_np(title); /* Don't care if it fails. */ - err = 0; + return; out: - if (core_foundation_handle != NULL) - dlclose(core_foundation_handle); + uv__set_process_title_platform_fini(); +#endif /* !TARGET_OS_IPHONE */ +} - if (application_services_handle != NULL) - dlclose(application_services_handle); - return err; +void uv__set_process_title(const char* title) { +#if !TARGET_OS_IPHONE + if (core_foundation_handle != NULL && pSetApplicationIsDaemon(1) != noErr) { + CFTypeRef asn; + pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); + pLSApplicationCheckIn(/* Magic value */ -2, + pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); + asn = pLSGetCurrentApplicationASN(); + pLSSetApplicationInformationItem(/* Magic value */ -2, asn, + *display_name_key, S(title), NULL); + } #endif /* !TARGET_OS_IPHONE */ + + if (dynamic_pthread_setname_np != NULL) { + char namebuf[64]; /* MAXTHREADNAMESIZE */ + strncpy(namebuf, title, sizeof(namebuf) - 1); + namebuf[sizeof(namebuf) - 1] = '\0'; + dynamic_pthread_setname_np(namebuf); + } } diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index 70ccb13042fddb..0f729cfd4776a6 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -47,15 +47,6 @@ # define CP_INTR 4 #endif -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); @@ -159,76 +150,6 @@ void uv_loadavg(double avg[3]) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - int oid[4]; - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = getpid(); - - sysctl(oid, - ARRAY_SIZE(oid), - NULL, - NULL, - process_title, - strlen(process_title) + 1); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - int uv_resident_set_memory(size_t* rss) { struct kinfo_proc kinfo; size_t page_size; diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index 3db5f89c9503d2..9068d4b115b646 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -358,19 +358,22 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) { return n; } +#if defined(_POSIX_PATH_MAX) +# define UV__FS_PATH_MAX _POSIX_PATH_MAX +#elif defined(PATH_MAX) +# define UV__FS_PATH_MAX PATH_MAX +#else +# define UV__FS_PATH_MAX_FALLBACK 8192 +# define UV__FS_PATH_MAX UV__FS_PATH_MAX_FALLBACK +#endif static ssize_t uv__fs_pathmax_size(const char* path) { ssize_t pathmax; pathmax = pathconf(path, _PC_PATH_MAX); - if (pathmax == -1) { -#if defined(PATH_MAX) - return PATH_MAX; -#else -#error "PATH_MAX undefined in the current platform" -#endif - } + if (pathmax == -1) + pathmax = UV__FS_PATH_MAX; return pathmax; } @@ -381,7 +384,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { char* buf; char* newbuf; +#if defined(UV__FS_PATH_MAX_FALLBACK) + /* We may not have a real PATH_MAX. Read size of link. */ + struct stat st; + int ret; + ret = lstat(req->path, &st); + if (ret != 0) + return -1; + if (!S_ISLNK(st.st_mode)) { + errno = EINVAL; + return -1; + } + + maxlen = st.st_size; + + /* According to readlink(2) lstat can report st_size == 0 + for some symlinks, such as those in /proc or /sys. */ + if (maxlen == 0) + maxlen = uv__fs_pathmax_size(req->path); +#else maxlen = uv__fs_pathmax_size(req->path); +#endif + buf = uv__malloc(maxlen); if (buf == NULL) { @@ -419,9 +443,15 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { } static ssize_t uv__fs_realpath(uv_fs_t* req) { - ssize_t len; char* buf; +#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L + buf = realpath(req->path, NULL); + if (buf == NULL) + return -1; +#else + ssize_t len; + len = uv__fs_pathmax_size(req->path); buf = uv__malloc(len + 1); @@ -434,6 +464,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) { uv__free(buf); return -1; } +#endif req->ptr = buf; diff --git a/deps/uv/src/unix/getaddrinfo.c b/deps/uv/src/unix/getaddrinfo.c index 25827c1feeb6b3..6d23fbe02a8df3 100644 --- a/deps/uv/src/unix/getaddrinfo.c +++ b/deps/uv/src/unix/getaddrinfo.c @@ -27,6 +27,7 @@ #include "uv.h" #include "internal.h" +#include "idna.h" #include #include /* NULL */ @@ -141,15 +142,34 @@ int uv_getaddrinfo(uv_loop_t* loop, const char* hostname, const char* service, const struct addrinfo* hints) { + char hostname_ascii[256]; size_t hostname_len; size_t service_len; size_t hints_len; size_t len; char* buf; + long rc; if (req == NULL || (hostname == NULL && service == NULL)) return UV_EINVAL; + /* FIXME(bnoordhuis) IDNA does not seem to work z/OS, + * probably because it uses EBCDIC rather than ASCII. + */ +#ifdef __MVS__ + (void) &hostname_ascii; +#else + if (hostname != NULL) { + rc = uv__idna_toascii(hostname, + hostname + strlen(hostname), + hostname_ascii, + hostname_ascii + sizeof(hostname_ascii)); + if (rc < 0) + return rc; + hostname = hostname_ascii; + } +#endif + hostname_len = hostname ? strlen(hostname) + 1 : 0; service_len = service ? strlen(service) + 1 : 0; hints_len = hints ? sizeof(*hints) : 0; diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index cd79037102013e..72d8da8a508b88 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -185,7 +185,6 @@ int uv__nonblock_fcntl(int fd, int set); int uv__close(int fd); /* preserves errno */ int uv__close_nocheckstdio(int fd); int uv__socket(int domain, int type, int protocol); -int uv__dup(int fd); ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags); void uv__make_close_pending(uv_handle_t* handle); int uv__getiovmax(void); diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 75362eb76d7f5d..991d1c60aee3dc 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -826,9 +826,10 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { return !exclude_type; } -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { #ifndef HAVE_IFADDRS_H + *count = 0; + *addresses = NULL; return UV_ENOSYS; #else struct ifaddrs *addrs, *ent; @@ -836,12 +837,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int i; struct sockaddr_ll *sll; - if (getifaddrs(&addrs)) - return UV__ERR(errno); - *count = 0; *addresses = NULL; + if (getifaddrs(&addrs)) + return UV__ERR(errno); + /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent, UV__EXCLUDE_IFADDR)) @@ -850,8 +851,10 @@ int uv_interface_addresses(uv_interface_address_t** addresses, (*count)++; } - if (*count == 0) + if (*count == 0) { + freeifaddrs(addrs); return 0; + } *addresses = uv__malloc(*count * sizeof(**addresses)); if (!(*addresses)) { @@ -890,12 +893,13 @@ int uv_interface_addresses(uv_interface_address_t** addresses, continue; address = *addresses; - memset(address->phys_addr, 0, sizeof(address->phys_addr)); for (i = 0; i < (*count); i++) { if (strcmp(address->name, ent->ifa_name) == 0) { sll = (struct sockaddr_ll*)ent->ifa_addr; memcpy(address->phys_addr, sll->sll_addr, sizeof(address->phys_addr)); + } else { + memset(address->phys_addr, 0, sizeof(address->phys_addr)); } address++; } diff --git a/deps/uv/src/unix/netbsd.c b/deps/uv/src/unix/netbsd.c index 2605c114bca72d..4cfde1a586444c 100644 --- a/deps/uv/src/unix/netbsd.c +++ b/deps/uv/src/unix/netbsd.c @@ -40,15 +40,6 @@ #include #include -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); @@ -134,65 +125,6 @@ uint64_t uv_get_total_memory(void) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - setproctitle("%s", title); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - - int uv_resident_set_memory(size_t* rss) { kvm_t *kd = NULL; struct kinfo_proc2 *kinfo = NULL; diff --git a/deps/uv/src/unix/openbsd.c b/deps/uv/src/unix/openbsd.c index ce937cd3efec25..bffb58bcd9ff00 100644 --- a/deps/uv/src/unix/openbsd.c +++ b/deps/uv/src/unix/openbsd.c @@ -36,16 +36,6 @@ #include -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); } @@ -146,65 +136,6 @@ uint64_t uv_get_total_memory(void) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - setproctitle("%s", title); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - - int uv_resident_set_memory(size_t* rss) { struct kinfo_proc kinfo; size_t page_size = getpagesize(); diff --git a/deps/uv/src/unix/os390.c b/deps/uv/src/unix/os390.c index 65e9b708303668..b43aebfc926940 100644 --- a/deps/uv/src/unix/os390.c +++ b/deps/uv/src/unix/os390.c @@ -357,13 +357,11 @@ uint64_t uv_get_total_memory(void) { int uv_resident_set_memory(size_t* rss) { - char* psa; char* ascb; char* rax; size_t nframes; - psa = PSA_PTR; - ascb = *(char* __ptr32 *)(psa + PSAAOLD); + ascb = *(char* __ptr32 *)(PSA_PTR + PSAAOLD); rax = *(char* __ptr32 *)(ascb + ASCBRSME); nframes = *(unsigned int*)(rax + RAXFMCT); @@ -531,12 +529,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { struct ifreq* p; int count_v6; + *count = 0; + *addresses = NULL; + /* get the ipv6 addresses first */ uv_interface_address_t* addresses_v6; uv__interface_addresses_v6(&addresses_v6, &count_v6); /* now get the ipv4 addresses */ - *count = 0; /* Assume maximum buffer size allowable */ maxsize = 16384; @@ -578,6 +578,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + uv__close(sockfd); + return 0; + } + /* Alloc the return interface structs */ *addresses = uv__malloc((*count + count_v6) * sizeof(uv_interface_address_t)); @@ -752,7 +757,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { memcpy(reg_struct.__rfis_rftok, handle->rfis_rftok, sizeof(handle->rfis_rftok)); - /* + /* * This call will take "/" as the path argument in case we * don't care to supply the correct path. The system will simply * ignore it. @@ -988,7 +993,7 @@ void uv__set_process_title(const char* title) { } int uv__io_fork(uv_loop_t* loop) { - /* + /* Nullify the msg queue but don't close it because it is still being used by the parent. */ diff --git a/deps/uv/src/unix/proctitle.c b/deps/uv/src/unix/proctitle.c index 1a8c7a7090e8a6..a5ce2030c55be8 100644 --- a/deps/uv/src/unix/proctitle.c +++ b/deps/uv/src/unix/proctitle.c @@ -24,6 +24,7 @@ #include #include +extern void uv__set_process_title_platform_init(void); extern void uv__set_process_title(const char* title); static uv_mutex_t process_title_mutex; @@ -38,6 +39,9 @@ static struct { static void init_process_title_mutex_once(void) { uv_mutex_init(&process_title_mutex); +#ifdef __APPLE__ + uv__set_process_title_platform_init(); +#endif } diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c index b6b3dfea77a8d7..ec5ecd7d3ce6b9 100644 --- a/deps/uv/src/unix/sunos.c +++ b/deps/uv/src/unix/sunos.c @@ -692,6 +692,8 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { #ifdef SUNOS_NO_IFADDRS int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + *count = 0; + *addresses = NULL; return UV_ENOSYS; } #else /* SUNOS_NO_IFADDRS */ @@ -758,11 +760,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { struct ifaddrs* addrs; struct ifaddrs* ent; + *count = 0; + *addresses = NULL; + if (getifaddrs(&addrs)) return UV__ERR(errno); - *count = 0; - /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent)) @@ -770,6 +773,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + freeifaddrs(addrs); + return 0; + } + *addresses = uv__malloc(*count * sizeof(**addresses)); if (!(*addresses)) { freeifaddrs(addrs); diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index f0aec452606cb8..71d100a162f4ca 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -72,7 +72,9 @@ char* uv__strndup(const char* s, size_t n) { } void* uv__malloc(size_t size) { - return uv__allocator.local_malloc(size); + if (size > 0) + return uv__allocator.local_malloc(size); + return NULL; } void uv__free(void* ptr) { @@ -91,7 +93,10 @@ void* uv__calloc(size_t count, size_t size) { } void* uv__realloc(void* ptr, size_t size) { - return uv__allocator.local_realloc(ptr, size); + if (size > 0) + return uv__allocator.local_realloc(ptr, size); + uv__free(ptr); + return NULL; } int uv_replace_allocator(uv_malloc_func malloc_func, diff --git a/deps/uv/src/win/dl.c b/deps/uv/src/win/dl.c index 97ac1c1ad10012..5b84555ca4d57f 100644 --- a/deps/uv/src/win/dl.c +++ b/deps/uv/src/win/dl.c @@ -107,7 +107,8 @@ static int uv__dlerror(uv_lib_t* lib, const char* filename, DWORD errorno) { MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR) &lib->errmsg, 0, NULL); - if (!res && GetLastError() == ERROR_MUI_FILE_NOT_FOUND) { + if (!res && (GetLastError() == ERROR_MUI_FILE_NOT_FOUND || + GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND)) { res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 812c1a6de583d2..7ad0d077a6440b 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -42,6 +42,8 @@ #define UV_FS_FREE_PTR 0x0008 #define UV_FS_CLEANEDUP 0x0010 +#define UV__RENAME_RETRIES 4 +#define UV__RENAME_WAIT 250 #define INIT(subtype) \ do { \ @@ -1329,12 +1331,78 @@ static void fs__fstat(uv_fs_t* req) { static void fs__rename(uv_fs_t* req) { - if (!MoveFileExW(req->file.pathw, req->fs.info.new_pathw, MOVEFILE_REPLACE_EXISTING)) { + int tries; + int sys_errno; + int result; + int try_rmdir; + WCHAR* src, *dst; + DWORD src_attrib, dst_attrib; + + src = req->file.pathw; + dst = req->fs.info.new_pathw; + try_rmdir = 0; + + /* Do some checks to fail early. */ + src_attrib = GetFileAttributesW(src); + if (src_attrib == INVALID_FILE_ATTRIBUTES) { SET_REQ_WIN32_ERROR(req, GetLastError()); return; } + dst_attrib = GetFileAttributesW(dst); + if (dst_attrib != INVALID_FILE_ATTRIBUTES) { + if (dst_attrib & FILE_ATTRIBUTE_READONLY) { + req->result = UV_EPERM; + return; + } + /* Renaming folder to a folder name that already exist will fail on + * Windows. We will try to delete target folder first. + */ + if (src_attrib & FILE_ATTRIBUTE_DIRECTORY && + dst_attrib & FILE_ATTRIBUTE_DIRECTORY) + try_rmdir = 1; + } - SET_REQ_RESULT(req, 0); + /* Sometimes an antivirus or indexing software can lock the target or the + * source file/directory. This is annoying for users, in such cases we will + * retry couple of times with some delay before failing. + */ + for (tries = 0; tries < UV__RENAME_RETRIES; ++tries) { + if (tries > 0) + Sleep(UV__RENAME_WAIT); + + if (try_rmdir) { + result = _wrmdir(dst) == 0 ? 0 : uv_translate_sys_error(_doserrno); + switch (result) + { + case 0: + case UV_ENOENT: + /* Folder removed or did not exist at all. */ + try_rmdir = 0; + break; + case UV_ENOTEMPTY: + /* Non-empty target folder, fail instantly. */ + SET_REQ_RESULT(req, -1); + return; + default: + /* All other errors - try to move file anyway and handle the error + * there, retrying folder deletion next time around. + */ + break; + } + } + + if (MoveFileExW(src, dst, MOVEFILE_REPLACE_EXISTING) != 0) { + SET_REQ_RESULT(req, 0); + return; + } + + sys_errno = GetLastError(); + result = uv_translate_sys_error(sys_errno); + if (result != UV_EBUSY && result != UV_EPERM && result != UV_EACCES) + break; + } + req->sys_errno_ = sys_errno; + req->result = result; } diff --git a/deps/uv/src/win/getaddrinfo.c b/deps/uv/src/win/getaddrinfo.c index 614ea8e376e8af..dfab860a735e47 100644 --- a/deps/uv/src/win/getaddrinfo.c +++ b/deps/uv/src/win/getaddrinfo.c @@ -24,6 +24,7 @@ #include "uv.h" #include "internal.h" #include "req-inl.h" +#include "idna.h" /* EAI_* constants. */ #include @@ -259,11 +260,13 @@ int uv_getaddrinfo(uv_loop_t* loop, const char* node, const char* service, const struct addrinfo* hints) { + char hostname_ascii[256]; int nodesize = 0; int servicesize = 0; int hintssize = 0; char* alloc_ptr = NULL; int err; + long rc; if (req == NULL || (node == NULL && service == NULL)) { return UV_EINVAL; @@ -277,12 +280,19 @@ int uv_getaddrinfo(uv_loop_t* loop, /* calculate required memory size for all input values */ if (node != NULL) { - nodesize = ALIGNED_SIZE(MultiByteToWideChar(CP_UTF8, 0, node, -1, NULL, 0) * - sizeof(WCHAR)); + rc = uv__idna_toascii(node, + node + strlen(node), + hostname_ascii, + hostname_ascii + sizeof(hostname_ascii)); + if (rc < 0) + return rc; + nodesize = ALIGNED_SIZE(MultiByteToWideChar(CP_UTF8, 0, hostname_ascii, + -1, NULL, 0) * sizeof(WCHAR)); if (nodesize == 0) { err = GetLastError(); goto error; } + node = hostname_ascii; } if (service != NULL) { diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c index b47f203e9d9c7f..e7cccd9c80123f 100644 --- a/deps/uv/src/win/process.c +++ b/deps/uv/src/win/process.c @@ -964,6 +964,8 @@ int uv_spawn(uv_loop_t* loop, UV_PROCESS_SETGID | UV_PROCESS_SETUID | UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_HIDE_CONSOLE | + UV_PROCESS_WINDOWS_HIDE_GUI | UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); err = uv_utf8_to_utf16_alloc(options->file, &application); @@ -1065,7 +1067,8 @@ int uv_spawn(uv_loop_t* loop, process_flags = CREATE_UNICODE_ENVIRONMENT; - if (options->flags & UV_PROCESS_WINDOWS_HIDE) { + if ((options->flags & UV_PROCESS_WINDOWS_HIDE_CONSOLE) || + (options->flags & UV_PROCESS_WINDOWS_HIDE)) { /* Avoid creating console window if stdio is not inherited. */ for (i = 0; i < options->stdio_count; i++) { if (options->stdio[i].flags & UV_INHERIT_FD) @@ -1073,7 +1076,9 @@ int uv_spawn(uv_loop_t* loop, if (i == options->stdio_count - 1) process_flags |= CREATE_NO_WINDOW; } - + } + if ((options->flags & UV_PROCESS_WINDOWS_HIDE_GUI) || + (options->flags & UV_PROCESS_WINDOWS_HIDE)) { /* Use SW_HIDE to avoid any potential process window. */ startup.wShowWindow = SW_HIDE; } else { diff --git a/deps/uv/src/win/signal.c b/deps/uv/src/win/signal.c index 3d0b8a35b93ace..276dc609733320 100644 --- a/deps/uv/src/win/signal.c +++ b/deps/uv/src/win/signal.c @@ -190,7 +190,7 @@ int uv__signal_start(uv_signal_t* handle, int signum, int oneshot) { /* Test for invalid signal values. */ - if (signum != SIGWINCH && (signum <= 0 || signum >= NSIG)) + if (signum <= 0 || signum >= NSIG) return UV_EINVAL; /* Short circuit: if the signal watcher is already watching {signum} don't go diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index 8b6f0a5c99bd70..3ce5548c0a4d4a 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -945,6 +945,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req) { DWORD bytes, flags, err; uv_buf_t buf; + int count; assert(handle->type == UV_TCP); @@ -999,7 +1000,8 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, } /* Do nonblocking reads until the buffer is empty */ - while (handle->flags & UV_HANDLE_READING) { + count = 32; + while ((handle->flags & UV_HANDLE_READING) && (count-- > 0)) { buf = uv_buf_init(NULL, 0); handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); if (buf.base == NULL || buf.len == 0) { diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index 32ccf74ca8cb6a..398288ec1de53b 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -941,20 +941,15 @@ void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, handle->read_cb((uv_stream_t*) handle, uv_translate_sys_error(GET_REQ_ERROR(req)), &buf); - } else { - /* The read was cancelled, or whatever we don't care */ - handle->read_cb((uv_stream_t*) handle, 0, &buf); } - } else { - if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING)) { + if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING) && + req->u.io.overlapped.InternalHigh != 0) { /* Read successful. TODO: read unicode, convert to utf-8 */ DWORD bytes = req->u.io.overlapped.InternalHigh; handle->read_cb((uv_stream_t*) handle, bytes, &buf); - } else { - handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING; - handle->read_cb((uv_stream_t*) handle, 0, &buf); } + handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING; } /* Wait for more input events. */ diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index c994984fe65a25..6e81c26165fbc0 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -816,6 +816,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, int is_vista_or_greater; ULONG flags; + *addresses_ptr = NULL; + *count_ptr = 0; + is_vista_or_greater = is_windows_version_or_greater(6, 0, 0, 0); if (is_vista_or_greater) { flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | diff --git a/deps/uv/test/echo-server.c b/deps/uv/test/echo-server.c index bfed67675dd46a..a38e975d4841d6 100644 --- a/deps/uv/test/echo-server.c +++ b/deps/uv/test/echo-server.c @@ -340,6 +340,7 @@ HELPER_IMPL(tcp4_echo_server) { if (tcp4_echo_start(TEST_PORT)) return 1; + notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); return 0; } @@ -351,6 +352,7 @@ HELPER_IMPL(tcp6_echo_server) { if (tcp6_echo_start(TEST_PORT)) return 1; + notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); return 0; } @@ -362,6 +364,7 @@ HELPER_IMPL(pipe_echo_server) { if (pipe_echo_start(TEST_PIPENAME)) return 1; + notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); return 0; } @@ -373,6 +376,7 @@ HELPER_IMPL(udp4_echo_server) { if (udp4_echo_start(TEST_PORT)) return 1; + notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); return 0; } diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c index 9b8af0460877bd..42bde0bb96476d 100644 --- a/deps/uv/test/run-tests.c +++ b/deps/uv/test/run-tests.c @@ -109,20 +109,24 @@ static int maybe_run_test(int argc, char **argv) { } if (strcmp(argv[1], "spawn_helper1") == 0) { + notify_parent_process(); return 1; } if (strcmp(argv[1], "spawn_helper2") == 0) { + notify_parent_process(); printf("hello world\n"); return 1; } if (strcmp(argv[1], "spawn_tcp_server_helper") == 0) { + notify_parent_process(); return spawn_tcp_server_helper(); } if (strcmp(argv[1], "spawn_helper3") == 0) { char buffer[256]; + notify_parent_process(); ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); buffer[sizeof(buffer) - 1] = '\0'; fputs(buffer, stdout); @@ -130,12 +134,14 @@ static int maybe_run_test(int argc, char **argv) { } if (strcmp(argv[1], "spawn_helper4") == 0) { + notify_parent_process(); /* Never surrender, never return! */ while (1) uv_sleep(10000); } if (strcmp(argv[1], "spawn_helper5") == 0) { const char out[] = "fourth stdio!\n"; + notify_parent_process(); #ifdef _WIN32 DWORD bytes; WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL); @@ -156,6 +162,8 @@ static int maybe_run_test(int argc, char **argv) { if (strcmp(argv[1], "spawn_helper6") == 0) { int r; + notify_parent_process(); + r = fprintf(stdout, "hello world\n"); ASSERT(r > 0); @@ -168,6 +176,9 @@ static int maybe_run_test(int argc, char **argv) { if (strcmp(argv[1], "spawn_helper7") == 0) { int r; char *test; + + notify_parent_process(); + /* Test if the test value from the parent is still set */ test = getenv("ENV_TEST"); ASSERT(test != NULL); @@ -181,6 +192,8 @@ static int maybe_run_test(int argc, char **argv) { #ifndef _WIN32 if (strcmp(argv[1], "spawn_helper8") == 0) { int fd; + + notify_parent_process(); ASSERT(sizeof(fd) == read(0, &fd, sizeof(fd))); ASSERT(fd > 2); ASSERT(-1 == write(fd, "x", 1)); @@ -190,6 +203,7 @@ static int maybe_run_test(int argc, char **argv) { #endif /* !_WIN32 */ if (strcmp(argv[1], "spawn_helper9") == 0) { + notify_parent_process(); return spawn_stdin_stdout(); } @@ -200,6 +214,7 @@ static int maybe_run_test(int argc, char **argv) { ASSERT(uid == getuid()); ASSERT(gid == getgid()); + notify_parent_process(); return 1; } diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c index de0db0cc486d6a..432cf33d482cd9 100644 --- a/deps/uv/test/runner-unix.c +++ b/deps/uv/test/runner-unix.c @@ -40,6 +40,31 @@ #include #include +extern char** environ; + +static void closefd(int fd) { + if (close(fd) == 0 || errno == EINTR || errno == EINPROGRESS) + return; + + perror("close"); + abort(); +} + + +void notify_parent_process(void) { + char* arg; + int fd; + + arg = getenv("UV_TEST_RUNNER_FD"); + if (arg == NULL) + return; + + fd = atoi(arg); + assert(fd > STDERR_FILENO); + unsetenv("UV_TEST_RUNNER_FD"); + closefd(fd); +} + /* Do platform-specific initialization. */ int platform_init(int argc, char **argv) { @@ -64,9 +89,31 @@ int process_start(char* name, char* part, process_info_t* p, int is_helper) { int stdout_fd; const char* arg; char* args[16]; + int pipefd[2]; + char fdstr[8]; + ssize_t rc; int n; pid_t pid; + arg = getenv("UV_USE_VALGRIND"); + n = 0; + + /* Disable valgrind for helpers, it complains about helpers leaking memory. + * They're killed after the test and as such never get a chance to clean up. + */ + if (is_helper == 0 && arg != NULL && atoi(arg) != 0) { + args[n++] = "valgrind"; + args[n++] = "--quiet"; + args[n++] = "--leak-check=full"; + args[n++] = "--show-reachable=yes"; + args[n++] = "--error-exitcode=125"; + } + + args[n++] = executable_path; + args[n++] = name; + args[n++] = part; + args[n++] = NULL; + stdout_file = tmpfile(); stdout_fd = fileno(stdout_file); if (!stdout_file) { @@ -74,6 +121,19 @@ int process_start(char* name, char* part, process_info_t* p, int is_helper) { return -1; } + if (is_helper) { + if (pipe(pipefd)) { + perror("pipe"); + return -1; + } + + snprintf(fdstr, sizeof(fdstr), "%d", pipefd[1]); + if (setenv("UV_TEST_RUNNER_FD", fdstr, /* overwrite */ 1)) { + perror("setenv"); + return -1; + } + } + p->terminated = 0; p->status = 0; @@ -86,29 +146,12 @@ int process_start(char* name, char* part, process_info_t* p, int is_helper) { if (pid == 0) { /* child */ - arg = getenv("UV_USE_VALGRIND"); - n = 0; - - /* Disable valgrind for helpers, it complains about helpers leaking memory. - * They're killed after the test and as such never get a chance to clean up. - */ - if (is_helper == 0 && arg != NULL && atoi(arg) != 0) { - args[n++] = "valgrind"; - args[n++] = "--quiet"; - args[n++] = "--leak-check=full"; - args[n++] = "--show-reachable=yes"; - args[n++] = "--error-exitcode=125"; - } - - args[n++] = executable_path; - args[n++] = name; - args[n++] = part; - args[n++] = NULL; - + if (is_helper) + closefd(pipefd[0]); dup2(stdout_fd, STDOUT_FILENO); dup2(stdout_fd, STDERR_FILENO); - execvp(args[0], args); - perror("execvp()"); + execve(args[0], args, environ); + perror("execve()"); _exit(127); } @@ -117,6 +160,28 @@ int process_start(char* name, char* part, process_info_t* p, int is_helper) { p->name = strdup(name); p->stdout_file = stdout_file; + if (!is_helper) + return 0; + + closefd(pipefd[1]); + unsetenv("UV_TEST_RUNNER_FD"); + + do + rc = read(pipefd[0], &n, 1); + while (rc == -1 && errno == EINTR); + + closefd(pipefd[0]); + + if (rc == -1) { + perror("read"); + return -1; + } + + if (rc > 0) { + fprintf(stderr, "EOF expected but got data.\n"); + return -1; + } + return 0; } diff --git a/deps/uv/test/runner-win.c b/deps/uv/test/runner-win.c index aa52d7cc5aa9a6..e3e91a7b69ca62 100644 --- a/deps/uv/test/runner-win.c +++ b/deps/uv/test/runner-win.c @@ -76,6 +76,11 @@ int process_start(char *name, char *part, process_info_t *p, int is_helper) { PROCESS_INFORMATION pi; DWORD result; + if (!is_helper) { + /* Give the helpers time to settle. Race-y, fix this. */ + uv_sleep(250); + } + if (GetTempPathW(sizeof(path) / sizeof(WCHAR), (WCHAR*)&path) == 0) goto error; if (GetTempFileNameW((WCHAR*)&path, L"uv", 0, (WCHAR*)&filename) == 0) diff --git a/deps/uv/test/runner.c b/deps/uv/test/runner.c index f017902a04f7c8..aec560a59dbc5c 100644 --- a/deps/uv/test/runner.c +++ b/deps/uv/test/runner.c @@ -215,9 +215,6 @@ int run_test(const char* test, process_count++; } - /* Give the helpers time to settle. Race-y, fix this. */ - uv_sleep(250); - /* Now start the test itself. */ for (task = TASKS; task->main; task++) { if (strcmp(test, task->task_name) != 0) { diff --git a/deps/uv/test/task.h b/deps/uv/test/task.h index 92a90a540be34f..282c02d50ce42d 100644 --- a/deps/uv/test/task.h +++ b/deps/uv/test/task.h @@ -181,6 +181,12 @@ extern int snprintf(char*, size_t, const char*, ...); # define UNUSED #endif +#if defined(_WIN32) +#define notify_parent_process() ((void) 0) +#else +extern void notify_parent_process(void); +#endif + /* Fully close a loop */ static void close_walk_cb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 01f5a7b0236514..038d2dd6159245 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -3037,6 +3037,60 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { return 0; } +TEST_IMPL(fs_read_dir) { + int r; + char buf[2]; + loop = uv_default_loop(); + + /* Setup */ + rmdir("test_dir"); + r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); + ASSERT(mkdir_cb_count == 1); + /* Setup Done Here */ + + /* Get a file descriptor for the directory */ + r = uv_fs_open(loop, + &open_req1, + "test_dir", + UV_FS_O_RDONLY | UV_FS_O_DIRECTORY, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + uv_fs_req_cleanup(&open_req1); + + /* Try to read data from the directory */ + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, 0, NULL); +#if defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) || \ + defined(__DragonFly__) || \ + defined(_AIX) || \ + defined(__sun) || \ + defined(__MVS__) + /* + * As of now, these operating systems support reading from a directory, + * that too depends on the filesystem this temporary test directory is + * created on. That is why this assertion is a bit lenient. + */ + ASSERT((r >= 0) || (r == UV_EISDIR)); +#else + ASSERT(r == UV_EISDIR); +#endif + uv_fs_req_cleanup(&read_req); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + rmdir("test_dir"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} #ifdef _WIN32 diff --git a/deps/uv/test/test-idna.c b/deps/uv/test/test-idna.c new file mode 100644 index 00000000000000..b76853cb996ecc --- /dev/null +++ b/deps/uv/test/test-idna.c @@ -0,0 +1,195 @@ +/* Copyright The libuv project and contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "task.h" +#include "../src/idna.c" +#include + +TEST_IMPL(utf8_decode1) { + const char* p; + char b[32]; + int i; + + /* ASCII. */ + p = b; + snprintf(b, sizeof(b), "%c\x7F", 0x00); + ASSERT(0 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 1); + ASSERT(127 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 2); + + /* Two-byte sequences. */ + p = b; + snprintf(b, sizeof(b), "\xC2\x80\xDF\xBF"); + ASSERT(128 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 2); + ASSERT(0x7FF == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 4); + + /* Three-byte sequences. */ + p = b; + snprintf(b, sizeof(b), "\xE0\xA0\x80\xEF\xBF\xBF"); + ASSERT(0x800 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 3); + ASSERT(0xFFFF == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 6); + + /* Four-byte sequences. */ + p = b; + snprintf(b, sizeof(b), "\xF0\x90\x80\x80\xF4\x8F\xBF\xBF"); + ASSERT(0x10000 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 4); + ASSERT(0x10FFFF == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 8); + + /* Four-byte sequences > U+10FFFF; disallowed. */ + p = b; + snprintf(b, sizeof(b), "\xF4\x90\xC0\xC0\xF7\xBF\xBF\xBF"); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 4); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 8); + + /* Overlong; disallowed. */ + p = b; + snprintf(b, sizeof(b), "\xC0\x80\xC1\x80"); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 2); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 4); + + /* Surrogate pairs; disallowed. */ + p = b; + snprintf(b, sizeof(b), "\xED\xA0\x80\xED\xA3\xBF"); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 3); + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + 6); + + /* Simply illegal. */ + p = b; + snprintf(b, sizeof(b), "\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"); + + for (i = 1; i <= 8; i++) { + ASSERT((unsigned) -1 == uv__utf8_decode1(&p, b + sizeof(b))); + ASSERT(p == b + i); + } + + return 0; +} + +/* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */ +#ifndef __MVS__ + +#define F(input, err) \ + do { \ + char d[256] = {0}; \ + static const char s[] = "" input ""; \ + ASSERT(err == uv__idna_toascii(s, s + sizeof(s) - 1, d, d + sizeof(d))); \ + } while (0) + +#define T(input, expected) \ + do { \ + long n; \ + char d1[256] = {0}; \ + char d2[256] = {0}; \ + static const char s[] = "" input ""; \ + n = uv__idna_toascii(s, s + sizeof(s) - 1, d1, d1 + sizeof(d1)); \ + ASSERT(n == sizeof(expected)); \ + ASSERT(0 == memcmp(d1, expected, n)); \ + /* Sanity check: encoding twice should not change the output. */ \ + n = uv__idna_toascii(d1, d1 + strlen(d1), d2, d2 + sizeof(d2)); \ + ASSERT(n == sizeof(expected)); \ + ASSERT(0 == memcmp(d2, expected, n)); \ + ASSERT(0 == memcmp(d1, d2, sizeof(d2))); \ + } while (0) + +TEST_IMPL(idna_toascii) { + /* Illegal inputs. */ + F("\xC0\x80\xC1\x80", UV_EINVAL); /* Overlong UTF-8 sequence. */ + F("\xC0\x80\xC1\x80.com", UV_EINVAL); /* Overlong UTF-8 sequence. */ + /* No conversion. */ + T("", ""); + T(".", "."); + T(".com", ".com"); + T("example", "example"); + T("example-", "example-"); + T("straße.de", "xn--strae-oqa.de"); + /* Test cases adapted from punycode.js. Most are from RFC 3492. */ + T("foo.bar", "foo.bar"); + T("mañana.com", "xn--maana-pta.com"); + T("example.com.", "example.com."); + T("bücher.com", "xn--bcher-kva.com"); + T("café.com", "xn--caf-dma.com"); + T("café.café.com", "xn--caf-dma.xn--caf-dma.com"); + T("☃-⌘.com", "xn----dqo34k.com"); + T("퐀☃-⌘.com", "xn----dqo34kn65z.com"); + T("💩.la", "xn--ls8h.la"); + T("mañana.com", "xn--maana-pta.com"); + T("mañana。com", "xn--maana-pta.com"); + T("mañana.com", "xn--maana-pta.com"); + T("mañana。com", "xn--maana-pta.com"); + T("ü", "xn--tda"); + T(".ü", ".xn--tda"); + T("ü.ü", "xn--tda.xn--tda"); + T("ü.ü.", "xn--tda.xn--tda."); + T("üëäö♥", "xn--4can8av2009b"); + T("Willst du die Blüthe des frühen, die Früchte des späteren Jahres", + "xn--Willst du die Blthe des frhen, " + "die Frchte des spteren Jahres-x9e96lkal"); + T("ليهمابتكلموشعربي؟", "xn--egbpdaj6bu4bxfgehfvwxn"); + T("他们为什么不说中文", "xn--ihqwcrb4cv8a8dqg056pqjye"); + T("他們爲什麽不說中文", "xn--ihqwctvzc91f659drss3x8bo0yb"); + T("Pročprostěnemluvíčesky", "xn--Proprostnemluvesky-uyb24dma41a"); + T("למההםפשוטלאמדבריםעברית", "xn--4dbcagdahymbxekheh6e0a7fei0b"); + T("यहलोगहिन्दीक्योंनहींबोलसकतेहैं", + "xn--i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd"); + T("なぜみんな日本語を話してくれないのか", + "xn--n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa"); + T("세계의모든사람들이한국어를이해한다면얼마나좋을까", + "xn--989aomsvi5e83db1d2a355cv1e0vak1d" + "wrv93d5xbh15a0dt30a5jpsd879ccm6fea98c"); + T("почемужеонинеговорятпорусски", "xn--b1abfaaepdrnnbgefbadotcwatmq2g4l"); + T("PorquénopuedensimplementehablarenEspañol", + "xn--PorqunopuedensimplementehablarenEspaol-fmd56a"); + T("TạisaohọkhôngthểchỉnóitiếngViệt", + "xn--TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g"); + T("3年B組金八先生", "xn--3B-ww4c5e180e575a65lsy2b"); + T("安室奈美恵-with-SUPER-MONKEYS", + "xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n"); + T("Hello-Another-Way-それぞれの場所", + "xn--Hello-Another-Way--fc4qua05auwb3674vfr0b"); + T("ひとつ屋根の下2", "xn--2-u9tlzr9756bt3uc0v"); + T("MajiでKoiする5秒前", "xn--MajiKoi5-783gue6qz075azm5e"); + T("パフィーdeルンバ", "xn--de-jg4avhby1noc0d"); + T("そのスピードで", "xn--d9juau41awczczp"); + T("-> $1.00 <-", "-> $1.00 <-"); + /* Test cases from https://unicode.org/reports/tr46/ */ + T("faß.de", "xn--fa-hia.de"); + T("βόλος.com", "xn--nxasmm1c.com"); + T("ශ්‍රී.com", "xn--10cl1a0b660p.com"); + T("نامه‌ای.com", "xn--mgba3gch31f060k.com"); + return 0; +} + +#undef T + +#endif /* __MVS__ */ diff --git a/deps/uv/test/test-ipc-heavy-traffic-deadlock-bug.c b/deps/uv/test/test-ipc-heavy-traffic-deadlock-bug.c index 240fc64588b413..325305a6442fcf 100644 --- a/deps/uv/test/test-ipc-heavy-traffic-deadlock-bug.c +++ b/deps/uv/test/test-ipc-heavy-traffic-deadlock-bug.c @@ -150,6 +150,7 @@ int ipc_helper_heavy_traffic_deadlock_bug(void) { r = uv_pipe_open(&pipe, 0); ASSERT(r == 0); + notify_parent_process(); do_writes_and_reads((uv_stream_t*) &pipe); uv_sleep(100); diff --git a/deps/uv/test/test-ipc-send-recv.c b/deps/uv/test/test-ipc-send-recv.c index 3dedc86b8b0170..166225c01c6b52 100644 --- a/deps/uv/test/test-ipc-send-recv.c +++ b/deps/uv/test/test-ipc-send-recv.c @@ -397,6 +397,7 @@ int run_ipc_send_recv_helper(uv_loop_t* loop, int inprocess) { send_recv_start(); } + notify_parent_process(); r = uv_run(loop, UV_RUN_DEFAULT); ASSERT(r == 0); diff --git a/deps/uv/test/test-ipc.c b/deps/uv/test/test-ipc.c index 200f68d6000a77..829d178d47fe7a 100644 --- a/deps/uv/test/test-ipc.c +++ b/deps/uv/test/test-ipc.c @@ -724,6 +724,7 @@ int ipc_helper(int listen_after_write) { ASSERT(r == 0); } + notify_parent_process(); r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); ASSERT(r == 0); diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 1bd062da3d2e4b..46db4b2710138f 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -346,6 +346,7 @@ TEST_DECLARE (fs_partial_read) TEST_DECLARE (fs_partial_write) TEST_DECLARE (fs_file_pos_after_op_with_offset) TEST_DECLARE (fs_null_req) +TEST_DECLARE (fs_read_dir) #ifdef _WIN32 TEST_DECLARE (fs_exclusive_sharing_mode) TEST_DECLARE (fs_open_readonly_acl) @@ -441,6 +442,9 @@ TEST_DECLARE (fork_threadpool_queue_work_simple) #endif #endif +TEST_DECLARE (idna_toascii) +TEST_DECLARE (utf8_decode1) + TASK_LIST_START TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000) @@ -897,6 +901,7 @@ TASK_LIST_START TEST_ENTRY (fs_read_write_null_arguments) TEST_ENTRY (fs_file_pos_after_op_with_offset) TEST_ENTRY (fs_null_req) + TEST_ENTRY (fs_read_dir) #ifdef _WIN32 TEST_ENTRY (fs_exclusive_sharing_mode) TEST_ENTRY (fs_open_readonly_acl) @@ -944,6 +949,13 @@ TASK_LIST_START #endif #endif + TEST_ENTRY (utf8_decode1) + +/* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */ +#ifndef __MVS__ + TEST_ENTRY (idna_toascii) +#endif + #if 0 /* These are for testing the test runner. */ TEST_ENTRY (fail_always) diff --git a/deps/uv/test/test-process-title-threadsafe.c b/deps/uv/test/test-process-title-threadsafe.c index cc3fd41a136833..c0dee48a79f22f 100644 --- a/deps/uv/test/test-process-title-threadsafe.c +++ b/deps/uv/test/test-process-title-threadsafe.c @@ -25,11 +25,7 @@ #include -#ifdef __APPLE__ -# define NUM_ITERATIONS 10 -#else -# define NUM_ITERATIONS 50 -#endif +#define NUM_ITERATIONS 50 static const char* titles[] = { "8L2NY0Kdj0XyNFZnmUZigIOfcWjyNr0SkMmUhKw99VLUsZFrvCQQC3XIRfNR8pjyMjXObllled", diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index 4fcd905eed7500..594a64c60b8d5a 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -1172,6 +1172,7 @@ TEST_IMPL(argument_escaping) { for (i = 0; i < count; ++i) { free(test_output[i]); } + free(test_output); result = make_program_args(verbatim, 1, &verbatim_output); ASSERT(result == 0); diff --git a/deps/uv/test/test-stdio-over-pipes.c b/deps/uv/test/test-stdio-over-pipes.c index 15744761049d84..a130ff6a9bc0c1 100644 --- a/deps/uv/test/test-stdio-over-pipes.c +++ b/deps/uv/test/test-stdio-over-pipes.c @@ -232,6 +232,7 @@ int stdio_over_pipes_helper(void) { ASSERT(r == 0); } + notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); ASSERT(after_write_called == 7); diff --git a/deps/uv/test/test.gyp b/deps/uv/test/test.gyp index 855eda1c50003a..098512208c3cf8 100644 --- a/deps/uv/test/test.gyp +++ b/deps/uv/test/test.gyp @@ -46,6 +46,7 @@ 'test-homedir.c', 'test-hrtime.c', 'test-idle.c', + 'test-idna.c', 'test-ip6-addr.c', 'test-ipc-heavy-traffic-deadlock-bug.c', 'test-ipc-send-recv.c', diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 5148a850ab4c15..746d1ed5416322 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -70,6 +70,8 @@ 'include/uv/version.h', 'src/fs-poll.c', 'src/heap-inl.h', + 'src/idna.c', + 'src/idna.h', 'src/inet.c', 'src/queue.h', 'src/threadpool.c', @@ -326,7 +328,10 @@ 'sources': [ 'src/unix/netbsd.c' ], }], [ 'OS in "freebsd dragonflybsd openbsd netbsd".split()', { - 'sources': [ 'src/unix/posix-hrtime.c' ], + 'sources': [ + 'src/unix/posix-hrtime.c', + 'src/unix/bsd-proctitle.c' + ], }], [ 'OS in "ios mac freebsd dragonflybsd openbsd netbsd".split()', { 'sources': [ From c5e32fdebfccc429f8b10a6893a14fd466c13f04 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 13 Nov 2018 10:52:44 -0800 Subject: [PATCH 004/316] build: remove unnecessary prerequisite in Makefile bench-addons-build is not needed by test-ci. PR-URL: https://github.com/nodejs/node/pull/24342 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c2afde30a3d28..2c6efa7b9afb44 100644 --- a/Makefile +++ b/Makefile @@ -455,7 +455,7 @@ test-ci-js: | clear-stalled .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info -test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build +test-ci: | clear-stalled build-addons build-addons-napi doc-only out/Release/cctest --gtest_output=tap:cctest.tap $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ From 85f92016871c626d52d2ed74c610c851cda64cfd Mon Sep 17 00:00:00 2001 From: Charalampos Fanoulis <38255093+cfanoulis@users.noreply.github.com> Date: Thu, 15 Nov 2018 14:51:01 +0200 Subject: [PATCH 005/316] doc: update collaborator guide with LTS labels PR-URL: https://github.com/nodejs/node/pull/24379 Reviewed-By: Richard Lau Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- COLLABORATOR_GUIDE.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index ec3b0a8bf503fb..deadf87ed15092 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -794,8 +794,8 @@ TSC for further discussion. #### How are LTS Branches Managed? -There are multiple LTS branches, e.g. `v8.x` and `v6.x`. Each of these is paired -with a staging branch: `v8.x-staging` and `v6.x-staging`. +There are multiple LTS branches, e.g. `v10.x` and `v8.x`. Each of these is +paired with a staging branch: `v10.x-staging` and `v8.x-staging`. As commits land on the master branch, they are cherry-picked back to each staging branch as appropriate. If the commit applies only to the LTS branch, the @@ -817,14 +817,18 @@ on backporting, please see the [backporting guide][]. Several LTS related issue and PR labels have been provided: -* `lts-watch-v6.x` - tells the LTS WG that the issue/PR needs to be considered - for landing in the `v6.x-staging` branch. -* `lts-watch-v4.x` - tells the LTS WG that the issue/PR needs to be considered - for landing in the `v4.x-staging` branch. +* `lts-watch-v10.x` - tells the LTS WG that the issue/PR needs to be + considered for landing in the `v10.x-staging` branch. +* `lts-watch-v8.x` - tells the LTS WG that the issue/PR needs to be + considered for landing in the `v8.x-staging` branch. +* `lts-watch-v6.x` - tells the LTS WG that the issue/PR needs to be + considered for landing in the `v6.x-staging` branch. +* `land-on-v10.x` - tells the release team that the commit should be landed + in a future v10.x release. +* `land-on-v8.x` - tells the release team that the commit should be landed + in a future v8.x release. * `land-on-v6.x` - tells the release team that the commit should be landed - in a future v6.x release -* `land-on-v4.x` - tells the release team that the commit should be landed - in a future v4.x release + in a future v6.x release. Any Collaborator can attach these labels to any PR/issue. As commits are landed into the staging branches, the `lts-watch-` label will be removed. From b9a4bc15c227ab7cc917a92258fc09ec8f293c27 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Tue, 13 Nov 2018 16:04:45 +0900 Subject: [PATCH 006/316] tools: update remark version to v10 from v8 Including the below two updates: + https://github.com/remarkjs/remark/releases/tag/9.0.0 + https://github.com/remarkjs/remark/releases/tag/10.0.0 PR-URL: https://github.com/nodejs/node/pull/24333 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius --- .../node-lint-md-cli-rollup/package-lock.json | 52 +++++++++++++------ tools/node-lint-md-cli-rollup/package.json | 2 +- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index 2d37506884a12b..fb2dcaa492829b 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -1951,13 +1951,13 @@ } }, "remark": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz", - "integrity": "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz", + "integrity": "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==", "requires": { - "remark-parse": "^4.0.0", - "remark-stringify": "^4.0.0", - "unified": "^6.0.0" + "remark-parse": "^6.0.0", + "remark-stringify": "^6.0.0", + "unified": "^7.0.0" } }, "remark-lint": { @@ -2341,9 +2341,9 @@ } }, "remark-parse": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-4.0.0.tgz", - "integrity": "sha512-XZgICP2gJ1MHU7+vQaRM+VA9HEL3X253uwUM/BGgx3iv6TH2B3bF3B8q00DKcyP9YrJV+/7WOWEWBFF/u8cIsw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-6.0.2.tgz", + "integrity": "sha512-cBbst7OG/pH+VHYggWRabpVn9EP6CUb2hAtSg9cPysRvf+NE1v2cRdXC+TfXumJCar/wpPDK833zPu1fwVanZw==", "requires": { "collapse-white-space": "^1.0.2", "is-alphabetical": "^1.0.0", @@ -2351,7 +2351,7 @@ "is-whitespace-character": "^1.0.0", "is-word-character": "^1.0.0", "markdown-escapes": "^1.0.0", - "parse-entities": "^1.0.2", + "parse-entities": "^1.1.0", "repeat-string": "^1.5.4", "state-toggle": "^1.0.0", "trim": "0.0.1", @@ -2405,9 +2405,9 @@ } }, "remark-stringify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-4.0.0.tgz", - "integrity": "sha512-xLuyKTnuQer3ke9hkU38SUYLiTmS078QOnoFavztmbt/pAJtNSkNtFgR0U//uCcmG0qnyxao+PDuatQav46F1w==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-6.0.3.tgz", + "integrity": "sha512-/x4EsH7uiqmTAe6/s1HmwaIeJm5Gq8pI+TpGB+t/uwrfSJW0x+ZuXezSLQ0z8bT7vhrR31yUkHwm3qkkVuo/5Q==", "requires": { "ccount": "^1.0.0", "is-alphanumeric": "^1.0.0", @@ -2958,16 +2958,34 @@ } }, "unified": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", - "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/unified/-/unified-7.0.1.tgz", + "integrity": "sha512-8bUzPn/gVVkLgZKKjmGMjFDi7tg/y+KmGcvbzdvkIP+9q77AZvg7u1jNLKlsXr6rrOzppFWzNpduumn8jLKOsg==", "requires": { "bail": "^1.0.0", "extend": "^3.0.0", "is-plain-obj": "^1.1.0", "trough": "^1.0.0", - "vfile": "^2.0.0", + "vfile": "^3.0.0", "x-is-string": "^0.1.0" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + }, + "vfile": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz", + "integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==", + "requires": { + "is-buffer": "^2.0.0", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + } } }, "unified-args": { diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index b3d491717d4d2f..128ba8b0d2ef90 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "markdown-extensions": "^1.1.0", - "remark": "^8.0.0", + "remark": "^10.0.0", "remark-lint": "^6.0.2", "remark-preset-lint-node": "^1.1.0", "unified-args": "^6.0.0", From 7ffc8b7778a7f56fa7ad261eb072c383118e690d Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Tue, 13 Nov 2018 17:50:06 +0900 Subject: [PATCH 007/316] tools: update remark-lint to v6.0.3 from v6.0.2 PR-URL: https://github.com/nodejs/node/pull/24333 Refs: https://github.com/remarkjs/remark-lint/releases/tag/6.0.3 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius --- tools/node-lint-md-cli-rollup/package-lock.json | 6 +++--- tools/node-lint-md-cli-rollup/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index fb2dcaa492829b..f49f22797d2b8c 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -1961,9 +1961,9 @@ } }, "remark-lint": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-6.0.2.tgz", - "integrity": "sha512-zrIx7InZLLOUYUViT6lSa8T80pDyl3Ywvliog+4hoc7LoiJZRV74ejq+RBZK70bg/p2dU/CV6ycedgypFFePPg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-6.0.3.tgz", + "integrity": "sha512-PQkF5vQos3iCJ7kXcvGLG/06UoC4cL1h6JORludnClFQYKIeWi9Z6HHLTJl439Q95OLf6ywwOdaKIU5Vul/Thg==", "requires": { "remark-message-control": "^4.0.0" } diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 128ba8b0d2ef90..3fec3f64e72de4 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -11,7 +11,7 @@ "dependencies": { "markdown-extensions": "^1.1.0", "remark": "^10.0.0", - "remark-lint": "^6.0.2", + "remark-lint": "^6.0.3", "remark-preset-lint-node": "^1.1.0", "unified-args": "^6.0.0", "unified-engine": "^5.1.0" From 5748e862b0dcf78af5d01fd7a8b8021f24e7dd63 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Tue, 13 Nov 2018 18:23:17 +0900 Subject: [PATCH 008/316] tools: fix `make lint-md-rollup` and run it PR-URL: https://github.com/nodejs/node/pull/24333 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius --- Makefile | 4 +- tools/lint-md.js | 4429 +++++++++++++++++++++++++--------------------- 2 files changed, 2441 insertions(+), 1992 deletions(-) diff --git a/Makefile b/Makefile index 2c6efa7b9afb44..3d828f71f80bb6 100644 --- a/Makefile +++ b/Makefile @@ -1060,13 +1060,11 @@ bench-addons-clean: .PHONY: lint-md-rollup lint-md-rollup: - cd tools/node-lint-md-cli-rollup/remark-preset-lint-node && npm up - cd tools/node-lint-md-cli-rollup && npm up + cd tools/node-lint-md-cli-rollup && npm install cd tools/node-lint-md-cli-rollup && npm run build-node .PHONY: lint-md-clean lint-md-clean: - $(RM) -r tools/node-lint-md-cli-rollup/remark-preset-lint-node/node_modules $(RM) -r tools/node-lint-md-cli-rollup/node_modules $(RM) tools/.*mdlintstamp diff --git a/tools/lint-md.js b/tools/lint-md.js index cbb658dd418932..f13c25fca78913 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -14537,28 +14537,240 @@ function bail(err) { } } -var toString$4 = Object.prototype.toString; +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ -var isPlainObj = function (x) { - var prototype; - return toString$4.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +var isBuffer$1 = function isBuffer (obj) { + return obj != null && obj.constructor != null && + typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) }; -/* Dependencies. */ +var core$6 = VFile$2; + +var own$2 = {}.hasOwnProperty; +var proto$3 = VFile$2.prototype; + +proto$3.toString = toString$4; + +// Order of setting (least specific to most), we need this because otherwise +// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a +// stem can be set. +var order$1 = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; + +// Construct a new file. +function VFile$2(options) { + var prop; + var index; + var length; + + if (!options) { + options = {}; + } else if (typeof options === 'string' || isBuffer$1(options)) { + options = {contents: options}; + } else if ('message' in options && 'messages' in options) { + return options + } + + if (!(this instanceof VFile$2)) { + return new VFile$2(options) + } + + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = process.cwd(); + + // Set path related properties in the correct order. + index = -1; + length = order$1.length; + + while (++index < length) { + prop = order$1[index]; + + if (own$2.call(options, prop)) { + this[prop] = options[prop]; + } + } + + // Set non-path related properties. + for (prop in options) { + if (order$1.indexOf(prop) === -1) { + this[prop] = options[prop]; + } + } +} + +// Access full path (`~/index.min.js`). +Object.defineProperty(proto$3, 'path', { + get: function() { + return this.history[this.history.length - 1] + }, + set: function(path$$1) { + assertNonEmpty$1(path$$1, 'path'); + + if (path$$1 !== this.path) { + this.history.push(path$$1); + } + } +}); + +// Access parent path (`~`). +Object.defineProperty(proto$3, 'dirname', { + get: function() { + return typeof this.path === 'string' ? path.dirname(this.path) : undefined + }, + set: function(dirname) { + assertPath$1(this.path, 'dirname'); + this.path = path.join(dirname || '', this.basename); + } +}); + +// Access basename (`index.min.js`). +Object.defineProperty(proto$3, 'basename', { + get: function() { + return typeof this.path === 'string' ? path.basename(this.path) : undefined + }, + set: function(basename) { + assertNonEmpty$1(basename, 'basename'); + assertPart$1(basename, 'basename'); + this.path = path.join(this.dirname || '', basename); + } +}); + +// Access extname (`.js`). +Object.defineProperty(proto$3, 'extname', { + get: function() { + return typeof this.path === 'string' ? path.extname(this.path) : undefined + }, + set: function(extname) { + var ext = extname || ''; + + assertPart$1(ext, 'extname'); + assertPath$1(this.path, 'extname'); + + if (ext) { + if (ext.charAt(0) !== '.') { + throw new Error('`extname` must start with `.`') + } + + if (ext.indexOf('.', 1) !== -1) { + throw new Error('`extname` cannot contain multiple dots') + } + } + + this.path = replaceExt_1(this.path, ext); + } +}); + +// Access stem (`index.min`). +Object.defineProperty(proto$3, 'stem', { + get: function() { + return typeof this.path === 'string' + ? path.basename(this.path, this.extname) + : undefined + }, + set: function(stem) { + assertNonEmpty$1(stem, 'stem'); + assertPart$1(stem, 'stem'); + this.path = path.join(this.dirname || '', stem + (this.extname || '')); + } +}); + +// Get the value of the file. +function toString$4(encoding) { + var value = this.contents || ''; + return isBuffer$1(value) ? value.toString(encoding) : String(value) +} + +// Assert that `part` is not a path (i.e., does not contain `path.sep`). +function assertPart$1(part, name) { + if (part.indexOf(path.sep) !== -1) { + throw new Error( + '`' + name + '` cannot be a path: did not expect `' + path.sep + '`' + ) + } +} + +// Assert that `part` is not empty. +function assertNonEmpty$1(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty') + } +} + +// Assert `path` exists. +function assertPath$1(path$$1, name) { + if (!path$$1) { + throw new Error('Setting `' + name + '` requires `path` to be set too') + } +} + +var vfile$5 = core$6; + +var proto$4 = core$6.prototype; + +proto$4.message = message$1; +proto$4.info = info$1; +proto$4.fail = fail$1; + +// Slight backwards compatibility. Remove in the future. +proto$4.warn = message$1; + +// Create a message with `reason` at `position`. When an error is passed in as +// `reason`, copies the stack. +function message$1(reason, position, origin) { + var filePath = this.path; + var message = new vfileMessage(reason, position, origin); + + if (filePath) { + message.name = filePath + ':' + message.name; + message.file = filePath; + } + + message.fatal = false; + + this.messages.push(message); + + return message +} + +// Fail. Creates a vmessage, associates it with the file, and throws it. +function fail$1() { + var message = this.message.apply(this, arguments); + + message.fatal = true; + throw message +} +// Info. Creates a vmessage, associates it with the file, and marks the +// fatality as null. +function info$1() { + var message = this.message.apply(this, arguments); + message.fatal = null; + return message +} +var toString$5 = Object.prototype.toString; +var isPlainObj = function (x) { + var prototype; + return toString$5.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +}; -/* Expose a frozen processor. */ +// Expose a frozen processor. var unified_1 = unified().freeze(); var slice$3 = [].slice; -var own$2 = {}.hasOwnProperty; +var own$3 = {}.hasOwnProperty; -/* Process pipeline. */ +// Process pipeline. var pipeline = trough_1() .use(pipelineParse) .use(pipelineRun) @@ -14586,7 +14798,7 @@ function pipelineStringify(p, ctx) { ctx.file.contents = p.stringify(ctx.tree, ctx.file); } -/* Function to create the first processor. */ +// Function to create the first processor. function unified() { var attachers = []; var transformers = trough_1(); @@ -14594,17 +14806,17 @@ function unified() { var frozen = false; var freezeIndex = -1; - /* Data management. */ + // Data management. processor.data = data; - /* Lock. */ + // Lock. processor.freeze = freeze; - /* Plug-ins. */ + // Plugins. processor.attachers = attachers; processor.use = use; - /* API. */ + // API. processor.parse = parse; processor.stringify = stringify; processor.run = run; @@ -14612,11 +14824,10 @@ function unified() { processor.process = process; processor.processSync = processSync; - /* Expose. */ + // Expose. return processor - /* Create a new processor based on the processor - * in the current scope. */ + // Create a new processor based on the processor in the current scope. function processor() { var destination = unified(); var length = attachers.length; @@ -14631,15 +14842,13 @@ function unified() { return destination } - /* Freeze: used to signal a processor that has finished - * configuration. - * - * For example, take unified itself. It’s frozen. - * Plug-ins should not be added to it. Rather, it should - * be extended, by invoking it, before modifying it. - * - * In essence, always invoke this when exporting a - * processor. */ + // Freeze: used to signal a processor that has finished configuration. + // + // For example, take unified itself. It’s frozen. Plugins should not be + // added to it. Rather, it should be extended, by invoking it, before + // modifying it. + // + // In essence, always invoke this when exporting a processor. function freeze() { var values; var plugin; @@ -14677,11 +14886,10 @@ function unified() { return processor } - /* Data management. - * Getter / setter for processor-specific informtion. */ + // Data management. Getter / setter for processor-specific informtion. function data(key, value) { if (xIsString(key)) { - /* Set `key`. */ + // Set `key`. if (arguments.length === 2) { assertUnfrozen('data', frozen); @@ -14690,35 +14898,35 @@ function unified() { return processor } - /* Get `key`. */ - return (own$2.call(namespace, key) && namespace[key]) || null + // Get `key`. + return (own$3.call(namespace, key) && namespace[key]) || null } - /* Set space. */ + // Set space. if (key) { assertUnfrozen('data', frozen); namespace = key; return processor } - /* Get space. */ + // Get space. return namespace } - /* Plug-in management. - * - * Pass it: - * * an attacher and options, - * * a preset, - * * a list of presets, attachers, and arguments (list - * of attachers and options). */ + // Plugin management. + // + // Pass it: + // * an attacher and options, + // * a preset, + // * a list of presets, attachers, and arguments (list of attachers and + // options). function use(value) { var settings; assertUnfrozen('use', frozen); if (value === null || value === undefined) { - /* Empty */ + // Empty. } else if (typeof value === 'function') { addPlugin.apply(null, arguments); } else if (typeof value === 'object') { @@ -14764,7 +14972,7 @@ function unified() { var index; if (plugins === null || plugins === undefined) { - /* Empty */ + // Empty. } else if (typeof plugins === 'object' && 'length' in plugins) { length = plugins.length; index = -1; @@ -14806,11 +15014,10 @@ function unified() { } } - /* Parse a file (in string or VFile representation) - * into a Unist node using the `Parser` on the - * processor. */ + // Parse a file (in string or vfile representation) into a unist node using + // the `Parser` on the processor. function parse(doc) { - var file = vfile(doc); + var file = vfile$5(doc); var Parser; freeze(); @@ -14824,8 +15031,8 @@ function unified() { return Parser(String(file), file) // eslint-disable-line new-cap } - /* Run transforms on a Unist node representation of a file - * (in string or VFile representation), async. */ + // Run transforms on a unist node representation of a file (in string or + // vfile representation), async. function run(node, file, cb) { assertNode(node); freeze(); @@ -14842,7 +15049,7 @@ function unified() { executor(null, cb); function executor(resolve, reject) { - transformers.run(node, vfile(file), done); + transformers.run(node, vfile$5(file), done); function done(err, tree, file) { tree = tree || node; @@ -14857,8 +15064,8 @@ function unified() { } } - /* Run transforms on a Unist node representation of a file - * (in string or VFile representation), sync. */ + // Run transforms on a unist node representation of a file (in string or + // vfile representation), sync. function runSync(node, file) { var complete = false; var result; @@ -14876,11 +15083,10 @@ function unified() { } } - /* Stringify a Unist node representation of a file - * (in string or VFile representation) into a string - * using the `Compiler` on the processor. */ + // Stringify a unist node representation of a file (in string or vfile + // representation) into a string using the `Compiler` on the processor. function stringify(node, doc) { - var file = vfile(doc); + var file = vfile$5(doc); var Compiler; freeze(); @@ -14895,11 +15101,10 @@ function unified() { return Compiler(node, file) // eslint-disable-line new-cap } - /* Parse a file (in string or VFile representation) - * into a Unist node using the `Parser` on the processor, - * then run transforms on that node, and compile the - * resulting node using the `Compiler` on the processor, - * and store that result on the VFile. */ + // Parse a file (in string or vfile representation) into a unist node using + // the `Parser` on the processor, then run transforms on that node, and + // compile the resulting node using the `Compiler` on the processor, and + // store that result on the vfile. function process(doc, cb) { freeze(); assertParser('process', processor.Parser); @@ -14912,7 +15117,7 @@ function unified() { executor(null, cb); function executor(resolve, reject) { - var file = vfile(doc); + var file = vfile$5(doc); pipeline.run(processor, {file: file}, done); @@ -14928,8 +15133,7 @@ function unified() { } } - /* Process the given document (in string or VFile - * representation), sync. */ + // Process the given document (in string or vfile representation), sync. function processSync(doc) { var complete = false; var file; @@ -14937,7 +15141,7 @@ function unified() { freeze(); assertParser('processSync', processor.Parser); assertCompiler('processSync', processor.Compiler); - file = vfile(doc); + file = vfile$5(doc); process(file, done); @@ -14952,12 +15156,12 @@ function unified() { } } -/* Check if `func` is a constructor. */ +// Check if `func` is a constructor. function newable(value) { return typeof value === 'function' && keys(value.prototype) } -/* Check if `value` is an object with keys. */ +// Check if `value` is an object with keys. function keys(value) { var key; for (key in value) { @@ -14966,41 +15170,39 @@ function keys(value) { return false } -/* Assert a parser is available. */ +// Assert a parser is available. function assertParser(name, Parser) { if (typeof Parser !== 'function') { throw new Error('Cannot `' + name + '` without `Parser`') } } -/* Assert a compiler is available. */ +// Assert a compiler is available. function assertCompiler(name, Compiler) { if (typeof Compiler !== 'function') { throw new Error('Cannot `' + name + '` without `Compiler`') } } -/* Assert the processor is not frozen. */ +// Assert the processor is not frozen. function assertUnfrozen(name, frozen) { if (frozen) { throw new Error( - [ - 'Cannot invoke `' + name + '` on a frozen processor.\nCreate a new ', - 'processor first, by invoking it: use `processor()` instead of ', - '`processor`.' - ].join('') + 'Cannot invoke `' + + name + + '` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.' ) } } -/* Assert `node` is a Unist node. */ +// Assert `node` is a unist node. function assertNode(node) { if (!node || !xIsString(node.type)) { throw new Error('Expected node, got `' + node + '`') } } -/* Assert that `complete` is `true`. */ +// Assert that `complete` is `true`. function assertDone(name, asyncName, complete) { if (!complete) { throw new Error( @@ -15150,16 +15352,16 @@ function indices(value) { var _unescape = factory$2; -/* Factory to de-escape a value, based on a list at `key` - * in `ctx`. */ +var backslash = '\\'; + +// Factory to de-escape a value, based on a list at `key` in `ctx`. function factory$2(ctx, key) { - return unescape; + return unescape - /* De-escape a string using the expression at `key` - * in `ctx`. */ + // De-escape a string using the expression at `key` in `ctx`. function unescape(value) { var prev = 0; - var index = value.indexOf('\\'); + var index = value.indexOf(backslash); var escape = ctx[key]; var queue = []; var character; @@ -15169,18 +15371,17 @@ function factory$2(ctx, key) { prev = index + 1; character = value.charAt(prev); - /* If the following character is not a valid escape, - * add the slash. */ + // If the following character is not a valid escape, add the slash. if (!character || escape.indexOf(character) === -1) { - queue.push('\\'); + queue.push(backslash); } - index = value.indexOf('\\', prev); + index = value.indexOf(backslash, prev + 1); } queue.push(value.slice(prev)); - return queue.join(''); + return queue.join('') } } @@ -17238,7 +17439,7 @@ const oplus = "⊕"; const or = "∨"; const orarr = "↻"; const ord = "º"; -const order$1 = "ℴ"; +const order$2 = "ℴ"; const orderof = "ℴ"; const ordf$1 = "ª"; const ordm$1 = "º"; @@ -19459,7 +19660,7 @@ var index$4 = { or: or, orarr: orarr, ord: ord, - order: order$1, + order: order$2, orderof: orderof, ordf: ordf$1, ordm: ordm$1, @@ -21684,7 +21885,7 @@ var characterEntities = Object.freeze({ or: or, orarr: orarr, ord: ord, - order: order$1, + order: order$2, orderof: orderof, ordf: ordf$1, ordm: ordm$1, @@ -22262,10 +22463,10 @@ var characterEntities$1 = ( characterEntities && index$4 ) || characterEntities; var decodeEntity_1 = decodeEntity; -var own$3 = {}.hasOwnProperty; +var own$4 = {}.hasOwnProperty; function decodeEntity(characters) { - return own$3.call(characterEntities$1, characters) + return own$4.call(characterEntities$1, characters) ? characterEntities$1[characters] : false } @@ -22276,7 +22477,7 @@ var invalid = ( characterReferenceInvalid && index$3 ) || characterReferenceInva var parseEntities_1 = parseEntities; -var own$4 = {}.hasOwnProperty; +var own$5 = {}.hasOwnProperty; var fromCharCode = String.fromCharCode; var noop$1 = Function.prototype; @@ -22503,7 +22704,7 @@ function parse$7(value, settings) { * last viable named reference. This * ensures we do not need to walk backwards * later. */ - if (type === NAMED && own$4.call(legacy, characters)) { + if (type === NAMED && own$5.call(legacy, characters)) { entityCharacters = characters; entity = legacy[characters]; } @@ -22715,13 +22916,13 @@ function disallowed(code) { var decode$1 = factory$3; -/* Factory to create an entity decoder. */ +// Factory to create an entity decoder. function factory$3(ctx) { decoder.raw = decodeRaw; - return decoder; + return decoder - /* Normalize `position` to add an `indent`. */ + // Normalize `position` to add an `indent`. function normalize(position) { var offsets = ctx.offset; var line = position.line; @@ -22729,30 +22930,16 @@ function factory$3(ctx) { while (++line) { if (!(line in offsets)) { - break; + break } result.push((offsets[line] || 0) + 1); } - return { - start: position, - indent: result - }; - } - - /* Handle a warning. - * See https://github.com/wooorm/parse-entities - * for the warnings. */ - function handleWarning(reason, position, code) { - if (code === 3) { - return; - } - - ctx.file.message(reason, position); + return {start: position, indent: result} } - /* Decode `value` (at `position`) into text-nodes. */ + // Decode `value` (at `position`) into text-nodes. function decoder(value, position, handler) { parseEntities_1(value, { position: normalize(position), @@ -22764,65 +22951,30 @@ function factory$3(ctx) { }); } - /* Decode `value` (at `position`) into a string. */ - function decodeRaw(value, position) { - return parseEntities_1(value, { - position: normalize(position), - warning: handleWarning - }); + // Decode `value` (at `position`) into a string. + function decodeRaw(value, position, options) { + return parseEntities_1( + value, + immutable(options, {position: normalize(position), warning: handleWarning}) + ) } -} - -var tokenizer = factory$4; - -var MERGEABLE_NODES = { - text: mergeText, - blockquote: mergeBlockquote -}; - -/* Check whether a node is mergeable with adjacent nodes. */ -function mergeable(node) { - var start; - var end; - if (node.type !== 'text' || !node.position) { - return true; + // Handle a warning. + // See for the warnings. + function handleWarning(reason, position, code) { + if (code !== 3) { + ctx.file.message(reason, position); + } } - - start = node.position.start; - end = node.position.end; - - /* Only merge nodes which occupy the same size as their - * `value`. */ - return start.line !== end.line || - end.column - start.column === node.value.length; -} - -/* Merge two text nodes: `node` into `prev`. */ -function mergeText(prev, node) { - prev.value += node.value; - - return prev; } -/* Merge two blockquotes: `node` into `prev`, unless in - * CommonMark mode. */ -function mergeBlockquote(prev, node) { - if (this.options.commonmark) { - return node; - } - - prev.children = prev.children.concat(node.children); - - return prev; -} +var tokenizer = factory$4; -/* Construct a tokenizer. This creates both - * `tokenizeInline` and `tokenizeBlock`. */ +// Construct a tokenizer. This creates both `tokenizeInline` and `tokenizeBlock`. function factory$4(type) { - return tokenize; + return tokenize - /* Tokenizer for a bound `type`. */ + // Tokenizer for a bound `type`. function tokenize(value, location) { var self = this; var offset = self.offset; @@ -22838,23 +22990,21 @@ function factory$4(type) { var matched; var valueLength; - /* Trim white space only lines. */ + // Trim white space only lines. if (!value) { - return tokens; + return tokens } - /* Expose on `eat`. */ + // Expose on `eat`. eat.now = now; eat.file = self.file; - /* Sync initial offset. */ + // Sync initial offset. updatePosition(''); - /* Iterate over `value`, and iterate over all - * tokenizers. When one eats something, re-iterate - * with the remaining value. If no tokenizer eats, - * something failed (should not happen) and an - * exception is thrown. */ + // Iterate over `value`, and iterate over all tokenizers. When one eats + // something, re-iterate with the remaining value. If no tokenizer eats, + // something failed (should not happen) and an exception is thrown. while (value) { index = -1; length = methods.length; @@ -22878,7 +23028,7 @@ function factory$4(type) { matched = valueLength !== value.length; if (matched) { - break; + break } } } @@ -22891,10 +23041,9 @@ function factory$4(type) { self.eof = now(); - return tokens; + return tokens - /* Update line, column, and offset based on - * `value`. */ + // Update line, column, and offset based on `value`. function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); @@ -22920,15 +23069,15 @@ function factory$4(type) { } } - /* Get offset. Called before the first character is - * eaten to retrieve the range's offsets. */ + // Get offset. Called before the first character is eaten to retrieve the + // range’s offsets. function getOffset() { var indentation = []; var pos = line + 1; - /* Done. Called when the last character is - * eaten to retrieve the range’s offsets. */ - return function () { + // Done. Called when the last character is eaten to retrieve the range’s + // offsets. + return function() { var last = line + 1; while (pos < last) { @@ -22937,49 +23086,47 @@ function factory$4(type) { pos++; } - return indentation; - }; + return indentation + } } - /* Get the current position. */ + // Get the current position. function now() { var pos = {line: line, column: column}; pos.offset = self.toOffset(pos); - return pos; + return pos } - /* Store position information for a node. */ + // Store position information for a node. function Position(start) { this.start = start; this.end = now(); } - /* Throw when a value is incorrectly eaten. - * This shouldn’t happen but will throw on new, - * incorrect rules. */ + // Throw when a value is incorrectly eaten. This shouldn’t happen but will + // throw on new, incorrect rules. function validateEat(subvalue) { /* istanbul ignore if */ if (value.substring(0, subvalue.length) !== subvalue) { - /* Capture stack-trace. */ + // Capture stack-trace. self.file.fail( new Error( - 'Incorrectly eaten value: please report this ' + - 'warning on http://git.io/vg5Ft' + 'Incorrectly eaten value: please report this warning on https://git.io/vg5Ft' ), now() ); } } - /* Mark position and patch `node.position`. */ + // Mark position and patch `node.position`. function position() { var before = now(); - return update; + return update - /* Add the position to a node. */ + // Add the position to a node. function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; @@ -22989,14 +23136,11 @@ function factory$4(type) { node.position = new Position(start); - /* If there was already a `position`, this - * node was merged. Fixing `start` wasn’t - * hard, but the indent is different. - * Especially because some information, the - * indent between `n` and `l` wasn’t - * tracked. Luckily, that space is - * (should be?) empty, so we can safely - * check for it now. */ + // If there was already a `position`, this node was merged. Fixing + // `start` wasn’t hard, but the indent is different. Especially + // because some information, the indent between `n` and `l` wasn’t + // tracked. Luckily, that space is (should be?) empty, so we can + // safely check for it now. if (prev && indent && prev.indent) { combined = prev.indent; @@ -23013,24 +23157,26 @@ function factory$4(type) { node.position.indent = indent || []; - return node; + return node } } - /* Add `node` to `parent`s children or to `tokens`. - * Performs merges where possible. */ + // Add `node` to `parent`s children or to `tokens`. Performs merges where + // possible. function add(node, parent) { var children = parent ? parent.children : tokens; var prev = children[children.length - 1]; + var fn; if ( prev && node.type === prev.type && - node.type in MERGEABLE_NODES && + (node.type === 'text' || node.type === 'blockquote') && mergeable(prev) && mergeable(node) ) { - node = MERGEABLE_NODES[node.type].call(self, prev, node); + fn = node.type === 'text' ? mergeText : mergeBlockquote; + node = fn.call(self, prev, node); } if (node !== prev) { @@ -23041,11 +23187,11 @@ function factory$4(type) { self.exitStart(); } - return node; + return node } - /* Remove `subvalue` from `value`. - * `subvalue` must be at the start of `value`. */ + // Remove `subvalue` from `value`. `subvalue` must be at the start of + // `value`. function eat(subvalue) { var indent = getOffset(); var pos = position(); @@ -23063,21 +23209,18 @@ function factory$4(type) { indent = indent(); - return apply; + return apply - /* Add the given arguments, add `position` to - * the returned node, and return the node. */ + // Add the given arguments, add `position` to the returned node, and + // return the node. function apply(node, parent) { - return pos(add(pos(node), parent), indent); + return pos(add(pos(node), parent), indent) } - /* Functions just like apply, but resets the - * content: the line and column are reversed, - * and the eaten value is re-added. - * This is useful for nodes with a single - * type of content, such as lists and tables. - * See `apply` above for what parameters are - * expected. */ + // Functions just like apply, but resets the content: the line and + // column are reversed, and the eaten value is re-added. This is + // useful for nodes with a single type of content, such as lists and + // tables. See `apply` above for what parameters are expected. function reset() { var node = apply.apply(null, arguments); @@ -23085,11 +23228,10 @@ function factory$4(type) { column = current.column; value = subvalue + value; - return node; + return node } - /* Test the position, after eating, and reverse - * to a not-eaten state. */ + // Test the position, after eating, and reverse to a not-eaten state. function test() { var result = pos({}); @@ -23097,12 +23239,48 @@ function factory$4(type) { column = current.column; value = subvalue + value; - return result.position; + return result.position } } } } +// Check whether a node is mergeable with adjacent nodes. +function mergeable(node) { + var start; + var end; + + if (node.type !== 'text' || !node.position) { + return true + } + + start = node.position.start; + end = node.position.end; + + // Only merge nodes which occupy the same size as their `value`. + return ( + start.line !== end.line || end.column - start.column === node.value.length + ) +} + +// Merge two text nodes: `node` into `prev`. +function mergeText(prev, node) { + prev.value += node.value; + + return prev +} + +// Merge two blockquotes: `node` into `prev`, unless in CommonMark mode. +function mergeBlockquote(prev, node) { + if (this.options.commonmark) { + return node + } + + prev.children = prev.children.concat(node.children); + + return prev +} + var markdownEscapes = escapes; var defaults$1 = [ @@ -23160,80 +23338,73 @@ function escapes(options) { } var blockElements = [ - "address", - "article", - "aside", - "base", - "basefont", - "blockquote", - "body", - "caption", - "center", - "col", - "colgroup", - "dd", - "details", - "dialog", - "dir", - "div", - "dl", - "dt", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "frame", - "frameset", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "iframe", - "legend", - "li", - "link", - "main", - "menu", - "menuitem", - "meta", - "nav", - "noframes", - "ol", - "optgroup", - "option", - "p", - "param", - "pre", - "section", - "source", - "title", - "summary", - "table", - "tbody", - "td", - "tfoot", - "th", - "thead", - "title", - "tr", - "track", - "ul" -] -; - -var blockElements$1 = Object.freeze({ - default: blockElements -}); - -var require$$0$15 = ( blockElements$1 && blockElements ) || blockElements$1; + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hgroup', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'meta', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'pre', + 'section', + 'source', + 'title', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +]; var defaults$2 = { position: true, @@ -23241,7 +23412,7 @@ var defaults$2 = { commonmark: false, footnotes: false, pedantic: false, - blocks: require$$0$15 + blocks: blockElements }; var setOptions_1 = setOptions; @@ -23257,10 +23428,7 @@ function setOptions(options) { } else if (typeof options === 'object') { options = immutable(options); } else { - throw new Error( - 'Invalid value `' + options + '` ' + - 'for setting `options`' - ); + throw new Error('Invalid value `' + options + '` for setting `options`') } for (key in defaults$2) { @@ -23274,7 +23442,9 @@ function setOptions(options) { (key !== 'blocks' && typeof value !== 'boolean') || (key === 'blocks' && typeof value !== 'object') ) { - throw new Error('Invalid value `' + value + '` for setting `options.' + key + '`'); + throw new Error( + 'Invalid value `' + value + '` for setting `options.' + key + '`' + ) } options[key] = value; @@ -23283,7 +23453,7 @@ function setOptions(options) { self.options = options; self.escape = markdownEscapes(options); - return self; + return self } /* eslint-disable max-params */ @@ -23511,10 +23681,10 @@ function soft(node) { var parse_1$3 = parse$8; -var C_NEWLINE = '\n'; -var EXPRESSION_LINE_BREAKS = /\r\n|\r/g; +var lineFeed = '\n'; +var lineBreaksExpression = /\r\n|\r/g; -/* Parse the bound file. */ +// Parse the bound file. function parse$8() { var self = this; var value = String(self.file); @@ -23522,12 +23692,12 @@ function parse$8() { var content = immutable(start); var node; - /* Clean non-unix newlines: `\r\n` and `\r` are all - * changed to `\n`. This should not affect positional - * information. */ - value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE); + // Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`. + // This should not affect positional information. + value = value.replace(lineBreaksExpression, lineFeed); - if (value.charCodeAt(0) === 0xFEFF) { + // BOM. + if (value.charCodeAt(0) === 0xfeff) { value = value.slice(1); content.column++; @@ -23537,17 +23707,14 @@ function parse$8() { node = { type: 'root', children: self.tokenizeBlock(value, content), - position: { - start: start, - end: self.eof || immutable(start) - } + position: {start: start, end: self.eof || immutable(start)} }; if (!self.options.position) { unistUtilRemovePosition(node, true); } - return node; + return node } var isWhitespaceCharacter = whitespace; @@ -23565,7 +23732,8 @@ function whitespace(character) { var newline_1 = newline; -/* Tokenise newline. */ +var lineFeed$1 = '\n'; + function newline(eat, value, silent) { var character = value.charAt(0); var length; @@ -23573,13 +23741,13 @@ function newline(eat, value, silent) { var queue; var index; - if (character !== '\n') { - return; + if (character !== lineFeed$1) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } index = 1; @@ -23591,12 +23759,12 @@ function newline(eat, value, silent) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } queue += character; - if (character === '\n') { + if (character === lineFeed$1) { subvalue += queue; queue = ''; } @@ -23625,14 +23793,13 @@ function trimTrailingLines(value) { var codeIndented = indentedCode; -var C_NEWLINE$1 = '\n'; -var C_TAB = '\t'; -var C_SPACE = ' '; +var lineFeed$2 = '\n'; +var tab = '\t'; +var space = ' '; -var CODE_INDENT_COUNT = 4; -var CODE_INDENT = repeatString(C_SPACE, CODE_INDENT_COUNT); +var tabSize = 4; +var codeIndent = repeatString(space, tabSize); -/* Tokenise indented code. */ function indentedCode(eat, value, silent) { var index = -1; var length = value.length; @@ -23655,7 +23822,7 @@ function indentedCode(eat, value, silent) { subvalueQueue = ''; contentQueue = ''; - if (character === C_NEWLINE$1) { + if (character === lineFeed$2) { subvalueQueue = character; contentQueue = character; } else { @@ -23665,10 +23832,10 @@ function indentedCode(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (!character || character === C_NEWLINE$1) { + if (!character || character === lineFeed$2) { contentQueue = character; subvalueQueue = character; - break; + break } subvalue += character; @@ -23676,27 +23843,27 @@ function indentedCode(eat, value, silent) { } } } else if ( - character === C_SPACE && + character === space && value.charAt(index + 1) === character && value.charAt(index + 2) === character && value.charAt(index + 3) === character ) { - subvalueQueue += CODE_INDENT; + subvalueQueue += codeIndent; index += 3; indent = true; - } else if (character === C_TAB) { + } else if (character === tab) { subvalueQueue += character; indent = true; } else { blankQueue = ''; - while (character === C_TAB || character === C_SPACE) { + while (character === tab || character === space) { blankQueue += character; character = value.charAt(++index); } - if (character !== C_NEWLINE$1) { - break; + if (character !== lineFeed$2) { + break } subvalueQueue += blankQueue + character; @@ -23706,31 +23873,32 @@ function indentedCode(eat, value, silent) { if (content) { if (silent) { - return true; + return true } return eat(subvalue)({ type: 'code', lang: null, + meta: null, value: trimTrailingLines_1(content) - }); + }) } } var codeFenced = fencedCode; -var C_NEWLINE$2 = '\n'; -var C_TAB$1 = '\t'; -var C_SPACE$1 = ' '; -var C_TILDE = '~'; -var C_TICK = '`'; +var lineFeed$3 = '\n'; +var tab$1 = '\t'; +var space$1 = ' '; +var tilde$1 = '~'; +var graveAccent = '`'; -var MIN_FENCE_COUNT = 3; -var CODE_INDENT_COUNT$1 = 4; +var minFenceCount = 3; +var tabSize$1 = 4; function fencedCode(eat, value, silent) { var self = this; - var settings = self.options; + var gfm = self.options.gfm; var length = value.length + 1; var index = 0; var subvalue = ''; @@ -23738,6 +23906,8 @@ function fencedCode(eat, value, silent) { var marker; var character; var flag; + var lang; + var meta; var queue; var content; var exdentedContent; @@ -23746,16 +23916,16 @@ function fencedCode(eat, value, silent) { var indent; var now; - if (!settings.gfm) { - return; + if (!gfm) { + return } - /* Eat initial spacing. */ + // Eat initial spacing. while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$1 && character !== C_TAB$1) { - break; + if (character !== space$1 && character !== tab$1) { + break } subvalue += character; @@ -23764,11 +23934,11 @@ function fencedCode(eat, value, silent) { indent = index; - /* Eat the fence. */ + // Eat the fence. character = value.charAt(index); - if (character !== C_TILDE && character !== C_TICK) { - return; + if (character !== tilde$1 && character !== graveAccent) { + return } index++; @@ -23780,7 +23950,7 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); if (character !== marker) { - break; + break } subvalue += character; @@ -23788,23 +23958,23 @@ function fencedCode(eat, value, silent) { index++; } - if (fenceCount < MIN_FENCE_COUNT) { - return; + if (fenceCount < minFenceCount) { + return } - /* Eat spacing before flag. */ + // Eat spacing before flag. while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$1 && character !== C_TAB$1) { - break; + if (character !== space$1 && character !== tab$1) { + break } subvalue += character; index++; } - /* Eat flag. */ + // Eat flag. flag = ''; queue = ''; @@ -23812,14 +23982,14 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); if ( - character === C_NEWLINE$2 || - character === C_TILDE || - character === C_TICK + character === lineFeed$3 || + character === tilde$1 || + character === graveAccent ) { - break; + break } - if (character === C_SPACE$1 || character === C_TAB$1) { + if (character === space$1 || character === tab$1) { queue += character; } else { flag += queue + character; @@ -23831,12 +24001,12 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); - if (character && character !== C_NEWLINE$2) { - return; + if (character && character !== lineFeed$3) { + return } if (silent) { - return true; + return true } now = eat.now(); @@ -23856,7 +24026,7 @@ function fencedCode(eat, value, silent) { content = ''; exdentedContent = ''; - /* Eat content. */ + // Eat content. while (index < length) { character = value.charAt(index); content += closing; @@ -23864,16 +24034,15 @@ function fencedCode(eat, value, silent) { closing = ''; exdentedClosing = ''; - if (character !== C_NEWLINE$2) { + if (character !== lineFeed$3) { content += character; exdentedClosing += character; index++; - continue; + continue } - /* Add the newline to `subvalue` if its the first - * character. Otherwise, add it to the `closing` - * queue. */ + // Add the newline to `subvalue` if its the first character. Otherwise, + // add it to the `closing` queue. if (content) { closing += character; exdentedClosing += character; @@ -23887,8 +24056,8 @@ function fencedCode(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$1) { - break; + if (character !== space$1) { + break } queue += character; @@ -23898,8 +24067,8 @@ function fencedCode(eat, value, silent) { closing += queue; exdentedClosing += queue.slice(indent); - if (queue.length >= CODE_INDENT_COUNT$1) { - continue; + if (queue.length >= tabSize$1) { + continue } queue = ''; @@ -23908,7 +24077,7 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); if (character !== marker) { - break; + break } queue += character; @@ -23919,7 +24088,7 @@ function fencedCode(eat, value, silent) { exdentedClosing += queue; if (queue.length < fenceCount) { - continue; + continue } queue = ''; @@ -23927,8 +24096,8 @@ function fencedCode(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$1 && character !== C_TAB$1) { - break; + if (character !== space$1 && character !== tab$1) { + break } closing += character; @@ -23936,18 +24105,36 @@ function fencedCode(eat, value, silent) { index++; } - if (!character || character === C_NEWLINE$2) { - break; + if (!character || character === lineFeed$3) { + break } } subvalue += content + closing; + // Get lang and meta from the flag. + index = -1; + length = flag.length; + + while (++index < length) { + character = flag.charAt(index); + + if (character === space$1 || character === tab$1) { + if (!lang) { + lang = flag.slice(0, index); + } + } else if (lang) { + meta = flag.slice(index); + break + } + } + return eat(subvalue)({ type: 'code', - lang: flag || null, + lang: lang || flag || null, + meta: meta || null, value: trimTrailingLines_1(exdentedContent) - }); + }) } var trim_1 = createCommonjsModule(function (module, exports) { @@ -23972,53 +24159,44 @@ var trim_3 = trim_1.right; var interrupt_1 = interrupt; function interrupt(interruptors, tokenizers, ctx, params) { - var bools = ['pedantic', 'commonmark']; - var count = bools.length; var length = interruptors.length; var index = -1; var interruptor; var config; - var fn; - var offset; - var bool; - var ignore; while (++index < length) { interruptor = interruptors[index]; config = interruptor[1] || {}; - fn = interruptor[0]; - offset = -1; - ignore = false; - - while (++offset < count) { - bool = bools[offset]; - if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) { - ignore = true; - break; - } + if ( + config.pedantic !== undefined && + config.pedantic !== ctx.options.pedantic + ) { + continue } - if (ignore) { - continue; + if ( + config.commonmark !== undefined && + config.commonmark !== ctx.options.commonmark + ) { + continue } - if (tokenizers[fn].apply(ctx, params)) { - return true; + if (tokenizers[interruptor[0]].apply(ctx, params)) { + return true } } - return false; + return false } var blockquote_1 = blockquote; -var C_NEWLINE$3 = '\n'; -var C_TAB$2 = '\t'; -var C_SPACE$2 = ' '; -var C_GT = '>'; +var lineFeed$4 = '\n'; +var tab$2 = '\t'; +var space$2 = ' '; +var greaterThan = '>'; -/* Tokenise a blockquote. */ function blockquote(eat, value, silent) { var self = this; var offsets = self.offset; @@ -24044,25 +24222,25 @@ function blockquote(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$2 && character !== C_TAB$2) { - break; + if (character !== space$2 && character !== tab$2) { + break } index++; } - if (value.charAt(index) !== C_GT) { - return; + if (value.charAt(index) !== greaterThan) { + return } if (silent) { - return true; + return true } index = 0; while (index < length) { - nextIndex = value.indexOf(C_NEWLINE$3, index); + nextIndex = value.indexOf(lineFeed$4, index); startIndex = index; prefixed = false; @@ -24073,18 +24251,18 @@ function blockquote(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$2 && character !== C_TAB$2) { - break; + if (character !== space$2 && character !== tab$2) { + break } index++; } - if (value.charAt(index) === C_GT) { + if (value.charAt(index) === greaterThan) { index++; prefixed = true; - if (value.charAt(index) === C_SPACE$2) { + if (value.charAt(index) === space$2) { index++; } } else { @@ -24095,16 +24273,15 @@ function blockquote(eat, value, silent) { if (!prefixed && !trim_1(content)) { index = startIndex; - break; + break } if (!prefixed) { rest = value.slice(index); - /* Check if the following code contains a possible - * block. */ + // Check if the following code contains a possible block. if (interrupt_1(interruptors, tokenizers, self, [eat, rest, true])) { - break; + break } } @@ -24119,7 +24296,7 @@ function blockquote(eat, value, silent) { index = -1; length = indents.length; - add = eat(values.join(C_NEWLINE$3)); + add = eat(values.join(lineFeed$4)); while (++index < length) { offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; @@ -24127,27 +24304,24 @@ function blockquote(eat, value, silent) { } exit = self.enterBlock(); - contents = self.tokenizeBlock(contents.join(C_NEWLINE$3), now); + contents = self.tokenizeBlock(contents.join(lineFeed$4), now); exit(); - return add({ - type: 'blockquote', - children: contents - }); + return add({type: 'blockquote', children: contents}) } var headingAtx = atxHeading; -var C_NEWLINE$4 = '\n'; -var C_TAB$3 = '\t'; -var C_SPACE$3 = ' '; -var C_HASH = '#'; +var lineFeed$5 = '\n'; +var tab$3 = '\t'; +var space$3 = ' '; +var numberSign = '#'; -var MAX_ATX_COUNT = 6; +var maxFenceCount = 6; function atxHeading(eat, value, silent) { var self = this; - var settings = self.options; + var pedantic = self.options.pedantic; var length = value.length + 1; var index = -1; var now = eat.now(); @@ -24157,75 +24331,67 @@ function atxHeading(eat, value, silent) { var queue; var depth; - /* Eat initial spacing. */ + // Eat initial spacing. while (++index < length) { character = value.charAt(index); - if (character !== C_SPACE$3 && character !== C_TAB$3) { + if (character !== space$3 && character !== tab$3) { index--; - break; + break } subvalue += character; } - /* Eat hashes. */ + // Eat hashes. depth = 0; while (++index <= length) { character = value.charAt(index); - if (character !== C_HASH) { + if (character !== numberSign) { index--; - break; + break } subvalue += character; depth++; } - if (depth > MAX_ATX_COUNT) { - return; + if (depth > maxFenceCount) { + return } - if ( - !depth || - (!settings.pedantic && value.charAt(index + 1) === C_HASH) - ) { - return; + if (!depth || (!pedantic && value.charAt(index + 1) === numberSign)) { + return } length = value.length + 1; - /* Eat intermediate white-space. */ + // Eat intermediate white-space. queue = ''; while (++index < length) { character = value.charAt(index); - if (character !== C_SPACE$3 && character !== C_TAB$3) { + if (character !== space$3 && character !== tab$3) { index--; - break; + break } queue += character; } - /* Exit when not in pedantic mode without spacing. */ - if ( - !settings.pedantic && - queue.length === 0 && - character && - character !== C_NEWLINE$4 - ) { - return; + // Exit when not in pedantic mode without spacing. + if (!pedantic && queue.length === 0 && character && character !== lineFeed$5) { + return } if (silent) { - return true; + return true } - /* Eat content. */ + // Eat content. subvalue += queue; queue = ''; content = ''; @@ -24233,31 +24399,33 @@ function atxHeading(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (!character || character === C_NEWLINE$4) { - break; + if (!character || character === lineFeed$5) { + break } - if ( - character !== C_SPACE$3 && - character !== C_TAB$3 && - character !== C_HASH - ) { + if (character !== space$3 && character !== tab$3 && character !== numberSign) { content += queue + character; queue = ''; - continue; + continue } - while (character === C_SPACE$3 || character === C_TAB$3) { + while (character === space$3 || character === tab$3) { queue += character; character = value.charAt(++index); } - while (character === C_HASH) { + // `#` without a queue is part of the content. + if (!pedantic && content && !queue && character === numberSign) { + content += character; + continue + } + + while (character === numberSign) { queue += character; character = value.charAt(++index); } - while (character === C_SPACE$3 || character === C_TAB$3) { + while (character === space$3 || character === tab$3) { queue += character; character = value.charAt(++index); } @@ -24273,19 +24441,19 @@ function atxHeading(eat, value, silent) { type: 'heading', depth: depth, children: self.tokenizeInline(content, now) - }); + }) } var thematicBreak_1 = thematicBreak; -var C_NEWLINE$5 = '\n'; -var C_TAB$4 = '\t'; -var C_SPACE$4 = ' '; -var C_ASTERISK = '*'; -var C_UNDERSCORE = '_'; -var C_DASH = '-'; +var tab$4 = '\t'; +var lineFeed$6 = '\n'; +var space$4 = ' '; +var asterisk = '*'; +var dash$1 = '-'; +var underscore = '_'; -var THEMATIC_BREAK_MARKER_COUNT = 3; +var maxCount = 3; function thematicBreak(eat, value, silent) { var index = -1; @@ -24299,19 +24467,19 @@ function thematicBreak(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (character !== C_TAB$4 && character !== C_SPACE$4) { - break; + if (character !== tab$4 && character !== space$4) { + break } subvalue += character; } if ( - character !== C_ASTERISK && - character !== C_DASH && - character !== C_UNDERSCORE + character !== asterisk && + character !== dash$1 && + character !== underscore ) { - return; + return } marker = character; @@ -24326,32 +24494,34 @@ function thematicBreak(eat, value, silent) { markerCount++; subvalue += queue + marker; queue = ''; - } else if (character === C_SPACE$4) { + } else if (character === space$4) { queue += character; } else if ( - markerCount >= THEMATIC_BREAK_MARKER_COUNT && - (!character || character === C_NEWLINE$5) + markerCount >= maxCount && + (!character || character === lineFeed$6) ) { subvalue += queue; if (silent) { - return true; + return true } - return eat(subvalue)({type: 'thematicBreak'}); + return eat(subvalue)({type: 'thematicBreak'}) } else { - return; + return } } } var getIndentation = indentation; -/* Map of characters, and their column length, - * which can be used as indentation. */ -var characters = {' ': 1, '\t': 4}; +var tab$5 = '\t'; +var space$5 = ' '; + +var spaceSize = 1; +var tabSize$2 = 4; -/* Gets indentation information for a line. */ +// Gets indentation information for a line. function indentation(value) { var index = 0; var indent = 0; @@ -24359,8 +24529,8 @@ function indentation(value) { var stops = {}; var size; - while (character in characters) { - size = characters[character]; + while (character === tab$5 || character === space$5) { + size = character === tab$5 ? tabSize$2 : spaceSize; indent += size; @@ -24369,24 +24539,23 @@ function indentation(value) { } stops[indent] = index; - character = value.charAt(++index); } - return {indent: indent, stops: stops}; + return {indent: indent, stops: stops} } var removeIndentation = indentation$1; -var C_SPACE$5 = ' '; -var C_NEWLINE$6 = '\n'; -var C_TAB$5 = '\t'; +var tab$6 = '\t'; +var lineFeed$7 = '\n'; +var space$6 = ' '; +var exclamationMark = '!'; -/* Remove the minimum indent from every line in `value`. - * Supports both tab, spaced, and mixed indentation (as - * well as possible). */ +// Remove the minimum indent from every line in `value`. Supports both tab, +// spaced, and mixed indentation (as well as possible). function indentation$1(value, maximum) { - var values = value.split(C_NEWLINE$6); + var values = value.split(lineFeed$7); var position = values.length + 1; var minIndent = Infinity; var matrix = []; @@ -24395,7 +24564,7 @@ function indentation$1(value, maximum) { var stops; var padding; - values.unshift(repeatString(C_SPACE$5, maximum) + '!'); + values.unshift(repeatString(space$6, maximum) + exclamationMark); while (position--) { indentation = getIndentation(values[position]); @@ -24403,7 +24572,7 @@ function indentation$1(value, maximum) { matrix[position] = indentation.stops; if (trim_1(values[position]).length === 0) { - continue; + continue } if (indentation.indent) { @@ -24413,7 +24582,7 @@ function indentation$1(value, maximum) { } else { minIndent = Infinity; - break; + break } } @@ -24433,20 +24602,19 @@ function indentation$1(value, maximum) { minIndent && index !== minIndent ) { - padding = C_TAB$5; + padding = tab$6; } else { padding = ''; } - values[position] = padding + values[position].slice( - index in stops ? stops[index] + 1 : 0 - ); + values[position] = + padding + values[position].slice(index in stops ? stops[index] + 1 : 0); } } values.shift(); - return values.join(C_NEWLINE$6); + return values.join(lineFeed$7) } /* eslint-disable max-params */ @@ -24460,44 +24628,23 @@ function indentation$1(value, maximum) { var list_1 = list; -var C_ASTERISK$1 = '*'; -var C_UNDERSCORE$1 = '_'; -var C_PLUS = '+'; -var C_DASH$1 = '-'; -var C_DOT = '.'; -var C_SPACE$6 = ' '; -var C_NEWLINE$7 = '\n'; -var C_TAB$6 = '\t'; -var C_PAREN_CLOSE = ')'; -var C_X_LOWER = 'x'; - -var TAB_SIZE = 4; -var EXPRESSION_LOOSE_LIST_ITEM = /\n\n(?!\s*$)/; -var EXPRESSION_TASK_ITEM = /^\[([ \t]|x|X)][ \t]/; -var EXPRESSION_BULLET = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; -var EXPRESSION_PEDANTIC_BULLET = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; -var EXPRESSION_INITIAL_INDENT = /^( {1,4}|\t)?/gm; - -/* Map of characters which can be used to mark - * list-items. */ -var LIST_UNORDERED_MARKERS = {}; - -LIST_UNORDERED_MARKERS[C_ASTERISK$1] = true; -LIST_UNORDERED_MARKERS[C_PLUS] = true; -LIST_UNORDERED_MARKERS[C_DASH$1] = true; - -/* Map of characters which can be used to mark - * list-items after a digit. */ -var LIST_ORDERED_MARKERS = {}; - -LIST_ORDERED_MARKERS[C_DOT] = true; - -/* Map of characters which can be used to mark - * list-items after a digit. */ -var LIST_ORDERED_COMMONMARK_MARKERS = {}; - -LIST_ORDERED_COMMONMARK_MARKERS[C_DOT] = true; -LIST_ORDERED_COMMONMARK_MARKERS[C_PAREN_CLOSE] = true; +var asterisk$1 = '*'; +var underscore$1 = '_'; +var plusSign = '+'; +var dash$2 = '-'; +var dot$1 = '.'; +var space$7 = ' '; +var lineFeed$8 = '\n'; +var tab$7 = '\t'; +var rightParenthesis = ')'; +var lowercaseX = 'x'; + +var tabSize$3 = 4; +var looseListItemExpression = /\n\n(?!\s*$)/; +var taskItemExpression = /^\[([ \t]|x|X)][ \t]/; +var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; +var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; +var initialIndentExpression = /^( {1,4}|\t)?/gm; function list(eat, value, silent) { var self = this; @@ -24505,7 +24652,6 @@ function list(eat, value, silent) { var pedantic = self.options.pedantic; var tokenizers = self.blockTokenizers; var interuptors = self.interruptList; - var markers; var index = 0; var length = value.length; var start = null; @@ -24528,7 +24674,7 @@ function list(eat, value, silent) { var item; var enterTop; var exitBlockquote; - var isLoose; + var spread = false; var node; var now; var end; @@ -24537,28 +24683,24 @@ function list(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_TAB$6) { - size += TAB_SIZE - (size % TAB_SIZE); - } else if (character === C_SPACE$6) { + if (character === tab$7) { + size += tabSize$3 - (size % tabSize$3); + } else if (character === space$7) { size++; } else { - break; + break } index++; } - if (size >= TAB_SIZE) { - return; + if (size >= tabSize$3) { + return } character = value.charAt(index); - markers = commonmark ? - LIST_ORDERED_COMMONMARK_MARKERS : - LIST_ORDERED_MARKERS; - - if (LIST_UNORDERED_MARKERS[character] === true) { + if (character === asterisk$1 || character === plusSign || character === dash$2) { marker = character; ordered = false; } else { @@ -24569,7 +24711,7 @@ function list(eat, value, silent) { character = value.charAt(index); if (!isDecimal(character)) { - break; + break } queue += character; @@ -24578,8 +24720,11 @@ function list(eat, value, silent) { character = value.charAt(index); - if (!queue || markers[character] !== true) { - return; + if ( + !queue || + !(character === dot$1 || (commonmark && character === rightParenthesis)) + ) { + return } start = parseInt(queue, 10); @@ -24588,12 +24733,16 @@ function list(eat, value, silent) { character = value.charAt(++index); - if (character !== C_SPACE$6 && character !== C_TAB$6) { - return; + if ( + character !== space$7 && + character !== tab$7 && + (pedantic || (character !== lineFeed$8 && character !== '')) + ) { + return } if (silent) { - return true; + return true } index = 0; @@ -24602,7 +24751,7 @@ function list(eat, value, silent) { emptyLines = []; while (index < length) { - nextIndex = value.indexOf(C_NEWLINE$7, index); + nextIndex = value.indexOf(lineFeed$8, index); startIndex = index; prefixed = false; indented = false; @@ -24611,24 +24760,24 @@ function list(eat, value, silent) { nextIndex = length; } - end = index + TAB_SIZE; + end = index + tabSize$3; size = 0; while (index < length) { character = value.charAt(index); - if (character === C_TAB$6) { - size += TAB_SIZE - (size % TAB_SIZE); - } else if (character === C_SPACE$6) { + if (character === tab$7) { + size += tabSize$3 - (size % tabSize$3); + } else if (character === space$7) { size++; } else { - break; + break } index++; } - if (size >= TAB_SIZE) { + if (size >= tabSize$3) { indented = true; } @@ -24640,7 +24789,11 @@ function list(eat, value, silent) { currentMarker = null; if (!indented) { - if (LIST_UNORDERED_MARKERS[character] === true) { + if ( + character === asterisk$1 || + character === plusSign || + character === dash$2 + ) { currentMarker = character; index++; size++; @@ -24651,7 +24804,7 @@ function list(eat, value, silent) { character = value.charAt(index); if (!isDecimal(character)) { - break; + break } queue += character; @@ -24661,7 +24814,10 @@ function list(eat, value, silent) { character = value.charAt(index); index++; - if (queue && markers[character] === true) { + if ( + queue && + (character === dot$1 || (commonmark && character === rightParenthesis)) + ) { currentMarker = character; size += queue.length + 1; } @@ -24670,26 +24826,26 @@ function list(eat, value, silent) { if (currentMarker) { character = value.charAt(index); - if (character === C_TAB$6) { - size += TAB_SIZE - (size % TAB_SIZE); + if (character === tab$7) { + size += tabSize$3 - (size % tabSize$3); index++; - } else if (character === C_SPACE$6) { - end = index + TAB_SIZE; + } else if (character === space$7) { + end = index + tabSize$3; while (index < end) { - if (value.charAt(index) !== C_SPACE$6) { - break; + if (value.charAt(index) !== space$7) { + break } index++; size++; } - if (index === end && value.charAt(index) === C_SPACE$6) { - index -= TAB_SIZE - 1; - size -= TAB_SIZE - 1; + if (index === end && value.charAt(index) === space$7) { + index -= tabSize$3 - 1; + size -= tabSize$3 - 1; } - } else if (character !== C_NEWLINE$7 && character !== '') { + } else if (character !== lineFeed$8 && character !== '') { currentMarker = null; } } @@ -24697,15 +24853,15 @@ function list(eat, value, silent) { if (currentMarker) { if (!pedantic && marker !== currentMarker) { - break; + break } prefixed = true; } else { - if (!commonmark && !indented && value.charAt(startIndex) === C_SPACE$6) { + if (!commonmark && !indented && value.charAt(startIndex) === space$7) { indented = true; } else if (commonmark && item) { - indented = size >= item.indent || size > TAB_SIZE; + indented = size >= item.indent || size > tabSize$3; } prefixed = false; @@ -24716,17 +24872,17 @@ function list(eat, value, silent) { content = startIndex === index ? line : value.slice(index, nextIndex); if ( - currentMarker === C_ASTERISK$1 || - currentMarker === C_UNDERSCORE$1 || - currentMarker === C_DASH$1 + currentMarker === asterisk$1 || + currentMarker === underscore$1 || + currentMarker === dash$2 ) { if (tokenizers.thematicBreak.call(self, eat, line, true)) { - break; + break } } prevEmpty = empty; - empty = !trim_1(content).length; + empty = !prefixed && !trim_1(content).length; if (indented && item) { item.value = item.value.concat(emptyLines, line); @@ -24734,6 +24890,7 @@ function list(eat, value, silent) { emptyLines = []; } else if (prefixed) { if (emptyLines.length !== 0) { + spread = true; item.value.push(''); item.trail = emptyLines.concat(); } @@ -24748,18 +24905,18 @@ function list(eat, value, silent) { allLines = allLines.concat(emptyLines, line); emptyLines = []; } else if (empty) { - if (prevEmpty) { - break; + if (prevEmpty && !commonmark) { + break } emptyLines.push(line); } else { if (prevEmpty) { - break; + break } if (interrupt_1(interuptors, tokenizers, self, [eat, line, true])) { - break; + break } item.value = item.value.concat(emptyLines, line); @@ -24770,34 +24927,29 @@ function list(eat, value, silent) { index = nextIndex + 1; } - node = eat(allLines.join(C_NEWLINE$7)).reset({ + node = eat(allLines.join(lineFeed$8)).reset({ type: 'list', ordered: ordered, start: start, - loose: null, + spread: spread, children: [] }); enterTop = self.enterList(); exitBlockquote = self.enterBlock(); - isLoose = false; index = -1; length = items.length; while (++index < length) { - item = items[index].value.join(C_NEWLINE$7); + item = items[index].value.join(lineFeed$8); now = eat.now(); - item = eat(item)(listItem(self, item, now), node); + eat(item)(listItem(self, item, now), node); - if (item.loose) { - isLoose = true; - } - - item = items[index].trail.join(C_NEWLINE$7); + item = items[index].trail.join(lineFeed$8); if (index !== length - 1) { - item += C_NEWLINE$7; + item += lineFeed$8; } eat(item); @@ -24806,9 +24958,7 @@ function list(eat, value, silent) { enterTop(); exitBlockquote(); - node.loose = isLoose; - - return node; + return node } function listItem(ctx, value, position) { @@ -24821,11 +24971,11 @@ function listItem(ctx, value, position) { value = fn.apply(null, arguments); if (ctx.options.gfm) { - task = value.match(EXPRESSION_TASK_ITEM); + task = value.match(taskItemExpression); if (task) { indent = task[0].length; - checked = task[1].toLowerCase() === C_X_LOWER; + checked = task[1].toLowerCase() === lowercaseX; offsets[position.line] += indent; value = value.slice(indent); } @@ -24833,38 +24983,36 @@ function listItem(ctx, value, position) { return { type: 'listItem', - loose: EXPRESSION_LOOSE_LIST_ITEM.test(value) || - value.charAt(value.length - 1) === C_NEWLINE$7, + spread: looseListItemExpression.test(value), checked: checked, children: ctx.tokenizeBlock(value, position) - }; + } } -/* Create a list-item using overly simple mechanics. */ +// Create a list-item using overly simple mechanics. function pedanticListItem(ctx, value, position) { var offsets = ctx.offset; var line = position.line; - /* Remove the list-item’s bullet. */ - value = value.replace(EXPRESSION_PEDANTIC_BULLET, replacer); + // Remove the list-item’s bullet. + value = value.replace(pedanticBulletExpression, replacer); - /* The initial line was also matched by the below, so - * we reset the `line`. */ + // The initial line was also matched by the below, so we reset the `line`. line = position.line; - return value.replace(EXPRESSION_INITIAL_INDENT, replacer); + return value.replace(initialIndentExpression, replacer) - /* A simple replacer which removed all matches, - * and adds their length to `offset`. */ + // A simple replacer which removed all matches, and adds their length to + // `offset`. function replacer($0) { offsets[line] = (offsets[line] || 0) + $0.length; line++; - return ''; + return '' } } -/* Create a list-item using sane mechanics. */ +// Create a list-item using sane mechanics. function normalListItem(ctx, value, position) { var offsets = ctx.offset; var line = position.line; @@ -24876,19 +25024,17 @@ function normalListItem(ctx, value, position) { var index; var length; - /* Remove the list-item’s bullet. */ - value = value.replace(EXPRESSION_BULLET, replacer); + // Remove the list-item’s bullet. + value = value.replace(bulletExpression, replacer); - lines = value.split(C_NEWLINE$7); + lines = value.split(lineFeed$8); - trimmedLines = removeIndentation(value, getIndentation(max).indent).split(C_NEWLINE$7); + trimmedLines = removeIndentation(value, getIndentation(max).indent).split(lineFeed$8); - /* We replaced the initial bullet with something - * else above, which was used to trick - * `removeIndentation` into removing some more - * characters when possible. However, that could - * result in the initial line to be stripped more - * than it should be. */ + // We replaced the initial bullet with something else above, which was used + // to trick `removeIndentation` into removing some more characters when + // possible. However, that could result in the initial line to be stripped + // more than it should be. trimmedLines[0] = rest; offsets[line] = (offsets[line] || 0) + bullet.length; @@ -24898,46 +25044,42 @@ function normalListItem(ctx, value, position) { length = lines.length; while (++index < length) { - offsets[line] = (offsets[line] || 0) + - lines[index].length - trimmedLines[index].length; + offsets[line] = + (offsets[line] || 0) + lines[index].length - trimmedLines[index].length; line++; } - return trimmedLines.join(C_NEWLINE$7); + return trimmedLines.join(lineFeed$8) function replacer($0, $1, $2, $3, $4) { bullet = $1 + $2 + $3; rest = $4; - /* Make sure that the first nine numbered list items - * can indent with an extra space. That is, when - * the bullet did not receive an extra final space. */ + // Make sure that the first nine numbered list items can indent with an + // extra space. That is, when the bullet did not receive an extra final + // space. if (Number($2) < 10 && bullet.length % 2 === 1) { - $2 = C_SPACE$6 + $2; + $2 = space$7 + $2; } - max = $1 + repeatString(C_SPACE$6, $2.length) + $3; + max = $1 + repeatString(space$7, $2.length) + $3; - return max + rest; + return max + rest } } var headingSetext = setextHeading; -var C_NEWLINE$8 = '\n'; -var C_TAB$7 = '\t'; -var C_SPACE$7 = ' '; -var C_EQUALS = '='; -var C_DASH$2 = '-'; - -var MAX_HEADING_INDENT = 3; +var lineFeed$9 = '\n'; +var tab$8 = '\t'; +var space$8 = ' '; +var equalsTo = '='; +var dash$3 = '-'; -/* Map of characters which can be used to mark setext - * headers, mapping to their corresponding depth. */ -var SETEXT_MARKERS = {}; +var maxIndent = 3; -SETEXT_MARKERS[C_EQUALS] = 1; -SETEXT_MARKERS[C_DASH$2] = 2; +var equalsToDepth = 1; +var dashDepth = 2; function setextHeading(eat, value, silent) { var self = this; @@ -24951,31 +25093,31 @@ function setextHeading(eat, value, silent) { var marker; var depth; - /* Eat initial indentation. */ + // Eat initial indentation. while (++index < length) { character = value.charAt(index); - if (character !== C_SPACE$7 || index >= MAX_HEADING_INDENT) { + if (character !== space$8 || index >= maxIndent) { index--; - break; + break } subvalue += character; } - /* Eat content. */ + // Eat content. content = ''; queue = ''; while (++index < length) { character = value.charAt(index); - if (character === C_NEWLINE$8) { + if (character === lineFeed$9) { index--; - break; + break } - if (character === C_SPACE$7 || character === C_TAB$7) { + if (character === space$8 || character === tab$8) { queue += character; } else { content += queue + character; @@ -24987,53 +25129,54 @@ function setextHeading(eat, value, silent) { now.offset += subvalue.length; subvalue += content + queue; - /* Ensure the content is followed by a newline and a - * valid marker. */ + // Ensure the content is followed by a newline and a valid marker. character = value.charAt(++index); marker = value.charAt(++index); - if (character !== C_NEWLINE$8 || !SETEXT_MARKERS[marker]) { - return; + if (character !== lineFeed$9 || (marker !== equalsTo && marker !== dash$3)) { + return } subvalue += character; - /* Eat Setext-line. */ + // Eat Setext-line. queue = marker; - depth = SETEXT_MARKERS[marker]; + depth = marker === equalsTo ? equalsToDepth : dashDepth; while (++index < length) { character = value.charAt(index); if (character !== marker) { - if (character !== C_NEWLINE$8) { - return; + if (character !== lineFeed$9) { + return } index--; - break; + break } queue += character; } if (silent) { - return true; + return true } return eat(subvalue + queue)({ type: 'heading', depth: depth, children: self.tokenizeInline(content, now) - }); + }) } var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; var unquoted = '[^"\'=<>`\\u0000-\\u0020]+'; -var singleQuoted = '\'[^\']*\''; +var singleQuoted = "'[^']*'"; var doubleQuoted = '"[^"]*"'; -var attributeValue = '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; -var attribute = '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; +var attributeValue = + '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; +var attribute = + '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; var comment = '|'; @@ -25043,14 +25186,21 @@ var cdata = ''; var openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); -var tag = new RegExp('^(?:' + - openTag + '|' + - closeTag + '|' + - comment + '|' + - processing + '|' + - declaration + '|' + - cdata + -')'); +var tag = new RegExp( + '^(?:' + + openTag + + '|' + + closeTag + + '|' + + comment + + '|' + + processing + + '|' + + declaration + + '|' + + cdata + + ')' +); var html = { openCloseTag: openCloseTag, @@ -25059,16 +25209,33 @@ var html = { var openCloseTag$1 = html.openCloseTag; -var htmlBlock = blockHTML; - -var C_TAB$8 = '\t'; -var C_SPACE$8 = ' '; -var C_NEWLINE$9 = '\n'; -var C_LT = '<'; - -function blockHTML(eat, value, silent) { +var htmlBlock = blockHtml; + +var tab$9 = '\t'; +var space$9 = ' '; +var lineFeed$10 = '\n'; +var lessThan = '<'; + +var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i; +var rawCloseExpression = /<\/(script|pre|style)>/i; +var commentOpenExpression = /^/; +var instructionOpenExpression = /^<\?/; +var instructionCloseExpression = /\?>/; +var directiveOpenExpression = /^/; +var cdataOpenExpression = /^/; +var elementCloseExpression = /^$/; +var otherElementOpenExpression = new RegExp(openCloseTag$1.source + '\\s*$'); + +function blockHtml(eat, value, silent) { var self = this; - var blocks = self.options.blocks; + var blocks = self.options.blocks.join('|'); + var elementOpenExpression = new RegExp( + '^|$))', + 'i' + ); var length = value.length; var index = 0; var next; @@ -25080,31 +25247,31 @@ function blockHTML(eat, value, silent) { var subvalue; var sequences = [ - [/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true], - [/^/, true], - [/^<\?/, /\?>/, true], - [/^/, true], - [/^/, true], - [new RegExp('^|$))', 'i'), /^$/, true], - [new RegExp(openCloseTag$1.source + '\\s*$'), /^$/, false] + [rawOpenExpression, rawCloseExpression, true], + [commentOpenExpression, commentCloseExpression, true], + [instructionOpenExpression, instructionCloseExpression, true], + [directiveOpenExpression, directiveCloseExpression, true], + [cdataOpenExpression, cdataCloseExpression, true], + [elementOpenExpression, elementCloseExpression, true], + [otherElementOpenExpression, elementCloseExpression, false] ]; - /* Eat initial spacing. */ + // Eat initial spacing. while (index < length) { character = value.charAt(index); - if (character !== C_TAB$8 && character !== C_SPACE$8) { - break; + if (character !== tab$9 && character !== space$9) { + break } index++; } - if (value.charAt(index) !== C_LT) { - return; + if (value.charAt(index) !== lessThan) { + return } - next = value.indexOf(C_NEWLINE$9, index + 1); + next = value.indexOf(lineFeed$10, index + 1); next = next === -1 ? length : next; line = value.slice(index, next); offset = -1; @@ -25113,23 +25280,23 @@ function blockHTML(eat, value, silent) { while (++offset < count) { if (sequences[offset][0].test(line)) { sequence = sequences[offset]; - break; + break } } if (!sequence) { - return; + return } if (silent) { - return sequence[2]; + return sequence[2] } index = next; if (!sequence[1].test(line)) { while (index < length) { - next = value.indexOf(C_NEWLINE$9, index + 1); + next = value.indexOf(lineFeed$10, index + 1); next = next === -1 ? length : next; line = value.slice(index + 1, next); @@ -25138,7 +25305,7 @@ function blockHTML(eat, value, silent) { index = next; } - break; + break } index = next; @@ -25147,7 +25314,7 @@ function blockHTML(eat, value, silent) { subvalue = value.slice(0, index); - return eat(subvalue)({type: 'html', value: subvalue}); + return eat(subvalue)({type: 'html', value: subvalue}) } var collapseWhiteSpace = collapse; @@ -25159,24 +25326,24 @@ function collapse(value) { var normalize_1 = normalize$2; -/* Normalize an identifier. Collapses multiple white space - * characters into a single space, and removes casing. */ +// Normalize an identifier. Collapses multiple white space characters into a +// single space, and removes casing. function normalize$2(value) { - return collapseWhiteSpace(value).toLowerCase(); + return collapseWhiteSpace(value).toLowerCase() } var footnoteDefinition_1 = footnoteDefinition; footnoteDefinition.notInList = true; footnoteDefinition.notInBlock = true; -var C_BACKSLASH = '\\'; -var C_NEWLINE$10 = '\n'; -var C_TAB$9 = '\t'; -var C_SPACE$9 = ' '; -var C_BRACKET_OPEN = '['; -var C_BRACKET_CLOSE = ']'; -var C_CARET = '^'; -var C_COLON = ':'; +var backslash$1 = '\\'; +var lineFeed$11 = '\n'; +var tab$10 = '\t'; +var space$10 = ' '; +var leftSquareBracket = '['; +var rightSquareBracket = ']'; +var caret$1 = '^'; +var colon$1 = ':'; var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; @@ -25197,7 +25364,7 @@ function footnoteDefinition(eat, value, silent) { var exit; if (!self.options.footnotes) { - return; + return } index = 0; @@ -25210,7 +25377,7 @@ function footnoteDefinition(eat, value, silent) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; @@ -25218,22 +25385,22 @@ function footnoteDefinition(eat, value, silent) { } if ( - value.charAt(index) !== C_BRACKET_OPEN || - value.charAt(index + 1) !== C_CARET + value.charAt(index) !== leftSquareBracket || + value.charAt(index + 1) !== caret$1 ) { - return; + return } - subvalue += C_BRACKET_OPEN + C_CARET; + subvalue += leftSquareBracket + caret$1; index = subvalue.length; queue = ''; while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE) { - break; - } else if (character === C_BACKSLASH) { + if (character === rightSquareBracket) { + break + } else if (character === backslash$1) { queue += character; index++; character = value.charAt(index); @@ -25245,25 +25412,25 @@ function footnoteDefinition(eat, value, silent) { if ( !queue || - value.charAt(index) !== C_BRACKET_CLOSE || - value.charAt(index + 1) !== C_COLON + value.charAt(index) !== rightSquareBracket || + value.charAt(index + 1) !== colon$1 ) { - return; + return } if (silent) { - return true; + return true } - identifier = normalize_1(queue); - subvalue += queue + C_BRACKET_CLOSE + C_COLON; + identifier = queue; + subvalue += queue + rightSquareBracket + colon$1; index = subvalue.length; while (index < length) { character = value.charAt(index); - if (character !== C_TAB$9 && character !== C_SPACE$9) { - break; + if (character !== tab$10 && character !== space$10) { + break } subvalue += character; @@ -25279,15 +25446,15 @@ function footnoteDefinition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_NEWLINE$10) { + if (character === lineFeed$11) { subqueue = character; index++; while (index < length) { character = value.charAt(index); - if (character !== C_NEWLINE$10) { - break; + if (character !== lineFeed$11) { + break } subqueue += character; @@ -25300,8 +25467,8 @@ function footnoteDefinition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$9) { - break; + if (character !== space$10) { + break } subqueue += character; @@ -25309,7 +25476,7 @@ function footnoteDefinition(eat, value, silent) { } if (subqueue.length === 0) { - break; + break } queue += subqueue; @@ -25326,11 +25493,11 @@ function footnoteDefinition(eat, value, silent) { subvalue += content; - content = content.replace(EXPRESSION_INITIAL_TAB, function (line) { + content = content.replace(EXPRESSION_INITIAL_TAB, function(line) { offsets[currentLine] = (offsets[currentLine] || 0) + line.length; currentLine++; - return ''; + return '' }); add = eat(subvalue); @@ -25341,28 +25508,29 @@ function footnoteDefinition(eat, value, silent) { return add({ type: 'footnoteDefinition', - identifier: identifier, + identifier: normalize_1(identifier), + label: identifier, children: content - }); + }) } var definition_1 = definition; definition.notInList = true; definition.notInBlock = true; -var C_DOUBLE_QUOTE = '"'; -var C_SINGLE_QUOTE = '\''; -var C_BACKSLASH$1 = '\\'; -var C_NEWLINE$11 = '\n'; -var C_TAB$10 = '\t'; -var C_SPACE$10 = ' '; -var C_BRACKET_OPEN$1 = '['; -var C_BRACKET_CLOSE$1 = ']'; -var C_PAREN_OPEN = '('; -var C_PAREN_CLOSE$1 = ')'; -var C_COLON$1 = ':'; -var C_LT$1 = '<'; -var C_GT$1 = '>'; +var quotationMark = '"'; +var apostrophe = "'"; +var backslash$2 = '\\'; +var lineFeed$12 = '\n'; +var tab$11 = '\t'; +var space$11 = ' '; +var leftSquareBracket$1 = '['; +var rightSquareBracket$1 = ']'; +var leftParenthesis = '('; +var rightParenthesis$1 = ')'; +var colon$2 = ':'; +var lessThan$1 = '<'; +var greaterThan$1 = '>'; function definition(eat, value, silent) { var self = this; @@ -25382,8 +25550,8 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$10 && character !== C_TAB$10) { - break; + if (character !== space$11 && character !== tab$11) { + break } subvalue += character; @@ -25392,8 +25560,8 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (character !== C_BRACKET_OPEN$1) { - return; + if (character !== leftSquareBracket$1) { + return } index++; @@ -25403,9 +25571,9 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE$1) { - break; - } else if (character === C_BACKSLASH$1) { + if (character === rightSquareBracket$1) { + break + } else if (character === backslash$2) { queue += character; index++; character = value.charAt(index); @@ -25417,26 +25585,22 @@ function definition(eat, value, silent) { if ( !queue || - value.charAt(index) !== C_BRACKET_CLOSE$1 || - value.charAt(index + 1) !== C_COLON$1 + value.charAt(index) !== rightSquareBracket$1 || + value.charAt(index + 1) !== colon$2 ) { - return; + return } identifier = queue; - subvalue += queue + C_BRACKET_CLOSE$1 + C_COLON$1; + subvalue += queue + rightSquareBracket$1 + colon$2; index = subvalue.length; queue = ''; while (index < length) { character = value.charAt(index); - if ( - character !== C_TAB$10 && - character !== C_SPACE$10 && - character !== C_NEWLINE$11 - ) { - break; + if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + break } subvalue += character; @@ -25447,14 +25611,14 @@ function definition(eat, value, silent) { queue = ''; beforeURL = subvalue; - if (character === C_LT$1) { + if (character === lessThan$1) { index++; while (index < length) { character = value.charAt(index); if (!isEnclosedURLCharacter(character)) { - break; + break } queue += character; @@ -25464,11 +25628,11 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character === isEnclosedURLCharacter.delimiter) { - subvalue += C_LT$1 + queue + character; + subvalue += lessThan$1 + queue + character; index++; } else { if (commonmark) { - return; + return } index -= queue.length + 1; @@ -25481,7 +25645,7 @@ function definition(eat, value, silent) { character = value.charAt(index); if (!isUnclosedURLCharacter(character)) { - break; + break } queue += character; @@ -25492,7 +25656,7 @@ function definition(eat, value, silent) { } if (!queue) { - return; + return } url = queue; @@ -25501,12 +25665,8 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if ( - character !== C_TAB$10 && - character !== C_SPACE$10 && - character !== C_NEWLINE$11 - ) { - break; + if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + break } queue += character; @@ -25516,12 +25676,12 @@ function definition(eat, value, silent) { character = value.charAt(index); test = null; - if (character === C_DOUBLE_QUOTE) { - test = C_DOUBLE_QUOTE; - } else if (character === C_SINGLE_QUOTE) { - test = C_SINGLE_QUOTE; - } else if (character === C_PAREN_OPEN) { - test = C_PAREN_CLOSE$1; + if (character === quotationMark) { + test = quotationMark; + } else if (character === apostrophe) { + test = apostrophe; + } else if (character === leftParenthesis) { + test = rightParenthesis$1; } if (!test) { @@ -25536,18 +25696,18 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character === test) { - break; + break } - if (character === C_NEWLINE$11) { + if (character === lineFeed$12) { index++; character = value.charAt(index); - if (character === C_NEWLINE$11 || character === test) { - return; + if (character === lineFeed$12 || character === test) { + return } - queue += C_NEWLINE$11; + queue += lineFeed$12; } queue += character; @@ -25557,7 +25717,7 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character !== test) { - return; + return } beforeTitle = subvalue; @@ -25566,14 +25726,14 @@ function definition(eat, value, silent) { title = queue; queue = ''; } else { - return; + return } while (index < length) { character = value.charAt(index); - if (character !== C_TAB$10 && character !== C_SPACE$10) { - break; + if (character !== tab$11 && character !== space$11) { + break } subvalue += character; @@ -25582,13 +25742,13 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (!character || character === C_NEWLINE$11) { + if (!character || character === lineFeed$12) { if (silent) { - return true; + return true } beforeURL = eat(beforeURL).test().end; - url = self.decode.raw(self.unescape(url), beforeURL); + url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}); if (title) { beforeTitle = eat(beforeTitle).test().end; @@ -25598,46 +25758,50 @@ function definition(eat, value, silent) { return eat(subvalue)({ type: 'definition', identifier: normalize_1(identifier), + label: identifier, title: title || null, url: url - }); + }) } } -/* Check if `character` can be inside an enclosed URI. */ +// Check if `character` can be inside an enclosed URI. function isEnclosedURLCharacter(character) { - return character !== C_GT$1 && - character !== C_BRACKET_OPEN$1 && - character !== C_BRACKET_CLOSE$1; + return ( + character !== greaterThan$1 && + character !== leftSquareBracket$1 && + character !== rightSquareBracket$1 + ) } -isEnclosedURLCharacter.delimiter = C_GT$1; +isEnclosedURLCharacter.delimiter = greaterThan$1; -/* Check if `character` can be inside an unclosed URI. */ +// Check if `character` can be inside an unclosed URI. function isUnclosedURLCharacter(character) { - return character !== C_BRACKET_OPEN$1 && - character !== C_BRACKET_CLOSE$1 && - !isWhitespaceCharacter(character); + return ( + character !== leftSquareBracket$1 && + character !== rightSquareBracket$1 && + !isWhitespaceCharacter(character) + ) } var table_1 = table$1; -var C_BACKSLASH$2 = '\\'; -var C_TICK$1 = '`'; -var C_DASH$3 = '-'; -var C_PIPE = '|'; -var C_COLON$2 = ':'; -var C_SPACE$11 = ' '; -var C_NEWLINE$12 = '\n'; -var C_TAB$11 = '\t'; +var tab$12 = '\t'; +var lineFeed$13 = '\n'; +var space$12 = ' '; +var dash$4 = '-'; +var colon$3 = ':'; +var backslash$3 = '\\'; +var graveAccent$1 = '`'; +var verticalBar = '|'; -var MIN_TABLE_COLUMNS = 1; -var MIN_TABLE_ROWS = 2; +var minColumns = 1; +var minRows = 2; -var TABLE_ALIGN_LEFT = 'left'; -var TABLE_ALIGN_CENTER = 'center'; -var TABLE_ALIGN_RIGHT = 'right'; -var TABLE_ALIGN_NONE = null; +var left = 'left'; +var center = 'center'; +var right = 'right'; function table$1(eat, value, silent) { var self = this; @@ -25666,35 +25830,34 @@ function table$1(eat, value, silent) { var pipeIndex; var first; - /* Exit when not in gfm-mode. */ + // Exit when not in gfm-mode. if (!self.options.gfm) { - return; + return } - /* Get the rows. - * Detecting tables soon is hard, so there are some - * checks for performance here, such as the minimum - * number of rows, and allowed characters in the - * alignment row. */ + // Get the rows. + // Detecting tables soon is hard, so there are some checks for performance + // here, such as the minimum number of rows, and allowed characters in the + // alignment row. index = 0; lineCount = 0; length = value.length + 1; lines = []; while (index < length) { - lineIndex = value.indexOf(C_NEWLINE$12, index); - pipeIndex = value.indexOf(C_PIPE, index + 1); + lineIndex = value.indexOf(lineFeed$13, index); + pipeIndex = value.indexOf(verticalBar, index + 1); if (lineIndex === -1) { lineIndex = value.length; } if (pipeIndex === -1 || pipeIndex > lineIndex) { - if (lineCount < MIN_TABLE_ROWS) { - return; + if (lineCount < minRows) { + return } - break; + break } lines.push(value.slice(index, lineIndex)); @@ -25702,8 +25865,8 @@ function table$1(eat, value, silent) { index = lineIndex + 1; } - /* Parse the alignment row. */ - subvalue = lines.join(C_NEWLINE$12); + // Parse the alignment row. + subvalue = lines.join(lineFeed$13); alignments = lines.splice(1, 1)[0] || []; index = 0; length = alignments.length; @@ -25714,12 +25877,12 @@ function table$1(eat, value, silent) { while (index < length) { character = alignments.charAt(index); - if (character === C_PIPE) { + if (character === verticalBar) { hasDash = null; if (alignment === false) { if (first === false) { - return; + return } } else { align.push(alignment); @@ -25727,19 +25890,19 @@ function table$1(eat, value, silent) { } first = false; - } else if (character === C_DASH$3) { + } else if (character === dash$4) { hasDash = true; - alignment = alignment || TABLE_ALIGN_NONE; - } else if (character === C_COLON$2) { - if (alignment === TABLE_ALIGN_LEFT) { - alignment = TABLE_ALIGN_CENTER; - } else if (hasDash && alignment === TABLE_ALIGN_NONE) { - alignment = TABLE_ALIGN_RIGHT; + alignment = alignment || null; + } else if (character === colon$3) { + if (alignment === left) { + alignment = center; + } else if (hasDash && alignment === null) { + alignment = right; } else { - alignment = TABLE_ALIGN_LEFT; + alignment = left; } } else if (!isWhitespaceCharacter(character)) { - return; + return } index++; @@ -25749,37 +25912,32 @@ function table$1(eat, value, silent) { align.push(alignment); } - /* Exit when without enough columns. */ - if (align.length < MIN_TABLE_COLUMNS) { - return; + // Exit when without enough columns. + if (align.length < minColumns) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - /* Parse the rows. */ + // Parse the rows. position = -1; rows = []; - table = eat(subvalue).reset({ - type: 'table', - align: align, - children: rows - }); + table = eat(subvalue).reset({type: 'table', align: align, children: rows}); while (++position < lineCount) { line = lines[position]; row = {type: 'tableRow', children: []}; - /* Eat a newline character when this is not the - * first row. */ + // Eat a newline character when this is not the first row. if (position) { - eat(C_NEWLINE$12); + eat(lineFeed$13); } - /* Eat the row. */ + // Eat the row. eat(line).reset(row, table); length = line.length + 1; @@ -25793,7 +25951,7 @@ function table$1(eat, value, silent) { while (index < length) { character = line.charAt(index); - if (character === C_TAB$11 || character === C_SPACE$11) { + if (character === tab$12 || character === space$12) { if (cell) { queue += character; } else { @@ -25801,17 +25959,17 @@ function table$1(eat, value, silent) { } index++; - continue; + continue } - if (character === '' || character === C_PIPE) { + if (character === '' || character === verticalBar) { if (preamble) { eat(character); } else { if (character && opening) { queue += character; index++; - continue; + continue } if ((cell || character) && !preamble) { @@ -25829,10 +25987,10 @@ function table$1(eat, value, silent) { now = eat.now(); - eat(subvalue)({ - type: 'tableCell', - children: self.tokenizeInline(cell, now) - }, row); + eat(subvalue)( + {type: 'tableCell', children: self.tokenizeInline(cell, now)}, + row + ); } eat(queue + character); @@ -25848,12 +26006,12 @@ function table$1(eat, value, silent) { cell += character; - if (character === C_BACKSLASH$2 && index !== length - 2) { + if (character === backslash$3 && index !== length - 2) { cell += line.charAt(index + 1); index++; } - if (character === C_TICK$1) { + if (character === graveAccent$1) { count = 1; while (line.charAt(index + 1) === character) { @@ -25874,24 +26032,24 @@ function table$1(eat, value, silent) { index++; } - /* Eat the alignment row. */ + // Eat the alignment row. if (!position) { - eat(C_NEWLINE$12 + alignments); + eat(lineFeed$13 + alignments); } } - return table; + return table } var paragraph_1 = paragraph; -var C_NEWLINE$13 = '\n'; -var C_TAB$12 = '\t'; -var C_SPACE$12 = ' '; +var tab$13 = '\t'; +var lineFeed$14 = '\n'; +var space$13 = ' '; -var TAB_SIZE$1 = 4; +var tabSize$4 = 4; -/* Tokenise paragraph. */ +// Tokenise paragraph. function paragraph(eat, value, silent) { var self = this; var settings = self.options; @@ -25899,7 +26057,7 @@ function paragraph(eat, value, silent) { var gfm = settings.gfm; var tokenizers = self.blockTokenizers; var interruptors = self.interruptParagraph; - var index = value.indexOf(C_NEWLINE$13); + var index = value.indexOf(lineFeed$14); var length = value.length; var position; var subvalue; @@ -25908,19 +26066,18 @@ function paragraph(eat, value, silent) { var now; while (index < length) { - /* Eat everything if there’s no following newline. */ + // Eat everything if there’s no following newline. if (index === -1) { index = length; - break; + break } - /* Stop if the next character is NEWLINE. */ - if (value.charAt(index + 1) === C_NEWLINE$13) { - break; + // Stop if the next character is NEWLINE. + if (value.charAt(index + 1) === lineFeed$14) { + break } - /* In commonmark-mode, following indented lines - * are part of the paragraph. */ + // In commonmark-mode, following indented lines are part of the paragraph. if (commonmark) { size = 0; position = index + 1; @@ -25928,52 +26085,48 @@ function paragraph(eat, value, silent) { while (position < length) { character = value.charAt(position); - if (character === C_TAB$12) { - size = TAB_SIZE$1; - break; - } else if (character === C_SPACE$12) { + if (character === tab$13) { + size = tabSize$4; + break + } else if (character === space$13) { size++; } else { - break; + break } position++; } - if (size >= TAB_SIZE$1) { - index = value.indexOf(C_NEWLINE$13, index + 1); - continue; + if (size >= tabSize$4 && character !== lineFeed$14) { + index = value.indexOf(lineFeed$14, index + 1); + continue } } subvalue = value.slice(index + 1); - /* Check if the following code contains a possible - * block. */ + // Check if the following code contains a possible block. if (interrupt_1(interruptors, tokenizers, self, [eat, subvalue, true])) { - break; + break } - /* Break if the following line starts a list, when - * already in a list, or when in commonmark, or when - * in gfm mode and the bullet is *not* numeric. */ + // Break if the following line starts a list, when already in a list, or + // when in commonmark, or when in gfm mode and the bullet is *not* numeric. if ( tokenizers.list.call(self, eat, subvalue, true) && - ( - self.inList || + (self.inList || commonmark || - (gfm && !isDecimal(trim_1.left(subvalue).charAt(0))) - ) + (gfm && !isDecimal(trim_1.left(subvalue).charAt(0)))) ) { - break; + break } position = index; - index = value.indexOf(C_NEWLINE$13, index + 1); + index = value.indexOf(lineFeed$14, index + 1); if (index !== -1 && trim_1(value.slice(position, index)) === '') { index = position; - break; + break } } @@ -25982,12 +26135,12 @@ function paragraph(eat, value, silent) { if (trim_1(subvalue) === '') { eat(subvalue); - return null; + return null } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -25996,42 +26149,42 @@ function paragraph(eat, value, silent) { return eat(subvalue)({ type: 'paragraph', children: self.tokenizeInline(subvalue, now) - }); + }) } var _escape = locate; function locate(value, fromIndex) { - return value.indexOf('\\', fromIndex); + return value.indexOf('\\', fromIndex) } var _escape$2 = escape; escape.locator = _escape; +var lineFeed$15 = '\n'; +var backslash$4 = '\\'; + function escape(eat, value, silent) { var self = this; var character; var node; - if (value.charAt(0) === '\\') { + if (value.charAt(0) === backslash$4) { character = value.charAt(1); if (self.escape.indexOf(character) !== -1) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - if (character === '\n') { + if (character === lineFeed$15) { node = {type: 'break'}; } else { - node = { - type: 'text', - value: character - }; + node = {type: 'text', value: character}; } - return eat('\\' + character)(node); + return eat(backslash$4 + character)(node) } } } @@ -26039,60 +26192,51 @@ function escape(eat, value, silent) { var tag$1 = locate$2; function locate$2(value, fromIndex) { - return value.indexOf('<', fromIndex); + return value.indexOf('<', fromIndex) } var autoLink_1 = autoLink; autoLink.locator = tag$1; autoLink.notInLink = true; -var C_LT$2 = '<'; -var C_GT$2 = '>'; -var C_AT_SIGN = '@'; -var C_SLASH = '/'; -var MAILTO = 'mailto:'; -var MAILTO_LENGTH = MAILTO.length; +var lessThan$2 = '<'; +var greaterThan$2 = '>'; +var atSign = '@'; +var slash = '/'; +var mailto = 'mailto:'; +var mailtoLength = mailto.length; -/* Tokenise a link. */ function autoLink(eat, value, silent) { - var self; - var subvalue; - var length; - var index; - var queue; + var self = this; + var subvalue = ''; + var length = value.length; + var index = 0; + var queue = ''; + var hasAtCharacter = false; + var link = ''; var character; - var hasAtCharacter; - var link; var now; var content; - var tokenize; + var tokenizers; var exit; - if (value.charAt(0) !== C_LT$2) { - return; + if (value.charAt(0) !== lessThan$2) { + return } - self = this; - subvalue = ''; - length = value.length; - index = 0; - queue = ''; - hasAtCharacter = false; - link = ''; - index++; - subvalue = C_LT$2; + subvalue = lessThan$2; while (index < length) { character = value.charAt(index); if ( isWhitespaceCharacter(character) || - character === C_GT$2 || - character === C_AT_SIGN || - (character === ':' && value.charAt(index + 1) === C_SLASH) + character === greaterThan$2 || + character === atSign || + (character === ':' && value.charAt(index + 1) === slash) ) { - break; + break } queue += character; @@ -26100,7 +26244,7 @@ function autoLink(eat, value, silent) { } if (!queue) { - return; + return } link += queue; @@ -26110,25 +26254,22 @@ function autoLink(eat, value, silent) { link += character; index++; - if (character === C_AT_SIGN) { + if (character === atSign) { hasAtCharacter = true; } else { - if ( - character !== ':' || - value.charAt(index + 1) !== C_SLASH - ) { - return; + if (character !== ':' || value.charAt(index + 1) !== slash) { + return } - link += C_SLASH; + link += slash; index++; } while (index < length) { character = value.charAt(index); - if (isWhitespaceCharacter(character) || character === C_GT$2) { - break; + if (isWhitespaceCharacter(character) || character === greaterThan$2) { + break } queue += character; @@ -26137,13 +26278,13 @@ function autoLink(eat, value, silent) { character = value.charAt(index); - if (!queue || character !== C_GT$2) { - return; + if (!queue || character !== greaterThan$2) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } link += queue; @@ -26154,80 +26295,83 @@ function autoLink(eat, value, silent) { now.offset++; if (hasAtCharacter) { - if (link.slice(0, MAILTO_LENGTH).toLowerCase() === MAILTO) { - content = content.substr(MAILTO_LENGTH); - now.column += MAILTO_LENGTH; - now.offset += MAILTO_LENGTH; + if (link.slice(0, mailtoLength).toLowerCase() === mailto) { + content = content.substr(mailtoLength); + now.column += mailtoLength; + now.offset += mailtoLength; } else { - link = MAILTO + link; + link = mailto + link; } } - /* Temporarily remove support for escapes in autolinks. */ - tokenize = self.inlineTokenizers.escape; - self.inlineTokenizers.escape = null; + // Temporarily remove all tokenizers except text in autolinks. + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + exit = self.enterLink(); content = self.tokenizeInline(content, now); - self.inlineTokenizers.escape = tokenize; + self.inlineTokenizers = tokenizers; exit(); return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(link), + url: parseEntities_1(link, {nonTerminated: false}), children: content - }); + }) } var url = locate$4; -var PROTOCOLS = ['https://', 'http://', 'mailto:']; +var protocols = ['https://', 'http://', 'mailto:']; function locate$4(value, fromIndex) { - var length = PROTOCOLS.length; + var length = protocols.length; var index = -1; var min = -1; var position; if (!this.options.gfm) { - return -1; + return -1 } while (++index < length) { - position = value.indexOf(PROTOCOLS[index], fromIndex); + position = value.indexOf(protocols[index], fromIndex); if (position !== -1 && (position < min || min === -1)) { min = position; } } - return min; + return min } var url_1 = url$2; url$2.locator = url; url$2.notInLink = true; -var C_BRACKET_OPEN$2 = '['; -var C_BRACKET_CLOSE$2 = ']'; -var C_PAREN_OPEN$1 = '('; -var C_PAREN_CLOSE$2 = ')'; -var C_LT$3 = '<'; -var C_AT_SIGN$1 = '@'; - -var HTTP_PROTOCOL = 'http://'; -var HTTPS_PROTOCOL = 'https://'; -var MAILTO_PROTOCOL = 'mailto:'; - -var PROTOCOLS$1 = [ - HTTP_PROTOCOL, - HTTPS_PROTOCOL, - MAILTO_PROTOCOL -]; +var quotationMark$1 = '"'; +var apostrophe$1 = "'"; +var leftParenthesis$1 = '('; +var rightParenthesis$2 = ')'; +var comma$1 = ','; +var dot$2 = '.'; +var colon$4 = ':'; +var semicolon = ';'; +var lessThan$3 = '<'; +var atSign$1 = '@'; +var leftSquareBracket$2 = '['; +var rightSquareBracket$2 = ']'; + +var http = 'http://'; +var https = 'https://'; +var mailto$1 = 'mailto:'; + +var protocols$1 = [http, https, mailto$1]; -var PROTOCOLS_LENGTH = PROTOCOLS$1.length; +var protocolsLength = protocols$1.length; function url$2(eat, value, silent) { var self = this; @@ -26242,28 +26386,28 @@ function url$2(eat, value, silent) { var queue; var parenCount; var nextCharacter; + var tokenizers; var exit; if (!self.options.gfm) { - return; + return } subvalue = ''; index = -1; - length = PROTOCOLS_LENGTH; - while (++index < length) { - protocol = PROTOCOLS$1[index]; + while (++index < protocolsLength) { + protocol = protocols$1[index]; match = value.slice(0, protocol.length); if (match.toLowerCase() === protocol) { subvalue = match; - break; + break } } if (!subvalue) { - return; + return } index = subvalue.length; @@ -26274,36 +26418,36 @@ function url$2(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (isWhitespaceCharacter(character) || character === C_LT$3) { - break; + if (isWhitespaceCharacter(character) || character === lessThan$3) { + break } if ( - character === '.' || - character === ',' || - character === ':' || - character === ';' || - character === '"' || - character === '\'' || - character === ')' || - character === ']' + character === dot$2 || + character === comma$1 || + character === colon$4 || + character === semicolon || + character === quotationMark$1 || + character === apostrophe$1 || + character === rightParenthesis$2 || + character === rightSquareBracket$2 ) { nextCharacter = value.charAt(index + 1); if (!nextCharacter || isWhitespaceCharacter(nextCharacter)) { - break; + break } } - if (character === C_PAREN_OPEN$1 || character === C_BRACKET_OPEN$2) { + if (character === leftParenthesis$1 || character === leftSquareBracket$2) { parenCount++; } - if (character === C_PAREN_CLOSE$2 || character === C_BRACKET_CLOSE$2) { + if (character === rightParenthesis$2 || character === rightSquareBracket$2) { parenCount--; if (parenCount < 0) { - break; + break } } @@ -26312,37 +26456,44 @@ function url$2(eat, value, silent) { } if (!queue) { - return; + return } subvalue += queue; content = subvalue; - if (protocol === MAILTO_PROTOCOL) { - position = queue.indexOf(C_AT_SIGN$1); + if (protocol === mailto$1) { + position = queue.indexOf(atSign$1); if (position === -1 || position === length - 1) { - return; + return } - content = content.substr(MAILTO_PROTOCOL.length); + content = content.substr(mailto$1.length); } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } exit = self.enterLink(); + + // Temporarily remove all tokenizers except text in url. + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + content = self.tokenizeInline(content, eat.now()); + + self.inlineTokenizers = tokenizers; exit(); return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(subvalue), + url: parseEntities_1(subvalue, {nonTerminated: false}), children: content - }); + }) } var tag$3 = html.tag; @@ -26350,8 +26501,13 @@ var tag$3 = html.tag; var htmlInline = inlineHTML; inlineHTML.locator = tag$1; -var EXPRESSION_HTML_LINK_OPEN = /^/i; +var lessThan$4 = '<'; +var questionMark = '?'; +var exclamationMark$1 = '!'; +var slash$1 = '/'; + +var htmlLinkOpenExpression = /^/i; function inlineHTML(eat, value, silent) { var self = this; @@ -26359,41 +26515,41 @@ function inlineHTML(eat, value, silent) { var character; var subvalue; - if (value.charAt(0) !== '<' || length < 3) { - return; + if (value.charAt(0) !== lessThan$4 || length < 3) { + return } character = value.charAt(1); if ( !isAlphabetical(character) && - character !== '?' && - character !== '!' && - character !== '/' + character !== questionMark && + character !== exclamationMark$1 && + character !== slash$1 ) { - return; + return } subvalue = value.match(tag$3); if (!subvalue) { - return; + return } /* istanbul ignore if - not used yet. */ if (silent) { - return true; + return true } subvalue = subvalue[0]; - if (!self.inLink && EXPRESSION_HTML_LINK_OPEN.test(subvalue)) { + if (!self.inLink && htmlLinkOpenExpression.test(subvalue)) { self.inLink = true; - } else if (self.inLink && EXPRESSION_HTML_LINK_CLOSE.test(subvalue)) { + } else if (self.inLink && htmlLinkCloseExpression.test(subvalue)) { self.inLink = false; } - return eat(subvalue)({type: 'html', value: subvalue}); + return eat(subvalue)({type: 'html', value: subvalue}) } var link = locate$6; @@ -26403,44 +26559,29 @@ function locate$6(value, fromIndex) { var image = value.indexOf('![', fromIndex); if (image === -1) { - return link; + return link } - /* Link can never be `-1` if an image is found, so we don’t need - * to check for that :) */ - return link < image ? link : image; + // Link can never be `-1` if an image is found, so we don’t need to check + // for that :) + return link < image ? link : image } var link_1 = link$2; link$2.locator = link; -var own$5 = {}.hasOwnProperty; - -var C_BACKSLASH$3 = '\\'; -var C_BRACKET_OPEN$3 = '['; -var C_BRACKET_CLOSE$3 = ']'; -var C_PAREN_OPEN$2 = '('; -var C_PAREN_CLOSE$3 = ')'; -var C_LT$4 = '<'; -var C_GT$3 = '>'; -var C_TICK$2 = '`'; -var C_DOUBLE_QUOTE$1 = '"'; -var C_SINGLE_QUOTE$1 = '\''; - -/* Map of characters, which can be used to mark link - * and image titles. */ -var LINK_MARKERS = {}; - -LINK_MARKERS[C_DOUBLE_QUOTE$1] = C_DOUBLE_QUOTE$1; -LINK_MARKERS[C_SINGLE_QUOTE$1] = C_SINGLE_QUOTE$1; - -/* Map of characters, which can be used to mark link - * and image titles in commonmark-mode. */ -var COMMONMARK_LINK_MARKERS = {}; - -COMMONMARK_LINK_MARKERS[C_DOUBLE_QUOTE$1] = C_DOUBLE_QUOTE$1; -COMMONMARK_LINK_MARKERS[C_SINGLE_QUOTE$1] = C_SINGLE_QUOTE$1; -COMMONMARK_LINK_MARKERS[C_PAREN_OPEN$2] = C_PAREN_CLOSE$3; +var lineFeed$16 = '\n'; +var exclamationMark$2 = '!'; +var quotationMark$2 = '"'; +var apostrophe$2 = "'"; +var leftParenthesis$2 = '('; +var rightParenthesis$3 = ')'; +var lessThan$5 = '<'; +var greaterThan$3 = '>'; +var leftSquareBracket$3 = '['; +var backslash$5 = '\\'; +var rightSquareBracket$3 = ']'; +var graveAccent$2 = '`'; function link$2(eat, value, silent) { var self = this; @@ -26457,7 +26598,6 @@ function link$2(eat, value, silent) { var beforeTitle; var subqueue; var hasMarker; - var markers; var isImage; var content; var marker; @@ -26470,29 +26610,28 @@ function link$2(eat, value, silent) { var exit; var node; - /* Detect whether this is an image. */ - if (character === '!') { + // Detect whether this is an image. + if (character === exclamationMark$2) { isImage = true; subvalue = character; character = value.charAt(++index); } - /* Eat the opening. */ - if (character !== C_BRACKET_OPEN$3) { - return; + // Eat the opening. + if (character !== leftSquareBracket$3) { + return } - /* Exit when this is a link and we’re already inside - * a link. */ + // Exit when this is a link and we’re already inside a link. if (!isImage && self.inLink) { - return; + return } subvalue += character; queue = ''; index++; - /* Eat the content. */ + // Eat the content. length = value.length; now = eat.now(); depth = 0; @@ -26504,11 +26643,11 @@ function link$2(eat, value, silent) { character = value.charAt(index); subqueue = character; - if (character === C_TICK$2) { - /* Inline-code in link content. */ + if (character === graveAccent$2) { + // Inline-code in link content. count = 1; - while (value.charAt(index + 1) === C_TICK$2) { + while (value.charAt(index + 1) === graveAccent$2) { subqueue += character; index++; count++; @@ -26519,28 +26658,25 @@ function link$2(eat, value, silent) { } else if (count >= opening) { opening = 0; } - } else if (character === C_BACKSLASH$3) { - /* Allow brackets to be escaped. */ + } else if (character === backslash$5) { + // Allow brackets to be escaped. index++; subqueue += value.charAt(index); - /* In GFM mode, brackets in code still count. - * In all other modes, they don’t. This empty - * block prevents the next statements are - * entered. */ - } else if ((!opening || gfm) && character === C_BRACKET_OPEN$3) { + } else if ((!opening || gfm) && character === leftSquareBracket$3) { + // In GFM mode, brackets in code still count. In all other modes, + // they don’t. depth++; - } else if ((!opening || gfm) && character === C_BRACKET_CLOSE$3) { + } else if ((!opening || gfm) && character === rightSquareBracket$3) { if (depth) { depth--; } else { - /* Allow white-space between content and - * url in GFM mode. */ + // Allow white-space between content and url in GFM mode. if (!pedantic) { while (index < length) { character = value.charAt(index + 1); if (!isWhitespaceCharacter(character)) { - break; + break } subqueue += character; @@ -26548,15 +26684,15 @@ function link$2(eat, value, silent) { } } - if (value.charAt(index + 1) !== C_PAREN_OPEN$2) { - return; + if (value.charAt(index + 1) !== leftParenthesis$2) { + return } - subqueue += C_PAREN_OPEN$2; + subqueue += leftParenthesis$2; closed = true; index++; - break; + break } } @@ -26565,57 +26701,56 @@ function link$2(eat, value, silent) { index++; } - /* Eat the content closing. */ + // Eat the content closing. if (!closed) { - return; + return } content = queue; subvalue += queue + subqueue; index++; - /* Eat white-space. */ + // Eat white-space. while (index < length) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; index++; } - /* Eat the URL. */ + // Eat the URL. character = value.charAt(index); - markers = commonmark ? COMMONMARK_LINK_MARKERS : LINK_MARKERS; queue = ''; beforeURL = subvalue; - if (character === C_LT$4) { + if (character === lessThan$5) { index++; - beforeURL += C_LT$4; + beforeURL += lessThan$5; while (index < length) { character = value.charAt(index); - if (character === C_GT$3) { - break; + if (character === greaterThan$3) { + break } - if (commonmark && character === '\n') { - return; + if (commonmark && character === lineFeed$16) { + return } queue += character; index++; } - if (value.charAt(index) !== C_GT$3) { - return; + if (value.charAt(index) !== greaterThan$3) { + return } - subvalue += C_LT$4 + queue + C_GT$3; + subvalue += lessThan$5 + queue + greaterThan$3; url = queue; index++; } else { @@ -26625,22 +26760,27 @@ function link$2(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (subqueue && own$5.call(markers, character)) { - break; + if ( + subqueue && + (character === quotationMark$2 || + character === apostrophe$2 || + (commonmark && character === leftParenthesis$2)) + ) { + break } if (isWhitespaceCharacter(character)) { if (!pedantic) { - break; + break } subqueue += character; } else { - if (character === C_PAREN_OPEN$2) { + if (character === leftParenthesis$2) { depth++; - } else if (character === C_PAREN_CLOSE$3) { + } else if (character === rightParenthesis$3) { if (depth === 0) { - break; + break } depth--; @@ -26649,8 +26789,8 @@ function link$2(eat, value, silent) { queue += subqueue; subqueue = ''; - if (character === C_BACKSLASH$3) { - queue += C_BACKSLASH$3; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -26665,14 +26805,14 @@ function link$2(eat, value, silent) { index = subvalue.length; } - /* Eat white-space. */ + // Eat white-space. queue = ''; while (index < length) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } queue += character; @@ -26682,29 +26822,32 @@ function link$2(eat, value, silent) { character = value.charAt(index); subvalue += queue; - /* Eat the title. */ - if (queue && own$5.call(markers, character)) { + // Eat the title. + if ( + queue && + (character === quotationMark$2 || + character === apostrophe$2 || + (commonmark && character === leftParenthesis$2)) + ) { index++; subvalue += character; queue = ''; - marker = markers[character]; + marker = character === leftParenthesis$2 ? rightParenthesis$3 : character; beforeTitle = subvalue; - /* In commonmark-mode, things are pretty easy: the - * marker cannot occur inside the title. - * - * Non-commonmark does, however, support nested - * delimiters. */ + // In commonmark-mode, things are pretty easy: the marker cannot occur + // inside the title. Non-commonmark does, however, support nested + // delimiters. if (commonmark) { while (index < length) { character = value.charAt(index); if (character === marker) { - break; + break } - if (character === C_BACKSLASH$3) { - queue += C_BACKSLASH$3; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -26715,7 +26858,7 @@ function link$2(eat, value, silent) { character = value.charAt(index); if (character !== marker) { - return; + return } title = queue; @@ -26726,7 +26869,7 @@ function link$2(eat, value, silent) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; @@ -26747,10 +26890,10 @@ function link$2(eat, value, silent) { hasMarker = true; } else if (!hasMarker) { queue += character; - } else if (character === C_PAREN_CLOSE$3) { + } else if (character === rightParenthesis$3) { subvalue += queue + marker + subqueue; title = queue; - break; + break } else if (isWhitespaceCharacter(character)) { subqueue += character; } else { @@ -26764,18 +26907,20 @@ function link$2(eat, value, silent) { } } - if (value.charAt(index) !== C_PAREN_CLOSE$3) { - return; + if (value.charAt(index) !== rightParenthesis$3) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - subvalue += C_PAREN_CLOSE$3; + subvalue += rightParenthesis$3; - url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end); + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, { + nonTerminated: false + }); if (title) { beforeTitle = eat(beforeTitle).test().end; @@ -26796,32 +26941,35 @@ function link$2(eat, value, silent) { exit(); } - return eat(subvalue)(node); + return eat(subvalue)(node) } var reference_1 = reference; reference.locator = link; -var T_LINK = 'link'; -var T_IMAGE = 'image'; -var T_FOOTNOTE = 'footnote'; -var REFERENCE_TYPE_SHORTCUT = 'shortcut'; -var REFERENCE_TYPE_COLLAPSED = 'collapsed'; -var REFERENCE_TYPE_FULL = 'full'; -var C_CARET$1 = '^'; -var C_BACKSLASH$4 = '\\'; -var C_BRACKET_OPEN$4 = '['; -var C_BRACKET_CLOSE$4 = ']'; +var link$3 = 'link'; +var image$1 = 'image'; +var footnote = 'footnote'; +var shortcut = 'shortcut'; +var collapsed = 'collapsed'; +var full = 'full'; +var space$14 = ' '; +var exclamationMark$3 = '!'; +var leftSquareBracket$4 = '['; +var backslash$6 = '\\'; +var rightSquareBracket$4 = ']'; +var caret$2 = '^'; function reference(eat, value, silent) { var self = this; + var commonmark = self.options.commonmark; var character = value.charAt(0); var index = 0; var length = value.length; var subvalue = ''; var intro = ''; - var type = T_LINK; - var referenceType = REFERENCE_TYPE_SHORTCUT; + var type = link$3; + var referenceType = shortcut; var content; var identifier; var now; @@ -26831,51 +26979,53 @@ function reference(eat, value, silent) { var bracketed; var depth; - /* Check whether we’re eating an image. */ - if (character === '!') { - type = T_IMAGE; + // Check whether we’re eating an image. + if (character === exclamationMark$3) { + type = image$1; intro = character; character = value.charAt(++index); } - if (character !== C_BRACKET_OPEN$4) { - return; + if (character !== leftSquareBracket$4) { + return } index++; intro += character; queue = ''; - /* Check whether we’re eating a footnote. */ - if ( - self.options.footnotes && - type === T_LINK && - value.charAt(index) === C_CARET$1 - ) { - intro += C_CARET$1; + // Check whether we’re eating a footnote. + if (self.options.footnotes && value.charAt(index) === caret$2) { + // Exit if `![^` is found, so the `!` will be seen as text after this, + // and we’ll enter this function again when `[^` is found. + if (type === image$1) { + return + } + + intro += caret$2; index++; - type = T_FOOTNOTE; + type = footnote; } - /* Eat the text. */ + // Eat the text. depth = 0; while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_OPEN$4) { + if (character === leftSquareBracket$4) { bracketed = true; depth++; - } else if (character === C_BRACKET_CLOSE$4) { + } else if (character === rightSquareBracket$4) { if (!depth) { - break; + break } depth--; } - if (character === C_BACKSLASH$4) { - queue += C_BACKSLASH$4; + if (character === backslash$6) { + queue += backslash$6; character = value.charAt(++index); } @@ -26887,29 +27037,34 @@ function reference(eat, value, silent) { content = queue; character = value.charAt(index); - if (character !== C_BRACKET_CLOSE$4) { - return; + if (character !== rightSquareBracket$4) { + return } index++; subvalue += character; queue = ''; - while (index < length) { - character = value.charAt(index); + if (!commonmark) { + // The original markdown syntax definition explicitly allows for whitespace + // between the link text and link label; commonmark departs from this, in + // part to improve support for shortcut reference links + while (index < length) { + character = value.charAt(index); - if (!isWhitespaceCharacter(character)) { - break; - } + if (!isWhitespaceCharacter(character)) { + break + } - queue += character; - index++; + queue += character; + index++; + } } character = value.charAt(index); - /* Inline footnotes cannot have an identifier. */ - if (type !== T_FOOTNOTE && character === C_BRACKET_OPEN$4) { + // Inline footnotes cannot have an identifier. + if (type !== footnote && character === leftSquareBracket$4) { identifier = ''; queue += character; index++; @@ -26917,12 +27072,12 @@ function reference(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_OPEN$4 || character === C_BRACKET_CLOSE$4) { - break; + if (character === leftSquareBracket$4 || character === rightSquareBracket$4) { + break } - if (character === C_BACKSLASH$4) { - identifier += C_BACKSLASH$4; + if (character === backslash$6) { + identifier += backslash$6; character = value.charAt(++index); } @@ -26932,8 +27087,8 @@ function reference(eat, value, silent) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE$4) { - referenceType = identifier ? REFERENCE_TYPE_FULL : REFERENCE_TYPE_COLLAPSED; + if (character === rightSquareBracket$4) { + referenceType = identifier ? full : collapsed; queue += identifier + character; index++; } else { @@ -26944,58 +27099,59 @@ function reference(eat, value, silent) { queue = ''; } else { if (!content) { - return; + return } identifier = content; } - /* Brackets cannot be inside the identifier. */ - if (referenceType !== REFERENCE_TYPE_FULL && bracketed) { - return; + // Brackets cannot be inside the identifier. + if (referenceType !== full && bracketed) { + return } subvalue = intro + subvalue; - if (type === T_LINK && self.inLink) { - return null; + if (type === link$3 && self.inLink) { + return null } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - if (type === T_FOOTNOTE && content.indexOf(' ') !== -1) { + if (type === footnote && content.indexOf(space$14) !== -1) { return eat(subvalue)({ - type: 'footnote', + type: footnote, children: this.tokenizeInline(content, eat.now()) - }); + }) } now = eat.now(); now.column += intro.length; now.offset += intro.length; - identifier = referenceType === REFERENCE_TYPE_FULL ? identifier : content; + identifier = referenceType === full ? identifier : content; node = { type: type + 'Reference', - identifier: normalize_1(identifier) + identifier: normalize_1(identifier), + label: identifier }; - if (type === T_LINK || type === T_IMAGE) { + if (type === link$3 || type === image$1) { node.referenceType = referenceType; } - if (type === T_LINK) { + if (type === link$3) { exit = self.enterLink(); node.children = self.tokenizeInline(content, now); exit(); - } else if (type === T_IMAGE) { + } else if (type === image$1) { node.alt = self.decode.raw(self.unescape(content), now) || null; } - return eat(subvalue)(node); + return eat(subvalue)(node) } var strong = locate$8; @@ -27005,21 +27161,22 @@ function locate$8(value, fromIndex) { var underscore = value.indexOf('__', fromIndex); if (underscore === -1) { - return asterisk; + return asterisk } if (asterisk === -1) { - return underscore; + return underscore } - return underscore < asterisk ? underscore : asterisk; + return underscore < asterisk ? underscore : asterisk } var strong_1 = strong$2; strong$2.locator = strong; -var C_ASTERISK$2 = '*'; -var C_UNDERSCORE$2 = '_'; +var backslash$7 = '\\'; +var asterisk$2 = '*'; +var underscore$2 = '_'; function strong$2(eat, value, silent) { var self = this; @@ -27034,10 +27191,10 @@ function strong$2(eat, value, silent) { var prev; if ( - (character !== C_ASTERISK$2 && character !== C_UNDERSCORE$2) || + (character !== asterisk$2 && character !== underscore$2) || value.charAt(++index) !== character ) { - return; + return } pedantic = self.options.pedantic; @@ -27049,7 +27206,7 @@ function strong$2(eat, value, silent) { character = ''; if (pedantic && isWhitespaceCharacter(value.charAt(index))) { - return; + return } while (index < length) { @@ -27065,12 +27222,12 @@ function strong$2(eat, value, silent) { if (character !== marker) { if (!trim_1(queue)) { - return; + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -27080,11 +27237,11 @@ function strong$2(eat, value, silent) { return eat(subvalue + queue + subvalue)({ type: 'strong', children: self.tokenizeInline(queue, now) - }); + }) } } - if (!pedantic && character === '\\') { + if (!pedantic && character === backslash$7) { queue += character; character = value.charAt(++index); } @@ -27114,21 +27271,22 @@ function locate$10(value, fromIndex) { var underscore = value.indexOf('_', fromIndex); if (underscore === -1) { - return asterisk; + return asterisk } if (asterisk === -1) { - return underscore; + return underscore } - return underscore < asterisk ? underscore : asterisk; + return underscore < asterisk ? underscore : asterisk } var emphasis_1 = emphasis$2; emphasis$2.locator = emphasis; -var C_ASTERISK$3 = '*'; -var C_UNDERSCORE$3 = '_'; +var asterisk$3 = '*'; +var underscore$3 = '_'; +var backslash$8 = '\\'; function emphasis$2(eat, value, silent) { var self = this; @@ -27142,8 +27300,8 @@ function emphasis$2(eat, value, silent) { var length; var prev; - if (character !== C_ASTERISK$3 && character !== C_UNDERSCORE$3) { - return; + if (character !== asterisk$3 && character !== underscore$3) { + return } pedantic = self.options.pedantic; @@ -27155,7 +27313,7 @@ function emphasis$2(eat, value, silent) { character = ''; if (pedantic && isWhitespaceCharacter(value.charAt(index))) { - return; + return } while (index < length) { @@ -27167,17 +27325,17 @@ function emphasis$2(eat, value, silent) { if (character !== marker) { if (!trim_1(queue) || prev === marker) { - return; + return } - if (!pedantic && marker === C_UNDERSCORE$3 && isWordCharacter(character)) { + if (!pedantic && marker === underscore$3 && isWordCharacter(character)) { queue += marker; - continue; + continue } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -27187,13 +27345,13 @@ function emphasis$2(eat, value, silent) { return eat(subvalue + queue + marker)({ type: 'emphasis', children: self.tokenizeInline(queue, now) - }); + }) } queue += marker; } - if (!pedantic && character === '\\') { + if (!pedantic && character === backslash$8) { queue += character; character = value.charAt(++index); } @@ -27206,14 +27364,14 @@ function emphasis$2(eat, value, silent) { var _delete = locate$12; function locate$12(value, fromIndex) { - return value.indexOf('~~', fromIndex); + return value.indexOf('~~', fromIndex) } var _delete$2 = strikethrough; strikethrough.locator = _delete; -var C_TILDE$1 = '~'; -var DOUBLE = '~~'; +var tilde$2 = '~'; +var fence = '~~'; function strikethrough(eat, value, silent) { var self = this; @@ -27227,11 +27385,11 @@ function strikethrough(eat, value, silent) { if ( !self.options.gfm || - value.charAt(0) !== C_TILDE$1 || - value.charAt(1) !== C_TILDE$1 || + value.charAt(0) !== tilde$2 || + value.charAt(1) !== tilde$2 || isWhitespaceCharacter(value.charAt(2)) ) { - return; + return } index = 1; @@ -27244,19 +27402,19 @@ function strikethrough(eat, value, silent) { character = value.charAt(index); if ( - character === C_TILDE$1 && - previous === C_TILDE$1 && + character === tilde$2 && + previous === tilde$2 && (!preceding || !isWhitespaceCharacter(preceding)) ) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - return eat(DOUBLE + subvalue + DOUBLE)({ + return eat(fence + subvalue + fence)({ type: 'delete', children: self.tokenizeInline(subvalue, now) - }); + }) } subvalue += previous; @@ -27268,15 +27426,14 @@ function strikethrough(eat, value, silent) { var codeInline = locate$14; function locate$14(value, fromIndex) { - return value.indexOf('`', fromIndex); + return value.indexOf('`', fromIndex) } var codeInline$2 = inlineCode; inlineCode.locator = codeInline; -var C_TICK$3 = '`'; +var graveAccent$3 = '`'; -/* Tokenise inline code. */ function inlineCode(eat, value, silent) { var length = value.length; var index = 0; @@ -27292,16 +27449,16 @@ function inlineCode(eat, value, silent) { var next; while (index < length) { - if (value.charAt(index) !== C_TICK$3) { - break; + if (value.charAt(index) !== graveAccent$3) { + break } - queue += C_TICK$3; + queue += graveAccent$3; index++; } if (!queue) { - return; + return } subvalue = queue; @@ -27314,7 +27471,7 @@ function inlineCode(eat, value, silent) { character = next; next = value.charAt(index + 1); - if (character === C_TICK$3) { + if (character === graveAccent$3) { count++; tickQueue += character; } else { @@ -27322,11 +27479,11 @@ function inlineCode(eat, value, silent) { queue += character; } - if (count && next !== C_TICK$3) { + if (count && next !== graveAccent$3) { if (count === openingCount) { subvalue += queue + tickQueue; found = true; - break; + break } queue += tickQueue; @@ -27338,7 +27495,7 @@ function inlineCode(eat, value, silent) { if (!found) { if (openingCount % 2 !== 0) { - return; + return } queue = ''; @@ -27346,7 +27503,7 @@ function inlineCode(eat, value, silent) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } contentQueue = ''; @@ -27359,7 +27516,7 @@ function inlineCode(eat, value, silent) { if (isWhitespaceCharacter(character)) { subqueue += character; - continue; + continue } if (subqueue) { @@ -27373,10 +27530,7 @@ function inlineCode(eat, value, silent) { contentQueue += character; } - return eat(subvalue)({ - type: 'inlineCode', - value: contentQueue - }); + return eat(subvalue)({type: 'inlineCode', value: contentQueue}) } var _break = locate$16; @@ -27386,19 +27540,21 @@ function locate$16(value, fromIndex) { while (index > fromIndex) { if (value.charAt(index - 1) !== ' ') { - break; + break } index--; } - return index; + return index } var _break$2 = hardBreak; hardBreak.locator = _break; -var MIN_BREAK_LENGTH = 2; +var space$15 = ' '; +var lineFeed$17 = '\n'; +var minBreakLength = 2; function hardBreak(eat, value, silent) { var length = value.length; @@ -27409,23 +27565,23 @@ function hardBreak(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (character === '\n') { - if (index < MIN_BREAK_LENGTH) { - return; + if (character === lineFeed$17) { + if (index < minBreakLength) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } queue += character; - return eat(queue)({type: 'break'}); + return eat(queue)({type: 'break'}) } - if (character !== ' ') { - return; + if (character !== space$15) { + return } queue += character; @@ -27449,7 +27605,7 @@ function text(eat, value, silent) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } methods = self.inlineMethods; @@ -27462,7 +27618,7 @@ function text(eat, value, silent) { name = methods[index]; if (name === 'text' || !tokenizers[name]) { - continue; + continue } tokenizer = tokenizers[name].locator; @@ -27481,12 +27637,11 @@ function text(eat, value, silent) { subvalue = value.slice(0, min); now = eat.now(); - self.decode(subvalue, now, function (content, position, source) { - eat(source || content)({ - type: 'text', - value: content - }); - }); + self.decode(subvalue, now, handler); + + function handler(content, position, source) { + eat(source || content)({type: 'text', value: content}); + } } var parser = Parser; @@ -27507,31 +27662,30 @@ function Parser(doc, file) { this.decode = decode$1(this); } -var proto$3 = Parser.prototype; +var proto$5 = Parser.prototype; -/* Expose core. */ -proto$3.setOptions = setOptions_1; -proto$3.parse = parse_1$3; +// Expose core. +proto$5.setOptions = setOptions_1; +proto$5.parse = parse_1$3; -/* Expose `defaults`. */ -proto$3.options = defaults$2; +// Expose `defaults`. +proto$5.options = defaults$2; -/* Enter and exit helpers. */ -proto$3.exitStart = stateToggle('atStart', true); -proto$3.enterList = stateToggle('inList', false); -proto$3.enterLink = stateToggle('inLink', false); -proto$3.enterBlock = stateToggle('inBlock', false); +// Enter and exit helpers. +proto$5.exitStart = stateToggle('atStart', true); +proto$5.enterList = stateToggle('inList', false); +proto$5.enterLink = stateToggle('inLink', false); +proto$5.enterBlock = stateToggle('inBlock', false); -/* Nodes that can interupt a paragraph: - * - * ```markdown - * A paragraph, followed by a thematic break. - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the paragraph. */ -proto$3.interruptParagraph = [ +// Nodes that can interupt a paragraph: +// +// ```markdown +// A paragraph, followed by a thematic break. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the paragraph. +proto$5.interruptParagraph = [ ['thematicBreak'], ['atxHeading'], ['fencedCode'], @@ -27542,32 +27696,31 @@ proto$3.interruptParagraph = [ ['footnote', {commonmark: false}] ]; -/* Nodes that can interupt a list: - * - * ```markdown - * - One - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the list. */ -proto$3.interruptList = [ +// Nodes that can interupt a list: +// +// ```markdown +// - One +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the list. +proto$5.interruptList = [ + ['atxHeading', {pedantic: false}], ['fencedCode', {pedantic: false}], ['thematicBreak', {pedantic: false}], ['definition', {commonmark: false}], ['footnote', {commonmark: false}] ]; -/* Nodes that can interupt a blockquote: - * - * ```markdown - * > A paragraph. - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the blockquote. */ -proto$3.interruptBlockquote = [ +// Nodes that can interupt a blockquote: +// +// ```markdown +// > A paragraph. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the blockquote. +proto$5.interruptBlockquote = [ ['indentedCode', {commonmark: true}], ['fencedCode', {commonmark: true}], ['atxHeading', {commonmark: true}], @@ -27579,8 +27732,8 @@ proto$3.interruptBlockquote = [ ['footnote', {commonmark: false}] ]; -/* Handlers. */ -proto$3.blockTokenizers = { +// Handlers. +proto$5.blockTokenizers = { newline: newline_1, indentedCode: codeIndented, fencedCode: codeFenced, @@ -27596,7 +27749,7 @@ proto$3.blockTokenizers = { paragraph: paragraph_1 }; -proto$3.inlineTokenizers = { +proto$5.inlineTokenizers = { escape: _escape$2, autoLink: autoLink_1, url: url_1, @@ -27611,16 +27764,16 @@ proto$3.inlineTokenizers = { text: text_1 }; -/* Expose precedence. */ -proto$3.blockMethods = keys$1(proto$3.blockTokenizers); -proto$3.inlineMethods = keys$1(proto$3.inlineTokenizers); +// Expose precedence. +proto$5.blockMethods = keys$1(proto$5.blockTokenizers); +proto$5.inlineMethods = keys$1(proto$5.inlineTokenizers); -/* Tokenizers. */ -proto$3.tokenizeBlock = tokenizer('block'); -proto$3.tokenizeInline = tokenizer('inline'); -proto$3.tokenizeFactory = tokenizer; +// Tokenizers. +proto$5.tokenizeBlock = tokenizer('block'); +proto$5.tokenizeInline = tokenizer('inline'); +proto$5.tokenizeFactory = tokenizer; -/* Get all keys in `value`. */ +// Get all keys in `value`. function keys$1(value) { var result = []; var key; @@ -27629,55 +27782,55 @@ function keys$1(value) { result.push(key); } - return result; + return result } var remarkParse = parse$9; parse$9.Parser = parser; function parse$9(options) { + var settings = this.data('settings'); var Local = unherit_1(parser); - Local.prototype.options = immutable(Local.prototype.options, this.data('settings'), options); + + Local.prototype.options = immutable(Local.prototype.options, settings, options); + this.Parser = Local; } -var returner_1 = returner; +var identity_1 = identity$1; -function returner(value) { - return value; +function identity$1(value) { + return value } var enterLinkReference = enter; -/* Shortcut and collapsed link references need no escaping - * and encoding during the processing of child nodes (it - * must be implied from identifier). - * - * This toggler turns encoding and escaping off for shortcut - * and collapsed references. - * - * Implies `enterLink`. - */ +// Shortcut and collapsed link references need no escaping and encoding during +// the processing of child nodes (it must be implied from identifier). +// +// This toggler turns encoding and escaping off for shortcut and collapsed +// references. +// +// Implies `enterLink`. function enter(compiler, node) { var encode = compiler.encode; var escape = compiler.escape; - var exit = compiler.enterLink(); + var exitLink = compiler.enterLink(); - if ( - node.referenceType !== 'shortcut' && - node.referenceType !== 'collapsed' - ) { - return exit; + if (node.referenceType !== 'shortcut' && node.referenceType !== 'collapsed') { + return exitLink } - compiler.escape = returner_1; - compiler.encode = returner_1; + compiler.escape = identity_1; + compiler.encode = identity_1; - return function () { + return exit + + function exit() { compiler.encode = encode; compiler.escape = escape; - exit(); - }; + exitLink(); + } } var defaults$5 = { @@ -27704,7 +27857,7 @@ var defaults$5 = { }; function stringLength(value) { - return value.length; + return value.length } const nbsp$2 = " "; @@ -27863,7 +28016,7 @@ const Prime$1 = "″"; const oline$1 = "‾"; const frasl$1 = "⁄"; const weierp$1 = "℘"; -const image$1 = "ℑ"; +const image$2 = "ℑ"; const real$1 = "ℜ"; const trade$1 = "™"; const alefsym$1 = "ℵ"; @@ -27937,7 +28090,7 @@ const Scaron$1 = "Š"; const scaron$1 = "š"; const Yuml$1 = "Ÿ"; const circ$1 = "ˆ"; -const tilde$1 = "˜"; +const tilde$3 = "˜"; const ensp$1 = " "; const emsp$1 = " "; const thinsp$1 = " "; @@ -28116,7 +28269,7 @@ var index$5 = { oline: oline$1, frasl: frasl$1, weierp: weierp$1, - image: image$1, + image: image$2, real: real$1, trade: trade$1, alefsym: alefsym$1, @@ -28190,7 +28343,7 @@ var index$5 = { scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$1, + tilde: tilde$3, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -28371,7 +28524,7 @@ var characterEntitiesHtml4 = Object.freeze({ oline: oline$1, frasl: frasl$1, weierp: weierp$1, - image: image$1, + image: image$2, real: real$1, trade: trade$1, alefsym: alefsym$1, @@ -28445,7 +28598,7 @@ var characterEntitiesHtml4 = Object.freeze({ scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$1, + tilde: tilde$3, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -28500,7 +28653,7 @@ var own$6 = {}.hasOwnProperty; var escapes$2 = ['"', "'", '<', '>', '&', '`']; /* Map of characters to names. */ -var characters$1 = construct(); +var characters = construct(); /* Default escapes. */ var defaultEscapes = toExpression(escapes$2); @@ -28563,8 +28716,8 @@ function one$1(char, next, options) { var named; var numeric; - if ((shortest || options.useNamedReferences) && own$6.call(characters$1, char)) { - named = toNamed(characters$1[char], next, omit, options.attribute); + if ((shortest || options.useNamedReferences) && own$6.call(characters, char)) { + named = toNamed(characters[char], next, omit, options.attribute); } if (shortest || !named) { @@ -28627,42 +28780,75 @@ var isAlphanumeric = function (str) { var entityPrefixLength = length; -/* Returns the length of HTML entity that is a prefix of - * the given string (excluding the ampersand), 0 if it - * does not start with an entity. */ +var ampersand = '&'; + +// Returns the length of HTML entity that is a prefix of the given string +// (excluding the ampersand), 0 if it does not start with an entity. function length(value) { var prefix; - /* istanbul ignore if - Currently also tested for at - * implemention, but we keep it here because that’s - * proper. */ - if (value.charAt(0) !== '&') { - return 0; + /* istanbul ignore if - Currently also tested for at implemention, but we + * keep it here because that’s proper. */ + if (value.charAt(0) !== ampersand) { + return 0 } - prefix = value.split('&', 2).join('&'); + prefix = value.split(ampersand, 2).join(ampersand); - return prefix.length - parseEntities_1(prefix).length; + return prefix.length - parseEntities_1(prefix).length } var _escape$4 = factory$5; -var BACKSLASH = '\\'; -var BULLETS = ['*', '-', '+']; -var ALLIGNMENT = [':', '-', ' ', '|']; -var entities$1 = {'<': '<', ':': ':', '&': '&', '|': '|', '~': '~'}; +var tab$14 = '\t'; +var lineFeed$18 = '\n'; +var space$16 = ' '; +var numberSign$1 = '#'; +var ampersand$1 = '&'; +var leftParenthesis$3 = '('; +var rightParenthesis$4 = ')'; +var asterisk$4 = '*'; +var plusSign$1 = '+'; +var dash$5 = '-'; +var dot$3 = '.'; +var colon$5 = ':'; +var lessThan$6 = '<'; +var greaterThan$4 = '>'; +var leftSquareBracket$5 = '['; +var backslash$9 = '\\'; +var rightSquareBracket$5 = ']'; +var underscore$4 = '_'; +var graveAccent$4 = '`'; +var verticalBar$1 = '|'; +var tilde$4 = '~'; +var exclamationMark$4 = '!'; + +var entities$1 = { + '<': '<', + ':': ':', + '&': '&', + '|': '|', + '~': '~' +}; + +var shortcut$1 = 'shortcut'; +var mailto$2 = 'mailto'; +var https$1 = 'https'; +var http$1 = 'http'; -/* Factory to escape characters. */ +var blankExpression = /\n\s*$/; + +// Factory to escape characters. function factory$5(options) { - return escape; + return escape - /* Escape punctuation characters in a node's value. */ + // Escape punctuation characters in a node’s value. function escape(value, node, parent) { var self = this; var gfm = options.gfm; var commonmark = options.commonmark; var pedantic = options.pedantic; - var markers = commonmark ? ['.', ')'] : ['.']; + var markers = commonmark ? [dot$3, rightParenthesis$4] : [dot$3]; var siblings = parent && parent.children; var index = siblings && siblings.indexOf(node); var prev = siblings && siblings[index - 1]; @@ -28680,14 +28866,10 @@ function factory$5(options) { var replace; if (prev) { - afterNewLine = text$1(prev) && /\n\s*$/.test(prev.value); + afterNewLine = text$1(prev) && blankExpression.test(prev.value); } else { - afterNewLine = !parent || parent.type === 'root' || parent.type === 'paragraph'; - } - - function one(character) { - return escapable.indexOf(character) === -1 ? - entities$1[character] : BACKSLASH + character; + afterNewLine = + !parent || parent.type === 'root' || parent.type === 'paragraph'; } while (++position < length) { @@ -28697,35 +28879,36 @@ function factory$5(options) { if (character === '\n') { afterNewLine = true; } else if ( - character === BACKSLASH || - character === '`' || - character === '*' || - character === '[' || - character === '<' || - (character === '&' && entityPrefixLength(value.slice(position)) > 0) || - (character === ']' && self.inLink) || - (gfm && character === '~' && value.charAt(position + 1) === '~') || - (gfm && character === '|' && (self.inTable || alignment(value, position))) || - ( - character === '_' && - /* Delegate leading/trailing underscores - * to the multinode version below. */ + character === backslash$9 || + character === graveAccent$4 || + character === asterisk$4 || + (character === exclamationMark$4 && + value.charAt(position + 1) === leftSquareBracket$5) || + character === leftSquareBracket$5 || + character === lessThan$6 || + (character === ampersand$1 && entityPrefixLength(value.slice(position)) > 0) || + (character === rightSquareBracket$5 && self.inLink) || + (gfm && character === tilde$4 && value.charAt(position + 1) === tilde$4) || + (gfm && + character === verticalBar$1 && + (self.inTable || alignment(value, position))) || + (character === underscore$4 && + // Delegate leading/trailing underscores to the multinode version below. position > 0 && position < length - 1 && - ( - pedantic || - !isAlphanumeric(value.charAt(position - 1)) || - !isAlphanumeric(value.charAt(position + 1)) - ) - ) || - (gfm && !self.inLink && character === ':' && protocol(queue.join(''))) + (pedantic || + !isAlphanumeric(value.charAt(position - 1)) || + !isAlphanumeric(value.charAt(position + 1)))) || + (gfm && !self.inLink && character === colon$5 && protocol(queue.join(''))) ) { replace = true; } else if (afterNewLine) { if ( - character === '>' || - character === '#' || - BULLETS.indexOf(character) !== -1 + character === greaterThan$4 || + character === numberSign$1 || + character === asterisk$4 || + character === dash$5 || + character === plusSign$1 ) { replace = true; } else if (isDecimal(character)) { @@ -28733,7 +28916,7 @@ function factory$5(options) { while (offset < length) { if (!isDecimal(value.charAt(offset))) { - break; + break } offset++; @@ -28742,7 +28925,7 @@ function factory$5(options) { if (markers.indexOf(value.charAt(offset)) !== -1) { next = value.charAt(offset + 1); - if (!next || next === ' ' || next === '\t' || next === '\n') { + if (!next || next === space$16 || next === tab$14 || next === lineFeed$18) { queue.push(value.slice(position, offset)); position = offset; character = value.charAt(position); @@ -28759,135 +28942,157 @@ function factory$5(options) { queue.push(replace ? one(character) : character); } - /* Multi-node versions. */ + // Multi-node versions. if (siblings && text$1(node)) { - /* Check for an opening parentheses after a - * link-reference (which can be joined by - * white-space). */ - if (prev && prev.referenceType === 'shortcut') { + // Check for an opening parentheses after a link-reference (which can be + // joined by white-space). + if (prev && prev.referenceType === shortcut$1) { position = -1; length = escaped.length; while (++position < length) { character = escaped[position]; - if (character === ' ' || character === '\t') { - continue; + if (character === space$16 || character === tab$14) { + continue } - if (character === '(' || character === ':') { + if (character === leftParenthesis$3 || character === colon$5) { escaped[position] = one(character); } - break; + break } - /* If the current node is all spaces / tabs, - * preceded by a shortcut, and followed by - * a text starting with `(`, escape it. */ + // If the current node is all spaces / tabs, preceded by a shortcut, + // and followed by a text starting with `(`, escape it. if ( text$1(next) && position === length && - next.value.charAt(0) === '(' + next.value.charAt(0) === leftParenthesis$3 ) { - escaped.push(BACKSLASH); + escaped.push(backslash$9); } } - /* Ensure non-auto-links are not seen as links. - * This pattern needs to check the preceding - * nodes too. */ + // Ensure non-auto-links are not seen as links. This pattern needs to + // check the preceding nodes too. if ( gfm && !self.inLink && text$1(prev) && - value.charAt(0) === ':' && + value.charAt(0) === colon$5 && protocol(prev.value.slice(-6)) ) { - escaped[0] = one(':'); + escaped[0] = one(colon$5); } - /* Escape ampersand if it would otherwise - * start an entity. */ + // Escape ampersand if it would otherwise start an entity. if ( text$1(next) && - value.charAt(length - 1) === '&' && - entityPrefixLength('&' + next.value) !== 0 + value.charAt(length - 1) === ampersand$1 && + entityPrefixLength(ampersand$1 + next.value) !== 0 + ) { + escaped[escaped.length - 1] = one(ampersand$1); + } + + // Escape exclamation marks immediately followed by links. + if ( + next && + next.type === 'link' && + value.charAt(length - 1) === exclamationMark$4 ) { - escaped[escaped.length - 1] = one('&'); + escaped[escaped.length - 1] = one(exclamationMark$4); } - /* Escape double tildes in GFM. */ + // Escape double tildes in GFM. if ( gfm && text$1(next) && - value.charAt(length - 1) === '~' && - next.value.charAt(0) === '~' + value.charAt(length - 1) === tilde$4 && + next.value.charAt(0) === tilde$4 ) { - escaped.splice(escaped.length - 1, 0, BACKSLASH); + escaped.splice(escaped.length - 1, 0, backslash$9); } - /* Escape underscores, but not mid-word (unless - * in pedantic mode). */ + // Escape underscores, but not mid-word (unless in pedantic mode). wordCharBefore = text$1(prev) && isAlphanumeric(prev.value.slice(-1)); wordCharAfter = text$1(next) && isAlphanumeric(next.value.charAt(0)); if (length === 1) { - if (value === '_' && (pedantic || !wordCharBefore || !wordCharAfter)) { - escaped.unshift(BACKSLASH); + if ( + value === underscore$4 && + (pedantic || !wordCharBefore || !wordCharAfter) + ) { + escaped.unshift(backslash$9); } } else { if ( - value.charAt(0) === '_' && + value.charAt(0) === underscore$4 && (pedantic || !wordCharBefore || !isAlphanumeric(value.charAt(1))) ) { - escaped.unshift(BACKSLASH); + escaped.unshift(backslash$9); } if ( - value.charAt(length - 1) === '_' && - (pedantic || !wordCharAfter || !isAlphanumeric(value.charAt(length - 2))) + value.charAt(length - 1) === underscore$4 && + (pedantic || + !wordCharAfter || + !isAlphanumeric(value.charAt(length - 2))) ) { - escaped.splice(escaped.length - 1, 0, BACKSLASH); + escaped.splice(escaped.length - 1, 0, backslash$9); } } } - return escaped.join(''); + return escaped.join('') + + function one(character) { + return escapable.indexOf(character) === -1 + ? entities$1[character] + : backslash$9 + character + } } } -/* Check if `index` in `value` is inside an alignment row. */ +// Check if `index` in `value` is inside an alignment row. function alignment(value, index) { - var start = value.lastIndexOf('\n', index); - var end = value.indexOf('\n', index); + var start = value.lastIndexOf(lineFeed$18, index); + var end = value.indexOf(lineFeed$18, index); + var char; - start = start === -1 ? -1 : start; end = end === -1 ? value.length : end; while (++start < end) { - if (ALLIGNMENT.indexOf(value.charAt(start)) === -1) { - return false; + char = value.charAt(start); + + if ( + char !== colon$5 && + char !== dash$5 && + char !== space$16 && + char !== verticalBar$1 + ) { + return false } } - return true; + return true } -/* Check if `node` is a text node. */ +// Check if `node` is a text node. function text$1(node) { - return node && node.type === 'text'; + return node && node.type === 'text' } -/* Check if `value` ends in a protocol. */ +// Check if `value` ends in a protocol. function protocol(value) { var val = value.slice(-6).toLowerCase(); - return val === 'mailto' || val.slice(-5) === 'https' || val.slice(-4) === 'http'; + return val === mailto$2 || val.slice(-5) === https$1 || val.slice(-4) === http$1 } var setOptions_1$2 = setOptions$1; -/* Map of applicable enum's. */ +// Map of applicable enums. var maps = { entities: {true: true, false: true, numbers: true, escape: true}, bullet: {'*': true, '-': true, '+': true}, @@ -28898,7 +29103,7 @@ var maps = { fence: {'`': true, '~': true} }; -/* Expose `validate`. */ +// Expose `validate`. var validate = { boolean: validateBoolean, string: validateString, @@ -28906,8 +29111,7 @@ var validate = { function: validateFunction }; -/* Set options. Does not overwrite previously set - * options. */ +// Set options. Does not overwrite previously set options. function setOptions$1(options) { var self = this; var current = self.options; @@ -28919,7 +29123,7 @@ function setOptions$1(options) { } else if (typeof options === 'object') { options = immutable(options); } else { - throw new Error('Invalid value `' + options + '` for setting `options`'); + throw new Error('Invalid value `' + options + '` for setting `options`') } for (key in defaults$5) { @@ -28937,18 +29141,11 @@ function setOptions$1(options) { self.options = options; - return self; -} - -/* Throw an exception with in its `message` `value` - * and `name`. */ -function raise(value, name) { - throw new Error('Invalid value `' + value + '` for setting `' + name + '`'); + return self } -/* Validate a value to be boolean. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a boolean. */ +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. function validateBoolean(context, name, def) { var value = context[name]; @@ -28963,9 +29160,8 @@ function validateBoolean(context, name, def) { context[name] = value; } -/* Validate a value to be boolean. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a boolean. */ +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. function validateNumber(context, name, def) { var value = context[name]; @@ -28980,9 +29176,8 @@ function validateNumber(context, name, def) { context[name] = value; } -/* Validate a value to be in `map`. Defaults to `def`. - * Raises an exception with `context[name]` when not - * in `map`. */ +// Validate a value to be in `map`. Defaults to `def`. Raises an exception +// with `context[name]` when not in `map`. function validateString(context, name, def, map) { var value = context[name]; @@ -28999,9 +29194,8 @@ function validateString(context, name, def, map) { context[name] = value; } -/* Validate a value to be function. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a function. */ +// Validate a value to be function. Defaults to `def`. Raises an exception +// with `context[name]` when not a function. function validateFunction(context, name, def) { var value = context[name]; @@ -29016,17 +29210,15 @@ function validateFunction(context, name, def) { context[name] = value; } -/* Factory to encode HTML entities. - * Creates a no-operation function when `type` is - * `'false'`, a function which encodes using named - * references when `type` is `'true'`, and a function - * which encodes using numbered references when `type` is - * `'numbers'`. */ +// Factory to encode HTML entities. Creates a no-operation function when +// `type` is `'false'`, a function which encodes using named references when +// `type` is `'true'`, and a function which encodes using numbered references +// when `type` is `'numbers'`. function encodeFactory(type) { var options = {}; if (type === 'false') { - return returner_1; + return identity_1 } if (type === 'true') { @@ -29038,14 +29230,19 @@ function encodeFactory(type) { options.useNamedReferences = true; } - return wrapped; + return wrapped - /* Encode HTML entities using the bound options. */ + // Encode HTML entities using the bound options. function wrapped(value) { - return stringifyEntities(value, options); + return stringifyEntities(value, options) } } +// Throw an exception with in its `message` `value` and `name`. +function raise(value, name) { + throw new Error('Invalid value `' + value + '` for setting `' + name + '`') +} + var mdastUtilCompact = compact; /* Make an MDAST tree compact by merging adjacent text nodes. */ @@ -29106,9 +29303,9 @@ function mergeable$1(node, commonmark) { var compile_1 = compile$2; -/* Stringify the given tree. */ +// Stringify the given tree. function compile$2() { - return this.visit(mdastUtilCompact(this.tree, this.options.commonmark)); + return this.visit(mdastUtilCompact(this.tree, this.options.commonmark)) } var one_1 = one$2; @@ -29117,23 +29314,22 @@ function one$2(node, parent) { var self = this; var visitors = self.visitors; - /* Fail on unknown nodes. */ + // Fail on unknown nodes. if (typeof visitors[node.type] !== 'function') { self.file.fail( new Error( - 'Missing compiler for node of type `' + - node.type + '`: `' + node + '`' + 'Missing compiler for node of type `' + node.type + '`: `' + node + '`' ), node ); } - return visitors[node.type].call(self, node, parent); + return visitors[node.type].call(self, node, parent) } var all_1 = all; -/* Visit all children of `parent`. */ +// Visit all children of `parent`. function all(parent) { var self = this; var children = parent.children; @@ -29145,70 +29341,83 @@ function all(parent) { results[index] = self.visit(children[index], parent); } - return results; + return results } var block_1 = block$1; -/* Stringify a block node with block children (e.g., `root` - * or `blockquote`). - * Knows about code following a list, or adjacent lists - * with similar bullets, and places an extra newline - * between them. */ +var lineFeed$19 = '\n'; + +var blank$1 = lineFeed$19 + lineFeed$19; +var triple = blank$1 + lineFeed$19; +var comment$1 = blank$1 + '' + blank$1; + +// Stringify a block node with block children (e.g., `root` or `blockquote`). +// Knows about code following a list, or adjacent lists with similar bullets, +// and places an extra line feed between them. function block$1(node) { var self = this; + var options = self.options; + var fences = options.fences; + var gap = options.commonmark ? comment$1 : triple; var values = []; var children = node.children; var length = children.length; var index = -1; - var child; var prev; + var child; while (++index < length) { + prev = child; child = children[index]; if (prev) { - /* Duplicate nodes, such as a list - * directly following another list, - * often need multiple new lines. - * - * Additionally, code blocks following a list - * might easily be mistaken for a paragraph - * in the list itself. */ - if (child.type === prev.type && prev.type === 'list') { - values.push(prev.ordered === child.ordered ? '\n\n\n' : '\n\n'); - } else if (prev.type === 'list' && child.type === 'code' && !child.lang) { - values.push('\n\n\n'); + // A list preceding another list that are equally ordered, or a + // list preceding an indented code block, need a gap between them, + // so as not to see them as one list, or content of the list, + // respectively. + // + // In commonmark, only something that breaks both up can do that, + // so we opt for an empty, invisible comment. In other flavours, + // two blank lines are fine. + if ( + prev.type === 'list' && + ((child.type === 'list' && prev.ordered === child.ordered) || + (child.type === 'code' && (!child.lang && !fences))) + ) { + values.push(gap); } else { - values.push('\n\n'); + values.push(blank$1); } } values.push(self.visit(child, node)); - - prev = child; } - return values.join(''); + return values.join('') } var orderedItems_1 = orderedItems; -/* Visit ordered list items. - * - * Starts the list with - * `node.start` and increments each following list item - * bullet by one: - * - * 2. foo - * 3. bar - * - * In `incrementListMarker: false` mode, does not increment - * each marker and stays on `node.start`: - * - * 1. foo - * 1. bar - */ +var lineFeed$20 = '\n'; +var dot$4 = '.'; + +var blank$2 = lineFeed$20 + lineFeed$20; + +// Visit ordered list items. +// +// Starts the list with +// `node.start` and increments each following list item +// bullet by one: +// +// 2. foo +// 3. bar +// +// In `incrementListMarker: false` mode, does not increment +// each marker and stays on `node.start`: +// +// 1. foo +// 1. bar function orderedItems(node) { var self = this; var fn = self.visitors.listItem; @@ -29220,19 +29429,23 @@ function orderedItems(node) { var index = -1; var bullet; + start = start == null ? 1 : start; + while (++index < length) { - bullet = (increment ? start + index : start) + '.'; + bullet = (increment ? start + index : start) + dot$4; values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join('\n'); + return values.join(node.spread ? blank$2 : lineFeed$20) } var unorderedItems_1 = unorderedItems; -/* Visit unordered list items. - * Uses `options.bullet` as each item's bullet. - */ +var lineFeed$21 = '\n'; + +var blank$3 = lineFeed$21 + lineFeed$21; + +// Visit unordered list items. Uses `options.bullet` as each item’s bullet. function unorderedItems(node) { var self = this; var bullet = self.options.bullet; @@ -29246,52 +29459,66 @@ function unorderedItems(node) { values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join('\n'); + return values.join(node.spread ? blank$3 : lineFeed$21) } var root_1 = root; -/* Stringify a root. - * Adds a final newline to ensure valid POSIX files. */ +var lineFeed$22 = '\n'; + +// Stringify a root. +// Adds a final newline to ensure valid POSIX files. */ function root(node) { - return this.block(node) + '\n'; + return this.block(node) + lineFeed$22 } -var text_1$2 = text$2; - -/* Stringify text. - * Supports named entities in `settings.encode: true` mode: - * - * AT&T - * - * Supports numbered entities in `settings.encode: numbers` - * mode: - * - * AT&T - */ +var text_1$2 = text$2; + +// Stringify text. +// Supports named entities in `settings.encode: true` mode: +// +// ```markdown +// AT&T +// ``` +// +// Supports numbered entities in `settings.encode: numbers` mode: +// +// ```markdown +// AT&T +// ``` function text$2(node, parent) { - return this.encode(this.escape(node.value, node, parent), node); + return this.encode(this.escape(node.value, node, parent), node) } var heading_1 = heading; -/* Stringify a heading. - * - * In `setext: true` mode and when `depth` is smaller than - * three, creates a setext header: - * - * Foo - * === - * - * Otherwise, an ATX header is generated: - * - * ### Foo - * - * In `closeAtx: true` mode, the header is closed with - * hashes: - * - * ### Foo ### - */ +var lineFeed$23 = '\n'; +var space$17 = ' '; +var numberSign$2 = '#'; +var dash$6 = '-'; +var equalsTo$1 = '='; + +// Stringify a heading. +// +// In `setext: true` mode and when `depth` is smaller than three, creates a +// setext header: +// +// ```markdown +// Foo +// === +// ``` +// +// Otherwise, an ATX header is generated: +// +// ```markdown +// ### Foo +// ``` +// +// In `closeAtx: true` mode, the header is closed with hashes: +// +// ```markdown +// ### Foo ### +// ``` function heading(node) { var self = this; var depth = node.depth; @@ -29301,24 +29528,30 @@ function heading(node) { var prefix; if (setext && depth < 3) { - return content + '\n' + repeatString(depth === 1 ? '=' : '-', content.length); + return ( + content + lineFeed$23 + repeatString(depth === 1 ? equalsTo$1 : dash$6, content.length) + ) } - prefix = repeatString('#', node.depth); + prefix = repeatString(numberSign$2, node.depth); - return prefix + ' ' + content + (closeAtx ? ' ' + prefix : ''); + return prefix + space$17 + content + (closeAtx ? space$17 + prefix : '') } var paragraph_1$2 = paragraph$1; function paragraph$1(node) { - return this.all(node).join(''); + return this.all(node).join('') } var blockquote_1$2 = blockquote$1; +var lineFeed$24 = '\n'; +var space$18 = ' '; +var greaterThan$5 = '>'; + function blockquote$1(node) { - var values = this.block(node).split('\n'); + var values = this.block(node).split(lineFeed$24); var result = []; var length = values.length; var index = -1; @@ -29326,74 +29559,74 @@ function blockquote$1(node) { while (++index < length) { value = values[index]; - result[index] = (value ? ' ' : '') + value; + result[index] = (value ? space$18 : '') + value; } - return '>' + result.join('\n>'); + return greaterThan$5 + result.join(lineFeed$24 + greaterThan$5) } var list_1$2 = list$1; -/* Which method to use based on `list.ordered`. */ -var ORDERED_MAP = { - true: 'visitOrderedItems', - false: 'visitUnorderedItems' -}; - function list$1(node) { - return this[ORDERED_MAP[node.ordered]](node); + var fn = node.ordered ? this.visitOrderedItems : this.visitUnorderedItems; + return fn.call(this, node) } var pad_1 = pad; -var INDENT = 4; +var lineFeed$25 = '\n'; +var space$19 = ' '; -/* Pad `value` with `level * INDENT` spaces. Respects - * lines. Ignores empty lines. */ -function pad(value, level) { - var index; - var padding; - - value = value.split('\n'); +var tabSize$5 = 4; - index = value.length; - padding = repeatString(' ', level * INDENT); +// Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty +// lines. +function pad(value, level) { + var values = value.split(lineFeed$25); + var index = values.length; + var padding = repeatString(space$19, level * tabSize$5); while (index--) { - if (value[index].length !== 0) { - value[index] = padding + value[index]; + if (values[index].length !== 0) { + values[index] = padding + values[index]; } } - return value.join('\n'); + return values.join(lineFeed$25) } var listItem_1 = listItem$1; -/* Which checkbox to use. */ -var CHECKBOX_MAP = { - undefined: '', - null: '', - true: '[x] ', - false: '[ ] ' -}; +var lineFeed$26 = '\n'; +var space$20 = ' '; +var leftSquareBracket$6 = '['; +var rightSquareBracket$6 = ']'; +var lowercaseX$1 = 'x'; -/* Stringify a list item. - * - * Prefixes the content with a checked checkbox when - * `checked: true`: - * - * [x] foo - * - * Prefixes the content with an unchecked checkbox when - * `checked: false`: - * - * [ ] foo - */ +var ceil = Math.ceil; +var blank$4 = lineFeed$26 + lineFeed$26; + +var tabSize$6 = 4; + +// Stringify a list item. +// +// Prefixes the content with a checked checkbox when `checked: true`: +// +// ```markdown +// [x] foo +// ``` +// +// Prefixes the content with an unchecked checkbox when `checked: false`: +// +// ```markdown +// [ ] foo +// ``` function listItem$1(node, parent, position, bullet) { var self = this; var style = self.options.listItemIndent; - var loose = node.loose; + var marker = bullet || self.options.bullet; + var spread = node.spread == null ? true : node.spread; + var checked = node.checked; var children = node.children; var length = children.length; var values = []; @@ -29406,23 +29639,31 @@ function listItem$1(node, parent, position, bullet) { values[index] = self.visit(children[index], node); } - value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\n\n' : '\n'); + value = values.join(spread ? blank$4 : lineFeed$26); - if (style === '1' || (style === 'mixed' && value.indexOf('\n') === -1)) { - indent = bullet.length + 1; - spacing = ' '; - } else { - indent = Math.ceil((bullet.length + 1) / 4) * 4; - spacing = repeatString(' ', indent - bullet.length); + if (typeof checked === 'boolean') { + // Note: I’d like to be able to only add the space between the check and + // the value, but unfortunately github does not support empty list-items + // with a checkbox :( + value = + leftSquareBracket$6 + + (checked ? lowercaseX$1 : space$20) + + rightSquareBracket$6 + + space$20 + + value; } - value = bullet + spacing + pad_1(value, indent / 4).slice(indent); - - if (loose && parent.children.length - 1 !== position) { - value += '\n'; + if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed$26) === -1)) { + indent = marker.length + 1; + spacing = space$20; + } else { + indent = ceil((marker.length + 1) / tabSize$6) * tabSize$6; + spacing = repeatString(space$20, indent - marker.length); } - return value; + return value + ? marker + spacing + pad_1(value, indent / tabSize$6).slice(indent) + : marker } /* Expose. */ @@ -29464,178 +29705,222 @@ function longestStreak(value, character) { var inlineCode_1 = inlineCode$1; -/* Stringify inline code. - * - * Knows about internal ticks (`\``), and ensures one more - * tick is used to enclose the inline code: - * - * ```foo ``bar`` baz``` - * - * Even knows about inital and final ticks: - * - * `` `foo `` - * `` foo` `` - */ +var space$21 = ' '; +var graveAccent$5 = '`'; + +// Stringify inline code. +// +// Knows about internal ticks (`\``), and ensures one more tick is used to +// enclose the inline code: +// +// ````markdown +// ```foo ``bar`` baz``` +// ```` +// +// Even knows about inital and final ticks: +// +// ``markdown +// `` `foo `` +// `` foo` `` +// ``` function inlineCode$1(node) { var value = node.value; - var ticks = repeatString('`', longestStreak_1(value, '`') + 1); + var ticks = repeatString(graveAccent$5, longestStreak_1(value, graveAccent$5) + 1); var start = ticks; var end = ticks; - if (value.charAt(0) === '`') { - start += ' '; + if (value.charAt(0) === graveAccent$5) { + start += space$21; } - if (value.charAt(value.length - 1) === '`') { - end = ' ' + end; + if (value.charAt(value.length - 1) === graveAccent$5) { + end = space$21 + end; } - return start + value + end; + return start + value + end } var code_1 = code; -var FENCE = /([`~])\1{2}/; +var lineFeed$27 = '\n'; +var space$22 = ' '; -/* Stringify code. - * Creates indented code when: - * - * - No language tag exists; - * - Not in `fences: true` mode; - * - A non-empty value exists. - * - * Otherwise, GFM fenced code is created: - * - * ```js - * foo(); - * ``` - * - * When in ``fence: `~` `` mode, uses tildes as fences: - * - * ~~~js - * foo(); - * ~~~ - * - * Knows about internal fences (Note: GitHub/Kramdown does - * not support this): - * - * ````javascript - * ```markdown - * foo - * ``` - * ```` - */ +// Stringify code. +// Creates indented code when: +// +// - No language tag exists +// - Not in `fences: true` mode +// - A non-empty value exists +// +// Otherwise, GFM fenced code is created: +// +// ````markdown +// ```js +// foo(); +// ``` +// ```` +// +// When in ``fence: `~` `` mode, uses tildes as fences: +// +// ```markdown +// ~~~js +// foo(); +// ~~~ +// ``` +// +// Knows about internal fences: +// +// `````markdown +// ````markdown +// ```javascript +// foo(); +// ``` +// ```` +// ````` function code(node, parent) { var self = this; var value = node.value; var options = self.options; var marker = options.fence; - var language = self.encode(node.lang || '', node); + var info = node.lang || ''; var fence; - /* Without (needed) fences. */ - if (!language && !options.fences && value) { - /* Throw when pedantic, in a list item which - * isn’t compiled using a tab. */ + if (info && node.meta) { + info += space$22 + node.meta; + } + + info = self.encode(self.escape(info, node)); + + // Without (needed) fences. + if (!info && !options.fences && value) { + // Throw when pedantic, in a list item which isn’t compiled using a tab. if ( parent && parent.type === 'listItem' && options.listItemIndent !== 'tab' && options.pedantic ) { - self.file.fail('Cannot indent code properly. See http://git.io/vgFvT', node.position); + self.file.fail( + 'Cannot indent code properly. See https://git.io/fxKR8', + node.position + ); } - return pad_1(value, 1); - } - - fence = longestStreak_1(value, marker) + 1; - - /* Fix GFM / RedCarpet bug, where fence-like characters - * inside fenced code can exit a code-block. - * Yes, even when the outer fence uses different - * characters, or is longer. - * Thus, we can only pad the code to make it work. */ - if (FENCE.test(value)) { - value = pad_1(value, 1); + return pad_1(value, 1) } - fence = repeatString(marker, Math.max(fence, 3)); + fence = repeatString(marker, Math.max(longestStreak_1(value, marker) + 1, 3)); - return fence + language + '\n' + value + '\n' + fence; + return fence + info + lineFeed$27 + value + lineFeed$27 + fence } var html_1 = html$2; function html$2(node) { - return node.value; + return node.value } var thematicBreak$1 = thematic; -/* Stringify a `thematic-break`. - * The character used is configurable through `rule`: (`'_'`) - * - * ___ - * - * The number of repititions is defined through - * `ruleRepetition`: (`6`) - * - * ****** - * - * Whether spaces delimit each character, is configured - * through `ruleSpaces`: (`true`) - * - * * * * - */ +var space$23 = ' '; + +// Stringify a `thematic-break`. +// The character used is configurable through `rule`: (`'_'`): +// +// ```markdown +// ___ +// ``` +// +// The number of repititions is defined through `ruleRepetition` (`6`): +// +// ```markdown +// ****** +// ``` +// +// Whether spaces delimit each character, is configured through `ruleSpaces` +// (`true`): +// ```markdown +// * * * +// ``` function thematic() { var options = this.options; var rule = repeatString(options.rule, options.ruleRepetition); - return options.ruleSpaces ? rule.split('').join(' ') : rule; + return options.ruleSpaces ? rule.split('').join(space$23) : rule } var strong_1$2 = strong$3; -/* Stringify a `strong`. - * - * The marker used is configurable by `strong`, which - * defaults to an asterisk (`'*'`) but also accepts an - * underscore (`'_'`): - * - * __foo__ - */ +// Stringify a `strong`. +// +// The marker used is configurable by `strong`, which defaults to an asterisk +// (`'*'`) but also accepts an underscore (`'_'`): +// +// ```markdown +// __foo__ +// ``` function strong$3(node) { var marker = repeatString(this.options.strong, 2); - return marker + this.all(node).join('') + marker; + return marker + this.all(node).join('') + marker } var emphasis_1$2 = emphasis$3; -/* Stringify an `emphasis`. - * - * The marker used is configurable through `emphasis`, which - * defaults to an underscore (`'_'`) but also accepts an - * asterisk (`'*'`): - * - * *foo* - */ +var underscore$5 = '_'; +var asterisk$5 = '*'; + +// Stringify an `emphasis`. +// +// The marker used is configurable through `emphasis`, which defaults to an +// underscore (`'_'`) but also accepts an asterisk (`'*'`): +// +// ```markdown +// *foo* +// ``` +// +// In `pedantic` mode, text which itself contains an underscore will cause the +// marker to default to an asterisk instead: +// +// ```markdown +// *foo_bar* +// ``` function emphasis$3(node) { var marker = this.options.emphasis; - return marker + this.all(node).join('') + marker; + var content = this.all(node).join(''); + + // When in pedantic mode, prevent using underscore as the marker when there + // are underscores in the content. + if ( + this.options.pedantic && + marker === underscore$5 && + content.indexOf(marker) !== -1 + ) { + marker = asterisk$5; + } + + return marker + content + marker } var _break$4 = lineBreak; -var map$4 = {true: '\\\n', false: ' \n'}; +var backslash$10 = '\\'; +var lineFeed$28 = '\n'; +var space$24 = ' '; + +var commonmark$1 = backslash$10 + lineFeed$28; +var normal = space$24 + space$24 + lineFeed$28; function lineBreak() { - return map$4[this.options.commonmark]; + return this.options.commonmark ? commonmark$1 : normal } var _delete$4 = strikethrough$1; +var tilde$5 = '~'; + +var fence$1 = tilde$5 + tilde$5; + function strikethrough$1(node) { - return '~~' + this.all(node).join('') + '~~'; + return fence$1 + this.all(node).join('') + fence$1 } var ccount_1 = ccount; @@ -29662,59 +29947,82 @@ function ccount(value, character) { var encloseUri = enclose; -var re$3 = /\s/; +var leftParenthesis$4 = '('; +var rightParenthesis$5 = ')'; +var lessThan$7 = '<'; +var greaterThan$6 = '>'; -/* Wrap `url` in angle brackets when needed, or when - * forced. - * In links, images, and definitions, the URL part needs - * to be enclosed when it: - * - * - has a length of `0`; - * - contains white-space; - * - has more or less opening than closing parentheses. - */ +var expression = /\s/; + +// Wrap `url` in angle brackets when needed, or when +// forced. +// In links, images, and definitions, the URL part needs +// to be enclosed when it: +// +// - has a length of `0` +// - contains white-space +// - has more or less opening than closing parentheses function enclose(uri, always) { - if (always || uri.length === 0 || re$3.test(uri) || ccount_1(uri, '(') !== ccount_1(uri, ')')) { - return '<' + uri + '>'; + if ( + always || + uri.length === 0 || + expression.test(uri) || + ccount_1(uri, leftParenthesis$4) !== ccount_1(uri, rightParenthesis$5) + ) { + return lessThan$7 + uri + greaterThan$6 } - return uri; + return uri } var encloseTitle = enclose$1; -/* There is currently no way to support nested delimiters - * across Markdown.pl, CommonMark, and GitHub (RedCarpet). - * The following code supports Markdown.pl and GitHub. - * CommonMark is not supported when mixing double- and - * single quotes inside a title. */ +var quotationMark$3 = '"'; +var apostrophe$3 = "'"; + +// There is currently no way to support nested delimiters across Markdown.pl, +// CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl +// and GitHub. +// CommonMark is not supported when mixing double- and single quotes inside a +// title. function enclose$1(title) { - var delimiter = title.indexOf('"') === -1 ? '"' : '\''; - return delimiter + title + delimiter; + var delimiter = + title.indexOf(quotationMark$3) === -1 ? quotationMark$3 : apostrophe$3; + return delimiter + title + delimiter } -var link_1$2 = link$3; +var link_1$2 = link$4; -/* Expression for a protocol: - * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var PROTOCOL = /^[a-z][a-z+.-]+:\/?/i; +var space$25 = ' '; +var leftSquareBracket$7 = '['; +var rightSquareBracket$7 = ']'; +var leftParenthesis$5 = '('; +var rightParenthesis$6 = ')'; -/* Stringify a link. - * - * When no title exists, the compiled `children` equal - * `url`, and `url` starts with a protocol, an auto - * link is created: - * - * - * - * Otherwise, is smart about enclosing `url` (see - * `encloseURI()`) and `title` (see `encloseTitle()`). - * - * [foo]( 'An "example" e-mail') - * - * Supports named entities in the `url` and `title` when - * in `settings.encode` mode. */ -function link$3(node) { +// Expression for a protocol: +// See . +var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; + +// Stringify a link. +// +// When no title exists, the compiled `children` equal `url`, and `url` starts +// with a protocol, an auto link is created: +// +// ```markdown +// +// ``` +// +// Otherwise, is smart about enclosing `url` (see `encloseURI()`) and `title` +// (see `encloseTitle()`). +// ``` +// +// ```markdown +// [foo]( 'An "example" e-mail') +// ``` +// +// Supports named entities in the `url` and `title` when in `settings.encode` +// mode. +function link$4(node) { var self = this; var content = self.encode(node.url || '', node); var exit = self.enterLink(); @@ -29723,37 +30031,40 @@ function link$3(node) { exit(); - if ( - node.title == null && - PROTOCOL.test(content) && - (escaped === value || escaped === 'mailto:' + value) - ) { - /* Backslash escapes do not work in autolinks, - * so we do not escape. */ - return encloseUri(self.encode(node.url), true); + if (node.title == null && protocol$1.test(content) && escaped === value) { + // Backslash escapes do not work in autolinks, so we do not escape. + return encloseUri(self.encode(node.url), true) } content = encloseUri(content); if (node.title) { - content += ' ' + encloseTitle(self.encode(self.escape(node.title, node), node)); + content += space$25 + encloseTitle(self.encode(self.escape(node.title, node), node)); } - return '[' + value + '](' + content + ')'; + return ( + leftSquareBracket$7 + + value + + rightSquareBracket$7 + + leftParenthesis$5 + + content + + rightParenthesis$6 + ) } var copyIdentifierEncoding = copy$5; -var PUNCTUATION = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; +var ampersand$2 = '&'; -/* For shortcut and collapsed reference links, the contents - * is also an identifier, so we need to restore the original - * encoding and escaping that were present in the source - * string. - * - * This function takes the unescaped & unencoded value from - * shortcut's child nodes and the identifier and encodes - * the former according to the latter. */ +var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; + +// For shortcut and collapsed reference links, the contents is also an +// identifier, so we need to restore the original encoding and escaping +// that were present in the source string. +// +// This function takes the unescaped & unencoded value from shortcut’s +// child nodes and the identifier and encodes the former according to +// the latter. function copy$5(value, identifier) { var length = value.length; var count = identifier.length; @@ -29763,25 +30074,31 @@ function copy$5(value, identifier) { var start; while (index < length) { - /* Take next non-punctuation characters from `value`. */ + // Take next non-punctuation characters from `value`. start = index; - while (index < length && !PUNCTUATION.test(value.charAt(index))) { + while (index < length && !punctuationExppresion.test(value.charAt(index))) { index += 1; } result.push(value.slice(start, index)); - /* Advance `position` to the next punctuation character. */ - while (position < count && !PUNCTUATION.test(identifier.charAt(position))) { + // Advance `position` to the next punctuation character. + while ( + position < count && + !punctuationExppresion.test(identifier.charAt(position)) + ) { position += 1; } - /* Take next punctuation characters from `identifier`. */ + // Take next punctuation characters from `identifier`. start = position; - while (position < count && PUNCTUATION.test(identifier.charAt(position))) { - if (identifier.charAt(position) === '&') { + while ( + position < count && + punctuationExppresion.test(identifier.charAt(position)) + ) { + if (identifier.charAt(position) === ampersand$2) { position += entityPrefixLength(identifier.slice(position)); } @@ -29790,32 +30107,49 @@ function copy$5(value, identifier) { result.push(identifier.slice(start, position)); - /* Advance `index` to the next non-punctuation character. */ - while (index < length && PUNCTUATION.test(value.charAt(index))) { + // Advance `index` to the next non-punctuation character. + while (index < length && punctuationExppresion.test(value.charAt(index))) { index += 1; } } - return result.join(''); + return result.join('') } var label_1 = label; -/* Stringify a reference label. - * Because link references are easily, mistakingly, - * created (for example, `[foo]`), reference nodes have - * an extra property depicting how it looked in the - * original document, so stringification can cause minimal - * changes. */ +var leftSquareBracket$8 = '['; +var rightSquareBracket$8 = ']'; + +var shortcut$2 = 'shortcut'; +var collapsed$1 = 'collapsed'; + +// Stringify a reference label. +// Because link references are easily, mistakingly, created (for example, +// `[foo]`), reference nodes have an extra property depicting how it looked in +// the original document, so stringification can cause minimal changes. function label(node) { var type = node.referenceType; - var value = type === 'full' ? node.identifier : ''; - return type === 'shortcut' ? value : '[' + value + ']'; + if (type === shortcut$2) { + return '' + } + + return ( + leftSquareBracket$8 + + (type === collapsed$1 ? '' : node.label || node.identifier) + + rightSquareBracket$8 + ) } var linkReference_1 = linkReference; +var leftSquareBracket$9 = '['; +var rightSquareBracket$9 = ']'; + +var shortcut$3 = 'shortcut'; +var collapsed$2 = 'collapsed'; + function linkReference(node) { var self = this; var type = node.referenceType; @@ -29824,51 +30158,82 @@ function linkReference(node) { exit(); - if (type === 'shortcut' || type === 'collapsed') { - value = copyIdentifierEncoding(value, node.identifier); + if (type === shortcut$3 || type === collapsed$2) { + value = copyIdentifierEncoding(value, node.label || node.identifier); } - return '[' + value + ']' + label_1(node); + return leftSquareBracket$9 + value + rightSquareBracket$9 + label_1(node) } var imageReference_1 = imageReference; +var leftSquareBracket$10 = '['; +var rightSquareBracket$10 = ']'; +var exclamationMark$5 = '!'; + function imageReference(node) { - return '![' + (this.encode(node.alt, node) || '') + ']' + label_1(node); + return ( + exclamationMark$5 + + leftSquareBracket$10 + + (this.encode(node.alt, node) || '') + + rightSquareBracket$10 + + label_1(node) + ) } var definition_1$2 = definition$1; -/* Stringify an URL definition. - * - * Is smart about enclosing `url` (see `encloseURI()`) and - * `title` (see `encloseTitle()`). - * - * [foo]: 'An "example" e-mail' - */ +var space$26 = ' '; +var colon$6 = ':'; +var leftSquareBracket$11 = '['; +var rightSquareBracket$11 = ']'; + +// Stringify an URL definition. +// +// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see +// `encloseTitle()`). +// +// ```markdown +// [foo]: 'An "example" e-mail' +// ``` function definition$1(node) { var content = encloseUri(node.url); if (node.title) { - content += ' ' + encloseTitle(node.title); + content += space$26 + encloseTitle(node.title); } - return '[' + node.identifier + ']: ' + content; + return ( + leftSquareBracket$11 + + (node.label || node.identifier) + + rightSquareBracket$11 + + colon$6 + + space$26 + + content + ) } -var image_1 = image$2; +var image_1 = image$3; -/* Stringify an image. - * - * Is smart about enclosing `url` (see `encloseURI()`) and - * `title` (see `encloseTitle()`). - * - * ![foo]( 'My "favourite" icon') - * - * Supports named entities in `url`, `alt`, and `title` - * when in `settings.encode` mode. - */ -function image$2(node) { +var space$27 = ' '; +var leftParenthesis$6 = '('; +var rightParenthesis$7 = ')'; +var leftSquareBracket$12 = '['; +var rightSquareBracket$12 = ']'; +var exclamationMark$6 = '!'; + +// Stringify an image. +// +// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see +// `encloseTitle()`). +// +// ```markdown +// ![foo]( 'My "favourite" icon') +// ``` +// +// Supports named entities in `url`, `alt`, and `title` when in +// `settings.encode` mode. +function image$3(node) { var self = this; var content = encloseUri(self.encode(node.url || '', node)); var exit = self.enterLink(); @@ -29877,31 +30242,72 @@ function image$2(node) { exit(); if (node.title) { - content += ' ' + encloseTitle(self.encode(node.title, node)); + content += space$27 + encloseTitle(self.encode(node.title, node)); } - return '![' + alt + '](' + content + ')'; + return ( + exclamationMark$6 + + leftSquareBracket$12 + + alt + + rightSquareBracket$12 + + leftParenthesis$6 + + content + + rightParenthesis$7 + ) } -var footnote_1 = footnote; +var footnote_1 = footnote$1; + +var leftSquareBracket$13 = '['; +var rightSquareBracket$13 = ']'; +var caret$3 = '^'; -function footnote(node) { - return '[^' + this.all(node).join('') + ']'; +function footnote$1(node) { + return ( + leftSquareBracket$13 + caret$3 + this.all(node).join('') + rightSquareBracket$13 + ) } var footnoteReference_1 = footnoteReference; +var leftSquareBracket$14 = '['; +var rightSquareBracket$14 = ']'; +var caret$4 = '^'; + function footnoteReference(node) { - return '[^' + node.identifier + ']'; + return ( + leftSquareBracket$14 + + caret$4 + + (node.label || node.identifier) + + rightSquareBracket$14 + ) } +var lineFeed$29 = '\n'; +var space$28 = ' '; +var colon$7 = ':'; +var leftSquareBracket$15 = '['; +var rightSquareBracket$15 = ']'; +var caret$5 = '^'; + +var tabSize$7 = 4; +var blank$5 = lineFeed$29 + lineFeed$29; +var indent = repeatString(space$28, tabSize$7); + var footnoteDefinition_1$2 = footnoteDefinition$1; function footnoteDefinition$1(node) { - var id = node.identifier.toLowerCase(); - var content = this.all(node).join('\n\n' + repeatString(' ', 4)); + var content = this.all(node).join(blank$5 + indent); - return '[^' + id + ']: ' + content; + return ( + leftSquareBracket$15 + + caret$5 + + (node.label || node.identifier) + + rightSquareBracket$15 + + colon$7 + + space$28 + + content + ) } /* Expose. */ @@ -29918,7 +30324,7 @@ var CENTER = 'c'; var DOT = '.'; var NULL = ''; -var ALLIGNMENT$1 = [LEFT, RIGHT, CENTER, DOT, NULL]; +var ALLIGNMENT = [LEFT, RIGHT, CENTER, DOT, NULL]; var MIN_CELL_SIZE = 3; /* Characters. */ @@ -30003,7 +30409,7 @@ function markdownTable(table, options) { align = align.charAt(0).toLowerCase(); } - if (ALLIGNMENT$1.indexOf(align) === -1) { + if (ALLIGNMENT.indexOf(align) === -1) { align = NULL; } @@ -30156,26 +30562,28 @@ function dotindex$1(value) { var table_1$2 = table$2; -/* Stringify table. - * - * Creates a fenced table by default, but not in - * `looseTable: true` mode: - * - * Foo | Bar - * :-: | --- - * Baz | Qux - * - * NOTE: Be careful with `looseTable: true` mode, as a - * loose table inside an indented code block on GitHub - * renders as an actual table! - * - * Creates a spaced table by default, but not in - * `spacedTable: false`: - * - * |Foo|Bar| - * |:-:|---| - * |Baz|Qux| - */ +var space$29 = ' '; +var verticalBar$2 = '|'; + +// Stringify table. +// +// Creates a fenced table by default, but not in `looseTable: true` mode: +// +// ```markdown +// Foo | Bar +// :-: | --- +// Baz | Qux +// +// NOTE: Be careful with `looseTable: true` mode, as a loose table inside an +// indented code block on GitHub renders as an actual table! +// +// Creates a spaced table by default, but not in `spacedTable: false`: +// +// ```markdown +// |Foo|Bar| +// |:-:|---| +// |Baz|Qux| +// ``` function table$2(node) { var self = this; var options = self.options; @@ -30200,11 +30608,11 @@ function table$2(node) { start = ''; end = ''; } else if (spaced) { - start = '| '; - end = ' |'; + start = verticalBar$2 + space$29; + end = space$29 + verticalBar$2; } else { - start = '|'; - end = '|'; + start = verticalBar$2; + end = verticalBar$2; } return markdownTable_1(result, { @@ -30213,19 +30621,19 @@ function table$2(node) { start: start, end: end, stringLength: stringLength, - delimiter: spaced ? ' | ' : '|' - }); + delimiter: spaced ? space$29 + verticalBar$2 + space$29 : verticalBar$2 + }) } var tableCell_1 = tableCell; function tableCell(node) { - return this.all(node).join(''); + return this.all(node).join('') } var compiler = Compiler; -/* Construct a new compiler. */ +// Construct a new compiler. function Compiler(tree, file) { this.inLink = false; this.inTable = false; @@ -30235,26 +30643,26 @@ function Compiler(tree, file) { this.setOptions({}); } -var proto$4 = Compiler.prototype; +var proto$6 = Compiler.prototype; -/* Enter and exit helpers. */ -proto$4.enterLink = stateToggle('inLink', false); -proto$4.enterTable = stateToggle('inTable', false); -proto$4.enterLinkReference = enterLinkReference; +// Enter and exit helpers. */ +proto$6.enterLink = stateToggle('inLink', false); +proto$6.enterTable = stateToggle('inTable', false); +proto$6.enterLinkReference = enterLinkReference; -/* Configuration. */ -proto$4.options = defaults$5; -proto$4.setOptions = setOptions_1$2; +// Configuration. +proto$6.options = defaults$5; +proto$6.setOptions = setOptions_1$2; -proto$4.compile = compile_1; -proto$4.visit = one_1; -proto$4.all = all_1; -proto$4.block = block_1; -proto$4.visitOrderedItems = orderedItems_1; -proto$4.visitUnorderedItems = unorderedItems_1; +proto$6.compile = compile_1; +proto$6.visit = one_1; +proto$6.all = all_1; +proto$6.block = block_1; +proto$6.visitOrderedItems = orderedItems_1; +proto$6.visitUnorderedItems = unorderedItems_1; -/* Expose visitors. */ -proto$4.visitors = { +// Expose visitors. +proto$6.visitors = { root: root_1, text: text_1$2, heading: heading_1, @@ -30287,81 +30695,124 @@ stringify$7.Compiler = compiler; function stringify$7(options) { var Local = unherit_1(compiler); - Local.prototype.options = immutable(Local.prototype.options, this.data('settings'), options); + Local.prototype.options = immutable( + Local.prototype.options, + this.data('settings'), + options + ); this.Compiler = Local; } -var remark = unified_1().use(remarkParse).use(remarkStringify).freeze(); - -const name = "remark"; -const version$1 = "8.0.0"; +var remark = unified_1() + .use(remarkParse) + .use(remarkStringify) + .freeze(); + +const _from = "remark@^10.0.0"; +const _id = "remark@10.0.0"; +const _inBundle = false; +const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; +const _location = "/remark"; +const _phantomChildren = {}; +const _requested = {"type":"range","registry":true,"raw":"remark@^10.0.0","name":"remark","escapedName":"remark","rawSpec":"^10.0.0","saveSpec":null,"fetchSpec":"^10.0.0"}; +const _requiredBy = ["/"]; +const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; +const _shasum = "4d94ae09d0e81e52fe40a31e89a0103c553f509e"; +const _spec = "remark@^10.0.0"; +const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"; +const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; +const bugs = {"url":"https://github.com/remarkjs/remark/issues"}; +const bundleDependencies = false; +const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; +const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; +const deprecated$1 = false; const description = "Markdown processor powered by plugins"; -const license = "MIT"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; -const dependencies = {"remark-parse":"^4.0.0","remark-stringify":"^4.0.0","unified":"^6.0.0"}; -const homepage = "http://remark.js.org"; -const repository = "https://github.com/wooorm/remark/tree/master/packages/remark"; -const bugs = "https://github.com/wooorm/remark/issues"; -const author = "Titus Wormer (http://wooorm.com)"; -const contributors = ["Titus Wormer (http://wooorm.com)"]; +const devDependencies = {"tape":"^4.9.1"}; const files = ["index.js"]; -const scripts = {}; +const homepage = "http://remark.js.org"; +const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; +const license = "MIT"; +const name = "remark"; +const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"}; +const scripts = {"test":"tape test.js"}; +const version$1 = "10.0.0"; const xo = false; -const _resolved = "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz"; -const _integrity = "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw=="; -const _from = "remark@8.0.0"; var _package = { - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - dependencies: dependencies, - homepage: homepage, - repository: repository, - bugs: bugs, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _shasum: _shasum, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, + bundleDependencies: bundleDependencies, contributors: contributors, + dependencies: dependencies, + deprecated: deprecated$1, + description: description, + devDependencies: devDependencies, files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, - xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from + version: version$1, + xo: xo }; var _package$1 = Object.freeze({ - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - dependencies: dependencies, - homepage: homepage, - repository: repository, - bugs: bugs, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _shasum: _shasum, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, + bundleDependencies: bundleDependencies, contributors: contributors, + dependencies: dependencies, + deprecated: deprecated$1, + description: description, + devDependencies: devDependencies, files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, + version: version$1, xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from, default: _package }); const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for node markdown linting"; const version$2 = "1.0.0"; -const devDependencies = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^8.0.0","remark-lint":"^6.0.2","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; +const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; +const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; var _package$2 = { name: name$1, description: description$1, version: version$2, - devDependencies: devDependencies, + devDependencies: devDependencies$1, dependencies: dependencies$1, scripts: scripts$1 }; @@ -30370,7 +30821,7 @@ var _package$3 = Object.freeze({ name: name$1, description: description$1, version: version$2, - devDependencies: devDependencies, + devDependencies: devDependencies$1, dependencies: dependencies$1, scripts: scripts$1, default: _package$2 @@ -31489,7 +31940,7 @@ var remarkLintFencedCodeFlag = unifiedLintRule('remark-lint:fenced-code-flag', f var start$1 = unistUtilPosition.start; var end$1 = unistUtilPosition.end; -var fence = /^ {0,3}([~`])\1{2,}/; +var fence$2 = /^ {0,3}([~`])\1{2,}/; var reasonInvalid = 'Invalid code-language flag'; var reasonMissing = 'Missing code-language flag'; @@ -31520,7 +31971,7 @@ function fencedCodeFlag(tree, file, pref) { } else { value = contents.slice(start$1(node).offset, end$1(node).offset); - if (!allowEmpty && fence.test(value)) { + if (!allowEmpty && fence$2.test(value)) { file.message(reasonMissing, node); } } @@ -31596,15 +32047,15 @@ function hardBreakSpaces(tree, file) { } } -var mdastUtilToString = toString$5; +var mdastUtilToString = toString$6; /* Get the text content of a node. If the node itself * does not expose plain-text fields, `toString` will * recursivly try its children. */ -function toString$5(node) { +function toString$6(node) { return ( valueOf$1(node) || - (node.children && node.children.map(toString$5).join('')) || + (node.children && node.children.map(toString$6).join('')) || '' ) } @@ -31627,7 +32078,7 @@ var end$2 = unistUtilPosition.end; /* Protocol expression. See: * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; +var protocol$2 = /^[a-z][a-z+.-]+:\/?/i; var reason$3 = 'All automatic links must start with a protocol'; @@ -31643,7 +32094,7 @@ function noAutoLinkWithoutProtocol(tree, file) { if ( start$3(node).column === start$3(children[0]).column - 1 && end$2(node).column === end$2(children[children.length - 1]).column + 1 && - !protocol$1.test(mdastUtilToString(node)) + !protocol$2.test(mdastUtilToString(node)) ) { file.message(reason$3, node); } @@ -33041,7 +33492,7 @@ function fileExtension(tree, file, pref) { var remarkLintFirstHeadingLevel = unifiedLintRule('remark-lint:first-heading-level', firstHeadingLevel); -var re$4 = / Date: Sat, 10 Nov 2018 21:09:42 +0100 Subject: [PATCH 009/316] tls: do not rely on 'drain' handlers in StreamWrap `'drain'` event handlers may not be invoked if the stream is currently finishing. Instead, use the fact that we know when writes are active or not, and invoke the delayed shutdown handler from our own after-write callback. PR-URL: https://github.com/nodejs/node/pull/24290 Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/internal/wrap_js_stream.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/internal/wrap_js_stream.js b/lib/internal/wrap_js_stream.js index 7ca7ff8bf49d25..cf8f45aa4505ff 100644 --- a/lib/internal/wrap_js_stream.js +++ b/lib/internal/wrap_js_stream.js @@ -11,6 +11,7 @@ const { ERR_STREAM_WRAP } = require('internal/errors').codes; const kCurrentWriteRequest = Symbol('kCurrentWriteRequest'); const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest'); +const kPendingShutdownRequest = Symbol('kPendingShutdownRequest'); function isClosing() { return this[owner_symbol].isClosing(); } function onreadstart() { return this[owner_symbol].readStart(); } @@ -79,6 +80,7 @@ class JSStreamWrap extends Socket { this.stream = stream; this[kCurrentWriteRequest] = null; this[kCurrentShutdownRequest] = null; + this[kPendingShutdownRequest] = null; this.readable = stream.readable; this.writable = stream.writable; @@ -115,8 +117,10 @@ class JSStreamWrap extends Socket { // Working around that on the native side is not quite trivial (yet?), // so for now that is supported here. - if (this[kCurrentWriteRequest] !== null) - return this.once('drain', () => this.doShutdown(req)); + if (this[kCurrentWriteRequest] !== null) { + this[kPendingShutdownRequest] = req; + return 0; + } assert.strictEqual(this[kCurrentWriteRequest], null); assert.strictEqual(this[kCurrentShutdownRequest], null); this[kCurrentShutdownRequest] = req; @@ -189,6 +193,11 @@ class JSStreamWrap extends Socket { this[kCurrentWriteRequest] = null; handle.finishWrite(req, errCode); + if (this[kPendingShutdownRequest]) { + const req = this[kPendingShutdownRequest]; + this[kPendingShutdownRequest] = null; + this.doShutdown(req); + } } doClose(cb) { From 71a9c987b24c6808ef2ee4c22edfb98eb3e0bc38 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 21:11:17 +0100 Subject: [PATCH 010/316] tls: destroy TLS socket if StreamWrap is destroyed Previously, there was no mechanism in place that would have destroyed the TLS socket once the underlying socket had been closed. PR-URL: https://github.com/nodejs/node/pull/24290 Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/_tls_wrap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 36440ad4eaddf8..f00a9dce3fbc76 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -308,10 +308,12 @@ function TLSSocket(socket, opts) { // Wrap plain JS Stream into StreamWrap var wrap; - if ((socket instanceof net.Socket && socket._handle) || !socket) + if ((socket instanceof net.Socket && socket._handle) || !socket) { wrap = socket; - else + } else { wrap = new StreamWrap(socket); + wrap.once('close', () => this.destroy()); + } // Just a documented property to make secure sockets // distinguishable from regular ones. From e82f67d710c5e9b29eab9fd7563f51bd348904a2 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 21:03:46 +0100 Subject: [PATCH 011/316] Revert "net: partially revert "simplify Socket.prototype._final"" This reverts commit ac1f56c76a5d1a8ebcb2421d5c629e51df1ac48c. Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 PR-URL: https://github.com/nodejs/node/pull/24290 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/net.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/net.js b/lib/net.js index 3291ac92fb664a..914fe00a61fba9 100644 --- a/lib/net.js +++ b/lib/net.js @@ -350,12 +350,6 @@ Socket.prototype._final = function(cb) { return this.once('connect', () => this._final(cb)); } - // TODO(addaleax): This should not be necessary. - if (!this.readable || this._readableState.ended) { - cb(); - return this.destroy(); - } - if (!this._handle) return cb(); From 806570d80a6162e1fd73d39cf72ae3a49a56d271 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 14 Nov 2018 05:09:02 +0100 Subject: [PATCH 012/316] src: remove unused variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the following compiler warnings are generated: ../src/node_process.cc:799:16: warning: unused variable 'ary' [-Wunused-variable] Local ary = Array::New(args.GetIsolate()); ^ 1 warning generated. ../src/node_http2.cc:1294:16: warning: unused variable 'holder' [-Wunused-variable] Local holder = Array::New(isolate); ^ 1 warning generated. This commit removes these unused variables. PR-URL: https://github.com/nodejs/node/pull/24355 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- src/node_http2.cc | 1 - src/node_process.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 20b634f90fc00d..552903059abce5 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1291,7 +1291,6 @@ void Http2Session::HandleHeadersFrame(const nghttp2_frame* frame) { Local name_str; Local value_str; - Local holder = Array::New(isolate); // The headers are passed in above as a queue of nghttp2_header structs. // The following converts that into a JS array with the structure: // [name1, value1, name2, value2, name3, value3, name3, value4] and so on. diff --git a/src/node_process.cc b/src/node_process.cc index 161833ebbd3843..017d8d0073ac83 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -796,7 +796,6 @@ void GetParentProcessId(Local property, void GetActiveRequests(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - Local ary = Array::New(args.GetIsolate()); std::vector> request_v; for (auto w : *env->req_wrap_queue()) { if (w->persistent().IsEmpty()) From 2d885ed0f96fbf1c6e6de4faf996deca7761b8f3 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 14 Nov 2018 05:24:07 +0100 Subject: [PATCH 013/316] src: fix compiler warning in node_os MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the following compiler warnings is generated: ../src/node_os.cc:167:24: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare] for (size_t i = 0; i < count; i++) { ~ ^ ~~~~~ 1 warning generated. This commit changes the type of i to int. PR-URL: https://github.com/nodejs/node/pull/24356 Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Colin Ihrig --- src/node_os.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_os.cc b/src/node_os.cc index 0b46af95f4ba78..9e5530646a3708 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -163,7 +163,7 @@ static void GetCPUInfo(const FunctionCallbackInfo& args) { // The array is in the format // [model, speed, (5 entries of cpu_times), model2, speed2, ...] std::vector> result(count * 7); - for (size_t i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { uv_cpu_info_t* ci = cpu_infos + i; result[i * 7] = OneByteString(isolate, ci->model); result[i * 7 + 1] = Number::New(isolate, ci->speed); From fa9e03c1a7643d7b487b097382b79fb271ec8050 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 15 Nov 2018 12:51:05 -0800 Subject: [PATCH 014/316] src: re-sort the symbol macros The symbol macros were almost lexically sorted, but some were misplaced. PR-URL: https://github.com/nodejs/node/pull/24382 Reviewed-By: Gus Caplan Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann Reviewed-By: Anna Henningsen --- src/env.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/env.h b/src/env.h index d58990567b0b0d..42a76c1fbe8928 100644 --- a/src/env.h +++ b/src/env.h @@ -110,8 +110,8 @@ struct PackageConfig { // for the sake of convenience. #define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ V(handle_onclose_symbol, "handle_onclose") \ - V(owner_symbol, "owner") \ V(oninit_symbol, "oninit") \ + V(owner_symbol, "owner") \ // Strings are per-isolate primitives but Environment proxies them // for the sake of convenience. Strings should be ASCII-only. @@ -124,15 +124,14 @@ struct PackageConfig { V(bytes_parsed_string, "bytesParsed") \ V(bytes_read_string, "bytesRead") \ V(bytes_written_string, "bytesWritten") \ - V(cached_data_string, "cachedData") \ V(cached_data_produced_string, "cachedDataProduced") \ V(cached_data_rejected_string, "cachedDataRejected") \ + V(cached_data_string, "cachedData") \ V(change_string, "change") \ V(channel_string, "channel") \ V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \ - V(constants_string, "constants") \ - V(oncertcb_string, "oncertcb") \ V(code_string, "code") \ + V(constants_string, "constants") \ V(cwd_string, "cwd") \ V(dest_string, "dest") \ V(destroyed_string, "destroyed") \ @@ -149,7 +148,6 @@ struct PackageConfig { V(dns_txt_string, "TXT") \ V(duration_string, "duration") \ V(emit_warning_string, "emitWarning") \ - V(exchange_string, "exchange") \ V(encoding_string, "encoding") \ V(entries_string, "entries") \ V(entry_type_string, "entryType") \ @@ -157,6 +155,7 @@ struct PackageConfig { V(env_var_settings_string, "envVarSettings") \ V(errno_string, "errno") \ V(error_string, "error") \ + V(exchange_string, "exchange") \ V(exit_code_string, "exitCode") \ V(expire_string, "expire") \ V(exponent_string, "exponent") \ @@ -167,8 +166,8 @@ struct PackageConfig { V(fatal_exception_string, "_fatalException") \ V(fd_string, "fd") \ V(file_string, "file") \ - V(fingerprint_string, "fingerprint") \ V(fingerprint256_string, "fingerprint256") \ + V(fingerprint_string, "fingerprint") \ V(flags_string, "flags") \ V(fragment_string, "fragment") \ V(get_data_clone_error_string, "_getDataCloneError") \ @@ -183,8 +182,8 @@ struct PackageConfig { V(infoaccess_string, "infoAccess") \ V(inherit_string, "inherit") \ V(input_string, "input") \ - V(internal_string, "internal") \ V(internal_binding_string, "internalBinding") \ + V(internal_string, "internal") \ V(ipv4_string, "IPv4") \ V(ipv6_string, "IPv6") \ V(isclosing_string, "isClosing") \ @@ -195,9 +194,9 @@ struct PackageConfig { V(mac_string, "mac") \ V(main_string, "main") \ V(max_buffer_string, "maxBuffer") \ - V(message_string, "message") \ - V(message_port_string, "messagePort") \ V(message_port_constructor_string, "MessagePort") \ + V(message_port_string, "messagePort") \ + V(message_string, "message") \ V(minttl_string, "minttl") \ V(module_string, "module") \ V(modulus_string, "modulus") \ @@ -206,6 +205,7 @@ struct PackageConfig { V(nsname_string, "nsname") \ V(ocsp_request_string, "OCSPRequest") \ V(onaltsvc_string, "onaltsvc") \ + V(oncertcb_string, "oncertcb") \ V(onchange_string, "onchange") \ V(onclienthello_string, "onclienthello") \ V(oncomplete_string, "oncomplete") \ @@ -215,19 +215,19 @@ struct PackageConfig { V(onexit_string, "onexit") \ V(onframeerror_string, "onframeerror") \ V(ongetpadding_string, "ongetpadding") \ + V(ongoawaydata_string, "ongoawaydata") \ V(onhandshakedone_string, "onhandshakedone") \ V(onhandshakestart_string, "onhandshakestart") \ V(onheaders_string, "onheaders") \ V(onmessage_string, "onmessage") \ V(onnewsession_string, "onnewsession") \ V(onocspresponse_string, "onocspresponse") \ - V(ongoawaydata_string, "ongoawaydata") \ V(onorigin_string, "onorigin") \ + V(onping_string, "onping") \ V(onpriority_string, "onpriority") \ V(onread_string, "onread") \ V(onreadstart_string, "onreadstart") \ V(onreadstop_string, "onreadstop") \ - V(onping_string, "onping") \ V(onsettings_string, "onsettings") \ V(onshutdown_string, "onshutdown") \ V(onsignal_string, "onsignal") \ @@ -237,19 +237,19 @@ struct PackageConfig { V(onwrite_string, "onwrite") \ V(openssl_error_stack, "opensslErrorStack") \ V(options_string, "options") \ - V(output_string, "output") \ V(order_string, "order") \ + V(output_string, "output") \ V(parse_error_string, "Parse Error") \ V(password_string, "password") \ V(path_string, "path") \ V(pending_handle_string, "pendingHandle") \ V(pid_string, "pid") \ + V(pipe_source_string, "pipeSource") \ V(pipe_string, "pipe") \ V(pipe_target_string, "pipeTarget") \ - V(pipe_source_string, "pipeSource") \ - V(port_string, "port") \ V(port1_string, "port1") \ V(port2_string, "port2") \ + V(port_string, "port") \ V(preference_string, "preference") \ V(priority_string, "priority") \ V(process_string, "process") \ @@ -267,11 +267,11 @@ struct PackageConfig { V(require_string, "require") \ V(retry_string, "retry") \ V(scheme_string, "scheme") \ - V(serial_string, "serial") \ V(scopeid_string, "scopeid") \ V(serial_number_string, "serialNumber") \ - V(service_string, "service") \ + V(serial_string, "serial") \ V(servername_string, "servername") \ + V(service_string, "service") \ V(session_id_string, "sessionId") \ V(shell_string, "shell") \ V(signal_string, "signal") \ @@ -310,7 +310,7 @@ struct PackageConfig { V(write_host_object_string, "_writeHostObject") \ V(write_queue_size_string, "writeQueueSize") \ V(x_forwarded_string, "x-forwarded-for") \ - V(zero_return_string, "ZERO_RETURN") + V(zero_return_string, "ZERO_RETURN") \ #define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) \ V(as_external, v8::External) \ @@ -320,17 +320,17 @@ struct PackageConfig { V(async_hooks_destroy_function, v8::Function) \ V(async_hooks_init_function, v8::Function) \ V(async_hooks_promise_resolve_function, v8::Function) \ - V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(async_wrap_ctor_template, v8::FunctionTemplate) \ + V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(buffer_prototype_object, v8::Object) \ V(context, v8::Context) \ V(domain_callback, v8::Function) \ V(domexception_function, v8::Function) \ - V(fdclose_constructor_template, v8::ObjectTemplate) \ V(fd_constructor_template, v8::ObjectTemplate) \ + V(fdclose_constructor_template, v8::ObjectTemplate) \ V(filehandlereadwrap_template, v8::ObjectTemplate) \ - V(fsreqpromise_constructor_template, v8::ObjectTemplate) \ V(fs_use_promises_symbol, v8::Symbol) \ + V(fsreqpromise_constructor_template, v8::ObjectTemplate) \ V(handle_wrap_ctor_template, v8::FunctionTemplate) \ V(host_import_module_dynamically_callback, v8::Function) \ V(host_initialize_import_meta_object_callback, v8::Function) \ @@ -348,9 +348,9 @@ struct PackageConfig { V(native_modules_source_hash, v8::Object) \ V(native_modules_with_cache, v8::Set) \ V(native_modules_without_cache, v8::Set) \ - V(pipe_constructor_template, v8::FunctionTemplate) \ V(performance_entry_callback, v8::Function) \ V(performance_entry_template, v8::Function) \ + V(pipe_constructor_template, v8::FunctionTemplate) \ V(process_object, v8::Object) \ V(promise_handler_function, v8::Function) \ V(promise_wrap_template, v8::ObjectTemplate) \ @@ -367,7 +367,7 @@ struct PackageConfig { V(tty_constructor_template, v8::FunctionTemplate) \ V(udp_constructor_function, v8::Function) \ V(url_constructor_function, v8::Function) \ - V(write_wrap_template, v8::ObjectTemplate) + V(write_wrap_template, v8::ObjectTemplate) \ class Environment; From 5d67eeca1a9f9c033b55f49c115e77b693ca4c07 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Wed, 14 Nov 2018 09:06:18 -0600 Subject: [PATCH 015/316] src: emit warnings from V8 PR-URL: https://github.com/nodejs/node/pull/24365 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig --- src/node.cc | 37 ++++++++++++++++++++++++++++++------- test/message/v8_warning.js | 19 +++++++++++++++++++ test/message/v8_warning.out | 1 + 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 test/message/v8_warning.js create mode 100644 test/message/v8_warning.out diff --git a/src/node.cc b/src/node.cc index 4c84f781707b01..153399f1b61777 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1074,12 +1074,6 @@ static void DLOpen(const FunctionCallbackInfo& args) { // coverity[leaked_storage] } -static void OnMessage(Local message, Local error) { - // The current version of V8 sends messages for errors only - // (thus `error` is always set). - FatalException(Isolate::GetCurrent(), error, message); -} - static Maybe ProcessEmitWarningGeneric(Environment* env, const char* warning, const char* type = nullptr, @@ -1156,6 +1150,33 @@ Maybe ProcessEmitDeprecationWarning(Environment* env, deprecation_code); } +static void OnMessage(Local message, Local error) { + Isolate* isolate = message->GetIsolate(); + switch (message->ErrorLevel()) { + case Isolate::MessageErrorLevel::kMessageWarning: { + Environment* env = Environment::GetCurrent(isolate); + if (!env) { + break; + } + Utf8Value filename(isolate, + message->GetScriptOrigin().ResourceName()); + // (filename):(line) (message) + std::stringstream warning; + warning << *filename; + warning << ":"; + warning << message->GetLineNumber(env->context()).FromMaybe(-1); + warning << " "; + v8::String::Utf8Value msg(isolate, message->Get()); + warning << *msg; + USE(ProcessEmitWarningGeneric(env, warning.str().c_str(), "V8")); + break; + } + case Isolate::MessageErrorLevel::kMessageError: + FatalException(isolate, error, message); + break; + } +} + static Local InitModule(Environment* env, node_module* mod, @@ -2580,7 +2601,9 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop) { v8_platform.Platform()->RegisterIsolate(isolate, event_loop); Isolate::Initialize(isolate, params); - isolate->AddMessageListener(OnMessage); + isolate->AddMessageListenerWithErrorLevel(OnMessage, + Isolate::MessageErrorLevel::kMessageError | + Isolate::MessageErrorLevel::kMessageWarning); isolate->SetAbortOnUncaughtExceptionCallback(ShouldAbortOnUncaughtException); isolate->SetMicrotasksPolicy(MicrotasksPolicy::kExplicit); isolate->SetFatalErrorHandler(OnFatalError); diff --git a/test/message/v8_warning.js b/test/message/v8_warning.js new file mode 100644 index 00000000000000..e3394cdd7094e8 --- /dev/null +++ b/test/message/v8_warning.js @@ -0,0 +1,19 @@ +'use strict'; + +require('../common'); + +function AsmModule() { + 'use asm'; + + function add(a, b) { + a = a | 0; + b = b | 0; + + // should be `return (a + b) | 0;` + return a + b; + } + + return { add: add }; +} + +AsmModule(); diff --git a/test/message/v8_warning.out b/test/message/v8_warning.out new file mode 100644 index 00000000000000..7943d0e9d64dfe --- /dev/null +++ b/test/message/v8_warning.out @@ -0,0 +1 @@ +(node:*) V8: *v8_warning.js:* Invalid asm.js: Invalid return type From ee64ae0f6d8c9c4b5800a07d2654595c464d8727 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 14 Nov 2018 11:09:57 -0800 Subject: [PATCH 016/316] test: remove unused function arguments in async-hooks tests Remove unused function arguments in two async-hooks tests. PR-URL: https://github.com/nodejs/node/pull/24368 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Franziska Hinkelmann --- test/async-hooks/test-getaddrinforeqwrap.js | 2 +- test/async-hooks/test-getnameinforeqwrap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-getaddrinforeqwrap.js b/test/async-hooks/test-getaddrinforeqwrap.js index 0cd6ff39676424..f2a978d7640677 100644 --- a/test/async-hooks/test-getaddrinforeqwrap.js +++ b/test/async-hooks/test-getaddrinforeqwrap.js @@ -14,7 +14,7 @@ const hooks = initHooks(); hooks.enable(); dns.lookup('www.google.com', 4, common.mustCall(onlookup)); -function onlookup(err_, ip, family) { +function onlookup() { // we don't care about the error here in order to allow // tests to run offline (lookup will fail in that case and the err be set); diff --git a/test/async-hooks/test-getnameinforeqwrap.js b/test/async-hooks/test-getnameinforeqwrap.js index 50aa623458f41c..9e06cbf9cbf174 100644 --- a/test/async-hooks/test-getnameinforeqwrap.js +++ b/test/async-hooks/test-getnameinforeqwrap.js @@ -14,7 +14,7 @@ const hooks = initHooks(); hooks.enable(); dns.lookupService('127.0.0.1', 80, common.mustCall(onlookupService)); -function onlookupService(err_, ip, family) { +function onlookupService() { // we don't care about the error here in order to allow // tests to run offline (lookup will fail in that case and the err be set) From 331b26eda996e9923c02baf62213fbd481f4c8f1 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 10 Nov 2018 17:12:56 -0500 Subject: [PATCH 017/316] build,tools: update make-v8.sh for ppc64le PR-URL: https://github.com/nodejs/node/pull/24293 Fixes: https://github.com/nodejs/build/issues/1536 Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: Franziska Hinkelmann --- tools/make-v8.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/make-v8.sh b/tools/make-v8.sh index 1bbf472aae7df2..fd66fda94274df 100755 --- a/tools/make-v8.sh +++ b/tools/make-v8.sh @@ -6,8 +6,8 @@ V8_BUILD_OPTIONS=$2 cd deps/v8 tools/node/fetch_deps.py . -if [ "`arch`" == "s390x" ] -then +ARCH="`arch`" +if [[ "$ARCH" == "s390x" ]] || [[ "$ARCH" == "ppc64le" ]]; then # set paths manually for now to use locally installed gn export BUILD_TOOLS=/home/iojs/build-tools export LD_LIBRARY_PATH=$BUILD_TOOLS:$LD_LIBRARY_PATH @@ -15,12 +15,21 @@ then CXX_PATH=`which $CXX |grep g++` rm -f "$BUILD_TOOLS/g++" rm -f "$BUILD_TOOLS/gcc" +fi +if [[ "$ARCH" == "s390x" ]]; then ln -s $CXX_PATH "$BUILD_TOOLS/g++" ln -s $CXX_PATH "$BUILD_TOOLS/gcc" g++ --version export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config gn gen -v out.gn/$BUILD_ARCH_TYPE --args='is_component_build=false is_debug=false use_goma=false goma_dir="None" use_custom_libcxx=false v8_target_cpu="s390x" target_cpu="s390x"' ninja -v -C out.gn/$BUILD_ARCH_TYPE d8 cctest inspector-test +elif [[ "$ARCH" == "ppc64le" ]]; then + ln -s /usr/bin/$CXX "$BUILD_TOOLS/g++" + ln -s /usr/bin/$CC "$BUILD_TOOLS/gcc" + g++ --version + export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config-files + gn gen out.gn/$BUILD_ARCH_TYPE --args='is_component_build=false is_debug=false use_goma=false goma_dir="None" use_custom_libcxx=false v8_target_cpu="ppc64" target_cpu="ppc64"' + ninja -C out.gn/$BUILD_ARCH_TYPE d8 cctest inspector-test else PATH=~/_depot_tools:$PATH tools/dev/v8gen.py $BUILD_ARCH_TYPE --no-goma $V8_BUILD_OPTIONS PATH=~/_depot_tools:$PATH ninja -C out.gn/$BUILD_ARCH_TYPE/ d8 cctest inspector-test From 5f747f1dc56a59573e056946c016b4b588e9e80e Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Nov 2018 22:53:59 +0000 Subject: [PATCH 018/316] doc: add help on fixing IPv6 test failures It took me a while to figure out the problem and then some googling to find the right answer. I think it is worth adding this to help other people in the future and to have an easy place to point people to for the solution if their test run fails with IPv6 failures. PR-URL: https://github.com/nodejs/node/pull/24372 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann --- BUILDING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 63ddf8e7f4ff2a..50f2984d679274 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -253,6 +253,16 @@ $ ./node ./test/parallel/test-stream2-transform.js Remember to recompile with `make -j4` in between test runs if you change code in the `lib` or `src` directories. +The tests attempt to detect support for IPv6 and exclude IPv6 tests if +appropriate. If your main interface has IPv6 addresses, then your +loopback interface must also have '::1' enabled. For some default installations +on Ubuntu that does not seem to be the case. To enable '::1' on the +loopback interface on Ubuntu: + +```bash +sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 +``` + #### Running Coverage It's good practice to ensure any code you add or change is covered by tests. From a3599a5067ea52ad7b5a12e4c55c544a2a0c867b Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Nov 2018 14:51:12 -0500 Subject: [PATCH 019/316] doc: better linkage to node-addon-api One of the comments we got at the N-API workshop at NodeConfEU was that we should have a better link to node-addon-api and the docs in the main API docs for N-API. The goal being to help people find node-addon-api and potentially start with the node-addon-api docs instead if they are using C++. This expands and strengthens the link along with a recommendation that starting with the node-addon-api docs might make sense. PR-URL: https://github.com/nodejs/node/pull/24371 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Vse Mozhet Byt Reviewed-By: Franziska Hinkelmann --- doc/api/n-api.md | 52 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index c976c5e8f060f0..27ebefb4b56b3e 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -34,13 +34,51 @@ properties: handling section [Error Handling][]. The N-API is a C API that ensures ABI stability across Node.js versions -and different compiler levels. However, we also understand that a C++ -API can be easier to use in many cases. To support these cases we expect -there to be one or more C++ wrapper modules that provide an inlineable C++ -API. Binaries built with these wrapper modules will depend on the symbols -for the N-API C based functions exported by Node.js. These wrappers are not -part of N-API, nor will they be maintained as part of Node.js. One such -example is: [node-addon-api](https://github.com/nodejs/node-addon-api). +and different compiler levels. A C++ API can be easier to use. +To support using C++, the project maintains a +C++ wrapper module called +[node-addon-api](https://github.com/nodejs/node-addon-api). +This wrapper provides an inlineable C++ API. Binaries built +with `node-addon-api` will depend on the symbols for the N-API C-based +functions exported by Node.js. `node-addon-api` is a more +efficient way to write code that calls N-API. Take, for example, the +following `node-addon-api` code. The first section shows the +`node-addon-api` code and the second section shows what actually gets +used in the addon. + +```C++ +Object obj = Object::New(env); +obj["foo"] = String::New(env, "bar"); +``` + +```C++ +napi_status status; +napi_value object, string; +status = napi_create_object(env, &object); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} + +status = napi_crate_string_utf8(env, "bar", NAPI_AUTO_LENGTH, &string); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} + +status = napi_set_named_property(env, object, "foo", string); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} +``` + +The end result is that the addon only uses the exported C APIs. As a result, +it still gets the benefits of the ABI stability provided by the C API. + +When using `node-addon-api` instead of the C APIs, start with the API +[docs](https://github.com/nodejs/node-addon-api#api-documentation) +for `node-addon-api`. ## Implications of ABI Stability From 2fc9550280d9adc82f022d3f5d33421479dcef18 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 22 Dec 2016 11:04:59 -0800 Subject: [PATCH 020/316] test: rename agent1-pfx.pem to agent1.pfx PFX is not PEM, its binary DER. Use the same .pfx extension as test/fixtures/test_cert.pfx does. PR-URL: https://github.com/nodejs/node/pull/24374 Reviewed-By: Daniel Bevenius Reviewed-By: Ben Noordhuis Reviewed-By: Franziska Hinkelmann --- test/fixtures/keys/Makefile | 8 ++++---- .../fixtures/keys/{agent1-pfx.pem => agent1.pfx} | Bin test/fixtures/keys/ec-pfx.pem | Bin 1006 -> 0 bytes test/fixtures/keys/ec.pfx | Bin 0 -> 1006 bytes test/parallel/test-tls-multi-pfx.js | 4 ++-- test/parallel/test-tls-ocsp-callback.js | 2 +- test/parallel/test-tls-pfx-authorizationerror.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename test/fixtures/keys/{agent1-pfx.pem => agent1.pfx} (100%) delete mode 100644 test/fixtures/keys/ec-pfx.pem create mode 100644 test/fixtures/keys/ec.pfx diff --git a/test/fixtures/keys/Makefile b/test/fixtures/keys/Makefile index 32e34705bb9794..c4ac0768e7685f 100644 --- a/test/fixtures/keys/Makefile +++ b/test/fixtures/keys/Makefile @@ -92,13 +92,13 @@ agent1-cert.pem: agent1-csr.pem ca1-cert.pem ca1-key.pem -CAcreateserial \ -out agent1-cert.pem -agent1-pfx.pem: agent1-cert.pem agent1-key.pem ca1-cert.pem +agent1.pfx: agent1-cert.pem agent1-key.pem ca1-cert.pem openssl pkcs12 -export \ -descert \ -in agent1-cert.pem \ -inkey agent1-key.pem \ -certfile ca1-cert.pem \ - -out agent1-pfx.pem \ + -out agent1.pfx \ -password pass:sample agent1-verify: agent1-cert.pem ca1-cert.pem @@ -334,12 +334,12 @@ ec-cert.pem: ec-csr.pem ec-key.pem -signkey ec-key.pem \ -out ec-cert.pem -ec-pfx.pem: ec-cert.pem ec-key.pem +ec.pfx: ec-cert.pem ec-key.pem openssl pkcs12 -export \ -descert \ -in ec-cert.pem \ -inkey ec-key.pem \ - -out ec-pfx.pem \ + -out ec.pfx \ -password pass: dh512.pem: diff --git a/test/fixtures/keys/agent1-pfx.pem b/test/fixtures/keys/agent1.pfx similarity index 100% rename from test/fixtures/keys/agent1-pfx.pem rename to test/fixtures/keys/agent1.pfx diff --git a/test/fixtures/keys/ec-pfx.pem b/test/fixtures/keys/ec-pfx.pem deleted file mode 100644 index f5e76a76118e44c62e08a24d8dbe86b4bb2bf4ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1006 zcmXqLVt&QM$ZXKWyn&5VtIebBJ1-+UMQF98S@); zKE$lpYO>_Cq*ch&`wU&*%jD|KS9F@lc3a4Bym-hr`_%CYJx|>i-!s1dOtyN}dNWj6 z;_Fu1+();=_RMoqw_jnF;AJIcVm*h|n^&jxKxf>&j^&GNlYg(3v$)tQrs&Z+|5W#C zPFYPki7k8qiE7tp#Kv7c^x)64fBKQHU!}VKOL$sl68cG0V0p*1OYgVX314}x@#c9J z%iWB7lHm~(qZs~YZCmt7NNSDIhp_L5ZkzFG{#$TjGka=D#G~^@$_lqyei-gbn$1+8}@xS+d+HbW*K6l&&xep89(;^-oM29rB}p^d$T`8f2;f~ULMuH`5t$r|KaZ516uNW zN|TfK9&pzztLQ%R=>49(wh51azTL3nQ{kE^!r$(>oTysqGkvYIT&}g8^CTOCP>tJb zPTziBv8_D7onSUTD@X`%%evQVijEr0 z?q5BF@$@X+dG0!%6L}@4yXS15VW?`L4EG+VsG%5(h#;qZ_o`WKrn!?Quw4#hI=wq7 z-^jqwK+%Acja8eEnMsP3fkkAeiA=$*$5v6IX9cDnUB6ee*-K<23rA~=lEgs<2N95G E0oTd5u>b%7 diff --git a/test/fixtures/keys/ec.pfx b/test/fixtures/keys/ec.pfx new file mode 100644 index 0000000000000000000000000000000000000000..3130860e9939309cb90c1ecae28ad88bd8ceb5e3 GIT binary patch literal 1006 zcmXqLVt&QM$ZXKWyn&5VtIebBJ1-+UA!2PZtPfIyeN-Tr#61dzx&hg{@%)Y zZ)&N|{lfZ)RP80)2aEkJuP;oT^KOl{hYNS&MEAyp-?RUV-;jRs;bh!C`Qxk$_w#Bh zZjkxhWUHjDCsgY6LT5#E*8ihQDt{+B7Myers90(9b-LDke`_b}tua}DEG9`c%!pS# z{VB8i@LrLYgFbU^C5TKu^IKcoNA;-&QBye+Q}$$ru=Q7hvQYOq=AEU~9UM(B|CX6CM-X8-*EMZpQL)|m1C z2)giNcHh0luaAA-+?i7lsPu<#p~K!Qo*YlOv$sIO^{69bqh=(_8x z9a*+Q;M}uYWy?F3hgB%5cSRM}UB7+qaaM|t^^_I6*T23dkaNLzM&-GqSMG3%u)a6+ zBGUokr_pCFVUHL}a%_5BL?myona|~E49A3Rh$$Pl$)F$)9sy*ivWb_xkY3gI2 zT+_{{YFaW=)ldG8zW2Gv&;9wks;>q%oGvIeXkuhSN_YzzzpylZG-!Nh(D<5-8X-;PQEGr;qMZTobg{Z`*&>Sg!H{T$~2|Jm+sSfzjeb- z&eckcxss>D?whG5rfHY#(~ebMwDtX?+mkk*EOwmSYvs9G@2SbV<;7WjC-T0n5h(iq zCE?K{k>piY{AzQXq?fvzHL#be+Zn1FD8s$SDQYOjA|l9X-@R&9n`!Q(32c`GnNIIc z$~Q7FG*C3)WMkFlV`h?KWnd9`Eb_x))*|&NvA3J@x=L=V_n4GDV&TY~+| Date: Tue, 20 Dec 2016 14:17:05 -0800 Subject: [PATCH 021/316] test: add independent multi-alg crypto identities agent6 was the only cert that had a chain (an intermediate certificate), and there were no non-RSA certs other than a single self-signed one. This makes it impossible to test cert-chain scenarios with multiple identities which require chains to prove chain completion, and multi-algorithm because OpenSSL doesn't support multiple identities unless they are multi-algorithm. PFX files were also missing for most identities, making it difficult to test multi-PFX and PFX interactions with cert-chain+key and CA options. New server cert chains: - ECC: ca5 signs ca6 signs ec10, CN=agent10.example.com - RSA: ca2 signs ca4 signs agent10, CN=agent10.example.com PFX added for: - agent6 - agent10 - ec10 All pem and pfx regenerated from scratch to test that the Makefile is actually working as intended. PR-URL: https://github.com/nodejs/node/pull/24374 Reviewed-By: Daniel Bevenius Reviewed-By: Ben Noordhuis Reviewed-By: Franziska Hinkelmann --- test/fixtures/keys/Makefile | 214 +++++++++++++++++- test/fixtures/keys/agent1-cert.pem | 22 +- test/fixtures/keys/agent1-csr.pem | 16 +- test/fixtures/keys/agent1-key.pem | 26 +-- test/fixtures/keys/agent1.pfx | Bin 2445 -> 2445 bytes test/fixtures/keys/agent10-cert.pem | 32 +++ test/fixtures/keys/agent10-csr.pem | 13 ++ test/fixtures/keys/agent10-key.pem | 15 ++ test/fixtures/keys/agent10.cnf | 17 ++ test/fixtures/keys/agent10.pfx | Bin 0 -> 3061 bytes test/fixtures/keys/agent2-cert.pem | 20 +- test/fixtures/keys/agent2-csr.pem | 16 +- test/fixtures/keys/agent2-key.pem | 26 +-- test/fixtures/keys/agent3-cert.pem | 18 +- test/fixtures/keys/agent3-csr.pem | 16 +- test/fixtures/keys/agent3-key.pem | 26 +-- test/fixtures/keys/agent4-cert.pem | 20 +- test/fixtures/keys/agent4-csr.pem | 16 +- test/fixtures/keys/agent4-key.pem | 26 +-- test/fixtures/keys/agent5-cert.pem | 20 +- test/fixtures/keys/agent5-csr.pem | 12 +- test/fixtures/keys/agent5-key.pem | 26 +-- test/fixtures/keys/agent6-cert.pem | 38 ++-- test/fixtures/keys/agent6-csr.pem | 12 +- test/fixtures/keys/agent6-key.pem | 26 +-- test/fixtures/keys/agent6.pfx | Bin 0 -> 3029 bytes test/fixtures/keys/agent7-cert.pem | 28 +-- test/fixtures/keys/agent7-csr.pem | 26 +-- test/fixtures/keys/agent7-key.pem | 50 ++-- test/fixtures/keys/agent8-cert.pem | 26 +-- test/fixtures/keys/agent8-csr.pem | 26 +-- test/fixtures/keys/agent8-key.pem | 50 ++-- test/fixtures/keys/agent9-cert.pem | 32 +-- test/fixtures/keys/agent9-csr.pem | 26 +-- test/fixtures/keys/agent9-key.pem | 50 ++-- test/fixtures/keys/ca1-cert.pem | 20 +- test/fixtures/keys/ca1-cert.srl | 2 +- test/fixtures/keys/ca1-key.pem | 32 +-- test/fixtures/keys/ca2-cert.pem | 18 +- test/fixtures/keys/ca2-cert.srl | 2 +- test/fixtures/keys/ca2-crl.pem | 10 +- test/fixtures/keys/ca2-database.txt | 2 +- test/fixtures/keys/ca2-database.txt.attr | 2 +- test/fixtures/keys/ca2-database.txt.attr.old | 1 + test/fixtures/keys/ca2-key.pem | 32 +-- test/fixtures/keys/ca3-cert.pem | 20 +- test/fixtures/keys/ca3-cert.srl | 2 +- test/fixtures/keys/ca3-csr.pem | 16 +- test/fixtures/keys/ca3-key.pem | 26 +-- test/fixtures/keys/ca4-cert.pem | 16 ++ test/fixtures/keys/ca4-cert.srl | 1 + test/fixtures/keys/ca4-csr.pem | 13 ++ test/fixtures/keys/ca4-key.pem | 15 ++ test/fixtures/keys/ca4.cnf | 23 ++ test/fixtures/keys/ca5-cert.pem | 14 ++ test/fixtures/keys/ca5-cert.srl | 1 + test/fixtures/keys/ca5-csr.pem | 10 + test/fixtures/keys/ca5-key.pem | 8 + test/fixtures/keys/ca5.cnf | 35 +++ test/fixtures/keys/ca6-cert.pem | 14 ++ test/fixtures/keys/ca6-cert.srl | 1 + test/fixtures/keys/ca6-csr.pem | 10 + test/fixtures/keys/ca6-key.pem | 8 + test/fixtures/keys/ca6.cnf | 22 ++ test/fixtures/keys/dh1024.pem | 6 +- test/fixtures/keys/dh2048.pem | 12 +- test/fixtures/keys/dh512.pem | 4 +- test/fixtures/keys/dns-cert1.cnf | Bin 0 -> 565 bytes test/fixtures/keys/dsa1025.pem | 14 +- test/fixtures/keys/dsa_private_1025.pem | 20 +- test/fixtures/keys/dsa_public_1025.pem | 20 +- test/fixtures/keys/ec-cert.pem | 22 +- test/fixtures/keys/ec-csr.pem | 8 +- test/fixtures/keys/ec-key.pem | 6 +- test/fixtures/keys/ec.pfx | Bin 1006 -> 1006 bytes test/fixtures/keys/ec10-cert.pem | 27 +++ test/fixtures/keys/ec10-csr.pem | 10 + test/fixtures/keys/ec10-key.pem | 8 + test/fixtures/keys/ec10.pfx | Bin 0 -> 2198 bytes test/fixtures/keys/fake-cnnic-root-cert.pem | 28 +-- test/fixtures/keys/fake-cnnic-root-cert.srl | 2 +- test/fixtures/keys/fake-cnnic-root-key.pem | 50 ++-- .../fixtures/keys/fake-startcom-root-cert.pem | 32 +-- .../keys/fake-startcom-root-database.txt | 4 +- .../keys/fake-startcom-root-database.txt.attr | 2 +- .../fake-startcom-root-database.txt.attr.old | 2 +- .../keys/fake-startcom-root-database.txt.old | 2 +- .../fake-startcom-root-issued-certs/01.pem | 26 +-- .../fake-startcom-root-issued-certs/02.pem | 32 +-- test/fixtures/keys/fake-startcom-root-key.pem | 50 ++-- test/fixtures/keys/rsa_private_1024.pem | 26 +-- test/fixtures/keys/rsa_private_2048.pem | 50 ++-- test/fixtures/keys/rsa_private_4096.pem | 98 ++++---- test/fixtures/keys/rsa_public_1024.pem | 8 +- test/fixtures/keys/rsa_public_2048.pem | 14 +- test/fixtures/keys/rsa_public_4096.pem | 24 +- test/parallel/test-tls-cert-chains-concat.js | 6 +- test/parallel/test-tls-cert-chains-in-ca.js | 6 +- test/parallel/test-tls-peer-certificate.js | 14 +- .../test-tls-pfx-authorizationerror.js | 4 +- 100 files changed, 1254 insertions(+), 746 deletions(-) create mode 100644 test/fixtures/keys/agent10-cert.pem create mode 100644 test/fixtures/keys/agent10-csr.pem create mode 100644 test/fixtures/keys/agent10-key.pem create mode 100644 test/fixtures/keys/agent10.cnf create mode 100644 test/fixtures/keys/agent10.pfx create mode 100644 test/fixtures/keys/agent6.pfx create mode 100644 test/fixtures/keys/ca2-database.txt.attr.old create mode 100644 test/fixtures/keys/ca4-cert.pem create mode 100644 test/fixtures/keys/ca4-cert.srl create mode 100644 test/fixtures/keys/ca4-csr.pem create mode 100644 test/fixtures/keys/ca4-key.pem create mode 100644 test/fixtures/keys/ca4.cnf create mode 100644 test/fixtures/keys/ca5-cert.pem create mode 100644 test/fixtures/keys/ca5-cert.srl create mode 100644 test/fixtures/keys/ca5-csr.pem create mode 100644 test/fixtures/keys/ca5-key.pem create mode 100644 test/fixtures/keys/ca5.cnf create mode 100644 test/fixtures/keys/ca6-cert.pem create mode 100644 test/fixtures/keys/ca6-cert.srl create mode 100644 test/fixtures/keys/ca6-csr.pem create mode 100644 test/fixtures/keys/ca6-key.pem create mode 100644 test/fixtures/keys/ca6.cnf create mode 100644 test/fixtures/keys/dns-cert1.cnf create mode 100644 test/fixtures/keys/ec10-cert.pem create mode 100644 test/fixtures/keys/ec10-csr.pem create mode 100644 test/fixtures/keys/ec10-key.pem create mode 100644 test/fixtures/keys/ec10.pfx diff --git a/test/fixtures/keys/Makefile b/test/fixtures/keys/Makefile index c4ac0768e7685f..964fb2f5f1451b 100644 --- a/test/fixtures/keys/Makefile +++ b/test/fixtures/keys/Makefile @@ -1,4 +1,41 @@ -all: agent1-cert.pem agent1-pfx.pem agent2-cert.pem agent3-cert.pem agent4-cert.pem agent5-cert.pem agent6-cert.pem agent7-cert.pem agent8-cert.pem agent9-cert.pem ca1-cert.pem ca2-crl.pem ca3-cert.pem ec-cert.pem dh512.pem dh1024.pem dh2048.pem dsa1025.pem dsa_private_1025.pem dsa_public_1025.pem rsa_private_1024.pem rsa_private_2048.pem rsa_private_4096.pem rsa_public_1024.pem rsa_public_2048.pem rsa_public_4096.pem ec-pfx.pem +all: \ + ca1-cert.pem \ + ca2-cert.pem \ + ca2-crl.pem \ + ca3-cert.pem \ + ca4-cert.pem \ + ca5-cert.pem \ + ca6-cert.pem \ + agent1-cert.pem \ + agent1.pfx \ + agent2-cert.pem \ + agent3-cert.pem \ + agent4-cert.pem \ + agent5-cert.pem \ + agent6-cert.pem \ + agent6.pfx \ + agent7-cert.pem \ + agent8-cert.pem \ + agent9-cert.pem \ + agent10-cert.pem \ + agent10.pfx \ + ec10-cert.pem \ + ec10.pfx \ + dh512.pem \ + dh1024.pem \ + dh2048.pem \ + dsa1025.pem \ + dsa_private_1025.pem \ + dsa_public_1025.pem \ + ec-cert.pem \ + ec.pfx \ + fake-cnnic-root-cert.pem \ + rsa_private_1024.pem \ + rsa_private_2048.pem \ + rsa_private_4096.pem \ + rsa_public_1024.pem \ + rsa_public_2048.pem \ + rsa_public_4096.pem \ # # Create Certificate Authority: ca1 @@ -17,7 +54,7 @@ ca2-cert.pem: ca2.cnf touch ca2-database.txt # -# Create Subordinate Certificate Authority: ca3 +# Create Subordinate Certificate Authority: ca3 issued by ca1 # ('password' is used for the CA password.) # ca3-key.pem: @@ -42,6 +79,81 @@ ca3-cert.pem: ca3-csr.pem ca3-key.pem ca3.cnf ca1-cert.pem ca1-key.pem -CAcreateserial \ -out ca3-cert.pem +# +# Create Subordinate Certificate Authority: ca4 issued by ca2 +# ('password' is used for the CA password.) +# +ca4-key.pem: + openssl genrsa -out ca4-key.pem 1024 + +ca4-csr.pem: ca4.cnf ca4-key.pem + openssl req -new \ + -extensions v3_ca \ + -config ca4.cnf \ + -key ca4-key.pem \ + -out ca4-csr.pem + +ca4-cert.pem: ca4-csr.pem ca4-key.pem ca4.cnf ca2-cert.pem ca2-key.pem + openssl x509 -req \ + -extfile ca4.cnf \ + -extensions v3_ca \ + -days 99999 \ + -passin "pass:password" \ + -in ca4-csr.pem \ + -CA ca2-cert.pem \ + -CAkey ca2-key.pem \ + -CAcreateserial \ + -out ca4-cert.pem + +# +# Create Certificate Authority: ca5 with ECC +# ('password' is used for the CA password.) +# +ca5-key.pem: + openssl ecparam -genkey -out ca5-key.pem -name prime256v1 + +ca5-csr.pem: ca5.cnf ca5-key.pem + openssl req -new \ + -config ca5.cnf \ + -key ca5-key.pem \ + -out ca5-csr.pem + +ca5-cert.pem: ca5.cnf ca5-key.pem ca5-csr.pem + openssl x509 -req \ + -extfile ca5.cnf \ + -extensions v3_ca \ + -days 99999 \ + -passin "pass:password" \ + -in ca5-csr.pem \ + -signkey ca5-key.pem \ + -out ca5-cert.pem + +# +# Create Subordinate Certificate Authority: ca6 issued by ca5 with ECC +# ('password' is used for the CA password.) +# +ca6-key.pem: + openssl ecparam -genkey -out ca6-key.pem -name prime256v1 + +ca6-csr.pem: ca6.cnf ca6-key.pem + openssl req -new \ + -extensions v3_ca \ + -config ca6.cnf \ + -key ca6-key.pem \ + -out ca6-csr.pem + +ca6-cert.pem: ca6-csr.pem ca6-key.pem ca6.cnf ca5-cert.pem ca5-key.pem + openssl x509 -req \ + -extfile ca6.cnf \ + -extensions v3_ca \ + -days 99999 \ + -passin "pass:password" \ + -in ca6-csr.pem \ + -CA ca5-cert.pem \ + -CAkey ca5-key.pem \ + -CAcreateserial \ + -out ca6-cert.pem + # # Create Fake CNNIC Root Certificate Authority: fake-cnnic-root # @@ -179,7 +291,7 @@ agent4-verify: agent4-cert.pem ca2-cert.pem # # Make CRL with agent4 being rejected # -ca2-crl.pem: ca2-key.pem ca2-cert.pem ca2.cnf +ca2-crl.pem: ca2-key.pem ca2-cert.pem ca2.cnf agent4-cert.pem openssl ca -revoke agent4-cert.pem \ -keyfile ca2-key.pem \ -cert ca2-cert.pem \ @@ -219,7 +331,7 @@ agent5-verify: agent5-cert.pem ca2-cert.pem openssl verify -CAfile ca2-cert.pem agent5-cert.pem # -# agent6 is signed by ca3 +# agent6 is a client RSA cert signed by ca3 # agent6-key.pem: @@ -240,8 +352,17 @@ agent6-cert.pem: agent6-csr.pem ca3-cert.pem ca3-key.pem -out agent6-cert.pem cat ca3-cert.pem >> agent6-cert.pem -agent6-verify: agent6-cert.pem ca3-cert.pem - openssl verify -CAfile ca3-cert.pem agent6-cert.pem +agent6-verify: agent6-cert.pem ca3-cert.pem ca1-cert.pem + openssl verify -trusted ca1-cert.pem -untrusted ca3-cert.pem agent6-cert.pem + +agent6.pfx: agent6-cert.pem agent6-key.pem ca1-cert.pem + openssl pkcs12 -export \ + -descert \ + -in agent6-cert.pem \ + -inkey agent6-key.pem \ + -certfile ca1-cert.pem \ + -out agent6.pfx \ + -password pass:sample # # agent7 is signed by fake-cnnic-root. @@ -318,9 +439,80 @@ agent9-cert.pem: agent9-csr.pem -days 99999 \ -passin "pass:password" \ -in agent9-csr.pem \ - -startdate 161021000001Z \ + -startdate 20161021000001Z \ -notext -out agent9-cert.pem +# agent10 is a server RSA cert signed by ca4 for agent10.example.com +# + +agent10-key.pem: + openssl genrsa -out agent10-key.pem 1024 + +agent10-csr.pem: agent10.cnf agent10-key.pem + openssl req -new -config agent10.cnf -key agent10-key.pem -out agent10-csr.pem + +agent10-cert.pem: agent10-csr.pem ca4-cert.pem ca4-key.pem + openssl x509 -req \ + -days 99999 \ + -passin "pass:password" \ + -in agent10-csr.pem \ + -CA ca4-cert.pem \ + -CAkey ca4-key.pem \ + -CAcreateserial \ + -extfile agent10.cnf \ + -out agent10-cert.pem + cat ca4-cert.pem >> agent10-cert.pem + +agent10-verify: agent10-cert.pem ca4-cert.pem ca2-cert.pem + openssl verify -trusted ca2-cert.pem -untrusted ca4-cert.pem agent10-cert.pem + +agent10.pfx: agent10-cert.pem agent10-key.pem ca1-cert.pem + openssl pkcs12 -export \ + -descert \ + -in agent10-cert.pem \ + -inkey agent10-key.pem \ + -certfile ca1-cert.pem \ + -out agent10.pfx \ + -password pass:sample + +# +# ec10 is a server EC cert signed by ca6 for agent10.example.com +# + +ec10-key.pem: + openssl ecparam -genkey -out ec10-key.pem -name prime256v1 + +ec10-csr.pem: ec10-key.pem + openssl req -new -config agent10.cnf -key ec10-key.pem -out ec10-csr.pem + +ec10-cert.pem: ec10-csr.pem ca6-cert.pem ca6-key.pem + openssl x509 -req \ + -days 99999 \ + -passin "pass:password" \ + -in ec10-csr.pem \ + -CA ca6-cert.pem \ + -CAkey ca6-key.pem \ + -CAcreateserial \ + -extfile agent10.cnf \ + -out ec10-cert.pem + cat ca6-cert.pem >> ec10-cert.pem + +ec10-verify: ec10-cert.pem ca6-cert.pem ca5-cert.pem + openssl verify -trusted ca5-cert.pem -untrusted ca6-cert.pem ec10-cert.pem + +ec10.pfx: ec10-cert.pem ec10-key.pem ca6-cert.pem + openssl pkcs12 -export \ + -descert \ + -in ec10-cert.pem \ + -inkey ec10-key.pem \ + -certfile ca6-cert.pem \ + -out ec10.pfx \ + -password pass:sample + + +# +# ec is a self-signed EC cert for CN "agent2" +# ec-key.pem: openssl ecparam -genkey -out ec-key.pem -name prime256v1 @@ -379,10 +571,12 @@ rsa_public_4096.pem: rsa_private_4096.pem openssl rsa -in rsa_private_4096.pem -pubout -out rsa_public_4096.pem clean: - rm -f *.pem *.srl ca2-database.txt ca2-serial fake-startcom-root-serial + rm -f *.pfx *.pem *.srl ca2-database.txt ca2-serial fake-startcom-root-serial *.print *.old fake-startcom-root-issued-certs/*.pem @> fake-startcom-root-database.txt -test: agent1-verify agent2-verify agent3-verify agent4-verify agent5-verify +test: agent1-verify agent2-verify agent3-verify agent4-verify agent5-verify agent6-verify agent7-verify agent8-verify agent10-verify ec10-verify +%-cert.pem.print: %-cert.pem + openssl x509 -in $< -text -noout > $@ -.PHONY: all clean test agent1-verify agent2-verify agent3-verify agent4-verify agent5-verify +.PHONY: all clean test agent1-verify agent2-verify agent3-verify agent4-verify agent5-verify agent6-verify agent7-verify agent8-verify agent10-verify ec10-verify diff --git a/test/fixtures/keys/agent1-cert.pem b/test/fixtures/keys/agent1-cert.pem index ee4d9c434e272d..664d00ca6d8f9c 100644 --- a/test/fixtures/keys/agent1-cert.pem +++ b/test/fixtures/keys/agent1-cert.pem @@ -1,18 +1,18 @@ -----BEGIN CERTIFICATE----- -MIIC2DCCAkGgAwIBAgIJAPrVDMagf1FsMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIIC2DCCAkGgAwIBAgIJAOzJuFYnDamoMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTVaGA8yMjkyMDUyMjAx -MTY1NVowfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQDDAZhZ2Vu dDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3 -DQEBAQUAA4GNADCBiQKBgQDnXT3od/PORzybLaYoAhqwa87601hrKbOrcJH9XGVX -TqFoSqkVZCbFFHDDlambsucH0jejao7cKFm7UKyMhlOxSYaynD2o28nS1ZBRwybV -zOGsIhF2sPc3TY6+P2EQWhe1F9tZsUcoOSXihwx78V0HLVde3UoXmtDVwD8ASlRu -vQIDAQABo2EwXzBdBggrBgEFBQcBAQRRME8wIwYIKwYBBQUHMAGGF2h0dHA6Ly9v +DQEBAQUAA4GNADCBiQKBgQDvVEBwFjfiirsDjlZB+CjYNMNCqdJe27hqK/b72AnL +jgN6mLcXCOABJC5N61TGFkiF9Zndh6IyFXRZVb4gQX4zxNDRuAydo95BmiYHGV0v +t1ZXsLv7XrfQu6USLRtpZMe1cNULjsAB7raN+1hEN1CPMSmSjWc7MKPgv09QYJ5j +cQIDAQABo2EwXzBdBggrBgEFBQcBAQRRME8wIwYIKwYBBQUHMAGGF2h0dHA6Ly9v Y3NwLm5vZGVqcy5vcmcvMCgGCCsGAQUFBzAChhxodHRwOi8vY2Eubm9kZWpzLm9y -Zy9jYS5jZXJ0MA0GCSqGSIb3DQEBBQUAA4GBAIi44Hk6phewUYEEmSSuuS4pViPZ -Eu/uCDtDAdn/Qz/q2lFHRsaia9ov7xfncYpgV7/vq5MAHigas4ZGUoutwCzwnaAI -l9wxkLG3G8wPN3x4wDGoLxpqaH5nqJIo6iWady9WM9PDaVHn+6ibrP9p55T65o+O -BaF2ovk9NzkxpMPM +Zy9jYS5jZXJ0MA0GCSqGSIb3DQEBCwUAA4GBAHrKvx2Z4fsF7b3VRgiIbdbFCfxY +ICvoJ0+BObYPjqIZZm9+/5c36SpzKzGO9CN9qUEj3KxPmijnb+Zjsm1CSCrG1m04 +C73+AjAIPnQ+eWZnF1K4L2kuEDTpv8nQzYKYiGxsmW58PSMeAq1TmaFwtSW3TxHX +7ROnqBX0uXQlOo1m -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent1-csr.pem b/test/fixtures/keys/agent1-csr.pem index b6eb759b897b94..6ed2fb3aff9ef7 100644 --- a/test/fixtures/keys/agent1-csr.pem +++ b/test/fixtures/keys/agent1-csr.pem @@ -2,12 +2,12 @@ MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQD DAZhZ2VudDExIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G -CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnXT3od/PORzybLaYoAhqwa87601hrKbOr -cJH9XGVXTqFoSqkVZCbFFHDDlambsucH0jejao7cKFm7UKyMhlOxSYaynD2o28nS -1ZBRwybVzOGsIhF2sPc3TY6+P2EQWhe1F9tZsUcoOSXihwx78V0HLVde3UoXmtDV -wD8ASlRuvQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 -b3JkMA0GCSqGSIb3DQEBCwUAA4GBAMFbLKd2LbXJ3DPnwzYPcToOYZbwirgZicQX -AGyU93YrwnTwITgz8bfYlMDDm+tL8w8tLjUTZQNpYqAC7WrUeBw6HuxluQ3MNJz3 -1X9e0SXgeiuNXZjjBRP7zgXvjeZ+ArOC7KZJbswsFGAC/c3ZUpkGG0trcRULcYTA -+wjl1ERh +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDvVEBwFjfiirsDjlZB+CjYNMNCqdJe27hq +K/b72AnLjgN6mLcXCOABJC5N61TGFkiF9Zndh6IyFXRZVb4gQX4zxNDRuAydo95B +miYHGV0vt1ZXsLv7XrfQu6USLRtpZMe1cNULjsAB7raN+1hEN1CPMSmSjWc7MKPg +v09QYJ5jcQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBCwUAA4GBAN3UIAdShj7eA91fH8m8UQBJndgigNwt88qk +S2kS3XfZqkEawMu2HF/y5yWX7EyGs7OkRXZxJSR67GlgdrTi82qCBC3H2xF7fKXr +s5b6ges5NZFjEA9JTvX5PFSAfo5APbXuuhRWBdxvagi00szTnYiaKgGU4C/dZWAz +E0/tTFT4 -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent1-key.pem b/test/fixtures/keys/agent1-key.pem index 031aad87f10680..fe750dee3f47f5 100644 --- a/test/fixtures/keys/agent1-key.pem +++ b/test/fixtures/keys/agent1-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXwIBAAKBgQDnXT3od/PORzybLaYoAhqwa87601hrKbOrcJH9XGVXTqFoSqkV -ZCbFFHDDlambsucH0jejao7cKFm7UKyMhlOxSYaynD2o28nS1ZBRwybVzOGsIhF2 -sPc3TY6+P2EQWhe1F9tZsUcoOSXihwx78V0HLVde3UoXmtDVwD8ASlRuvQIDAQAB -AoGBAMaeCBh6aWWrR/8beCmebNUJJ/2x05TjjuddUybC3AjQasYCWhcQDCxh+NAe -uiT8t1LCh5sVTiD3zth8UDSu2EaWrL6gpOHqTHx1SgrVL1D99ha0QnDyBQ+GWBkh -0NoNHOF47mbmn7+gJpVNgiFtfTeOUyK3HUDlaa+/qJwdwEQNAkEA/9dzyExaFUzz -E6p1UGN0rvjTdC48Bak2D33Ut6FiABdBn1smAVIlroVv8nb+Tfvq7vgsgPXYTJcy -W2VN9f/tGwJBAOeB6QJLG7wUYRuKHndnXAPIJT6GW7TKuVQzNtRvB2wcqOZ3cF50 -gYi6dYmiV0SWEMr2IcYisgEnyE7uKh3tCQcCQQCB9OVBV1di/oVy9eFFhl+dCZQP -rfSbQ4rMb7R/2qA3P5j744b4oMu3TNzCoyMmZdK+tJ2WnErVDPBtcJYbYXcFAkEA -mTejbP8kle+u7TkWPNRNU7ts2tq1awwYaB+VFDd/ZA/7wLwfxIO7DzDIhZTJyPzA -lHMdmzJvONCJg6OggDnWlQJBAPpS05NSnr/gzoccnVfDkf0bqBe7ATAEJ8F7PS/z -kauA/tWM/Pec0unSdrAJKV9CLfKUvKBXwOIS3GPLTsYHTvc= +MIICXQIBAAKBgQDvVEBwFjfiirsDjlZB+CjYNMNCqdJe27hqK/b72AnLjgN6mLcX +COABJC5N61TGFkiF9Zndh6IyFXRZVb4gQX4zxNDRuAydo95BmiYHGV0vt1ZXsLv7 +XrfQu6USLRtpZMe1cNULjsAB7raN+1hEN1CPMSmSjWc7MKPgv09QYJ5jcQIDAQAB +AoGAbqk3TlyHpKFfDarf6Yr0X9wtuQJK+n+ACt+fSR3AkbVtmF9KsUTyRrTTEEZT +IXCmQgKpDYysi5nt/WyvB70gu6xGYbT6PzZaf1RmcpWd1pLcdyBOppY6y7nTMZA3 +BVFfmIPSmAvtCuzZwQFFnNoKH3d6cqna+ZQJ0zvCLCSLcw0CQQD6tswNlhCIfguh +tvhw7hJB5vZPWWEzyTQl8nVdY6SbxAT8FTx0UjxsKgOiJFzAGAVoCi40oRKIHhrw +pKwHsEqTAkEA9GABbi2xqAmhPn66e0AiU8t2uv69PISBSt2tXbUAburJFj+4rYZW +71QIbSKEYceveb7wm0NP+adgZqJlxn7oawJBAOjfK4+fCIJPWWx+8Cqs5yZxae1w +HrokNBzfJSZ2bCoGm36uFvYQgHETYUaUsdX3OeZWNm7KAdWO6QUGX4fQtqMCQGXv +OgmEY+utAKZ55D2PFgKQB1me8r6wouHgr/U7kA+0Peba86TmOZMhIVaspD3JNqf4 +/pI1NMH1kF+fdAalXzsCQQCelwr9I3FWhx336CWrfAY20xbiMOWMyAhrjVrexgUD +53Y6AhSaRC725pZTgO2PQ4AjkGLIP61sZKgTrXS85KmJ -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent1.pfx b/test/fixtures/keys/agent1.pfx index 11893f48eed1c1ee9dcd754f34bb252f963dc827..f830eccead5284d4abe5be09830a64c4718287df 100644 GIT binary patch delta 2311 zcmV+i3HbJn6O9v)U4Ka1vX(|NlL7()2mpYB1@Pt%jtK{6OX+~i7q`JvBx^;GdcG@F zUJ$*Zip$=M{)_SJ1}#w;;Dvnpj?%X(T<@)9HJe!v11j?Q{!-L~)vkk4*9-{9RkpV- z!EG!ld{t}y@C49DuNK19yi8Q+0g4U+zD}7PK`e;FM@l*w8GlydN^y|^hz0h~INqNRbcx>5uU?lXo zFjk?~{azM>XuiZ#RYOlqjl%a~;Tmbk+Q79->JAaRv6w?hfUc8ydWXE4pHZ>$c z?`h@g&m>@4JWHQifksBcoFiT;+sh1q#SGWGW*Y-*a_yleYp_WRVEAu2K8ePny?!Zv z?sLB1Oyha(_=PMYky)<)TPb2(M+qw70>;4;44RB}X5dF<*u~mIaMshSN~SkL*O%B8 z;zSMGE`RHDp(%VOGt^MlMq{XA`zA90Eyh!?VGZBj0zPFZDkFQR%!jE4QPq{gzs@jB zNT$I^O;AnmVJ4^*we2?D?%`x^Kq~TUY42GQwm7YLvvZv2o&!ifg+T@r7h=>RD+rl-^^* zq-GI~GQ4kjKim8Vt^?U4#|9n7Cv~k(Fe0(>_t`XTcS)NMOv`R5uclw+i^{Y8TU zT)l_XRSkTdg78<3%t`lZ5;$@;+H~kwf%cn1eSl?{ry6$B2*n3n9HHOPLWmhH-aVme z9e+0nG}D=P4*v)3$Up|Wct{>5JOFRTYbsW^DAB86UgId}<)JqC(;c>*jA;`<$^a$U zG-7Di^grfCPe9ZJo@Ju()t}86w}QiRmBv^B--wK$Gjw(<#JJW{M?mh{T8Vu4(Bmr{ zc<~E2F@&ki=2Y{-veQAHOcmAtWZ|zPe1EV>22l;qQSqTUS_G_v@2%Ud&f(08oxY9s zr{zGP!Z|J@Ll>=2hvn-yC37)IY9R*&;NqX3mo!ou+|?AX<&VOHKIHg^Z1MI z+yjZW{Tu!M^-oUUuima7MlXKHbcG#>B{ObNnco99Qx8x>*Fa%GaK9~}pY-imX@A;- zih_59n70EEUBn_ifAw`C5z%h+FK>*Fc$T}oQ~>y4X}X2GuR^EzYVex~ADkFvI{riGBEigwrI&vpm2EO`JX>)XWm19m|~eYf3i3_eRnf z)N&Wui`7<1h;a^Ua6(Xr-j;@yyMJ$|y1tBVh`)k_8!h2nizxAEQLfpLWljHl2F**| zUvj+R#aE+GrJaOzN^}mQfIESjlO^g>Xcn-gXsu-LZh8Z0`an9g6@+zEC->0=rZ~IE z2mf@`rtC<#XLPOHr(p_QEF=5HR!vfvkKXC70zifY;Bd(WM}D`w-30LMAAgENY!nIz z!Ff9W9}x;OhR!L2=#R?iZJ4|8c%Ni1#2Y;u9ir&fs~JFMnTY(9QGy(alq+1R)4Vj# z$QY)ow{hKk%0GepY#1GC{1lJ>1`lGqNvE4?!ROcs=5laLGeIZmC0>9)M?)8~H zDk*$HUI>pgDnwsgX11iLcz*}y)t@vC^b(2EbgtrojK7aHr{(>F+AxE)o(UTNjF^*W z-Ad$?hzu0~KJ%82mTVr=x@6T<{*|^{x-&s^Qv%SH5*D~cEeKPrgg9S7Vi(vHZePPo z^;!`o8^g^7^K1j}qQBk@SI>ZbTF^<@8(C-%{ZRj z$_|rV21b8No!}L%x^xEu0tf&Ef&zeHGkrXedDweV_mN%=L>Df~2z5NdQN%yVY|ZKV zpebrrJw*}WtgRF6$_~FrF;9hc7tnD9N7-vO5F%Z>83~AES>T1^R@L^{pNnL0nAve%~N2(0qdxTe6qvX~= zrcb&vmiS_B5GD5e1EHg+Ij5;qzTOQLPoRNJJPYz;h(5nR7kv92tS-7s_wSXvPA3xT z9(wU0Y1dRa%jkf8>-0H|V&I$Qv#KY(w4(cd&r2XjD$AHnqt6Ohe!ERhSL)}c1N}u4ku?`^NF(oh~1_>&L zNQU?a%Oj}=1PGJJR%{k|G>!rS2mq_@RD=Kk delta 2311 zcmV+i3HbJn6O9v)U4IAeB*F&cpM?Sf2mpYB1@IIpkz~y`hyeqJZI7oDVM}tAD7pf> z4IM`$GZ|OViH~7GhG}jD`&Gi{8RgEIr!yJ}bpDW`<`0o>BEzOg0CW zC&ar&)`WBRFq8ebWo*U(NIv*=er%lJQ}#e?woVO2RAR$PaDT1Q=Yct2f<4!?x)f(N z7W*>F$Asvyftza~>_+3?aX{s4(cNPAidcK4>$iM(WY6j<1pGqKzBq3GVvY-AD=kSYZXAGzKBvv23MssXINn zOk)0JlOM#ND1V1%SzxxLgPdQ^N1mLB)~ihG7ky;pLjImzbM@VfUdPw$MSFNfhmYP} z<4B{zAlXIGsmRM|$q@WLvfA=u09hszd?5s%WSFl6pN%em4U_Q6$*)U!ql#fFY>C|J zoKzHS#H2IR^he@_2_pLf6R)l?O6V)|69mFP#@gO&Q-5LAW$}mzV9UPmZ))Yyei@;& z32!`Ae85eZU2->SmJoM~736Dsk5U9?$eDyfE)7-%_H_~TqKnV}cX!(S4Gb)y=SW(l z?UGO+#7L|K)Z?SNMNM>Jhf0)f01Z5Oge$RLZO?C;kGpXYImi68lz4 zqd}yGzJC)AE-ab60rUs+cJ|o7D|G0~@GxLq_IQXAfXPt@y>`*51Y&oG*w6h!ZoZ~j z+lQ4z^o}w~iS~GQ^rf;Cb3y9Iv~mN`ETM``Se8#l{)764>kOS@Bgxf6Mk zfCt^Ag0(jHsNh3HACU9Aw#RO=`Y4zcO+J?E3-;%sVFbd-jT`Bq} zO0MZP?N-d5hlqJN{-lhbq*pmGz~m_h=U&@;&!-iawQMpwWlx}2X54d5A63zRooQVK zEPuI;`WJt+;HB?4u3Y$|RJp4gHuXLw zr;n60sOo{3vpQt%ukhd}_m&>`XJt{-=6}NFv7VsG(~Se9CLc4uKX91aE#zIyrBdEB zqQcqBCzoB_Llwv*lQa>u8Cv3o zGbhFNY(|h;QENeF13Vf3fQy-_!1m2$o4a5v`R8@{8Qrm}8MU zi|~E_CUCOQ%<)x3GEm#@T;Ml+Hh*#A;vbzc>GK(;>O+Y6I^31(g{IDF<9%9%foGr%Gt4x@EmWhzL>W*Lo{3I8PSy2g@CRRnuR6tB;^um z8-NR^>Xzxv!cVo-U<7b<(@8*7>B&1Lln(cX0Buwx|E`Ky+8836TR#x*TYrmvz%VUH zP^_3;9b72z95A3U==EJ%%lCmLt}cyB%W!&>iH$rhrP|yG0k|##D!bOZ@8RjP^?MKP z5VpHfzVnxXDt5=l4!#fTM8*7jyRqX^YtGRgE=>T;dHT0@JG&dL6%1=89J$>x(dP+w z^E!Sazqzho$p-rIPWJj}wc1<3=JGLn~92#KbsJqyuq? zj$$WU34!k(w)rMH#^H_pF90L+Q_L4!QU}kM8k7B-;l4GZ&}3Ql1q|G2_n-#AI$RNy z^zsiJxrf5H?yBh;EH#_}k00!Dt*t$?kemN`jzl<|$8lAbZZ>sD#|%35IFE;F^VdFq zX^)d#21b8P6Bv;;_@OTX0tf&Ef&zdI`6tz*I%+H(H=W8vX}d%F^rO4hhrta0fp=X_ z^k;aG^%Dn-L}}Je+EUjMjMtOee`vHuUW@mZDkYjaGcHRN4X3us<vCC(db ziQ)G0v$#B(T_%i0SU%pOHI+F?JJSw`ZOEJYpG;h?bU#=Gu|crSrP@#e zNT+{2b?g*f{ULFd$MDTk4bsB5b`6@+FdcgTknfL^N_<`xou@D&4u93fS#D`k9W@#H z0@GVReArH-;>;gqOtLe#o`ZcH<6sdj1GtBo=I-T8?sB&MdM6I1z#WeyWpIUW|n`fc!O#7OMuhN_3EUj)LETUohMz&t;D9G zbj~#+S9%?k<4YBJ>Ol~NyL7_FlkG9Zu`pl~5~0+f2JA%pzh0-j$4Js7lW1W8I?*qYcdS}fQ5YA_NCe$3g!?Sh{jcng~V;3|Jg zOW+fbd$D$VZZpF^=XkcSd$7Wq_z0LJ*-`wH-^RyA@s}UMEV4@Px8VuV95OpQ(2VhN zAnt^KR89Nn5JcQB>vF0pvMG;6FhPz9L&w1Y(;02lo}H64P$-IM$zxIKdgN_4u@vBo z9VzAl>65KUD+u1`i&QI`M%FD|>kThj`rlF(oh~1_>&L zNQUp4R+9qB2dxZkmVnHKZO%I|F)$%82?hl#4g&%j1povTwb|%i h^@E<}pf9KZyD37^cf7h31PJW)O%B*uqJ;ti2mlkmbNK)O diff --git a/test/fixtures/keys/agent10-cert.pem b/test/fixtures/keys/agent10-cert.pem new file mode 100644 index 00000000000000..8aaabd3f938bea --- /dev/null +++ b/test/fixtures/keys/agent10-cert.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIICfzCCAeigAwIBAgIJAOyvM6GMZDW6MA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD +VQQGEwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMR8wHQYDVQQKDBZUaGUg +Tm9kZS5qcyBGb3VuZGF0aW9uMRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANj +YTQxHjAcBgkqhkiG9w0BCQEWD2NhNEBleGFtcGxlLm9yZzAgFw0xODExMTYxODQy +MjFaGA8yMjkyMDgzMDE4NDIyMVoweDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB +MQswCQYDVQQHDAJTRjEfMB0GA1UECgwWVGhlIE5vZGUuanMgRm91bmRhdGlvbjEQ +MA4GA1UECwwHTm9kZS5qczEcMBoGA1UEAwwTYWdlbnQxMC5leGFtcGxlLmNvbTCB +nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArV2diVumrKDS5k81MrcdECnYYVZ5 +feQ/FZDqwEHM/zlXvs6vphU3rGmZeASMQEdHg7vUjzzvE8PDqJuJXKrC5lEO1OUY +eUDhaZ/QvYS9tDp7qTJzORxT9im65dQH0Xq5JQwTy30hidQHxOgAkILNive07/Jk +N1vle6TnZX6K/dkCAwEAATANBgkqhkiG9w0BAQsFAAOBgQAAg+FpvhA6coalWxGR +acWiUbc7CJ4RWjlSeA+fhd1G00x0Hl5hjt6IAqEHe4T9fV41U05X1eo5KaN3jXWU +IS56SVX8BxOhU53lr0iID0MpxMqttA9LgjE3fc6uAjThnx1zX50VGR4P8LQqG+HL +WJUW0+3oJrOgRbJ6wAEs0iCcTg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICkzCCAfygAwIBAgIJAJHwBmNgafKbMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu +dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EyMSAwHgYJKoZIhvcNAQkB +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0Yx +HzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAOBgNVBAsMB05vZGUu +anMxDDAKBgNVBAMMA2NhNDEeMBwGCSqGSIb3DQEJARYPY2E0QGV4YW1wbGUub3Jn +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDC1M2aGVYsmrBiut1n0nfTU+9v +TNVdAmKQBjnNsv3IIch/PPaEOIEm7dFhgdk86Z+wVCN3sAKu54Bz4JDKdPsFGvDy +18JGuGH1vIVW5285IW7fMrzvAdZtETeBAiPM10Q69ddB4M6FbLiF273ZqCJ+vSsw +kl5Dkas8YTZ0uwqKjQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB +CwUAA4GBAGDMGSbPg/B4OripSxT2scXFIwoej47PW1byJgWaGoMJ8zgKUoKE7Z7A +aWQbD22In05F0kBllqpSJWEZpTuVFsyyLeb3R7cuGQWs/puaaPul7sx+PRGhwxYe +nrNIGtsaBf8TO/kb5lMiXWbhM5gZbBtbMMv3xWA4FxqU0AgfO3jM +-----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent10-csr.pem b/test/fixtures/keys/agent10-csr.pem new file mode 100644 index 00000000000000..b96e682d5bd7da --- /dev/null +++ b/test/fixtures/keys/agent10-csr.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIB3TCCAUYCAQAweDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH +DAJTRjEfMB0GA1UECgwWVGhlIE5vZGUuanMgRm91bmRhdGlvbjEQMA4GA1UECwwH +Tm9kZS5qczEcMBoGA1UEAwwTYWdlbnQxMC5leGFtcGxlLmNvbTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEArV2diVumrKDS5k81MrcdECnYYVZ5feQ/FZDqwEHM +/zlXvs6vphU3rGmZeASMQEdHg7vUjzzvE8PDqJuJXKrC5lEO1OUYeUDhaZ/QvYS9 +tDp7qTJzORxT9im65dQH0Xq5JQwTy30hidQHxOgAkILNive07/JkN1vle6TnZX6K +/dkCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBwYXNzd29yZDAN +BgkqhkiG9w0BAQsFAAOBgQBeyxGhHnFF0ifHhWUbqqMM9zJ5OhLjGsQ0gvmK/LHL +vmGJ43XgeYiN/U6xREQ7DZMss+C14mfQvp5oM0zQRWwQhLgV7YlIIIe09CYTKTfC +xxc18OJewNQUje5cG5aSMZb2HfHmLDaavAJqK0Yaoj69e+iEnAkVFVZALqlhezS+ +xQ== +-----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent10-key.pem b/test/fixtures/keys/agent10-key.pem new file mode 100644 index 00000000000000..dd589cafdf6191 --- /dev/null +++ b/test/fixtures/keys/agent10-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCtXZ2JW6asoNLmTzUytx0QKdhhVnl95D8VkOrAQcz/OVe+zq+m +FTesaZl4BIxAR0eDu9SPPO8Tw8Oom4lcqsLmUQ7U5Rh5QOFpn9C9hL20OnupMnM5 +HFP2Kbrl1AfRerklDBPLfSGJ1AfE6ACQgs2K97Tv8mQ3W+V7pOdlfor92QIDAQAB +AoGAIAjiaVVEMTXugpw0SlDH0ArLbwEZpgedGJEUr7348VhZPGrYzimxhexlbWX5 +vI7vSgpVNrqduts7tlY3RaZQKQzFkSqkUUb432bXkJLHNIspd0XHOO2Hy/ZbTg0n +OIQes7C91Z/OLUi9esXoh4AMsAoxiHoVee0dkEJt8RoywNkCQQDk39QND1rQ2eJq +Fcfj/v6fXgsHmQT16w2Ii9P5uPAeIGrGcrsCoVWrsh+wjSlYc7emGV8JINiltNhZ +fSg6ux8/AkEAwemf5LryUDCoZ68MlAYMcH+G7gtm06d+FUFpBclT3hJeXnUAdlyU +6kCvazcVTQQKDTWIS1oIBuleVmc/VWc05wJBAMVRZyq/QydtwTJ+hq+8pl5VIKMz +PECbnjZLfrv7wh/nCMcAINRarVZyIbn/aVbVpM3xb6qaA82QxTkZmvZPXtcCQFqx +pjMYrNSMrXcxDDT/Tzoeq0ES3BkKMZJHcZNfQnaPKMwM9RZm3s9hSapfrPrEdN8Q +tppnlXGGHLVUvO54wukCQBKbjspQONRZFBh9Fdeyf/rX+inBLhuMSnsY3FeBp0c6 +TAPbyuiezn7axr9kILojdjZgXK1b+MTHSEjqCpHwIvg= +-----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent10.cnf b/test/fixtures/keys/agent10.cnf new file mode 100644 index 00000000000000..7dc37fc7e3b7fb --- /dev/null +++ b/test/fixtures/keys/agent10.cnf @@ -0,0 +1,17 @@ +[ req ] +default_bits = 1024 +days = 9999 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no + +[ req_distinguished_name ] +C = US +ST = CA +L = SF +O = The Node.js Foundation +OU = Node.js +CN = agent10.example.com + +[ req_attributes ] +challengePassword = A challenge password diff --git a/test/fixtures/keys/agent10.pfx b/test/fixtures/keys/agent10.pfx new file mode 100644 index 0000000000000000000000000000000000000000..c6a5dd0386e7cf68e2b9b2aa225b83b0aa6a8efb GIT binary patch literal 3061 zcmZXWX*3j!8pmf4ld(h?yRl66F{nrgjW9{JsqBq?1|wT`g$b{H$=LTLYt}+jLfQ9S zl%2?K?279>=id9?bMA-dJm>uW=lOqnKKu|t;2jDeB_ar1M}1i=L^I@&9!LYs4gwcZ z1%dM~a5f?cl=V+UogD;e}!zf9vh zxzW&H3q(wb2wxXOyDo)OA+?1$`Bu08rJ^!;#=fZ}buOD&pqZAOT0w8&>e#PBRu040 zbCKAbXIW(B8_Yg<%Y38Ljm~981y19V?38|XYe`2G7h1D8SIkkj(K~p0>P86Z{E8BX z&U^y|%dI{9{we`n6XNZ(98?VIHJ!cE3wUHAMXG@E8Y(9{GDd&r^CorJ@k~7!rmz-Y zxgAd)ex3~d@La>s?1lPI%u#3Q-GsS6B`?sLC>{UXiM-ENv5Bpw8fxy{6J3RV01rmh z4c|2b7pdYZ{4yKUhl3|cSWDEpC4{%VGa5V~CIg@xmiP&fChw2jpqD^gXY207G^{MZN1h-2k13OT@Hb zKes23oEI4Fn(4w!$j?uR$A*I&;l~-IOxa*&|Fj;DuO!`3&g7uVJxC=_F2R1+qpYDt zFY7!f++5F236)NZy>`s5YDgszsO^yYYK+2&W{`80fDD}ZDQ8Z8_~)vJ1LmLfz2c|`P}@1OKULZmAts-n{KmZNh3A`Y-;^_QSYK3pjIRGA|{d;DtT@lZCv%flfRYfG*&kA)wJE%tnw9R;_zA0 z0)AR^^EUA)kRu9NVkKgdmMyp+~2DsgV09i7*JTDEN$iT$X9#f9fuceA@k9aYY`a!T7Le1n8k?4I?iRZ8G zYps;+Kgk%C3_8U|P%T<8X~~uCFmL&EeQm~3d(Oi~;~>{gSa_#`@Pg9XZ0KI@9jx7` ztEq0;Jt>P!Z69Upb_2Uv(GZ6dRDe6fSzK`->-2J|%vmUZ&iu!x@jm0%o9Y^Dkj$t9 z2|Ke-71iv%v_Y|GueS!)^+Q9qY9*<;U*dLyjn1--);wO%v_$(u_hfkp&>2@-=|;va z>`J=7r^6wST4|nCW9gzSKf}W=$@B)5p3P6n^!xh5%9mQG@pjbBcUj7x#Pld>3FeET z4>_DMiGup(cvT7ehu=6}`k`XvU!;tHIe3KXSh!RB-0ML=8b(S4GBaZ>?5hIRkBQTC zT}2SqH0Ju58z=KvuLb=FeKKyScEqo|ETzflrbTe6*U@5l2{QPp8CZ$05gxIxBReyF zt>+6{%|7+;(y@0^vO}Yb48FHl2RE&BH~w8mr)K~L=FO4Hz@{1onMI5g)O+P|HPjxL7&a=aEZ;(e*Pw+mh9 zM4?gP&RD`a#PNV`6lL!!F>K+!lDn53OT_Q0wGSRCx<#obe5FbpxXfgG|5&CX_k-M0LxwKIMt}rj zFsYlY)^tE3xD)}p>Qu2Jkwa5ici(1hIG_vr$L40*j4?&DE~sus`1f%x7p@4!k?yk` zQKnb^$neQg>_(^nxEdUyR``~B7n)b)6LKnP^AO&@fcOt z=D@d%C3vyzfCEXOkFU%x_&%3fd-fDPSx#^*@LNDkya)Sc`MjvmA8dS*&tV789Hdwr z5C49dC&$8KG#70je-bH2o1ng*`Np@nxqd#S=eNRMHm>qsLyMHg!KOvW;IBCyTFpN_(g zPMi=y6vzJ~BH2L{zo>#JmM`%9#Y|I!|Dz?eK#Gg7@B-%kzpd<3)*CeJhFkt^D;MW4 z71JA|_Kf?r1~h*RAJ_t7^8T9R79Y?7cjdo4?^s!Cf;G^O6a^YVgfd&a)PyaKl6hXg z{#=;B=Gv*%?^;_x#N>{m_?hTxs@^c;hcN3i`w`s$z44ls6DBpv&uQGpHRf}NH1?~m zWUo_KVOSi9ym}M6qEeOPW~2~plH}BA(x%WxeKlgq$l`YSS5^;q^m0i~Lbz zmFZH9NQ1@dk_`TA^Nn&%+ghf<0OLfd}U6J)7^v#o`{ z|5$IJz6E|u3^7AikT(mE`T}M>TaQdmqGA$G#i^bvEj|E77H^gNE$Fj7du;Qi86U43 zJH1;SsHBec8-22BM2;MAZ*=Km*8fy|-l`d$#STPg9bN}`t*)jL3p>u@E)$dM2R&mPT2$$dbh}U5pxP;^g zC(*eQI7jHwj5qZUTVYsV0lr3k*pV^W%Y1EYvz_wsW4>Jkuuk+c=@3x9cH@oz`Quh* zlr+d5f10BhTz4-zu~^kn8io-3?^j=Dm1d)2k=3U))d^?H;Cc7c9QLu2^(dNE9wCk3 zM_i`9B+fud!FdTl#Ufg_1K_T-K{qYU>>%$=I#u^VmZ?Bh^ZlnbTFKA;{_cMP&@8o{ literal 0 HcmV?d00001 diff --git a/test/fixtures/keys/agent2-cert.pem b/test/fixtures/keys/agent2-cert.pem index dba141a39e222b..12750543c327df 100644 --- a/test/fixtures/keys/agent2-cert.pem +++ b/test/fixtures/keys/agent2-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICczCCAdwCCQDoSvlN91onszANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV +MIICczCCAdwCCQCtrfdcbYDS0jANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJV UzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZKb3llbnQxEDAO BgNVBAsMB05vZGUuanMxDzANBgNVBAMMBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR -cnlAdGlueWNsb3Vkcy5vcmcwIBcNMTgwODA4MDExNjU1WhgPMjI5MjA1MjIwMTE2 -NTVaMH0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzAN +cnlAdGlueWNsb3Vkcy5vcmcwIBcNMTgxMTE2MTg0MjIxWhgPMjI5MjA4MzAxODQy +MjFaMH0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzAN BgNVBAoMBkpveWVudDEQMA4GA1UECwwHTm9kZS5qczEPMA0GA1UEAwwGYWdlbnQy MSAwHgYJKoZIhvcNAQkBFhFyeUB0aW55Y2xvdWRzLm9yZzCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEA+ANNQJCYkK2xeMpXY7P0FqQRnWm757yDXwLfeoz4IRfk -/20bdRPMIA3EIzDfIUyibq9Zdgm+sLixfv0WPRANEhLeMOdDAT4AuNDeZGu/4lTz -Hl4wsMq/FGDokIlmFeC+IBjTcNFNllr0wXT3650lEnXANaTe2qb5eqgq1RHA9MUC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQDVUwS6OhVpM8nDknHMa1g05Ly9krwMP73V -01JpCsHxlXRomptTdAob/UVDSXlZxm6OrtXHiXI3Lz9bwStg++F3hxEfhVV7YJ1c -pc7HT1GqGkesFwYH6/KE871t54oIhpVzbeuJhtAdreRXRnjRrxxD11cYPwhn/f5O -jJdQL5duew== +AQEFAAOBjQAwgYkCgYEAq2BtovcwlIUNVAi3ukbyQveZNg3VkkxB6Ih+CL70VEX3 +0ji5EpQqGjwk5Ub6tRYfuGHwBWSO8+W2PwtdplDbuIOoK5MAp+wkDRCC8H1l4i8c +dOA97Edw3nRU6MiPrUiirV1u2liHYp6YDLWix80UiNnH6EOLFd5Wy5s7CSt4rEkC +AwEAATANBgkqhkiG9w0BAQsFAAOBgQCg75WmaDjpwBmMAl/+5oK8D7p2V98ChhyV +bIwhpLPo9jf7iPW9VayxQKvV5HXuiT1vpIjuvhbRRH3wGj3by0TtI+sqECcPKu1v +5bg2e+bX8s1OXFJh+x93KCnrcFNEwOVk9VjUX+ilJdTkdcGA75N4ZO7qEV5wKl9g +658PRZl3KA== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent2-csr.pem b/test/fixtures/keys/agent2-csr.pem index 05faae06068269..02217de52bd5e4 100644 --- a/test/fixtures/keys/agent2-csr.pem +++ b/test/fixtures/keys/agent2-csr.pem @@ -2,12 +2,12 @@ MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQD DAZhZ2VudDIxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G -CSqGSIb3DQEBAQUAA4GNADCBiQKBgQD4A01AkJiQrbF4yldjs/QWpBGdabvnvINf -At96jPghF+T/bRt1E8wgDcQjMN8hTKJur1l2Cb6wuLF+/RY9EA0SEt4w50MBPgC4 -0N5ka7/iVPMeXjCwyr8UYOiQiWYV4L4gGNNw0U2WWvTBdPfrnSUSdcA1pN7apvl6 -qCrVEcD0xQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 -b3JkMA0GCSqGSIb3DQEBCwUAA4GBAHVG4Ng4xzGOWDBCj7/6LyxOdRt7E7eknkPx -BrU41OdwS4HEA4nNx3dcsvP5VmFDtLOBrUD499qPvhqW/QKBfTYwozollD/azi99 -kBpJK/mYKw9TBV34PGwgEZ/Eirg6vA/g5dE/8szIbzyWfYaRhnaFEzM9/0bAEOyI -3gr2WmL7 +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrYG2i9zCUhQ1UCLe6RvJC95k2DdWSTEHo +iH4IvvRURffSOLkSlCoaPCTlRvq1Fh+4YfAFZI7z5bY/C12mUNu4g6grkwCn7CQN +EILwfWXiLxx04D3sR3DedFToyI+tSKKtXW7aWIdinpgMtaLHzRSI2cfoQ4sV3lbL +mzsJK3isSQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBCwUAA4GBAJqJXQdhuPxsJA6O/yWt9t9lQIgoYCQyCG2w +Xl0n84f14WDi/N9rF0IfGMSVWoLDCc5gcoqKal0X/vQI4lpPiZ0hctU5cXru1Pvi +yfDbIPB0td7POf3Q3Ge3a3RHf4I4cfRuzA6jfzMlorpgQmAKL+sstC94LZZnDiNp +ihciaeK7 -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent2-key.pem b/test/fixtures/keys/agent2-key.pem index 81a8bf343651df..6aca2ed78be7c3 100644 --- a/test/fixtures/keys/agent2-key.pem +++ b/test/fixtures/keys/agent2-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQD4A01AkJiQrbF4yldjs/QWpBGdabvnvINfAt96jPghF+T/bRt1 -E8wgDcQjMN8hTKJur1l2Cb6wuLF+/RY9EA0SEt4w50MBPgC40N5ka7/iVPMeXjCw -yr8UYOiQiWYV4L4gGNNw0U2WWvTBdPfrnSUSdcA1pN7apvl6qCrVEcD0xQIDAQAB -AoGBANrNPuhJKO/q7Pldub9SUXNwB8JSN954J4Y46KQbngTEKdlWjrS5ZIqa2oEZ -aqDcFSmFNW23py4NozofWfFBKeUdeRyQvSOg7wfhf2OdmpA4ilAhHx3Qih5wSPX1 -zz5cIpkO1f/d/SacT6Arl9eD1VEbhFUrMu59gTsUwfjJbhFBAkEA/TDhVL1PxH6l -zBgNiBPv9hc3ztjJYm+a6KhiP8EBObdPBqDRm1YOo3n8VeIhfruxn2yoVpvBDjCi -fD36XcQ2mQJBAPrDtvoqtiZjfjpzTnanAZjOYmVfS0VimQdLUd164A3lMAMV9nsG -hQbtzttges16i2/NJF8hky3dsjw25WcsBw0CQArUM17/ddDupcKz6KhASgwZdB6Z -sQtPwK1gvksBwz6ns26SJETjil69kehOcqZL+s3ZxN1nbftgYyKzN+kYwkkCQQDG -tSfdfNLyAI0aDBz08MnXKFPYOHcQ+FyC5zBr7N52pFIzX8f9HOF06CSuufkVsjGj -2k8kAxr5kV+XT3jhFIZRAkEAuDOSGDCVu+0vX120jTJu4PjfeHuaeNfWjC226x9h -EQAxkDfFfKTN7dsBXqt0r0HmLZfWBVQ1svEXCkwvPuRaeg== +MIICXAIBAAKBgQCrYG2i9zCUhQ1UCLe6RvJC95k2DdWSTEHoiH4IvvRURffSOLkS +lCoaPCTlRvq1Fh+4YfAFZI7z5bY/C12mUNu4g6grkwCn7CQNEILwfWXiLxx04D3s +R3DedFToyI+tSKKtXW7aWIdinpgMtaLHzRSI2cfoQ4sV3lbLmzsJK3isSQIDAQAB +AoGAbaqNPiXUjpX+C3Jwr+FKkhQDlRWRP8dQvc7qaApaK7uCdKIbvInXz2YBbj7X +nB4GOmVhxPGukODEmN9bFFzV3NbQVcAO8iPI6ldkYCmpmwfeEA1UJnBfBC2IYVFr +0TSuq7OdniiO+FLhZvSAJXN+5yDv66nZEnojMuu1oqpG/gECQQDdxzSeNbOY2ak8 +Db2ZYKSBWjxVbW+UC8mYA7jHVpcUxlNnamcJrhg6hEfJqax6c/vAefECFsngG7yy +XVTYX6rpAkEAxdI83zQz4NqYkZmFlCElNDRF7S1Sa2eX1HzzJYlOEMx3P1iE/z4U +HOQh9py2jlY1th3GdbChF1VWMIOqGCtaYQJAJwxS/GQyKgBw5qz4rA+zBz9vDg+F +rMhih0xodViOo07EEppOaArqIyt1RFGGl8ziD6Kox5hhlP7tO25paOt3OQJBALSL +6y60EF06ZWENwxKtJa19wAx1/vEz/SjcWXZ62JsQYg2Yltn2KJktxam04hEKsb7j +cgxcBsqrAh0JLicc+kECQDmH1wTvulw3E59jqOaKEbYNQFi18zzFkIIoNRVqMhtt +zTJx8NYT9NUS3YE4OcUX0dQtVO3W+NIVrniaY8i29UM= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent3-cert.pem b/test/fixtures/keys/agent3-cert.pem index 6aaa99cc81225f..9460b44bb6abe1 100644 --- a/test/fixtures/keys/agent3-cert.pem +++ b/test/fixtures/keys/agent3-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICcDCCAdkCCQD4FZz1QNuPSzANBgkqhkiG9w0BAQUFADB6MQswCQYDVQQGEwJV +MIICcDCCAdkCCQCR8AZjYGnynDANBgkqhkiG9w0BAQsFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZKb3llbnQxEDAO BgNVBAsMB05vZGUuanMxDDAKBgNVBAMMA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA -dGlueWNsb3Vkcy5vcmcwIBcNMTgwODA4MDExNjU2WhgPMjI5MjA1MjIwMTE2NTZa +dGlueWNsb3Vkcy5vcmcwIBcNMTgxMTE2MTg0MjIxWhgPMjI5MjA4MzAxODQyMjFa MH0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNV BAoMBkpveWVudDEQMA4GA1UECwwHTm9kZS5qczEPMA0GA1UEAwwGYWdlbnQzMSAw HgYJKoZIhvcNAQkBFhFyeUB0aW55Y2xvdWRzLm9yZzCBnzANBgkqhkiG9w0BAQEF -AAOBjQAwgYkCgYEApAJcDHyQjhzkfzqJy5+U0umvbr5KUDm1EjOlsRha37w+6Hlp -VM6zBgU0KtPfSgktRbKGYefB/W5JPzHE0gm0Cwye1WceUsM+IuEMSjRNz7A8BJuc -cj/wnGJR9YUTEFJBheDPVcpo4LraTR/hWgA8zde4+LBUZhNNYRQpA80Bz9MCAwEA -ATANBgkqhkiG9w0BAQUFAAOBgQAY3g3zQlroG4AgGPSc+OJvdmE6uxS22GLP2Z2S -OZaFBsrom2GbKV9angrVLRYYyLwRrvCtSWJJ/7YWv1Yu5mB5ZS/t7U7+c/WAnZdb -XhsAlDnAwaeioA9ktNfmsB72l1I4rdiBXjanhxNCV/yvGDN83ANibIxHql+FqgBW -/K16Rg== +AAOBjQAwgYkCgYEAv+hwfSVuJfHDQOXmF2D/HsI2JZkspfrPQE/ZL1tII2cXRnus +IqWZvLg9v7IVY0gSvx5gWMHxmqqaK75McVJvO1XEzLYpa9Ddnj06xqNWl6hwLHnP +bclRi2n63Cs6zSM80r1iQ16ovZ0hyWPjXaBlWmb71QeeBp6ynxhB+yA0eZsCAwEA +ATANBgkqhkiG9w0BAQsFAAOBgQA/C2xJIYA3Vo8pr1cfmzN+os9uvbMQEAegg6W+ +6/t82tLGnrCEglMTFHFp7MJCNiKCY16Ixi5WCZoUrGCfbh+Obtd4bP/wAlR8AS67 +lYZDvjADGU4e7Aqu0o0AHeb4MiRUQbkD0EUioyD8091Qhzlrx43UtdojPvakwAXM +N/LFEw== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent3-csr.pem b/test/fixtures/keys/agent3-csr.pem index 276ae2c2f2e454..21bb06e2ea72f5 100644 --- a/test/fixtures/keys/agent3-csr.pem +++ b/test/fixtures/keys/agent3-csr.pem @@ -2,12 +2,12 @@ MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQD DAZhZ2VudDMxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G -CSqGSIb3DQEBAQUAA4GNADCBiQKBgQCkAlwMfJCOHOR/OonLn5TS6a9uvkpQObUS -M6WxGFrfvD7oeWlUzrMGBTQq099KCS1FsoZh58H9bkk/McTSCbQLDJ7VZx5Swz4i -4QxKNE3PsDwEm5xyP/CcYlH1hRMQUkGF4M9VymjgutpNH+FaADzN17j4sFRmE01h -FCkDzQHP0wIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 -b3JkMA0GCSqGSIb3DQEBCwUAA4GBAE8nEwmxEzcYwoGWz7Myjwbf+dBMPZz6xVAj -IuW+h8ITimJ6lESWgAtXtWPCj2SSp95Kwmo3Ex0kp3opEAMe+8ShglyZaVvPwVyB -d8usbQ1zD6NdrNdSmS4Zn/J9l+OfI17VZLUvacpyVLouJe0MvA30Sf0pxJKLwXKq -UlecNvEf +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/6HB9JW4l8cNA5eYXYP8ewjYlmSyl+s9A +T9kvW0gjZxdGe6wipZm8uD2/shVjSBK/HmBYwfGaqporvkxxUm87VcTMtilr0N2e +PTrGo1aXqHAsec9tyVGLafrcKzrNIzzSvWJDXqi9nSHJY+NdoGVaZvvVB54GnrKf +GEH7IDR5mwIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBCwUAA4GBAFHJUONDqOhZpGN8ZCFkWkGyD4iDPGdJyR1f +lh1N2vSf9vx663ni6lG9XQrQZXyPH8n7vvyyX1bJE5X6dAKuiD4GYlcGUUCnsvcA +r+JzSBrbtwD57bPnn21YSUl2QEoG2b+/6uPKWxKr8e1sreMxHOLwsPgSavnQ84Bc +GvSLlIcR -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent3-key.pem b/test/fixtures/keys/agent3-key.pem index 8f6057ed82e008..3470fdf4b7bab4 100644 --- a/test/fixtures/keys/agent3-key.pem +++ b/test/fixtures/keys/agent3-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQCkAlwMfJCOHOR/OonLn5TS6a9uvkpQObUSM6WxGFrfvD7oeWlU -zrMGBTQq099KCS1FsoZh58H9bkk/McTSCbQLDJ7VZx5Swz4i4QxKNE3PsDwEm5xy -P/CcYlH1hRMQUkGF4M9VymjgutpNH+FaADzN17j4sFRmE01hFCkDzQHP0wIDAQAB -AoGBAJASSo3ldo6ALvDcmWM4AeHsyeD8ZAdpSfh9ShXxkRJtKM3KqY6ILJcjRxpA -GCvPN+e71XR3w98+XDWZII5pW6/ZE/bINkO2IMDuFmIWCbadvUbleQNd7eCVk5OI -bYtZwmRI8zxC5gfEf54ukwL2agR1Hq/uENqw35OAwMnINQgRAkEAz7/ckH3xIzyM -9w3oqe3kTTB2XyBzrSPSZaelfasV5qzin78EI3X9BRQzRSe53Dx2bAxcprGhUwHj -qMd047QZ3QJBAMoZ1r+tMn8bY9Am89ZKaXtOoLIlYrXVu83ieGNA78cdJy7+hspT -b0GFPM4ZkidXR9oVDOSgWuSNddvGryDN7W8CQBriaEemlKsLre5WtXIwH+hBSkA7 -Md0JErQnAsqFdlsYqmcj0ARKw4iBubTMVEgE5wpKez7zI75bMzvnO+AvsV0CQQC9 -2vQwcIYlfheQLWeXgaQB4GV5tUE7zKN20C+EHjaieLKcpSL+4s57YK00eDUinA21 -w1yvUizQ1EtJwSY3zPwlAkAg28bieVGyYxCMcK6jaSW28DscFcUXy9EuNGWc9nu6 -VPoBbU5tgHCz3k5lcgJtODkOAREGXdU8KKUEMiC3+Mpi +MIICXAIBAAKBgQC/6HB9JW4l8cNA5eYXYP8ewjYlmSyl+s9AT9kvW0gjZxdGe6wi +pZm8uD2/shVjSBK/HmBYwfGaqporvkxxUm87VcTMtilr0N2ePTrGo1aXqHAsec9t +yVGLafrcKzrNIzzSvWJDXqi9nSHJY+NdoGVaZvvVB54GnrKfGEH7IDR5mwIDAQAB +AoGAa94V5HH2kMNskXznsPpnS/2z+7w2OXFZrvdyx0iSqruWfJqlLbBRUp9orehG +V1C6oMxNMXaJ+/qqv62uQAAq3oCPHRrN5a1fLzYKk/ixUbk0F7saNvOsmWqbSIzv +OEtsHBt3zJxEkgLFzuaFnfoBoFL7lvJYol+4QPVvxYj2exkCQQDqVRGFbhRmKBZ+ +ienF9JpUOruKEsW4lmSKP2fUAL4rH40cJEFD0OI80/WdN/34USPOEqSsFTZITvFH ++y+45PD/AkEA0acinvAAb0FLlMlhcG0LGzIwcYUWcEpPxwkioGgwGaEPLR276gHv +NvgtL7xgLi4QMKB0n48zz4W4Usww6QmbZQJBAOGIZoipXfDEfIHlcp4XwcF3lbBa +SPpTpQh55hBhdqZCg6mmKzp9/IDW7/oVPdaVIYTg5KTK9ae6cvb4hwHJNzkCQE3p +YclVAaRWzKK/b/Ga5Gy36x7UybDzPNCHyZF5Bp8PppcqnKHrFB4GfqxlwgyHW8bm +alC9pBBz7jr+3RJNWq0CQFHxhrjdhQFhYJoW8b+pqE1ryNSSSf/1yBEug6Xsqsjn +MSuyCTLXRpoS/LAdL95ENCX3ULsu/5nlpKZmy99yY2M= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent4-cert.pem b/test/fixtures/keys/agent4-cert.pem index d4b231010fafe6..d39e9d2630b1ca 100644 --- a/test/fixtures/keys/agent4-cert.pem +++ b/test/fixtures/keys/agent4-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICjjCCAfegAwIBAgIJAPgVnPVA249MMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIICjjCCAfegAwIBAgIJAJHwBmNgafKaMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EyMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTZaGA8yMjkyMDUyMjAx -MTY1NlowfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjBaGA8yMjkyMDgzMDE4 +NDIyMFowfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQDDAZhZ2Vu dDQxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3 -DQEBAQUAA4GNADCBiQKBgQC9ODycAmQFQY9TjC+2PI65Oi2qfJhvAwSBxwrTOMII -Piw/p2WxG/Nj2FVNIzMKnD8PxhSQLp9Jy+B8kInxmluAu/RYLlnTnp+RXVILn8eV -/AYbDJ/es1lYOK1O23vfwfKn8lZx7n6atBTULFdXygAmRSzm5oZ2gy/KMJ69PUnl -WwIDAQABoxcwFTATBgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOB -gQAnI7sDFf6+B9xDRZJIDM9ZRF+xZ/ZcfReyYVJRUNDZ/HltbuVHLvRdbEpf1CXw -zFl4u6Zg0pYT+pOl/C8Cg9uJJZZ88U4IziWpgoK67Y830eAKr5st64YdNFDUjBKd -t8iNbMQoppeNCdzH1LDzuVSddogho/ro6ax+4CoVAW7+9g== +DQEBAQUAA4GNADCBiQKBgQCvcVH69FzdPGCUXgwowuBz4lLAV+COzishbuyNGF5l +J6mw6eY8gizLmpxh0r6d/REnlzKRy3Uy9FdZEQZKKfeK63MxLU6BYaHX0fnqz2y1 +oCaA2eW4yeGOLaSBcjEKHIs964Ik9VKEDnioYtoObbFihRbcS6QLNajQR9ij+7hl +pQIDAQABoxcwFTATBgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQsFAAOB +gQAykzKtLG++xAfLoq2AZ3OKlEYGC4RuOCy9J75RYWNRuy18UnYl0HGSepeqQ/4c +0r+dy/SLUVKxC7e87hs7gP8UX+f9UaVM7dvqvZbZMVH+A6w2nIAcO3zwtSJlfQ8H +NJAdQl1lZ6qc97APtBlfeTMTdi/hTghqZLah21/hIE5lFw== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent4-csr.pem b/test/fixtures/keys/agent4-csr.pem index eeb06113f8299a..3e803a6a3c0d44 100644 --- a/test/fixtures/keys/agent4-csr.pem +++ b/test/fixtures/keys/agent4-csr.pem @@ -2,12 +2,12 @@ MIIB4jCCAUsCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQ8wDQYDVQQD DAZhZ2VudDQxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0G -CSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9ODycAmQFQY9TjC+2PI65Oi2qfJhvAwSB -xwrTOMIIPiw/p2WxG/Nj2FVNIzMKnD8PxhSQLp9Jy+B8kInxmluAu/RYLlnTnp+R -XVILn8eV/AYbDJ/es1lYOK1O23vfwfKn8lZx7n6atBTULFdXygAmRSzm5oZ2gy/K -MJ69PUnlWwIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 -b3JkMA0GCSqGSIb3DQEBCwUAA4GBAI4ksOnyG7so/N9HdcDCopz+7DIS7FvggS6W -eqMADvdWjmJu24wkQsO7322E8TD8ws9yyNKjalJHGic86Ugmvd7mJgv5po89Mqcz -mHTHw/6QZ/3Y9rfQgg4nk8Mx0rVgLrg+dvgbzRpQ0ybK+/btCwI5iCNYR/tx1pns -W0afkoLM +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvcVH69FzdPGCUXgwowuBz4lLAV+COzish +buyNGF5lJ6mw6eY8gizLmpxh0r6d/REnlzKRy3Uy9FdZEQZKKfeK63MxLU6BYaHX +0fnqz2y1oCaA2eW4yeGOLaSBcjEKHIs964Ik9VKEDnioYtoObbFihRbcS6QLNajQ +R9ij+7hlpQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3 +b3JkMA0GCSqGSIb3DQEBCwUAA4GBAJ4tZ0hFXYqGQ0BDpcI6QIjufzoFHXMHBmE0 +wHU1f8jVM2v9Df5eInArMvAVya4gXtuZnMpRZKNrcbnwPUK9spwIzHxPyw7qjeCP +SG+TusJoFFIGgpZBo6zVdtpRCRbTxNfKteK+y34g+sYZolt88AmlzY8H2QYeQabI +1SBuLdBH -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent4-key.pem b/test/fixtures/keys/agent4-key.pem index a0c6bc9242c985..1e9a8b8d2ed911 100644 --- a/test/fixtures/keys/agent4-key.pem +++ b/test/fixtures/keys/agent4-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICWwIBAAKBgQC9ODycAmQFQY9TjC+2PI65Oi2qfJhvAwSBxwrTOMIIPiw/p2Wx -G/Nj2FVNIzMKnD8PxhSQLp9Jy+B8kInxmluAu/RYLlnTnp+RXVILn8eV/AYbDJ/e -s1lYOK1O23vfwfKn8lZx7n6atBTULFdXygAmRSzm5oZ2gy/KMJ69PUnlWwIDAQAB -AoGAUDom4JLW66+XYHogxKi6buiu8gkv7GmgIJJPEa2P/0S1KCwGnuhV8vCHglQ5 -UPdceYinsVZDLVvnC4mRI0IqJxlbZ383EmDGJU6K6gn0pLVM+VBcqQKG32y9GtXu -eBBchRi/tFDiCWRkBETz4O3UDKJsr9ZvsxmlrmwypURnBmkCQQDhDeSBTfbErLRY -rICMZZqXWK+Kg/oRX78sQCnOvehQCwRU/jCjbtSiKhs/FVJWNC5CRpCMQ5rpbWYc -jguSpwtlAkEA1zzvYbKaLcEFRbmOwLyC70CQOll/IcviOKcd0TlBE4pfTrIZW+GW -MhNTsf1bu/ZAfo/mKluuhxiPFeOEx9kBvwJBALPXmTmnJsJFzJxrxRHsg5vb9/M1 -wdiubaOb5ozaf1GvbBfLROzlPTAVe85uaGyQqEK4Bvy/bYSJsqaw8BiSOm0CQEOr -3+OKoNjzz/GNFqnYWx5X4UDHNKZukNCZElHeu2wmXDLE4h42Pd++ndjfPIFLOhnQ -ql/09Vl6Sjpqjyu6OccCP3TqpfqihkMkysTbC529Mh7h2okjWdkcHp9LNDn0EQj3 -BAkB5XEgSLxiqAsao37HDp/Dflhgv6ZL5em0E5bAaQ== +MIICXQIBAAKBgQCvcVH69FzdPGCUXgwowuBz4lLAV+COzishbuyNGF5lJ6mw6eY8 +gizLmpxh0r6d/REnlzKRy3Uy9FdZEQZKKfeK63MxLU6BYaHX0fnqz2y1oCaA2eW4 +yeGOLaSBcjEKHIs964Ik9VKEDnioYtoObbFihRbcS6QLNajQR9ij+7hlpQIDAQAB +AoGASgLVIbf6gP4ahByUppFnXJuqayfnPHcu7MC9m9we3i94P4C8tuP3f8Dunbno +3f9HQFthYu3guCkpvBIZhCnmGgrge/Rm5IYN9Jktc8gTSQ0NlJbr3hjgHEkJXhca +6zE/sFEgZVWF/yCIunyU3umbWBJE9R+suk+mpe1wZ9T+AXUCQQDU208b7AvW9Yoo +8SomHE5B1FJOwnyEWHBJ9W0myGXOrJbf6zNJ4eOLQsn1UWSsI9tzgeh49f6smc7B +bhWhHqoLAkEA0wCs6zyKs0pbzGfGYQFafDbjSUBbT+nn4tXR+3O7Z8K6x3gt7DBx +VtlbJtfBBWCCrIgYsrU3TUwtweDV6umtDwJBAJN7tU+SeQ2jKex+VQb8+9gu5iy+ +IwqMQJluHQgPOENAYHWcAPiDNGdMiqSYldmUKrzY2RvezmwHUjPCM+hkV8sCQQCF +MQL2RrQi8sg5ojQmXa1ZhWg5gAdjzXnTxTcUa/ybRd+TNDiAxB93PCL+xOiR1VcH +Q62beSqcf37OyHcgHztfAkAEHZwjVSRXFELBQDPzespHXVC3rwpQlbd1tqOybmPd +tpqmlWjvFxdvEDQZnemPUCtXNhMOaXcSOeeSYcUkIVX6 -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent5-cert.pem b/test/fixtures/keys/agent5-cert.pem index 2ae70a9788cdab..31e95265ff0470 100644 --- a/test/fixtures/keys/agent5-cert.pem +++ b/test/fixtures/keys/agent5-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIIChTCCAe6gAwIBAgIJAPgVnPVA249NMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIIChTCCAe6gAwIBAgIJAJHwBmNgafKdMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EyMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTZaGA8yMjkyMDUyMjAx -MTY1NlowdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREwDwYDVQQK +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREwDwYDVQQK DAhUcmVzb3JpdDEWMBQGA1UEAwwNw4Fkw6FtIExpcHBhaTEnMCUGCSqGSIb3DQEJ ARYYYWRhbS5saXBwYWlAdHJlc29yaXQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQClldd/5IKiKBpRdTuJbkYpfM8ksSRn6kaDrmDXgnywjEZweBieQf4N -T6KrnIVowtW+aDAigYKxFupdhKdzzSTLoQkxKxXzdeiIYjaL39SMtCBCQeziJ+0d -yEVUnA23qySJkkQwAZgH6O09XOfxoaDwoXD5/exPAv341wN52GITxwIDAQABoxcw -FTATBgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAYTgQziema -Qm593zYGZ5xjQdRl5+cgA6hVAQ6SMDLFqxsPaLd+YumJhlZ2IqBrRT+mjXjS94Rh -S8wCD2xZ8f4XRiE61Sc+K4xkY0ezaNMkc+iVw40aYX6nqoiNimGzk/k/2r9q5SGa -MXzu74XMo0fyCKW2yAdiecQZMWvkadgwzQ== +ADCBiQKBgQCksphKSkbE4aCa68r2o7j2xWbxbWP+bjAGwWWYQwnacQ6p5tlhaN10 +ebDAmPVakLo8xxPEXMqWFxCU2AWg0Wtd6TgqIQtIMNXQz6cif5Ufxo3lhus+dLhs +flz+yTpFD5vREvn0kQ9ce+jVjVzh8bK5qfpaNlaIqQc64WpJKQe+8QIDAQABoxcw +FTATBgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQsFAAOBgQAYcJ8LyVUB +5GNqnVdJW4dndeUvllYW3txxuUXhcxgvT7b0glDXSp/cRq0yxZb1jRCLqESsHer0 +o064S5GCWCktZWwbDo75YFE2Vo1R8TChhmD1txFcAi2J161yn9QVoHVbOhyyIHXz +Yw9zhrnJURZA+1lUpIarcRmkUsbSR25gyg== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent5-csr.pem b/test/fixtures/keys/agent5-csr.pem index 32424ab7239d7d..6d670ffd8c7302 100644 --- a/test/fixtures/keys/agent5-csr.pem +++ b/test/fixtures/keys/agent5-csr.pem @@ -2,11 +2,11 @@ MIIB2TCCAUICAQAwdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREw DwYDVQQKDAhUcmVzb3JpdDEWMBQGA1UEAwwNw4Fkw6FtIExpcHBhaTEnMCUGCSqG SIb3DQEJARYYYWRhbS5saXBwYWlAdHJlc29yaXQuY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQClldd/5IKiKBpRdTuJbkYpfM8ksSRn6kaDrmDXgnywjEZw -eBieQf4NT6KrnIVowtW+aDAigYKxFupdhKdzzSTLoQkxKxXzdeiIYjaL39SMtCBC -QeziJ+0dyEVUnA23qySJkkQwAZgH6O09XOfxoaDwoXD5/exPAv341wN52GITxwID +AQUAA4GNADCBiQKBgQCksphKSkbE4aCa68r2o7j2xWbxbWP+bjAGwWWYQwnacQ6p +5tlhaN10ebDAmPVakLo8xxPEXMqWFxCU2AWg0Wtd6TgqIQtIMNXQz6cif5Ufxo3l +hus+dLhsflz+yTpFD5vREvn0kQ9ce+jVjVzh8bK5qfpaNlaIqQc64WpJKQe+8QID AQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3b3JkMA0GCSqG -SIb3DQEBCwUAA4GBAJegSKpkqj2SlIyWOF1Km2YcAmW8sPlBsAVbP6Ymui6e63PM -u4wnufVABUEAYomBXQYx1WVdnPOFw1as/buRrGGvbqQZm15LpjKE0JfuXo9fliqh -f+TXRrTBkvIqhK+2nBQRGmxuZQ+6xFUwT3JRFxBzLhJuSLy7Xfhl+QFlq7HB +SIb3DQEBCwUAA4GBABmDywVdbouxznVhI5cnTB2cZTGKMDYCnYx+0pFOZw6ux1eR +oUF59E/QCIfibOI6b1+Dd7O3hK81aCQxd6oBiWWg8gyCjFcoCVqOkR/Ug176asZv +72+l6pBLYoZlmPrQXkxtfL+FtLM3/xLdt6hDSZEWyznWcraanDqKx9M4NEgG -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent5-key.pem b/test/fixtures/keys/agent5-key.pem index 07e358546ffa42..5de95c20b98020 100644 --- a/test/fixtures/keys/agent5-key.pem +++ b/test/fixtures/keys/agent5-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQClldd/5IKiKBpRdTuJbkYpfM8ksSRn6kaDrmDXgnywjEZweBie -Qf4NT6KrnIVowtW+aDAigYKxFupdhKdzzSTLoQkxKxXzdeiIYjaL39SMtCBCQezi -J+0dyEVUnA23qySJkkQwAZgH6O09XOfxoaDwoXD5/exPAv341wN52GITxwIDAQAB -AoGBAJj3rwggEqo4v+9mjKSuMbTb7wSnfMlevNujOSV+DzCNtfjqiVuR/V9QpSdC -RmB8NTdcSrNlz1VHpSTVilhJOGZEJO0FMVPzEj3SHpYltfn6nULIhHCWnw1w1/1L -HG6KpBqphGWD88VZrIrFYJqsqZ4dYJmo4wSuEWlNEY89IT4ZAkEA2QJS3nIetck1 -WDse+AcUxA5xu/cm2RKYMHCVtXFnLKM2LQBlHw1XKiDq4vnuOJcBdTplCHfurxzr -H3QYiQxIGwJBAMNWM23i6w24nN6bAQvT+0cfdCRjfOAdA18a8NePBIBFGXFWLoNU -ZX/B44pTbVJ3ZD193TQD34JT5CDx8EcTNcUCQEUvZngg7gWK1oUApEjzCP3QlRYW -H76JHRgkbLZiJ0Cl8Dm8rICP4kA+KmSexgIosoBLU7a1ddVCZPusKb5Xug0CQAc8 -nlMn4QV1HXqxy2wgwmJ0K91dQjcbXBCd8uZJiiUmajbktnxvGAOPr1pklNxFSBVv -IE7ZBeLSMNV3oStA7vECQD9fJpLUpakpuZn8k6/YI9KMeN6EvS3QEPPSzCZQV4A/ -BEgBKV4hPdIC7CkTzYmjIjSZMOYydx6dZZHu7+2SIhg= +MIICXAIBAAKBgQCksphKSkbE4aCa68r2o7j2xWbxbWP+bjAGwWWYQwnacQ6p5tlh +aN10ebDAmPVakLo8xxPEXMqWFxCU2AWg0Wtd6TgqIQtIMNXQz6cif5Ufxo3lhus+ +dLhsflz+yTpFD5vREvn0kQ9ce+jVjVzh8bK5qfpaNlaIqQc64WpJKQe+8QIDAQAB +AoGASLj7ecI2YXTnP8DiC+nbIEul2vDceFobJsB6pbLkROoq+WaPke2F64pYO5LO +s8C4G2IkHk6CvadNkQuZ4JrX9xgNdxWRHGAbDedEFnN8gi0inHQjHITj62Il9civ +JB8cR5fJxzAKZS23elrocrzU6lU90V4gm4VUUJ6dQhZYO2ECQQDYoC6r+Qf9YCNU +89/RnGdUzL26l1S/GmUw5VfIDorMNbwH1xfg6Z8MukF42Q9kZQdtoh+HVLG7Ljok +2cLmmBA9AkEAwqIlSsiGSjfJlzQoDi13X2ZgVp6/nicKan1eKCPq+EnWhA5CP1u1 +5WaYBbLjlDl7A7VA7gMd19tSNGHzRQRAxQJBAJe4kRe3wsXOqNBeQnuf7Kty/suK +JDv4s7jsWG/w53uhgwGGv92yIsiaRzLp7CLns60wqJ5zTkwIU4bt0dkJ1g0CQD9D +YQe7whqho37oTxS8po51wl6lXvdTDUmr0k0Nz7RAm990mwfpEWitPkCr8tkdDeUY +pzA2Bx9AhKnOJLqMNVkCQAwJYI4fS7Mec2f2Kv5SInxjMeasGivzDxe99EyLS8jz +dWfNwtCGA+gmpqcWqpT/JNnJgG4ljseW7Xk6YogngVU= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent6-cert.pem b/test/fixtures/keys/agent6-cert.pem index f47b6bf28bad67..18ded35c1f3f04 100644 --- a/test/fixtures/keys/agent6-cert.pem +++ b/test/fixtures/keys/agent6-cert.pem @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIICbDCCAdWgAwIBAgIJAOmH20toP0GBMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIICbDCCAdWgAwIBAgIJANAIL0WLbvvoMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EzMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTdaGA8yMjkyMDUyMjAx -MTY1N1owdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREwDwYDVQQK +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREwDwYDVQQK DAhUcmVzb3JpdDEWMBQGA1UEAwwNw4Fkw6FtIExpcHBhaTEnMCUGCSqGSIb3DQEJ ARYYYWRhbS5saXBwYWlAdHJlc29yaXQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQClbVjopeoE3BHAf9O/zO5DyQvpNfRBB4QMnaUVhsfu0arp7YKMYS1v -i+HjIP60m/6uaXpgWQPGJIAcO8V1fGq49U4/XgLmsgmSeaSjd5XzutDYVJRHFQVu -Mr9oKKf/1cCfCqJzeUDirC5snz+rauzLlD6dqS1293v/1naCC+akMQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAKFx8usWox9ncOq+h3KPjXH1y6m7ceKHs3zUj1UiSmVp -+E2cFQX9Azceqouf+m8At2e6Ki8JezY66JmZvh0vEUDg7RxIcQf9IRaPADub+MKp -UtAeaIgAQMbRl2dEiSrfjPoOBoqNy3R1eIfrDEyDsiPpqJALbUxfA/S0Ly7JMQIC +ADCBiQKBgQDBIF2kWViZb+GpjUKfQ2Jevk68mLWXib66z6vCi+mjpcvZeq6A5Z0M +qNJYftEgSykluxL9EkpRqWr6qCDsSrpazMHG2HB+yip8/lfLWCv/xGAHh9+4XY3s +UPGIGg+LmvhRCZvgxARxY2uG7AB+WZVMby4TCyAFAT7D/ri4L8iZZwIDAQABMA0G +CSqGSIb3DQEBCwUAA4GBAFU3MAVxVCmsaoNxr0y+KK/n0iEAzsOH9r0L3PL2gJtl +p62iOaOPw1/9x8c77RA6z/nXPX9IyAwASv0n8FEdxuIF2+KqFG6bXw5nyfgPIszr +U7YSV2Pi/Heinr76RrI6aWGtvEuD56Qt3Ce5TYiMnzAWtqEcPLGjgsx0MAv+m48B -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- -MIIChDCCAe2gAwIBAgIJAPrVDMagf1FtMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIIChDCCAe2gAwIBAgIJAOzJuFYnDamnMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTdaGA8yMjkyMDUyMjAx -MTY1N1owejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTMx IDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDIVigurX3u6qjhxxWERDRINbd8jc9VD1GD1T5SCt1oBjeK -qyUSEV4f6KFvHuh3oKjmiJy4OvuiNMkzNxI3v32yoJHkQUchB4tlBVLec4gz+ZfO -9RpM10gPBes9nSh6LUx4myZ8Rpungw0UcZaGvrwPNZYbFWvCqUSuea4GVF20fwID -AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACbwa28NeiUG -mqw14fpmT/ZDpc/BAR8gKO8OutMZO5oKjlFjplhujFlie3Zza/hxIlztF8IdYCE/ -/BZruPB+ed9ls5I7ODH1dFw8YAhxsa4y/lNP7Cq721SH49oFZJslqj1PYmhy1q4m -XrNdd447SPkWlB1D1s9NYINmqzNEsJyU +AQUAA4GNADCBiQKBgQCZ9fF/1UcYaurFIX0QIyAJdojn9+bfsTcjEIoGbsAnQLz2 +bsZ4pqRNhZbYJApxqc+oDzZOqJOaxe8mlB5jUZ/sUA9Sp+wfWly95tkEHBMSse4x +UNJVM4vFPfOG4fv9fYGH3pcmAU1QnST4Fh+qZRzrh9wa99ltmB/U2mJEF6NriwID +AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAM3CFiDdGEcx +07J6pm4zGX399VxPr50PID110jmX7BRAfqva+wBRhwweSxZ/QRcKe1v/FK3GE87y +RbaXhFfnPRUHoUHQMtGwmZuZcdK65Pim9RPGb7qrEJ2wlPt/C1Q6VjL/fBGqjtJM +Bq/2GR2GoBsE85jGM287hcvXV0eG5OwM -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent6-csr.pem b/test/fixtures/keys/agent6-csr.pem index d19b5e31c9d5de..af864a617e9756 100644 --- a/test/fixtures/keys/agent6-csr.pem +++ b/test/fixtures/keys/agent6-csr.pem @@ -2,11 +2,11 @@ MIIB2TCCAUICAQAwdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREw DwYDVQQKDAhUcmVzb3JpdDEWMBQGA1UEAwwNw4Fkw6FtIExpcHBhaTEnMCUGCSqG SIb3DQEJARYYYWRhbS5saXBwYWlAdHJlc29yaXQuY29tMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQClbVjopeoE3BHAf9O/zO5DyQvpNfRBB4QMnaUVhsfu0arp -7YKMYS1vi+HjIP60m/6uaXpgWQPGJIAcO8V1fGq49U4/XgLmsgmSeaSjd5XzutDY -VJRHFQVuMr9oKKf/1cCfCqJzeUDirC5snz+rauzLlD6dqS1293v/1naCC+akMQID +AQUAA4GNADCBiQKBgQDBIF2kWViZb+GpjUKfQ2Jevk68mLWXib66z6vCi+mjpcvZ +eq6A5Z0MqNJYftEgSykluxL9EkpRqWr6qCDsSrpazMHG2HB+yip8/lfLWCv/xGAH +h9+4XY3sUPGIGg+LmvhRCZvgxARxY2uG7AB+WZVMby4TCyAFAT7D/ri4L8iZZwID AQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3b3JkMA0GCSqG -SIb3DQEBCwUAA4GBAAQVVx4gJtdNpKrVpQ90Vu/nj/43Q4p/c2KdKlwzhkvcBp5X -5oJQdU/z9OJTRJIz3U3utDsmsNwPIaeSomPISr1OgmKfroytr36AkUmpeqGjK7Cx -ywkk2iENiiddS8eECmaYXO9iCwDelDMksFUrE8sEWYUwCjfuHMISiirmz5Dq +SIb3DQEBCwUAA4GBAAX9mbfgDULEA541c1teuG+eW0KLghFaaotFb0+R6WD1ZQLO +Url8y1iz6T/qqfuoAWu5OA8/7sKDdta/0mzV6UoGnDOcnWnH5FURmnQPUS/hBJ6A +mJBslJx6y0z4Rl/fxJUy5K31YbeRHHLEneM211usTv8QguAD0y2BNAQ0Mno0 -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent6-key.pem b/test/fixtures/keys/agent6-key.pem index 898457f0ce6cb4..0a2f2fae4f0c32 100644 --- a/test/fixtures/keys/agent6-key.pem +++ b/test/fixtures/keys/agent6-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICWwIBAAKBgQClbVjopeoE3BHAf9O/zO5DyQvpNfRBB4QMnaUVhsfu0arp7YKM -YS1vi+HjIP60m/6uaXpgWQPGJIAcO8V1fGq49U4/XgLmsgmSeaSjd5XzutDYVJRH -FQVuMr9oKKf/1cCfCqJzeUDirC5snz+rauzLlD6dqS1293v/1naCC+akMQIDAQAB -AoGAGfA/VJtPSlvHXMuuRBC5+172wyZ2mgu3pNLDI9DyYHv3tJ5NLf2+xhLE5Hwz -89XR5T8ctSa/9L2caNDmcTmE8iLLAquhc/ZrxVGrL3RvL4CSur2X+7BF5i4QESrr -V50B23PlocoPyfhaZ+f/2HXm1i8JWZeHz/l7ky8e7+GQ58ECQQDXNDvF2cfGfG/c -AiIuawr9uH55IPeii7hw6qmDpJ2haas7jGJ56rAU15Xb9dKDm6prNKaFyeHK9YLl -olQmT2x1AkEAxMl17Sih9mt1yZFWWKWt2gmetQR3zITox1r98ocoMxtzN5d4JHd6 -1WleBvTvLnv6DQyKZgUHCo5YANHQA6pRTQJAXUlmM8DQ6cidULiYCpkaPZvRLz7M -OejpPgFrFAay0fqVYI3dTk4eoBpH+v6Xj7dV63z6RnqZ5zn/0P1KDwVU1QJAWhVj -X5KXOggNXp2iqmgFwudeeL033i8FpKUZ1Vlb5LFvOAal4AO1/lYCzip4B46HdEvG -W1d31rQ8wvtJPzRLjQJAfhQXhlqngx7oUAdaz1Dy4AXyv6+khAXqq7aoQPq+Df+l -buwTlQkUTyHdPXha6eUnpnKhD14omo8f3OY/1RdOsw== +MIICXAIBAAKBgQDBIF2kWViZb+GpjUKfQ2Jevk68mLWXib66z6vCi+mjpcvZeq6A +5Z0MqNJYftEgSykluxL9EkpRqWr6qCDsSrpazMHG2HB+yip8/lfLWCv/xGAHh9+4 +XY3sUPGIGg+LmvhRCZvgxARxY2uG7AB+WZVMby4TCyAFAT7D/ri4L8iZZwIDAQAB +AoGAIfEMRBwnxB+zq1bWRKNVII2VzPORxqZAzRg+eZyZXVeAMiKrlJ/GMDljboYr +Pt+2xZjRR4T1ZtC9qnvt/VlM0uWTEIgyzo29ZO0Bd9yMnIF2EUlzVtW07UnN6+VW +z1/RxOgBiAvkrSTgN4SOQJJIgOZYAt2Xhrkz/0CLwEOis1ECQQD+1hQkEYwvNH6Y +qUVoWvlNg0Q4kozNQCrwUrkHCtIOxCmr/KxcwcPBaVmEypcCnwf78KbgUQ/5oIgZ +OReuNcWjAkEAwgIk38VZRxSyBP1RThbKrK5h+GIwkEO7RW7lZ9yoVKhV6YDMWof0 +xCl23YwdpflaTUHuBVOYa3EPegkOGCfxbQJAdCTDpzCsMHN/Yzp6nLYhu3chJ5t7 +OqyNJVy+YXxIAlzbFTyind/dxQ+rsf7XVmV+sQ+cLs4jNsU4Yi6IIWj2ewJBAKRH +OH4bF9vulEdRUTV0ay4Jg3/VdRXTpJHIs4xc9lSpLgZJP8Ew+nvYOISlDr3qBSMC +PtBX1uqzk81cOYkO2YkCQBUVMew70XetUXgh/2KOWyG/87uYy/s/NZ/LGImvo+tq +FUapBPapob9I7WA6gRYVseiE+mSGPAciGIFg/d6iyxI= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent6.pfx b/test/fixtures/keys/agent6.pfx new file mode 100644 index 0000000000000000000000000000000000000000..1f1d827dc9336527049a6d1722b27d2016ae4476 GIT binary patch literal 3029 zcmZXWXEYm(8plOb#EiXSmLgWvo~3phG_*$4CN{B0DT3Ox6}w7}s#T?CX+^bowRWvq zsTgVOJ*(Gy&b{}&=iCp^dCvL$&-4HEeE7jIG$Z7ID=-XA4h0DM*x>OI9e@&0jG;*c zVrb$naWo7=74=UgTaS*fW1ff*|u zid4=i4F{{hOEon6Z3OzXMa$*S(-$aAjMJniy;3uY?2lnWBNuHJN?7-*$gb3M=1?bl zb4KD1*Uhdhc`k*x7W`XkL=G9dU60b9);yp2Q&4`^>Jy#{^p#*BNm-fq*cjB>=X-+B zwSG0#w%POhF5@$`&w0TXPW5RIL)JMWDfY@nY!f;;ZGn5n;LLiIhoL#{)(0fmdSSH(5zSsH3NFy%@+KywJ z>+%}=6Oyt8o1eW|bG0NV`Baex*7lvp7Q9K8W{bVqBzmS824zf}uV?Q*e%02b2HHz= zblhZp4Lg1;m^I%W%UP1DuxItfEOaMIS}IcSP1{>-lLJDEOK=&zasTP&)sQ1&%m=8L z;nh!fKOo%svT7qYt5k5-5Ku|$c+&H`RQV^ds9&i!!Sn4vhk6w|KvILr#D4XsJ_n=*9t+zq#tj+m_*F&ms{EyvD*D zojeM%iUIAW=Mc2smyCkRB&3AaZbN$`PMzb%_yrdOt;y1A=Zw=)FiDs;)2$!^;_E?TUepDjya+|Um{YR>^wARC zP18~)y?4gnB_LV!^{Gkvcc8+dXr^JGt-0p{(zT7U11`{O*+Ej$$Br&MsvEE(ay#i8 zYi7tCvmAe^WT*a^9G15-m_jWPebe(j(ThmuiL6iGZvDuZ+^w5K%2HiS4I&uWLf{Gh zrIeW+4+rNB#RKDy=2y8p6x0_Tv9l3o+dEOroVP{J4U@7+Z_#_2a$APB3a4#{AD@eN zn?l`}HGeGkN#*gO(`cDFWw)6=8y;i*mfCyS?V7r#8WFq}#Kxq?tH}D&QKsV`PQ4PK zve<;%tq&MqNjgX%Gb?>4&1O_g98tQ->5;hU%Br|;#uwiCJFnLWYd^lSD!jaHC1dAp ze!49_mtZ<2sWv9bY^?w6P#&_)$(75l(QT;iXJ+)?$mG$VwUntk3rko0wd7ltUqSVf zMT~K$W3RQZN|pAfBt&L;4p~9rAK?k+ho5eO{3@#(xIEJUCt+FqwYZ;{ zIIj%?>PsgA#46Ca$>a`QAQ~2%Wc^tHNOlm>o$1rymaq-#J%@wT!A2^jxT2?;i@{5z)`|s zIo0l~NU%^U0@X0yJG!n>1J0^IP)o&sjB)hg?@fn6)n&Y3r9_G#i_xas^jfZ<3;p`a z%k`lEzCqS!5uk;uA0sN>+dr`vNN@!HQWcuzP0E69 z2{hqO&^oCFNUoddzyy4Y;cEYsu$vM_ech@pgFTL3JO3AeYcsk}`FY|OS)8H~KF{5Undqd!;*Y$}!jIZJQr#dc6voMqyax--rh$tXRsxJ03$r zAOVU#?m8le?@HJT++>?COu$%k|M33ukVFQ87<5XAX7aE;2_L;iL01WX?wZq3c=r}Q zwl1yN1R=+>mu{;myGcX+mY7IaOqP(%6Dtd&21M0A&HNKHr71-Iv+b6Pi3Q<^;vk>W z=uQ}K3_(PfKXM_mr-J9V3>aJ1;CY%WKN?E9$GZhC`9v~Gc?uf1TCSN!^NW>~GkPa<#S zBeX2}Ak%P^cA9|DK4na?!tbr5f_iFssUJ~Dee&#?#VWg zAFudWWiEVL z+R9XPG`iHH44f;WoK&Q=a3%yJs$SWklG(w-dC#FkhNJDuBvVOg<~^(Va{X#IrQxFKIgO@nL|Vh>S9hWn2fb9>X^m1%Gm`6AzK z8GTzZsYXO5jhmfO@Bs8u;O$v)zLA$2)@;wy)jF2n!^4361vt^GUVie#&1FJX7{eD^ zxEybHA!Dt=ub7R zZ|bTlFd57a0G)%<3F(_hh0%$?gxT3ffv!mT9*n-5scJ+9Lu*1H9zR2rm83Xb+%NYWZ& z>I@6sGSXw)@_UrQbfR=J0wI2u=2qyMQ6c^lRSFof`)#o)wPSauif>{EdFwvg=fe+Xu_vs!SxTjmFN;gMR-#=&J#48H(yg8 z6!r)fYe?EN?%=rYK{ncBraOO3AjLvCa=6}s*Of)kcpWZ58DZG9|9&-yRfY}7GAn2F zBlW@9loBSdCbcHiDfI5UcQ6^401QNNRh<3`IoDM(Aj^kwij&EX@21Yb$?32hs80v@ TNf{s&y?6%NjQ51~@9+K>A5NA- literal 0 HcmV?d00001 diff --git a/test/fixtures/keys/agent7-cert.pem b/test/fixtures/keys/agent7-cert.pem index 6a26fd45f2e5c5..98d3f6210cdd51 100644 --- a/test/fixtures/keys/agent7-cert.pem +++ b/test/fixtures/keys/agent7-cert.pem @@ -1,19 +1,19 @@ -----BEGIN CERTIFICATE----- -MIIDEjCCAfqgAwIBAgIJAL1FQTepkhMPMA0GCSqGSIb3DQEBBQUAMDIxCzAJBgNV +MIIDEjCCAfqgAwIBAgIJAJ4TtCDh9ccYMA0GCSqGSIb3DQEBCwUAMDIxCzAJBgNV BAYTAkNOMQ4wDAYDVQQKDAVDTk5JQzETMBEGA1UEAwwKQ05OSUMgUk9PVDAgFw0x -ODA4MDgwMTE2NThaGA8yMjkyMDUyMjAxMTY1OFowXTELMAkGA1UEBhMCVVMxCzAJ +ODExMTYxODQyMjFaGA8yMjkyMDgzMDE4NDIyMVowXTELMAkGA1UEBhMCVVMxCzAJ BgNVBAgMAkNBMQswCQYDVQQHDAJTRjENMAsGA1UECgwESU9KUzERMA8GA1UECwwI aW9qcy5vcmcxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBALCm7Zzcl94OLdlf5kL64gZNJby8pnR/rODqM90iHBqQ3wNe -645i/icRk2D89kOSFIJfPuyYBNxsslE10p1Z/+1SeptK6bf2G4BfDbAiEhkoGNfz -gqj+CsvmCePlN0wKt5Dvr3ePc2ZzD+RPMe2nyPYaJzen3eG3gtxNcJjUNu5q8UmR -acPXexRctxkGMknZwIQffZbw8imbXCx7UAqxsdbvqM5y3xYFhAEkoaavVYNbXdu+ -LxKiIpRSqqPRwMiKieI0gvMtGJ17VFyrQxReB1rRtG/FQyFc1KdnTLbMbpJ14I23 -uhe211TTfgXIdHJo5GWlvb8GH+jplPfvFIA+tzkCAwEAATANBgkqhkiG9w0BAQUF -AAOCAQEAD+viY75WLCyN6U9VMYUT9K6AH3rEAMtxS5XgMUnXGDqz17BF88gDc+Rw -qhDQBOdWSNgo7xYfAtYk8KYy2THo0tDoIT1lE1hUvK63kwY/HivKZD+/A8vQgWyM -m/b6mX7fEHNf9UrqdU8IiUJy6Gayd2ZUeYW1xOm4hebdEy8/SE5rvlodePbfwrQe -V/kAUN/SBjWsk1oYnAk/MYV03p5JbfqpYiVM3/wO63SS9Kos2JfoSLYT5/iUBLG7 -TaEToJFSoA1+UCL/1v2hbWcCRHZrku55a6MSyAUxuCoTWCFHWWnKyC9iBBk7zApI -3zGymgVX6g21j3iVo97G07oAMIHjsw== +ggEPADCCAQoCggEBAM2+DkRxPeRGI4JK0YpuaqCJkNswMYMyZM4VQYyn99SL7xS8 +lB9P0vIm+K1P4198WXwUHSykWRcyy54nMNpq+9Dfy8BalHRaUa8BO/7UQgipRGi0 +HidDk/bAuNNHNIzJr2sGYGHsZuHkO9inEqDcqrSlTc0G0zyLry5LekRZRTgAlXpl +C9PsAZl0J+gGA83rUhdD/RDjaT4ldqjLKycHvcMLCIS6Wq0TszYCUdbvMsageDcQ +zQerIJkHzfJFGYCetQR5/fiIKyF1bICKD22AnpLlfhdthAhLVlYQn34IlYJwdptq +2miktcqvBw4rnBhE1ONj8DqF61S9BKr9aCf5OoMCAwEAATANBgkqhkiG9w0BAQsF +AAOCAQEAbek4GyLi+vVeUg3Od17lr8qT108iP3esUJ5cfPrXaexxcypRAmYPB7r4 +NA/vVeOTNkxbb07Ct8dmz+rTn+FflI9h5eKRC7hbH/rFTDEfnoS66eSlxr/jJgtv +LWuKTMJhzXjgliHleaBDGzo3mR5hcJbQvj9qyK4pXjxlt2QvkPdx2H9H76+nBh1g +TY5bW4+3NFaHfaR2p2T20bY3no25/vfV7K5endff6pgzcZR3/SptGTywC4EZzIcz +9Q0JnALQtxAAxq1yrljQcvpjM/aAYY7BxwFHJuLmb/FpMulkzZ2vJALluF/3G5ne +RT9QhxJdwUz+Juv5QKH2i+nnb2Ur6g== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent7-csr.pem b/test/fixtures/keys/agent7-csr.pem index 556767b05c09c0..a3634a637f8cc3 100644 --- a/test/fixtures/keys/agent7-csr.pem +++ b/test/fixtures/keys/agent7-csr.pem @@ -1,17 +1,17 @@ -----BEGIN CERTIFICATE REQUEST----- MIICxzCCAa8CAQAwXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjENMAsGA1UECgwESU9KUzERMA8GA1UECwwIaW9qcy5vcmcxEjAQBgNVBAMM -CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALCm7Zzc -l94OLdlf5kL64gZNJby8pnR/rODqM90iHBqQ3wNe645i/icRk2D89kOSFIJfPuyY -BNxsslE10p1Z/+1SeptK6bf2G4BfDbAiEhkoGNfzgqj+CsvmCePlN0wKt5Dvr3eP -c2ZzD+RPMe2nyPYaJzen3eG3gtxNcJjUNu5q8UmRacPXexRctxkGMknZwIQffZbw -8imbXCx7UAqxsdbvqM5y3xYFhAEkoaavVYNbXdu+LxKiIpRSqqPRwMiKieI0gvMt -GJ17VFyrQxReB1rRtG/FQyFc1KdnTLbMbpJ14I23uhe211TTfgXIdHJo5GWlvb8G -H+jplPfvFIA+tzkCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw -YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAWo29DGuO+fzXS9/b6JYMbH/13+RN -nuxZx/rWLjRG3v128hC5dn7+M54fPIbsSUUC22Xr+qq7JoleeG8IAaFJGeCtAAw/ -x00uBqTDPbwbDs8ph+NvzSAXLyW9chiz4mfCPy/G+sM+a8harUeDyHDeYHPM0Dhs -yBiWKhVSkH0qbbbb2oLA1AAh4f4mN1J2/u88h6rtTTyKao/t9JkQkPmslxnW0e/W -HYvvQiUxm41YiaugHqSWSSgDZPEEJils3SyS9d41z0SlsEnSoh/TtPsTgqTHACXd -pW3CQ4lGPycXtKhkMW+wHm3iuiJtMCDVEhGw3eG5jOc/7wwSInqXrR0Iew== +CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM2+DkRx +PeRGI4JK0YpuaqCJkNswMYMyZM4VQYyn99SL7xS8lB9P0vIm+K1P4198WXwUHSyk +WRcyy54nMNpq+9Dfy8BalHRaUa8BO/7UQgipRGi0HidDk/bAuNNHNIzJr2sGYGHs +ZuHkO9inEqDcqrSlTc0G0zyLry5LekRZRTgAlXplC9PsAZl0J+gGA83rUhdD/RDj +aT4ldqjLKycHvcMLCIS6Wq0TszYCUdbvMsageDcQzQerIJkHzfJFGYCetQR5/fiI +KyF1bICKD22AnpLlfhdthAhLVlYQn34IlYJwdptq2miktcqvBw4rnBhE1ONj8DqF +61S9BKr9aCf5OoMCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw +YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAKcwglrFyAj+pc26WqHv5R9NToUKF +1Yd5zkExZHWH5glrAprCdRhUY575KcY1Sz4KCCRADdYo7KGUFHi4B/N+iyIS9m3t +TWpJQVq4o98hF0+FalhdYyIND2FdiTmdxzmi788JFcTKZT1ryKyoB7vAj0kvXdED +3VU2mDoxPc17ZInR5x0A8hJHDHY9SlDL96n6QTEAByXfqNq/c8S7bkBPEJJUln7G +L/8YWxQJ25971PEX/QLbWADMkSPGkHCHF0znZhtJ6wxTFRkdQJSa9FASKpVgDMMu +wQVEnOa10z2aQ3PayZUHh43zq441FakE7LAseeOoJChPb00lFrN3ph+TnQ== -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent7-key.pem b/test/fixtures/keys/agent7-key.pem index db2c889980e3ec..bc4cbe878af043 100644 --- a/test/fixtures/keys/agent7-key.pem +++ b/test/fixtures/keys/agent7-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAsKbtnNyX3g4t2V/mQvriBk0lvLymdH+s4Ooz3SIcGpDfA17r -jmL+JxGTYPz2Q5IUgl8+7JgE3GyyUTXSnVn/7VJ6m0rpt/YbgF8NsCISGSgY1/OC -qP4Ky+YJ4+U3TAq3kO+vd49zZnMP5E8x7afI9honN6fd4beC3E1wmNQ27mrxSZFp -w9d7FFy3GQYySdnAhB99lvDyKZtcLHtQCrGx1u+oznLfFgWEASShpq9Vg1td274v -EqIilFKqo9HAyIqJ4jSC8y0YnXtUXKtDFF4HWtG0b8VDIVzUp2dMtsxuknXgjbe6 -F7bXVNN+Bch0cmjkZaW9vwYf6OmU9+8UgD63OQIDAQABAoIBAFB/QLfCLdIaU/pC -IQNUn7qPXSrsLE3aAEVdc9TIvlW8vmMi1eREZ9wVvjrsCqwv3PirvljBzTVEst0e -0aKyaFUUyJoLQQV7OHz+05X3cJfWFbwSUu//E5xmbwtSYChemdeJ4UNyMvv0YsF+ -9Rl+46yBrm1GKW252f/Zqf16dq2de+FU/qi/Mhf0ruKtn/wHiDLyapyymr2qxO2s -O71qyZx7x/322UfzU75C0jhvYMsZlhJ/bJ4BdP689c5PDCzUF1aSwNxlkQkPkaAR -mbDVeHt4CSidVJwTAo4glbz6Lqg8FcKzSRyiWKtc4gYgAYdQ+TL7eUB3/a6wgWjr -6SmjOAECgYEA3sBlaiqufnYKGPCgmN4aDYMidcgEleVWpILk37l47ns4fvmymGvA -d4sG0XqIEtchnUidRs+ZGWTuCtFIunucorcM2Sj1LNbprXAmjxmDZrwr7sZsd65K -Z5XLuM2Jhk0ms5tQ2mfWSTo9RWaaWhcvgTou6XZb5LLQ7atV350k8RkCgYEAywUD -8v/WznkYeVZOH3nPtctWnRv1sRhDUtmDbj7slPAAo+JW4PmTDuqkW7MrOjdq6YyR -CgYnqhD/FzAaHQj3d9gofbOrfwX/fYGUDKE697SE888CRg3a0keNJLMEZumqib4j -BJUaLvAW9rFngV2aWgPa2PteDrc+TT6hsT0+GyECgYBjuCfuhlsFnBxbG+YZaVyq -belQZxG+dSP7k+mYSnTb9mfNWEVevOY13hRYVQ1zucF/oxFdsPQuDSQPza9MZKgz -o9Tpps9TmoaUMV/hsh9EL7tPMp8+WNVQWBwSiFknuYQ45bAlhlTFBYCGgC9bY4PN -y1lTBLyQvoiPzaMs7zGpiQKBgEI9ba9waB7QBfs4/J5qeSoAoU77m2tf1j+G9soW -v8xMjnjqVZxr8d5xEpVU3SrOgBSZp40UuwZTK1feeva0QUIaBgQVhkQYqebCS5Lf -XEUL4kFGbqB6zsXDULsDqdEGNn1gyz4og/WCoot1EKd16fGqxlH7mhHFGg/L+qfA -qq3hAoGBAKkpHzmQxyvKVy6hvLoIJmF2mKKh3xIihmkoc9F1dCUl/bEWnByYea/S -eYFfy0rSEa7unGtGAW8y8RsX5Qqypv83c0hY33dVO0atpKPXw0HfAythuuFUr9HZ -LQlwHN2QhrK3vvKiorHOrP3lskRKtkIg/sr1GoJ1TT2vy9fXt24e +MIIEowIBAAKCAQEAzb4ORHE95EYjgkrRim5qoImQ2zAxgzJkzhVBjKf31IvvFLyU +H0/S8ib4rU/jX3xZfBQdLKRZFzLLnicw2mr70N/LwFqUdFpRrwE7/tRCCKlEaLQe +J0OT9sC400c0jMmvawZgYexm4eQ72KcSoNyqtKVNzQbTPIuvLkt6RFlFOACVemUL +0+wBmXQn6AYDzetSF0P9EONpPiV2qMsrJwe9wwsIhLparROzNgJR1u8yxqB4NxDN +B6sgmQfN8kUZgJ61BHn9+IgrIXVsgIoPbYCekuV+F22ECEtWVhCffgiVgnB2m2ra +aKS1yq8HDiucGETU42PwOoXrVL0Eqv1oJ/k6gwIDAQABAoIBAEvZcmcXHIsotHSX +YrLXTCYNMUMtfENy86jqOzVAw2Qvhp+teiolAo7VgT5bwmZ0cIUG4U6Q9GtSBbEz +n5YWdOmnZ/VtL2fJ2G1dViH3XLTWumqjZK5zAnyoxjrV+HCi9jHNswDG55MF0m5o +Ab0ePSzF+G3Kw1uB376Agv3pr1QacVmMxsYxuUm8Ks0H3hB1E1rYByOcFgljq0EA +E7GuYG1JyjFcGsoyNPykpJ8Ri6mko5sbE7ndaTPqiYkovl02nsqGdiXSyrlC1Q7O ++XjfOO0gig6LFsWiKCWxQzJUOTD7RsqRaZTHnEHEf9iIcFmHh52i9Bt5r/lqNA/Q +D7V7vsECgYEA9pYzzZR4+xSYKfQHEpIdUGQTh1kFIdxHp/W4HD+3NJc+DIeUWGVl +7oUGcZvcEDfQojM3LUNAof/NuPuLinjKKzycRBU05ApuLIP9R1mq8ndxe98jxOIM +sCd/UfKHKAtOlyWnLvLuJZLozVYack+9/ZnEDUuz9u1S3l+IPUNiSmMCgYEA1Ziy +jFvchUecrXz1PFpW95psYMkCcgDYg26UwF8jrEcf26DblXs3O8mPGUqCwHOJHk+6 +fEXMGbF7ocr+b2HMKuq5EaCFUJqu5orZLDqFuxCDee2OS/pxfTXaXwrnCKVrYzJU +9HNmuac4pryWnarnGbA56BlXp9mJsAbRcxiZOWECgYEAm1CKOn+9H/Cd0zb4SXMs +8ZjHUCX6/JPhsmIr3+cl/wMQOxYekvrzFCRHpcFVAAYX7EI0C9djW2Zi7pPKFaL1 +O/yGNL/iu4vyTymnm4xYBzbCjRJEVltHQKDwKe6HwOo2Sy+VORYceCArcEI+kCe3 +9IconHNFXE+pNZWYm3XY8B8CgYBmEHUhBLQ3K6T+cXttv21XG382MFbuyuCqzShf +VBbjt4jNlevXXe1isEmkuCoKdCrNRSPDRkbk8B43jZxO9NhumYKdnaqWfZOdrjNg +IwbMAHQSyyT3wVCBmD4ktDz5sLHD0MUvmgU4KWO0qOD/ri6H4+GHurRcDGLyrg9f +hB2TgQKBgH1WLbZEHvY07coCUdAywMCjcR2zmKrxo2rsmVrfjNNF0X0mh6Tsw8Af +BpL/j2bb7bHIIVKEystD2lx+zmOyLZOmT7nvZ7nFKiRKe4HwHiZW5N3JJjpGfBWU +vzPAbJHWnyctRihxgXbq6eGJEv5Dwgf6ERP83Cnn3JiDUNPuEIa4 -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent8-cert.pem b/test/fixtures/keys/agent8-cert.pem index eec8e13a85ccc9..7b9304d7448c15 100644 --- a/test/fixtures/keys/agent8-cert.pem +++ b/test/fixtures/keys/agent8-cert.pem @@ -2,19 +2,19 @@ MIIDUDCCAjgCAQEwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UEBhMCSUwxFjAUBgNV BAoMDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsMIlNlY3VyZSBEaWdpdGFsIENlcnRp ZmljYXRlIFNpZ25pbmcxKTAnBgNVBAMMIFN0YXJ0Q29tIENlcnRpZmljYXRpb24g -QXV0aG9yaXR5MCAXDTE2MTAyMDIzNTk1OVoYDzIyOTIwNTIyMDExNzAxWjBdMQsw +QXV0aG9yaXR5MCAXDTE2MTAyMDIzNTk1OVoYDzIyOTIwODMwMTg0MjIxWjBdMQsw CQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZO T0RFSlMxDzANBgNVBAsMBmFnZW50ODESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwD0j4pL8gbhtpmcKdPo/Iq1HpuZi -VOTjk16e/AfBXjvZoUg9lujr/Mw4X1+X56zfr05Y3+Pyr8euVf/2t81RwvqyjB84 -xFKrk3wBnciv3JodbzmL3aKqVeAwE2O3DSvcR/yaTJtW7EthnDfvaoUwSTN4zpZA -c/PMVpPK0LWZ98vjIdQ7dTOFTLDmawtVxWouX7VPdo0vtYe3/DnzyTojhWQyCL68 -KS9AeWc1opYWmjLeHhOBC+8ovfPRBd9/kjZX0SsWRCC3bKqmJJ48/QTJe2jQnc1V -ERgiWy8SCS9irPDJpqGeEXJiAhCEfZGqZzjW+G34803rBGZCW3t8BibtPwIDAQAB -MA0GCSqGSIb3DQEBCwUAA4IBAQB1ixGtVRFWh3BGT096vdIhOjg/v1c8RZeIEgex -/GKGxcTq7BnQTh4QCTIvcgj/x2Y3RVpKzjF6OCMgAxTeY8cq0uSxrJXAMtpEyOaQ -izF0AwE0baehEY14VlYyuReZOcjVRoQOkNuDUa9lgmfLXQPMvC6rNnpRkD1mt/ot -GBCdHEAGcQNzcRcGVsAFDf9X3Jq6misskbsq/m+If/XXaIiGvT71XsV3CQYp+RF+ -QjcI9bjOOKwb1V7iGl4BBIIDdqMAaLPdKLymYKGglmWAtwwm5n6F1ViOoDXi1VnH -vai/7152egBZ0uoB/KumTa2LpuJUAGQ4b0QA6wb0v+JuOaOG +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvCbXGqz553XQ+W9zsQEaBc1/mhd4 +TFjivwbK1hSdTuB8vWyOw6oZuqAJjctcIPmNXf01zV1+cAurpoU8k9SmtetwqaDV +0K5ooKUuzgAefRoLJqU0XonW4VaK0ICQATkxSWdJzYET68NTukv5f9Fh0Jfi2Q6Y +PKlgUIuoTPQJSErAMsdph4KWMP7zsaEZNJhmZ1Lprfm4DdVnwUfYvDhq5VmAHFLj +Vor/z3DJS+pW9oORDta3CMvAY5oGcIYWWMxsoG9B9NtTTs58jjeFpJrw/RYJA/CM +uRawLWKt/z1zPhzmvknTKfAIc6SjbBqu8Nx/Xvcd61c2V39U/nZDTs+H9QIDAQAB +MA0GCSqGSIb3DQEBCwUAA4IBAQBfy91+ceZDfZ0DnHHAlm8e+26V5sdrdOXZJtkc +AacDcCX6AD1iMK+0axBgG6ZJs6m87cmFdaq23pLpBLQ+KHSdG5YgRCEuWW+RaJGj +/vVn9AS4eB3EmX0RhhJgYyVbN7ye8qjfAv0NtHzUsdMS8ay3HbdUCtrcsHonGDR3 +t/0BGsYny9Kt2f2PNN32UEkx/jhcssXwnNGxyxR/04heJUe6LI5ErdQoxxvaZtrd +u9ZgjSxix4dFH4nTYEYe3oXM1U7PakbzOzJvRMmDh8vYyK7/ih0w8/DcsK0d1Oej +mgtTF/IyJqy8T9goFf9U2uSshia+sKJBfrrzRaUHZMx+ZobA -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent8-csr.pem b/test/fixtures/keys/agent8-csr.pem index 251cb7fcb5ab4b..9b76b0f530b265 100644 --- a/test/fixtures/keys/agent8-csr.pem +++ b/test/fixtures/keys/agent8-csr.pem @@ -1,17 +1,17 @@ -----BEGIN CERTIFICATE REQUEST----- MIICxzCCAa8CAQAwXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGTk9ERUpTMQ8wDQYDVQQLDAZhZ2VudDgxEjAQBgNVBAMM -CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMA9I+KS -/IG4baZnCnT6PyKtR6bmYlTk45NenvwHwV472aFIPZbo6/zMOF9fl+es369OWN/j -8q/HrlX/9rfNUcL6sowfOMRSq5N8AZ3Ir9yaHW85i92iqlXgMBNjtw0r3Ef8mkyb -VuxLYZw372qFMEkzeM6WQHPzzFaTytC1mffL4yHUO3UzhUyw5msLVcVqLl+1T3aN -L7WHt/w588k6I4VkMgi+vCkvQHlnNaKWFpoy3h4TgQvvKL3z0QXff5I2V9ErFkQg -t2yqpiSePP0EyXto0J3NVREYIlsvEgkvYqzwyaahnhFyYgIQhH2Rqmc41vht+PNN -6wRmQlt7fAYm7T8CAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw -YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAL406WiM09XflXU0d0pWbeKG3buIA -L5iO1csseS4tbHTdcy7H0cr54JZEOGaBbsBTJrn/8ILJJsBzurPDdaA39KGv87qF -DM9HrAiKGYWOUuUk9lEPoghZhvLsZ/FV/SI+HOzrMu6Yi7/En56vXk1YwqxOf3JL -Gd0OCIxYbHnGlxvwhRATadBJk07NmG3w5WI46ClRdHSEVYLiCsTB1raRixCbKmxe -9sJ7fG3vnRoxOVZ8b0mMzSPsPyCHYRoTCGHivIytm/tps5jRkF2v1+BFDcy/unUm -NKRhIB8HNVYmZlTPlWdw/k8z8w/JIE72sJXp4jfgha8Zx8tL4qAiUbK9WA== +CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALwm1xqs ++ed10Plvc7EBGgXNf5oXeExY4r8GytYUnU7gfL1sjsOqGbqgCY3LXCD5jV39Nc1d +fnALq6aFPJPUprXrcKmg1dCuaKClLs4AHn0aCyalNF6J1uFWitCAkAE5MUlnSc2B +E+vDU7pL+X/RYdCX4tkOmDypYFCLqEz0CUhKwDLHaYeCljD+87GhGTSYZmdS6a35 +uA3VZ8FH2Lw4auVZgBxS41aK/89wyUvqVvaDkQ7WtwjLwGOaBnCGFljMbKBvQfTb +U07OfI43haSa8P0WCQPwjLkWsC1irf89cz4c5r5J0ynwCHOko2warvDcf173HetX +Nld/VP52Q07Ph/UCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw +YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAsLb6+50b2ck7DOop0M+EitLaY3H2 +PWZBS6A86RU+5y30pJsFKCtefN8Hb21DwSwqhkcFukHzZRcKuGA8IsMhlE2u7YAU +Bx8pX5jOBhFWbUG+mAoe563XPCQNZ3GbKg3pGOCJ8b6gflmGvIxXlzQlR8lg1RG2 +dT5q/sWTOXOsDyu49bObDw0jEFM/HgHzpFyHdrnh3P2vEULx7qdRVUXQ9JIsuPjB +bys9FhjDmV9yEabWfHRXqrFY318CPit25Q6Cl9G4EFMCYkUX2nVzjLojExkwJHdf +y4wDaEzxtqJgEEaQwMu+j68v3wgYAGk0yKMFNDQ0gaSZkAQ6u8I5unTGYQ== -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent8-key.pem b/test/fixtures/keys/agent8-key.pem index e38210c6389e62..dac8716602122e 100644 --- a/test/fixtures/keys/agent8-key.pem +++ b/test/fixtures/keys/agent8-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAwD0j4pL8gbhtpmcKdPo/Iq1HpuZiVOTjk16e/AfBXjvZoUg9 -lujr/Mw4X1+X56zfr05Y3+Pyr8euVf/2t81RwvqyjB84xFKrk3wBnciv3JodbzmL -3aKqVeAwE2O3DSvcR/yaTJtW7EthnDfvaoUwSTN4zpZAc/PMVpPK0LWZ98vjIdQ7 -dTOFTLDmawtVxWouX7VPdo0vtYe3/DnzyTojhWQyCL68KS9AeWc1opYWmjLeHhOB -C+8ovfPRBd9/kjZX0SsWRCC3bKqmJJ48/QTJe2jQnc1VERgiWy8SCS9irPDJpqGe -EXJiAhCEfZGqZzjW+G34803rBGZCW3t8BibtPwIDAQABAoIBABBw6jHFimz5vf7+ -TwmkIWQw17DxgTVrgf8nl4dMjoAltD4z9HiEoTI0sRmPDmnVAih3FejIEQhxlnpq -cspTeAup7z1Gqk84Fs59S5IYCNpgH+ZUUJ76+4ButQ3jeFNbDfLmKrgkjPGWnNmE -eyhsDa4lBc79ULPaBP7ekvj4nxtvIZM1NWt80ZE/nRPjl2fZKQKVIQHu6RQD4aks -LQYsqHV2c0GzOW5+PIcZJDkYBKcb+LexVxkLj2zbXKoFPkZBIUZB3VmXEkctCfmo -I/OZhtSg8yPfL/MM3md8FXq+tFRzDelmWZEHr4hlkvGcLWGyF8xDTZ7OOnO7j9ok -NBYnBdECgYEA6rO++sBhL/Fx+LgbnKp8Jo/oZsprUQtvoaBtrAmuWR/fVX8vmTUB -Q50OnZJ6EY//Xu4qjSIdChcIEjPaGd9WyNQDKjWdh4RXkAe92qKif1dSzo56lc2F -liThMn+zpzyrl8ssjrTSE2Ol8511/vlmKPXSgW01BNnPzYmamYiFcVcCgYEA0a7z -A77+9DSwaYrlV3sXpUKSVBf4oEcfFxY+o0MN+hL9ufSkO0+KtDl9TQK3UjjlikFm -eSAYtaEs/TFkP2bO9HUt+AxNBj3yqabxNb3uKvwKU4D9WIiMOVggPzsZZMn0nDXJ -mmuYeKJ58Tz08Fsqn9XMBe3IdM52r8CQzwR/6lkCgYAA3AenA21Xr5qrPoFbYYRy -37QKLFOYSGJwRRYhuydYTDWVKpISDY+jn7+d9BteVRiqUFT3j1hr4Qm2h1oVHixD -MAOS8/9Pr7xiWqTnWBEgRkGXYA4y3j3O/vOUK8OMqTw3ohbXrvHWAFdrPPhhpqgp -Hj1XG/9FtUZ9ijN2vHlAoQKBgARLLtK+0H2zroEaxQN7k8pgiJqMOx0dF7fjTrkN -IHYkeWmbZtmIEXELVFOFYLegTqL8H9sPGzJs8HzmzAS4WDiNRbm0lscv8Y4jywCs -uPnMW3HGTGnJsgVilpZ04Vo9AHNKbqxo06B0w0Z7VxCs7TyEpj7g1Z/+slN6//wd -PXlRAoGAK+sauzJ9rAPQyetIp1ZTj2ppkN0VYcI5prPnMijwiBumRZD/IkTL7pTe -H47iu/WzTI6wNI+JoQLkKad8vqm3eRkCg0zRtfcIYUvrcpru+jg2ClE8NxQXX7+R -IivQAD1Y0AyF7fV4vJh9YO+inw9Bcp4itG0hqTNZ244lWFK2E4E= +MIIEpAIBAAKCAQEAvCbXGqz553XQ+W9zsQEaBc1/mhd4TFjivwbK1hSdTuB8vWyO +w6oZuqAJjctcIPmNXf01zV1+cAurpoU8k9SmtetwqaDV0K5ooKUuzgAefRoLJqU0 +XonW4VaK0ICQATkxSWdJzYET68NTukv5f9Fh0Jfi2Q6YPKlgUIuoTPQJSErAMsdp +h4KWMP7zsaEZNJhmZ1Lprfm4DdVnwUfYvDhq5VmAHFLjVor/z3DJS+pW9oORDta3 +CMvAY5oGcIYWWMxsoG9B9NtTTs58jjeFpJrw/RYJA/CMuRawLWKt/z1zPhzmvknT +KfAIc6SjbBqu8Nx/Xvcd61c2V39U/nZDTs+H9QIDAQABAoIBAQC0gx8EfMgWBLbF +WORKAaCRyKKPl8zWksCYPVAFLCnwLvf+VFRz7JJatofz/hMZn9K9Rd2EdhqELO42 +CMYhnneDOasRUzlPyMSgu1m4UezuYTopjX485Um/T2RGvdFrGw/qOKpZ+2i9XNzL +c3Cf7KZHljERxirQqD+7hwGlMsxlCYpIRYbe6orpT0aAiGr1iVioohyk8tT+7iXD +mlPeF9qbWAChgfLzTmHcpxGpiFXS0w6KV1XG8sickm1tnoXbCV5ZJw6HscL5VBp9 +SBclRo8AXWBaqhcfj0mvLJWs5E5K3P6dM9X/RcxJwP4Q+kfABYoYjZrZ1/sOJkZr +mHzoYznRAoGBAPeDWWG5RLSlYgs6Llw9ERF3917AiY+eWUCai7faWGP3SEigmPOm +m7rHQcI650DN22aXm8DBSRM1QV0C/UWd1DoDpQAc76GexJhLYRA8/ZGAe24/q1nX +V0aDHzTLC6m8fYGj5ATOotvzYYz6aK9dCuLxPYfWmyZsIXU6K+ypsZOrAoGBAMKa +a+7es33C8aUf6kvBOtPPs9tJW8rhox9gMQxHXuibz+0ZUM7h0DUbsMkDpj4Ydwqr +c7O5sIHUjJLSmw7Oaw6xByK51tZNZeA3bVB2ZUAPILNkF2UqldRYRT7DfLTHEbNV +DMo5P4tR8HxWdrKuhcp+RdPfVmay7iIkFtcKWbLfAoGAR34nKTUMhWln4npRvc7d +yT/vsezHTzab7S82wEpPUcCxnljVFTvAq7i2Y9YDyhIsF3wfPxQVeXjegnFEmwE1 +tfQritbQ2Mw1WRAc30XesFJ+VKALbI3o5bMmJmen3MVXM0UVrdXJ8OJiAQiriEvF +wzuPXFc+xWBiYawF1/xEELUCgYAYBm6K2A262gVxSGZpodp8aekfiof9nSvBZOPJ +S0ppV0stT3HNiM1msRt7RasRgX244H/xUVx8Otx8B+pCwrMu5iYmYGEopfeM3eru +Ax/u768u1o2Y3NAQnjE2VXYg7269ACQLF1REBAK3pwkSeD9mR36hcLI/DZoetuvm +8o0uawKBgQCGwazVcS1cOOODw8mP39KIlWNtbpeRI6T4Qz8Z4FO5B324uccRmxL6 +gCRTdO0990mYQ/BJQ0EQWyrcnpqSfw1YYQOYpYvPexhKpRV+sU5KqJJkqEBe3WLm +oiaFpuz+NtKkQrCc9AlA3SHlJWPo7jTjIPCpGuVM+FipGTbLGHr7HA== -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/agent9-cert.pem b/test/fixtures/keys/agent9-cert.pem index 520ae4fde95e35..7fdada43d59d7a 100644 --- a/test/fixtures/keys/agent9-cert.pem +++ b/test/fixtures/keys/agent9-cert.pem @@ -1,20 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDUDCCAjgCAQIwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UEBhMCSUwxFjAUBgNV +MIIDUjCCAjoCAQIwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UEBhMCSUwxFjAUBgNV BAoMDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsMIlNlY3VyZSBEaWdpdGFsIENlcnRp ZmljYXRlIFNpZ25pbmcxKTAnBgNVBAMMIFN0YXJ0Q29tIENlcnRpZmljYXRpb24g -QXV0aG9yaXR5MCAXDTE2MTAyMTAwMDAwMVoYDzIyOTIwNTIyMDExNzAyWjBdMQsw -CQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZO -T0RFSlMxDzANBgNVBAsMBmFnZW50OTESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1RfsIHFH/58sMeDPPkKCj4sK4ujw -jiSMLi/vuwBjK9h/LtnBZ0wd5kMq9J9mFtQe21dqb4f+z2G2ZthziJ7GHDpJ7WEf -HQa6cEHrk7Tct3XpyGYMvLmSHD+y54U8cO/K66w0k9iZvTiQ1eJxdaPkoQsdqinC -Z+fh2Icy9tWbGatwtddizcGFM71a2vJjcg8Fnb/X/D/fCbF9L8hl3EVqWSs8Y+BD -gIiJqdnc/R9RW8T8W1QeCmkuX/Nm1dJqLF5fNXP8lMgdSMHASTgPE1v5OJqGpIvd -wBYOuYCaGvjplsS+isBh2sDA98SgmL35GGHWiNhZIQkVMKzjgiDkKKU8hwIDAQAB -MA0GCSqGSIb3DQEBCwUAA4IBAQBv4AYF2CfowizdqeL9vrDOSxMQAowxAZWLsixC -RHfzkjPaaN0t0dApEIdttzmmif104LuK8lqQe9zvG/F7kh4Mhj1cfaJZraNbNprL -QHnnV+sSL+flSJfkSmSkuu5Cn78g72qnERqzwYZKHIBnMQhUf6yUmHxmxQlJDtcP -kNCX4vCkkC9MW91n3GDXpSQX8KkSIP+aP1kHqHkWr7mh7du9p/E7rnI2UfVcXg0C -db3eSDVq94e41HK9uWQgYRLLMz9OSnMmOgfK21o+eBWaHb+07Wo87cSPzuGVBtj7 -0DueLUdvSpliM8wZBIf6xzTdF401VinLZfFGyg6pYM0ADfda +QXV0aG9yaXR5MCIYDzIwMTYxMDIxMDAwMDAxWhgPMjI5MjA4MzAxODQyMjFaMF0x +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoM +Bk5PREVKUzEPMA0GA1UECwwGYWdlbnQ5MRIwEAYDVQQDDAlsb2NhbGhvc3QwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2oEMk2EKwIZrx4IPNcGjHw5DO +u8A8yJrcWG4pThUadrvwMI7bQ4QwNgHm4PVpbjAPbSUsRPX98PWL6GcpoH0lmJ9+ +j9CCEIEkW+j5wM7hYBXUSGuAZZfkdrpbZHsvwpYj2U39sfmUyGT1gBbGBmaAzODh +ZaqYSm9VdaKS56SRMey3Pbsx+ikylgiEyPFoRKA141Zuxz1MKiwszLHuyz6pCZKY +K7x1dlEGi3h3dvkRAdMyeSXJkYCZGbS5Fbl2OuW4pSWP4no/M960vBwEYvuJPDtx +qxGezE51oXp4W4l9k+TYPOfGJDVW0PAg+JpfbepLetgFaO9/eNWes34AhF6FAgMB +AAEwDQYJKoZIhvcNAQELBQADggEBAD8ojlI4FdXLCyHVYwwTP6BncF4tfeGP82/i +Zcr8U9k28T2vlsLwdCGu8UVqGWfYrSY5oZqZmHPcDfZmv6Uc39eQ72aweoyLedk3 +UF1Ucwq+MxEM98doLlqL4lnPO1+TcpdhtoHAgT28WkddbR3alfsu+GRU3br3s4lS +DHcm6UzdA/lkgZtC8wFUSW04WhzSHB78gm8VOl+1JGY0pp/T+ae5swkfj45Q3jOd +H6jdZiUrU+LJQwLlXYniF4qzmH0SN8Gd3djVNzWJtNF+LFKXzCOYSK8AFaQ6Ta+s +Pd6Rqa8Hl6cMmlsDu1NLumstvGna5wsc7ks1VZwtWt6WfIyIN2k= -----END CERTIFICATE----- diff --git a/test/fixtures/keys/agent9-csr.pem b/test/fixtures/keys/agent9-csr.pem index b75a32311d6f2d..b93b34ec9412ce 100644 --- a/test/fixtures/keys/agent9-csr.pem +++ b/test/fixtures/keys/agent9-csr.pem @@ -1,17 +1,17 @@ -----BEGIN CERTIFICATE REQUEST----- MIICxzCCAa8CAQAwXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGTk9ERUpTMQ8wDQYDVQQLDAZhZ2VudDkxEjAQBgNVBAMM -CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANUX7CBx -R/+fLDHgzz5Cgo+LCuLo8I4kjC4v77sAYyvYfy7ZwWdMHeZDKvSfZhbUHttXam+H -/s9htmbYc4iexhw6Se1hHx0GunBB65O03Ld16chmDLy5khw/sueFPHDvyuusNJPY -mb04kNXicXWj5KELHaopwmfn4diHMvbVmxmrcLXXYs3BhTO9WtryY3IPBZ2/1/w/ -3wmxfS/IZdxFalkrPGPgQ4CIianZ3P0fUVvE/FtUHgppLl/zZtXSaixeXzVz/JTI -HUjBwEk4DxNb+TiahqSL3cAWDrmAmhr46ZbEvorAYdrAwPfEoJi9+Rhh1ojYWSEJ -FTCs44Ig5CilPIcCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw -YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAlbvFevH6Xx79VvWyXdZOehokMpqr -xbodQqntaxtk1pRtiostga5j2pBIos5BBE5KvgPCp2rJMYjdhjyxk6v4P04nhXDo -rtD2PVIVZEaHWw743HVtFpDl9V/JK35jm/FgAbstFFP/OG3uNuHGTxvdPq4NW4dc -TVWpJ09IdbAJ9YfWbro+r/FCP3anXO40TMTNZAJKztyhMlqcmrBC/GHahtav2Y37 -gPpc70WyhqfQE1paEXT/uO1GMiOaVqPt98RTlt7smnLxHodZ3aF3qONl7VFFEaC+ -8rdKdZWTpTJQiAbBo8Xn7UxY6PFvPjteCK9duRULV8+SfimEq0wmC6Fygg== +CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALagQyTY +QrAhmvHgg81waMfDkM67wDzImtxYbilOFRp2u/AwjttDhDA2Aebg9WluMA9tJSxE +9f3w9YvoZymgfSWYn36P0IIQgSRb6PnAzuFgFdRIa4Bll+R2ultkey/CliPZTf2x ++ZTIZPWAFsYGZoDM4OFlqphKb1V1opLnpJEx7Lc9uzH6KTKWCITI8WhEoDXjVm7H +PUwqLCzMse7LPqkJkpgrvHV2UQaLeHd2+REB0zJ5JcmRgJkZtLkVuXY65bilJY/i +ej8z3rS8HARi+4k8O3GrEZ7MTnWhenhbiX2T5Ng858YkNVbQ8CD4ml9t6kt62AVo +73941Z6zfgCEXoUCAwEAAaAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBw +YXNzd29yZDANBgkqhkiG9w0BAQsFAAOCAQEAms/rMyW2wVfNtBHZ7HAUxUlWl8ow +0dlZgVmAXF0WBnfOGn31CQcGPyj9btJ48tmaTXmhIw96KqQDIi8KmYXDrDm0JmEp +d+6Q704A0Qjwq4OmMqSobNHRVZUM24niF+U/oGuI8J5nSbCp/6m6chwM+R015cfl +1yNqqQXYYIogcHQZVdofeKvGmrQhBfsEt5cdk2riGqfWVBwY6rfXW+MSHIw6cHIn +vVFYG32Gk8ZU+MoWPQ/DLAy8B7Azo7ePMnidfaOxPAox6IGzCcZOfnCu2tZ09S5t +gqcpdnecBLuQdIybhKhCbM7GOmIricDeIJXkVhmwmjpcu1WdQWUIUsD18A== -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/agent9-key.pem b/test/fixtures/keys/agent9-key.pem index ad01bf54ba7423..1dc2df9a064344 100644 --- a/test/fixtures/keys/agent9-key.pem +++ b/test/fixtures/keys/agent9-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA1RfsIHFH/58sMeDPPkKCj4sK4ujwjiSMLi/vuwBjK9h/LtnB -Z0wd5kMq9J9mFtQe21dqb4f+z2G2ZthziJ7GHDpJ7WEfHQa6cEHrk7Tct3XpyGYM -vLmSHD+y54U8cO/K66w0k9iZvTiQ1eJxdaPkoQsdqinCZ+fh2Icy9tWbGatwtddi -zcGFM71a2vJjcg8Fnb/X/D/fCbF9L8hl3EVqWSs8Y+BDgIiJqdnc/R9RW8T8W1Qe -CmkuX/Nm1dJqLF5fNXP8lMgdSMHASTgPE1v5OJqGpIvdwBYOuYCaGvjplsS+isBh -2sDA98SgmL35GGHWiNhZIQkVMKzjgiDkKKU8hwIDAQABAoIBADeUw8w6f/MWy2o/ -Hw84PeG+/Jnu9D+/HKk3a6o1EajwEUxhE+cjnXDf+CZSJUizD1Fa3bI1oKrq666r -qobqEvZt5bZ67KifhqWdLBscw60+njndFFltdcTUgI+O2xMCGMWb5yLhDkiipnSD -WeC7XPj8c0JdHg4IF4poyUxEru3kpdVNrOzTbrs4hf6LUsts25c5IPourgpk1Awk -Rs0zuKMj7K5sp3oTAY+KrsFkavsWLVRrNVNaT9vY+bR1S8kfo7TUeBl2c65yUiBO -UcLWcrd8mALN797JGYe+PK0iQbGsH3106W8k5tve4tSowe2sRvIMiArSsfkBKl+j -/lGePyECgYEA8pbt2CoaW+Iusie9cEAqip2k4nGwh0Vdh+IHb8dgXwMDRC9x+DwL -DTP84+Bdc1siVNofNshzaLjyyG1ah6YXOqSzUpr6SO6dnGzotAFleUlA/z69vejk -FEp6VkElTb7YSuUUjzsPRgLZlfSHtyRIhg3V5rA8LSGQ2MXBVH+zyCkCgYEA4N+S -MrFORTld/6or6hQJGLoBvI2Hwvql3tM+vuNJS890FJBsaJRlHFYM6/4CSdZTZR9B -Za1A7vvYEggJqGGgDtfbKFgss00zrTYRzaY46PpK488HBevY/G2HxXZ2NLg8tK3m -556M0agBULxrWpFQYwu+37cd4oW7hA83EQ77NS8CgYEApnSrxRy2s3+SvQoJscFF -r5GWNw79qwQMtpWAttFerjMaBapskIFar/eROieU1/ebqg91RZjrn9rwNFjcuqFb -5RBoP3E59dtNaK1OS1197Gg4YiwB9BKeldG4+gB/gUZHkbR4lANZapfAB2Yfzanm -3Z0WvdEFqY4Tnrqq+rkZemkCgYAGwnGwmGfT6N+Med8MEEIdvimjM1XrZIFr60mt -j0N6xeelXpoDosJPUb7dsSr8cTbciU378nNLO8LI9/jiWNzo1VA/LDdbxGxTPpbW -abK4Ph3WLzj00pwZKmm0Y9U1zHv2qmuQdtGg074GYUOQ22FhOM8qBmUdlAuI8rQj -DSI7/QKBgQDYPHpPPWjqTr5J3a0hEZefRjGqccOkon0oW62DpKSLjH6pG1LpQYVS -akWh2gx18TFNk5x5JOlAS2ujZv2TyqXsIB/sDcI1+l1Ja9ARcdM/42qaTUSMUNGL -50DTvsKLtFK7aKgfs4LcBjniuzBN/az/GwxS0s/Bi+F/njlklzStGw== +MIIEpQIBAAKCAQEAtqBDJNhCsCGa8eCDzXBox8OQzrvAPMia3FhuKU4VGna78DCO +20OEMDYB5uD1aW4wD20lLET1/fD1i+hnKaB9JZiffo/QghCBJFvo+cDO4WAV1Ehr +gGWX5Ha6W2R7L8KWI9lN/bH5lMhk9YAWxgZmgMzg4WWqmEpvVXWikuekkTHstz27 +MfopMpYIhMjxaESgNeNWbsc9TCosLMyx7ss+qQmSmCu8dXZRBot4d3b5EQHTMnkl +yZGAmRm0uRW5djrluKUlj+J6PzPetLwcBGL7iTw7casRnsxOdaF6eFuJfZPk2Dzn +xiQ1VtDwIPiaX23qS3rYBWjvf3jVnrN+AIRehQIDAQABAoIBAQCxMp0TkfZa+bBi +woqAenJgaeQGg2vKTobcB72TvFyDmfNO4X6rRz5qnOyJfXsBelWNkkSASMU6SWOn +Ba+bV0o2gXk4DwisOqFjiv5p3uedDGMB3+bW5TxVA9JcPQm91JtjW0TuRJK7BxnW +jxsJt0ob7S7B5Kh7LbYLAKHm0nX+HgFcfiaRsVCiCtuYkTOzpkUQsl7psX4VJJQ+ +SYr4URsPZI7SGdIeq6ofKH/yGJeoYyhxfNDzNZXqdIC1LEU4BrsrBR6mVRTj35+K +0pHiOQ5Eezi5BnEFUgRR6ompTXQGfnDgEmNyuhzVhuP6nFJ/QPO2KUcIkU4cqViC +7ZTeaLjdAoGBAPNfZbi515DhtwdwDx/Ol0Y6kzyK2NP2FpMlGXwUKXSYbmwbSxSo +zXGyCjxmKtQfbwzVSd/aNdH1lPCHerNFmumhL52wsWi/9EIT+liaxN8Cw/IbUuOy +QlA8BT3Pf1H4Fv/ePIx1DuiPk5jp/eyAK/iPVCyXu7d85ULdfhvwVS7XAoGBAMAZ +/x7dP7qRAUgjvCw8JQVpJPxeVvraKHpzQnceIhd88oTAIYHONNomSBAlqoT00JzW +uFkDbtMZydhorOCUR/d6oHWyg4qEt7F89mssvCFXkROs+ePCuvspYO4F9B7/A7HT +dwErWsvEaRmEO/AWRvHMhjTV4F5ZMNvPj3E1YX4DAoGBAMM/y7oRzrG7hD2BV4Dr +G04KfElcE2ypx56xauqyujeCe0Rb+TZP3tLSRYgDZ2Ta+xrOmv/ubrNNVPpLltLw +isHYwPy/3vTs2yeQI46mTD+mVlGMPknSn4UDQik+qSS35qvMPcNpvlYxqfZJ85+j +jKNTSfKkoMMqfjvQuvXrMEvtAoGAIjZ/EWgmKXwZ1ldG9Dnh/gyz4Z6LrzGbc/OD +KuPa/oPqTWpKjWvETfXzb6zFqdhQLx6uxmuuGTrGkBxUbcr65kCYw11/v/PTI3E2 +EfBtsSJ/XBm6h63uzzyXXs0ApWSVq94Vm8e07AWXEkxSwHe3OulKHa7ZvvPzl7Jn +wanYKzECgYEAun2EZ1ETQ10fkQ9RYxeJYd3HjazTfWXUJJeVhPlsLQQyVfZoRwy0 +9nzdOclgSvE2/+m3SQFh4UHTddlrU1C/V8pkgImnOyCmBFEv8SAfuvEnhQWA13kA +bfreLGMiDnbK1+7MEq0CJeIUZ1LWeuHlFNJT8bYvyjLiZcJyipgQ3NA= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/ca1-cert.pem b/test/fixtures/keys/ca1-cert.pem index 205e2f7226bd07..c126543553d904 100644 --- a/test/fixtures/keys/ca1-cert.pem +++ b/test/fixtures/keys/ca1-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIIChDCCAe2gAwIBAgIJAO5Yan0JUdezMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV +MIIChDCCAe2gAwIBAgIJAMsVOuISYJ/GMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTVaGA8yMjkyMDUyMjAx -MTY1NVowejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjBaGA8yMjkyMDgzMDE4 +NDIyMFowejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTEx IDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQC1XJLKHcMcvx9RG2L0jL3Oc7M4ogGOobVDSE8Fom9Xe4nz -HRbOxNCell+HeJIvyieLNQ+UxF5qDa0hOdXgzFI3wzRmX8mzUoLsqIxeh1Tg4MOx -yPeBrFCK4gsiCRaYWjGhfcIEAE3pIkUz9/CpQeG6psqzPNV7ZnJLbl/XopLQjQID -AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBACfO4emOcWWf -sk98DJwfQQIc0i2D2ALRCgVUpszQOrhDci1ARGkSPc3oyx5xT/b9NCGYUxpHdz52 -t8bTqYJsU6u7kiOe6o0KcQT7FvKrzWgzcL+yCNiQ/2vrx6FJZBL/W3uvzVSoOYCU -D6TJXtGA5d2TnarRMflWXSk3rFqGvtUf +AQUAA4GNADCBiQKBgQDrNdKjVKhbxKbrDRLdy45u9vsU3IH8C3qFcLF5wqf+g7OC +vMOOrFDM6mL5iYwuYaLRvAtsC0mtGPzBGyFflxGhiBYaOhi7nCKEsUkFuNYlCzX+ +FflT04JYT3qWPLL7rT32GXpABND/8DEnj5D5liYYNR05PjV1fUnGg1gPqXVxbwID +AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAHhsWFy6m6VO +AjK14n0XCSM66ltk9qMKpOryXneLhmmkOQbJd7oavueUWzMdszWLMKhrBoXjmvuW +QceutP9IUq1Kzw7a/B+lLPD90xfLMr7tNLAxZoJmq/NAUI63M3nJGpX0HkjnYwoU +ekzNkKt5TggwcqqzK+cCSG1wDvJ+wjiD -----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca1-cert.srl b/test/fixtures/keys/ca1-cert.srl index 8ed0077c745736..d0ad2b1653b0c4 100644 --- a/test/fixtures/keys/ca1-cert.srl +++ b/test/fixtures/keys/ca1-cert.srl @@ -1 +1 @@ -FAD50CC6A07F516D +ECC9B856270DA9A8 diff --git a/test/fixtures/keys/ca1-key.pem b/test/fixtures/keys/ca1-key.pem index e46eb322c4781a..be4ad727f70200 100644 --- a/test/fixtures/keys/ca1-key.pem +++ b/test/fixtures/keys/ca1-key.pem @@ -1,18 +1,18 @@ -----BEGIN ENCRYPTED PRIVATE KEY----- -MIICzzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIq7DAvJ4TiXMCAggA -MB0GCWCGSAFlAwQBKgQQL6ValIJtDzAAQv3neNekGASCAoA54EMlceey59Q6XR4g -YAb97wr31CN/b+vyi8pg30k1QVgIvqoubNpkm8zSLBOU7trfIKQyyq2MYXiHeVHk -wEoNXDuGFesgE3xLc5aAVhh3wFNARGEwUkMhtKtrXn7rGIaQu59uHVOiSnM+9MaT -O7mhfEG+z1tO1xrd7IAGap/mZVu+jQpWAHvmQdL2F0Nf1xvBnVfS7z6PBVFBmKQG -hqtBWsDJtH2AwvdTsBAa8kNOr2/r3VuX33oJ6XHpzlbLFXqiGftqCzndCRYudpce -fB9lxHT7dN3t/D/VQ4TsjS1nfFECDxN/B1rM5Seri/n+g7b87gXZk90vA7lvtEGj -+d0kGJT/Fqnq7kusdDuhccMO7B7ZlKzc9i0umEeSoEbBgjk7RQT/AtxuRB7Nd5u+ -GWQjqePmaT3V0CR48LFCaZH0334RkF9vxKee+VVZUVOz5qbssclYDaZDR6gmZjFE -em1d+IVlmus1UI1GloVM+m9toYvyCHPpoZAwwA9iTX1Ez41Ig7I0k63UcAD+ziQY -juAP+L4HHtRBvT33TSDoLIq5unqRZD8uAd/ApHe9E3/NrCcbQNGK7vmT6A864uTS -el6xo1wCdLI6jx0PR7NHw9VnWNyFaJNhld8gu0FYMehtjw+rEMpVgnibuFYTtKCN -NRbMz+fFSOhfBgyUE+68GvqHHPoe05/Qep9uCeFJ9F6Y5uArArHMiIGNIv1ao7At -O+vK8NjPoEsK881rnjeWste/eT75qIU3iEyuDGvBnJNzGuQykI8adG6X60CruMuH -7LwS3kZK1W1QcBcG/xF3IZcs1o4le1zqzlsCH4qlWh4YfPID4HEKQGLS0DMzDY8x -tmzr +MIIC1DBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIO9cMY0yHJGgCAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECAKYHSZXK7beBIICgHkIYlgRIfZt +QZxMoahaz4Bu6t5F24ud9rdrpT8qKCnffj71z5mtwucE7sXMslcejgo4QEP5V3lS +zFWQDY5B0p9al+M9DIsseSz8L9StqgQo3FfYLGVs8njO4PFyaWSdbPWWpaXRUmdm +32CbOKwdvOMFhcR8G+jlezkm4uyQ9yCC5bERdrpsaaPJTlt8aMdrvxMytHw60OZo +VVF88fRm9x4kUT+sKyiwG0JWTRDueeFoJR4oa5xlw1AVmEYBBQee9Tc73wqtOr2r +4dnL/zwc6c9ZoTTDOGZNgBvxswVzg04K/qp9LIt3uOeHXqfnmzfmJ4eT5fG71pir +pSfZPIYXJwgC1NjWvsWudI/kE1Wj0JnGYuPY/Vea9RSSrRqq9nL9kqTSa1jgo8l1 +zTR/uZHZH2wCMlH09tiz7uOiPihsO8qeYWIe+vkgC2xCm6O/B1vMuqQY36LOxeVt +igi9hDLjWxNth9lEcC/0wsrft8Y1/CF5h3/j86h1IcgQKFrePu40kols/yBxp7/n +MIzm4oUoClGe3q+a3aajEYL5Cos+7tu2jSM3MKVMiNZ5aTICQ9Sr/OOz+tYZOdJd +hCDF/oncBALJ7nhe77mf1j+Qy/vZzCvDIl/ki3zK/S83U9InZW3oKFv4u3brh+77 +2zruIZ6l/zId8fFARdh6PvXz5avz2eC//EM1zNJiV6IC9DvB3xibvA05rmoK4g9V +DIIIWJsTJUPPvEXszMAtb1zR+MhDs71RF6KvM67KCasI0k07hGY0rgDjlzeoWe/3 +SLgXPda5/WCkRcpgznzRu53HJwq27tUsh74hXPbqaQREDrX0bBBokAMCGBxCFrJi +Btmo/ouOp4w= -----END ENCRYPTED PRIVATE KEY----- diff --git a/test/fixtures/keys/ca2-cert.pem b/test/fixtures/keys/ca2-cert.pem index 8d2d4273df7ff5..0c72d6c64756fe 100644 --- a/test/fixtures/keys/ca2-cert.pem +++ b/test/fixtures/keys/ca2-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIICbTCCAdYCCQDakSqa9pRwoTANBgkqhkiG9w0BAQsFADB6MQswCQYDVQQGEwJV +MIICbTCCAdYCCQDRrfgRk8tC1zANBgkqhkiG9w0BAQsFADB6MQswCQYDVQQGEwJV UzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZKb3llbnQxEDAO BgNVBAsMB05vZGUuanMxDDAKBgNVBAMMA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlA -dGlueWNsb3Vkcy5vcmcwIBcNMTgwODA4MDExNjU2WhgPMjI5MjA1MjIwMTE2NTZa +dGlueWNsb3Vkcy5vcmcwIBcNMTgxMTE2MTg0MjIwWhgPMjI5MjA4MzAxODQyMjBa MHoxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNV BAoMBkpveWVudDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EyMSAwHgYJ KoZIhvcNAQkBFhFyeUB0aW55Y2xvdWRzLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOB -jQAwgYkCgYEAvQ+FcEz9z9g97WelMFbnT1lPXyimgyfWr5hYDG51rVo0L8hBbxW3 -uaS+lxOodW1Sb+ycTAvyVIdfiIUi1XFROGyTUY2Vi2r8yglS7+YSQyk5+6jTJbHe -+UBLY8wO/B6vSZXBb1Ym1+LtfUeEJc1+5qtB7joyllwt3ID/qCeJxNECAwEAATAN -BgkqhkiG9w0BAQsFAAOBgQCzAc/3u++UkXTShUZgT9L5lA/wg2yfMA737EEg/FG1 -JEW7OmkvYekZdL7V3o2CpymYXpUuFaWgW6cxMRJ1wylZkqk8Ad527uAfe21fGIFl -9wiLSjXjoVYod0xHtsDE+5y3a46QspH/Rxq5gHkdhV3J4RkwYrx6deEnAEKHA5S4 -qg== +jQAwgYkCgYEAv61gNiLff+zxCdAwdzlVoucGu5L+LFFN9TXzcT3ZD8U1H6CiLp3Q +02IlbK1JRHwpJBXgYOFvMWd9LD6JiJgJsp61kpZShl2qZSUIfhzeExWH7kkuPHWC +IEkiP/aDp5wuqbFBkNUJu8opYr0E6/t9sIzl4IK7WNDXWgQvv8cqin8CAwEAATAN +BgkqhkiG9w0BAQsFAAOBgQB80WTJ9neA5yVaDVV+hZtOasLiZlUT8m49ImQMnInA +jdoAkxgySNOJP8IrsilleAGeHF+JPy042z8NZ5C+xL9REaB1/OaQ7+nwHP0O0f+l +kXHgZATQ3YVf6db5euK3R1mdO1Vv++R4Nu4NYBu0cmfMpdl/uKdYpXMjPVn21iB7 +5w== -----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca2-cert.srl b/test/fixtures/keys/ca2-cert.srl index d91d153202dea3..70dfed568de6b6 100644 --- a/test/fixtures/keys/ca2-cert.srl +++ b/test/fixtures/keys/ca2-cert.srl @@ -1 +1 @@ -F8159CF540DB8F4D +91F006636069F29D diff --git a/test/fixtures/keys/ca2-crl.pem b/test/fixtures/keys/ca2-crl.pem index 6cd77ea257cf21..de416297dcd381 100644 --- a/test/fixtures/keys/ca2-crl.pem +++ b/test/fixtures/keys/ca2-crl.pem @@ -2,9 +2,9 @@ MIIBXTCBxzANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQGEwJVUzELMAkGA1UECAwC Q0ExCzAJBgNVBAcMAlNGMQ8wDQYDVQQKDAZKb3llbnQxEDAOBgNVBAsMB05vZGUu anMxDDAKBgNVBAMMA2NhMjEgMB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5v -cmcXDTE4MDgwODAxMTcwMloXDTQ1MTIyMzAxMTcwMlowHDAaAgkA+BWc9UDbj0wX -DTE4MDgwODAxMTcwMlowDQYJKoZIhvcNAQENBQADgYEAQLa20feEGeSrXOrh5WZ/ -YAvsB6dPEy4lumjNOH8k+mbOmdlWEOAKlf75p3hsi02HYyVwoR02vsdbGGIxPAXi -WVa0h6/ZRmw3emLx08s7QxHLISrj3mzDgqU3mMrY27S07mtYaJqNd9gWJNusBXVF -3N7qhYNDijxwYG+e+Ty1WS8= +cmcXDTE4MTExNjE4NDIyMFoXDTQ2MDQwMjE4NDIyMFowHDAaAgkAkfAGY2Bp8poX +DTE4MTExNjE4NDIyMFowDQYJKoZIhvcNAQENBQADgYEAiZKSPllC/hi1S9jedRFt +eah65RINSkGZt40AuxPIFfyu5qSeKU+9p8zdXELtPqywSr2k6JjBP40yRIc5/odZ +CxFM5XR/AIoeNspplxb+Qg1v1KlbGxzfeBHRIn91QpKcvsMCEYF8nu3xKOJmYrTR +3Kj0gniNHbiLe/HTpEY7YOA= -----END X509 CRL----- diff --git a/test/fixtures/keys/ca2-database.txt b/test/fixtures/keys/ca2-database.txt index c943e0c0173e8f..3981127cab0db4 100644 --- a/test/fixtures/keys/ca2-database.txt +++ b/test/fixtures/keys/ca2-database.txt @@ -1 +1 @@ -R 22920522011656Z 180808011702Z F8159CF540DB8F4C unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org +R 22920830184220Z 181116184220Z 91F006636069F29A unknown /C=US/ST=CA/L=SF/O=Joyent/OU=Node.js/CN=agent4/emailAddress=ry@tinyclouds.org diff --git a/test/fixtures/keys/ca2-database.txt.attr b/test/fixtures/keys/ca2-database.txt.attr index 8f7e63a3475ce8..3a7e39e6ee60a2 100644 --- a/test/fixtures/keys/ca2-database.txt.attr +++ b/test/fixtures/keys/ca2-database.txt.attr @@ -1 +1 @@ -unique_subject = yes +unique_subject = no diff --git a/test/fixtures/keys/ca2-database.txt.attr.old b/test/fixtures/keys/ca2-database.txt.attr.old new file mode 100644 index 00000000000000..3a7e39e6ee60a2 --- /dev/null +++ b/test/fixtures/keys/ca2-database.txt.attr.old @@ -0,0 +1 @@ +unique_subject = no diff --git a/test/fixtures/keys/ca2-key.pem b/test/fixtures/keys/ca2-key.pem index 2e48b87636f1b3..2efd44d78c3b6a 100644 --- a/test/fixtures/keys/ca2-key.pem +++ b/test/fixtures/keys/ca2-key.pem @@ -1,18 +1,18 @@ -----BEGIN ENCRYPTED PRIVATE KEY----- -MIICzzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQI4wcMSIZ9VYYCAggA -MB0GCWCGSAFlAwQBKgQQrdlE/1g1dUWjPXe+cDF3hgSCAoBXqokDLdhUcEMNy6mp -S+yixHeWaS35QF8ESaqMa+Qc+l/ZJxLLUQRf52TimO+sz51TXfQFJtWTsZVaGyii -94uoniHVtaSirpzuQVUEPx9/o4XVRc9MtEf78z8DUwOJ6dHlVganU9BZesS0+TZc -E5apDKhWhjbrjWWhwNMUb2jYHQvaZoDjlvyhy5qUG9MQn65KbrK2WLT8Jsq9RE4y -38fxdV1S2OetDc29hSp54DWkXegjrX7iDOWLSGhG0GmjS6rggDQ71/CN7fbOAwf/ -ztniGUqriPNO2gaaivHiT9yuzYyA58FyGLCnVg6+jkQ8znhOfO9DwSWEaRWCsv2n -v1Ep4HzSopt2CogBUsJxg5Xzls7qq0e232+gndMlT4tEOfK194aOuXCReESA+yll -YRcdsjQzFUyCUrGv+RGmQmiK8QcLI9jIPa6Mi0R6VnUMyHGB3i7oY1UaKKS5+6zB -4ftXEOfx141siDymRTTALrmQd6jHqpXbbou2idbKGMNn/G6GSl/5fXmPSUOs0H2l -HdhvPJEfyYsWhS12jXRKtlWIAb+A7BKZac+y+kyhcJG2OLz2cCqmTXIZDdEMr3aE -aoz8rP2vloyKFx9LMDdK8/ec9b02cU/XctZ3XepL+0+WYfk2JKulhJsvsAyQX93l -Wdb16NzGE0X909+9N26VZzCVVeY2Ti2Xo40dLkQthMmGytz8h0sro8gTcHlasQv/ -4rQJ7nb4FL29Vv8TBLwAO0ivDSy/lDayi+eY3dOMBjHlXP4ZqBd5bybkpZNisG5f -C/p6R7czFrFZ/MMhU39O5GBZhD0Y3BfI+ih6ly0/jfqFnETNyG18jNrUOgJ8ZeEz -sVpU +MIIC1DBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQI0/0Q5tLDQW0CAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECHCRfosVTaMUBIICgHq2VKpOxq8W ++KZ7bVFuWx/gJvE1FAJokIZogK52LH3oEk9kMlEujwYAMovEew4lPMgAnyQh5Mbx +BXIm8Arww9hUZlRPuHmeQQuikbz/Sy5LVFbrzRsM0xGZxeWkpq3iKj3Z4W1OneRd +HAtBADAlID1a4r5f/BxiuNBGn5X54x66qbC94mJ2b02zHJJaRVd6OQM5iZURlcbi +N1E/LtQ3/I9qWqGYfiVCZf39ItxbrBkIEk65BbCackpDpVxzOfEbvC8RdBZcHxZm +8g4XZ6p1rCmzLi22l7usgEhd4QSMQyT9JTnMfM1QFzaqAVTqWr4ZFP108a2vH574 +T/HFKBkI+DEUsKQTLmYqZ05mg0wx80KGP/+1jOB1yx0tGnxCihGJVhqqGoFqgBSm +aqC5arQIZSUt2eN4OamakgU4iLzrKFb6bWGwTNUoHZNh4TsYz4CvFkPcM5tOyX+l +RoUyPAyfu348Z2IKBzUwYUfXJ5WFW2xq+RiOmlt4zF1Lym+aktEP6REQZYTGZZZx +l1YsvIUDd0pj5AJ3/PSTZN+VzkKz5lJdKEDEqpoOkEZnE/FL5VJHnRLOANyNf1zl +qZFgLGRZgZQwGkwj2hAF3auRJWJyvjuQW57v86F3U6XKKKejgBVb2ohMk7U6WW8B +wPtYyEa2zW1hSCLWhMEaek5Y2/2NX/dPryHNZ5XJ1UD0SGrPumN4lbErKDWGmAoK +jH6bpX/xVdmur2BwgGdqt6S1BW9B2F+cXz46UNiFKPYL49iBe13xM5EFKk9N9DL3 +HWPWrExlmi+p4PASL6cR5t9sDw8wUYp5cyC/M1RHDJPvjgBX987F17fI6GkNNToE +ZIbM6M/EuKg= -----END ENCRYPTED PRIVATE KEY----- diff --git a/test/fixtures/keys/ca3-cert.pem b/test/fixtures/keys/ca3-cert.pem index 99dbbc3096b3e3..7cc283053da2be 100644 --- a/test/fixtures/keys/ca3-cert.pem +++ b/test/fixtures/keys/ca3-cert.pem @@ -1,16 +1,16 @@ -----BEGIN CERTIFICATE----- -MIIChDCCAe2gAwIBAgIJAPrVDMagf1FtMA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV +MIIChDCCAe2gAwIBAgIJAOzJuFYnDamnMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2ExMSAwHgYJKoZIhvcNAQkB -FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODA4MDgwMTE2NTdaGA8yMjkyMDUyMjAx -MTY1N1owejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJTRjEP MA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTMx IDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDIVigurX3u6qjhxxWERDRINbd8jc9VD1GD1T5SCt1oBjeK -qyUSEV4f6KFvHuh3oKjmiJy4OvuiNMkzNxI3v32yoJHkQUchB4tlBVLec4gz+ZfO -9RpM10gPBes9nSh6LUx4myZ8Rpungw0UcZaGvrwPNZYbFWvCqUSuea4GVF20fwID -AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACbwa28NeiUG -mqw14fpmT/ZDpc/BAR8gKO8OutMZO5oKjlFjplhujFlie3Zza/hxIlztF8IdYCE/ -/BZruPB+ed9ls5I7ODH1dFw8YAhxsa4y/lNP7Cq721SH49oFZJslqj1PYmhy1q4m -XrNdd447SPkWlB1D1s9NYINmqzNEsJyU +AQUAA4GNADCBiQKBgQCZ9fF/1UcYaurFIX0QIyAJdojn9+bfsTcjEIoGbsAnQLz2 +bsZ4pqRNhZbYJApxqc+oDzZOqJOaxe8mlB5jUZ/sUA9Sp+wfWly95tkEHBMSse4x +UNJVM4vFPfOG4fv9fYGH3pcmAU1QnST4Fh+qZRzrh9wa99ltmB/U2mJEF6NriwID +AQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAM3CFiDdGEcx +07J6pm4zGX399VxPr50PID110jmX7BRAfqva+wBRhwweSxZ/QRcKe1v/FK3GE87y +RbaXhFfnPRUHoUHQMtGwmZuZcdK65Pim9RPGb7qrEJ2wlPt/C1Q6VjL/fBGqjtJM +Bq/2GR2GoBsE85jGM287hcvXV0eG5OwM -----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca3-cert.srl b/test/fixtures/keys/ca3-cert.srl index b3b7875005c3dd..c7fc41df3cd491 100644 --- a/test/fixtures/keys/ca3-cert.srl +++ b/test/fixtures/keys/ca3-cert.srl @@ -1 +1 @@ -E987DB4B683F4181 +D0082F458B6EFBE8 diff --git a/test/fixtures/keys/ca3-csr.pem b/test/fixtures/keys/ca3-csr.pem index ceeab96806a53c..2c0358727f46f7 100644 --- a/test/fixtures/keys/ca3-csr.pem +++ b/test/fixtures/keys/ca3-csr.pem @@ -2,12 +2,12 @@ MIIB3zCCAUgCAQAwejELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQH DAJTRjEPMA0GA1UECgwGSm95ZW50MRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQD DANjYTMxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMIGfMA0GCSqG -SIb3DQEBAQUAA4GNADCBiQKBgQDIVigurX3u6qjhxxWERDRINbd8jc9VD1GD1T5S -Ct1oBjeKqyUSEV4f6KFvHuh3oKjmiJy4OvuiNMkzNxI3v32yoJHkQUchB4tlBVLe -c4gz+ZfO9RpM10gPBes9nSh6LUx4myZ8Rpungw0UcZaGvrwPNZYbFWvCqUSuea4G -VF20fwIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3b3Jk -MA0GCSqGSIb3DQEBCwUAA4GBAIDV1hoEgicY9C07qhcJi1QiI0dw6IGOGANgUbXX -HCVYqQDNGfm+wuclaqp7kcMcTvZ0WY/soNeX+wsEyTGPxcjs5qQMWZoqclZqaseR -mQZ6IdITdYSngdqwL6/CyfIkHjTSyXzBikkHuM+cFpY9f6CekoZzDavyieUVcTEm -OMIp +SIb3DQEBAQUAA4GNADCBiQKBgQCZ9fF/1UcYaurFIX0QIyAJdojn9+bfsTcjEIoG +bsAnQLz2bsZ4pqRNhZbYJApxqc+oDzZOqJOaxe8mlB5jUZ/sUA9Sp+wfWly95tkE +HBMSse4xUNJVM4vFPfOG4fv9fYGH3pcmAU1QnST4Fh+qZRzrh9wa99ltmB/U2mJE +F6NriwIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3b3Jk +MA0GCSqGSIb3DQEBCwUAA4GBACeDmANyVHX/zFlz0OhqXzFw2C76/AjoNsR7cY6b +Mdl8R27MexPxkhD2IOzESxDkxFTzv+aVAz4gQIxDmdea307/P5LvRQXucAtNkAWi +2j6hB0Oq1BNKyBnevRTv28X7rhUp5OGDhRPP5lt1+PPA0zTurw+zJIaInePM//sT +7Ckh -----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/ca3-key.pem b/test/fixtures/keys/ca3-key.pem index f8be36b68e9a65..b1fe69b712fc85 100644 --- a/test/fixtures/keys/ca3-key.pem +++ b/test/fixtures/keys/ca3-key.pem @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXwIBAAKBgQDIVigurX3u6qjhxxWERDRINbd8jc9VD1GD1T5SCt1oBjeKqyUS -EV4f6KFvHuh3oKjmiJy4OvuiNMkzNxI3v32yoJHkQUchB4tlBVLec4gz+ZfO9RpM -10gPBes9nSh6LUx4myZ8Rpungw0UcZaGvrwPNZYbFWvCqUSuea4GVF20fwIDAQAB -AoGBAIm1/+UmSV0EXZbl/Tpwj+fbVQf/izgTUZtn6HEJGu046NEfmFn1KliQ1vfF -rVMeUzw1SFWz5em4k13rS1CbB1GczDcfRh03kFJrkGn8bI+3P1PXBJLjOWVC8dAE -r/guBreMN1K6O3FydQr8I9sZrYKiPB8ChoXj8pd4nRmwAbURAkEA8qSdoCTHbgZV -3O1x5CshLhD4wQAwOuEvEsTnTSW8MfULQMzlXJ7XofyqqL8GZGSRynp2GaS0Kwf3 -grSgM/XBFQJBANNdWRywZnSbvn/+eD//Y8LtwNuZZuf0rM4AmXGScxL51msetnGH -ALFrKsfh4c/MD3wYN2t3LhL+LPNsz3DufEMCQQCtMKZ5ugbHF6qNyMW0MLy8Hs0P -JU1HmZd59CWMwVR07A0eMaG83HvZWXmOfNrZKZeOSJ6naxJWbJdUKgz3SYCJAkEA -rEku1f/Dw9Efmt0lz6SxALcjuNx10STTpqc+bCDfw9v6Nx61wBw3KGceXAd3NRY0 -mQZ0RhjDaZ/drB5JiNgcWQJBAO39OvJf9L5AxnBNJ4Fvq+0OQTe51T90TG6+LG/Z -ipKhigb+V8dN6Xhwb7lGWFip1sfPmCJ0ehw9/uqGUJHLuGA= +MIICXAIBAAKBgQCZ9fF/1UcYaurFIX0QIyAJdojn9+bfsTcjEIoGbsAnQLz2bsZ4 +pqRNhZbYJApxqc+oDzZOqJOaxe8mlB5jUZ/sUA9Sp+wfWly95tkEHBMSse4xUNJV +M4vFPfOG4fv9fYGH3pcmAU1QnST4Fh+qZRzrh9wa99ltmB/U2mJEF6NriwIDAQAB +AoGAOfsmdNb0TFzPh2fiOnaP9SBf1MRGfU23DwyGfn+s+9tkjoYPVpajX9KEiWeh +S0cBPjBkamEQHYSXWPcFLrApwnaS8A3Tkp1Voas1dg9Bu3WmDzIIsmBseMgMW00C +6yETeYFtZ8/2nnpK/G7+N8eeseA63LUqg6ANw+BMH3o3dcECQQDNKW6ZfhDtn94+ +PWeXmxJWU6bm30U4othIo3iZKIswDhxVnlZhZ0mrgs0mc9c4CzTmyogvLKN0/nJF +gknvEcdrAkEAwByJR63E5Wg8OR/d0HgZAkrXVZGkGz33ZddGygrdUGvk4dfYYALB +A6/aCDc99gn4cUkzcOGOUGGEn3m38BeUYQJAUfyytChK/4sZt2m2kkFoTJNVaYHk +GcQKBs09DofDR8r7y8Ng5b/vEtlMvocghMcFtw1M6v09vS1J4Tk17pH+TQJBAJYZ +dbU4cv+e6nbjjAam3ztoSEjGK0dRqiu7AMc5p+N++WzvnVKetDnyOtNyfgnvjlrN +C9ElmnD5UIrdqjZ/5eECQHhcQsKgsWGRKPKxyf7f/sFHpkSeAEZSAPdh8ouzIdUS +xSRbK9UF+ckIop5cYjnBbmFa/BjWr4m9NcEKE8rXYxk= -----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/ca4-cert.pem b/test/fixtures/keys/ca4-cert.pem new file mode 100644 index 00000000000000..4a94c99f0c3a3b --- /dev/null +++ b/test/fixtures/keys/ca4-cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICkzCCAfygAwIBAgIJAJHwBmNgafKbMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0YxDzANBgNVBAoMBkpveWVu +dDEQMA4GA1UECwwHTm9kZS5qczEMMAoGA1UEAwwDY2EyMSAwHgYJKoZIhvcNAQkB +FhFyeUB0aW55Y2xvdWRzLm9yZzAgFw0xODExMTYxODQyMjFaGA8yMjkyMDgzMDE4 +NDIyMVowgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCU0Yx +HzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAOBgNVBAsMB05vZGUu +anMxDDAKBgNVBAMMA2NhNDEeMBwGCSqGSIb3DQEJARYPY2E0QGV4YW1wbGUub3Jn +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDC1M2aGVYsmrBiut1n0nfTU+9v +TNVdAmKQBjnNsv3IIch/PPaEOIEm7dFhgdk86Z+wVCN3sAKu54Bz4JDKdPsFGvDy +18JGuGH1vIVW5285IW7fMrzvAdZtETeBAiPM10Q69ddB4M6FbLiF273ZqCJ+vSsw +kl5Dkas8YTZ0uwqKjQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB +CwUAA4GBAGDMGSbPg/B4OripSxT2scXFIwoej47PW1byJgWaGoMJ8zgKUoKE7Z7A +aWQbD22In05F0kBllqpSJWEZpTuVFsyyLeb3R7cuGQWs/puaaPul7sx+PRGhwxYe +nrNIGtsaBf8TO/kb5lMiXWbhM5gZbBtbMMv3xWA4FxqU0AgfO3jM +-----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca4-cert.srl b/test/fixtures/keys/ca4-cert.srl new file mode 100644 index 00000000000000..328d9048a36464 --- /dev/null +++ b/test/fixtures/keys/ca4-cert.srl @@ -0,0 +1 @@ +ECAF33A18C6435BA diff --git a/test/fixtures/keys/ca4-csr.pem b/test/fixtures/keys/ca4-csr.pem new file mode 100644 index 00000000000000..0e6a0393843b27 --- /dev/null +++ b/test/fixtures/keys/ca4-csr.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIB7jCCAVcCAQAwgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UE +BwwCU0YxHzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAOBgNVBAsM +B05vZGUuanMxDDAKBgNVBAMMA2NhNDEeMBwGCSqGSIb3DQEJARYPY2E0QGV4YW1w +bGUub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDC1M2aGVYsmrBiut1n +0nfTU+9vTNVdAmKQBjnNsv3IIch/PPaEOIEm7dFhgdk86Z+wVCN3sAKu54Bz4JDK +dPsFGvDy18JGuGH1vIVW5285IW7fMrzvAdZtETeBAiPM10Q69ddB4M6FbLiF273Z +qCJ+vSswkl5Dkas8YTZ0uwqKjQIDAQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hh +bGxlbmdlIHBhc3N3b3JkMA0GCSqGSIb3DQEBCwUAA4GBAJoKIMOK0sCoXAa/cCaJ +oTYLHee1aJBWmt8XTUqREdFIIAjjrgY0/ZGEeA9OEczbFgSTMPXemir4Ks3ib3kr +MeJkOWSUgKL2gdV4jPZIUEdeTYaMQ5utiTvL2oKN4R51mSNg5ZEFIf+vZpK6UTpR +LCERUC79Hsj13NrHK2Lf8jhy +-----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/ca4-key.pem b/test/fixtures/keys/ca4-key.pem new file mode 100644 index 00000000000000..90d595bce5b50e --- /dev/null +++ b/test/fixtures/keys/ca4-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDC1M2aGVYsmrBiut1n0nfTU+9vTNVdAmKQBjnNsv3IIch/PPaE +OIEm7dFhgdk86Z+wVCN3sAKu54Bz4JDKdPsFGvDy18JGuGH1vIVW5285IW7fMrzv +AdZtETeBAiPM10Q69ddB4M6FbLiF273ZqCJ+vSswkl5Dkas8YTZ0uwqKjQIDAQAB +AoGALnr8Tf4ra9q/p94ywfkZMyZ8Ic5vvI+8GeYSVjuUhfFhVtGhcivUzAfCgwOq +YvjNaxC3oW8xRK7gG0UA5fwAgm24RkwazqYgcT2OTqoffRhd3lmyOUcR7fWB6FAN +p7mx9ctW83HBPCwc7SIFaWxMULi3O38A7jXMMJrjIzhEsVUCQQDiKJF8sE6Ep7cr +ARDcWxKP5INa7+UdsPdpR+wKxdrReQuhIF5V0hA6QbyCsNpqhqrO7e4El194qCMk +NfYnz1nPAkEA3IoHlwMOquisd6/KcurFbUHguKH6CWzpxRU6QfLqUkNf+MPPozU1 +qYOm7nukWyJq+dDt5hrmaSuZny6I9zWY4wJBALcq8kJRrRZFm9VppJVD8bG2+ygw +uZkllgyf4q4K9yHG7sNOKvlJDDmSujIDOLMkZLz5+VegngNj8ipGxhoSFwMCQGwv +VdvRhx919izcUk6fNmwLVgachsCa6e5hJGv3ktT58hlhTPk9/+4BBCGXC6AdOScF +Q76OUZsj5T8+H7hNVYsCQCahB/XNbok2MgfB8ABdqVPcAOMLtaGZH4gbE2M3p/Fh +Y6BHQ25FT3LPKEzU89XJuyRoxea3CXqioJngt3JxN1I= +-----END RSA PRIVATE KEY----- diff --git a/test/fixtures/keys/ca4.cnf b/test/fixtures/keys/ca4.cnf new file mode 100644 index 00000000000000..9081594e5c69bd --- /dev/null +++ b/test/fixtures/keys/ca4.cnf @@ -0,0 +1,23 @@ +[ req ] +default_bits = 1024 +days = 9999 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no +output_password = password +x509_extensions = v3_ca + +[ req_distinguished_name ] +C = US +ST = CA +L = SF +O = The Node.js Foundation +OU = Node.js +CN = ca4 +emailAddress = ca4@example.org + +[ req_attributes ] +challengePassword = A challenge password + +[ v3_ca ] +basicConstraints = CA:TRUE diff --git a/test/fixtures/keys/ca5-cert.pem b/test/fixtures/keys/ca5-cert.pem new file mode 100644 index 00000000000000..ef42f5bf92f668 --- /dev/null +++ b/test/fixtures/keys/ca5-cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICHDCCAcGgAwIBAgIJANUB/0ZUgBZhMAoGCCqGSM49BAMCMIGIMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMR8wHQYDVQQKDBZUaGUgTm9k +ZS5qcyBGb3VuZGF0aW9uMRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTUx +HjAcBgkqhkiG9w0BCQEWD2NhNUBleGFtcGxlLm9yZzAgFw0xODExMTYxODQyMjFa +GA8yMjkyMDgzMDE4NDIyMVowgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEL +MAkGA1UEBwwCU0YxHzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAO +BgNVBAsMB05vZGUuanMxDDAKBgNVBAMMA2NhNTEeMBwGCSqGSIb3DQEJARYPY2E1 +QGV4YW1wbGUub3JnMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6qDnQ6qm6hN+ +zbym76EK+spOKstEmqj9WzdA/tRBHhzZijXq1l90yQmRfmgclAKZw843qzMfj8Vj +RMRXdZyyYKMQMA4wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNJADBGAiEA4nCM +yQUkViSEvBeL3cLzRnak68tXTIkdRMekRFgdsOMCIQDFnkeCyB4S9u2gz1u/syEq +usBaxJpZkN5nyTLapTQGqA== +-----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca5-cert.srl b/test/fixtures/keys/ca5-cert.srl new file mode 100644 index 00000000000000..345399f1fb6859 --- /dev/null +++ b/test/fixtures/keys/ca5-cert.srl @@ -0,0 +1 @@ +C4C2054438388E3E diff --git a/test/fixtures/keys/ca5-csr.pem b/test/fixtures/keys/ca5-csr.pem new file mode 100644 index 00000000000000..a1f77c72a4e1a0 --- /dev/null +++ b/test/fixtures/keys/ca5-csr.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBaTCCARACAQAwgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UE +BwwCU0YxHzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAOBgNVBAsM +B05vZGUuanMxDDAKBgNVBAMMA2NhNTEeMBwGCSqGSIb3DQEJARYPY2E1QGV4YW1w +bGUub3JnMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6qDnQ6qm6hN+zbym76EK ++spOKstEmqj9WzdA/tRBHhzZijXq1l90yQmRfmgclAKZw843qzMfj8VjRMRXdZyy +YKAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBwYXNzd29yZDAKBggqhkjO +PQQDAgNHADBEAiABtQaxoQqAdrK8rjMh4wPB14/+uxMtJ7mY+QwJ411XywIgERcz +HrcyJDqk2CS8B9mHwzD+ERUZ1CgThc15bnBleN0= +-----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/ca5-key.pem b/test/fixtures/keys/ca5-key.pem new file mode 100644 index 00000000000000..c213e03beadcf4 --- /dev/null +++ b/test/fixtures/keys/ca5-key.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINQRYMZO9+WwFZsKDa03DHkQfraKyJ3EcAfYkgtyYtX3oAoGCCqGSM49 +AwEHoUQDQgAE6qDnQ6qm6hN+zbym76EK+spOKstEmqj9WzdA/tRBHhzZijXq1l90 +yQmRfmgclAKZw843qzMfj8VjRMRXdZyyYA== +-----END EC PRIVATE KEY----- diff --git a/test/fixtures/keys/ca5.cnf b/test/fixtures/keys/ca5.cnf new file mode 100644 index 00000000000000..f1efb3311a0abd --- /dev/null +++ b/test/fixtures/keys/ca5.cnf @@ -0,0 +1,35 @@ +[ ca ] +default_ca = CA_default + +[ CA_default ] +serial = ca5-serial +crl = ca5-crl.pem +database = ca5-database.txt +name_opt = CA_default +cert_opt = CA_default +default_crl_days = 999 +default_md = sha512 +x509_extensions = v3_ca + + +[ req ] +days = 9999 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no +output_password = password + +[ req_distinguished_name ] +C = US +ST = CA +L = SF +O = The Node.js Foundation +OU = Node.js +CN = ca5 +emailAddress = ca5@example.org + +[ req_attributes ] +challengePassword = A challenge password + +[ v3_ca ] +basicConstraints = CA:TRUE diff --git a/test/fixtures/keys/ca6-cert.pem b/test/fixtures/keys/ca6-cert.pem new file mode 100644 index 00000000000000..a6d2c1fbd2978b --- /dev/null +++ b/test/fixtures/keys/ca6-cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICGzCCAcGgAwIBAgIJAMTCBUQ4OI4+MAoGCCqGSM49BAMCMIGIMQswCQYDVQQG +EwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNGMR8wHQYDVQQKDBZUaGUgTm9k +ZS5qcyBGb3VuZGF0aW9uMRAwDgYDVQQLDAdOb2RlLmpzMQwwCgYDVQQDDANjYTUx +HjAcBgkqhkiG9w0BCQEWD2NhNUBleGFtcGxlLm9yZzAgFw0xODExMTYxODQyMjFa +GA8yMjkyMDgzMDE4NDIyMVowgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEL +MAkGA1UEBwwCU0YxHzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAO +BgNVBAsMB05vZGUuanMxDDAKBgNVBAMMA2NhNjEeMBwGCSqGSIb3DQEJARYPY2E2 +QGV4YW1wbGUub3JnMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEa7HfEgyVTPWY +ku9cWGRSym5OdB7zqFihL8+k93EfWViJph72fJH3sOZypUgDXS/sEyUaLhbxtLYz +sMbECzEDwaMQMA4wDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEA+NIP +zuqh2e3/59QndyPqRH2CZ4V4ipU6rf6ZZmwPApUCIBMABWesJfwdrETIjN6dT8gc +STrYyR4ovD8Aofubqjd0 +-----END CERTIFICATE----- diff --git a/test/fixtures/keys/ca6-cert.srl b/test/fixtures/keys/ca6-cert.srl new file mode 100644 index 00000000000000..422681ae4a1a4b --- /dev/null +++ b/test/fixtures/keys/ca6-cert.srl @@ -0,0 +1 @@ +A97535039C5E962B diff --git a/test/fixtures/keys/ca6-csr.pem b/test/fixtures/keys/ca6-csr.pem new file mode 100644 index 00000000000000..c12e008f533a87 --- /dev/null +++ b/test/fixtures/keys/ca6-csr.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBaTCCARACAQAwgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UE +BwwCU0YxHzAdBgNVBAoMFlRoZSBOb2RlLmpzIEZvdW5kYXRpb24xEDAOBgNVBAsM +B05vZGUuanMxDDAKBgNVBAMMA2NhNjEeMBwGCSqGSIb3DQEJARYPY2E2QGV4YW1w +bGUub3JnMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEa7HfEgyVTPWYku9cWGRS +ym5OdB7zqFihL8+k93EfWViJph72fJH3sOZypUgDXS/sEyUaLhbxtLYzsMbECzED +waAlMCMGCSqGSIb3DQEJBzEWDBRBIGNoYWxsZW5nZSBwYXNzd29yZDAKBggqhkjO +PQQDAgNHADBEAiAH69eeaDguTPAqGhWJbhFPEw7zXyZl6TgxoMIeZOouRgIge+Ft +kXO05md30kbq6s559B45rYoH4iHxFOJZqHso7Yc= +-----END CERTIFICATE REQUEST----- diff --git a/test/fixtures/keys/ca6-key.pem b/test/fixtures/keys/ca6-key.pem new file mode 100644 index 00000000000000..bb80dd3af4990b --- /dev/null +++ b/test/fixtures/keys/ca6-key.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFbxtF4Zc09n/2w7z5SMQLFNTdxg4QPSm1WgyffHtJFIoAoGCCqGSM49 +AwEHoUQDQgAEa7HfEgyVTPWYku9cWGRSym5OdB7zqFihL8+k93EfWViJph72fJH3 +sOZypUgDXS/sEyUaLhbxtLYzsMbECzEDwQ== +-----END EC PRIVATE KEY----- diff --git a/test/fixtures/keys/ca6.cnf b/test/fixtures/keys/ca6.cnf new file mode 100644 index 00000000000000..314761509600a0 --- /dev/null +++ b/test/fixtures/keys/ca6.cnf @@ -0,0 +1,22 @@ +[ req ] +days = 9999 +distinguished_name = req_distinguished_name +attributes = req_attributes +prompt = no +output_password = password +x509_extensions = v3_ca + +[ req_distinguished_name ] +C = US +ST = CA +L = SF +O = The Node.js Foundation +OU = Node.js +CN = ca6 +emailAddress = ca6@example.org + +[ req_attributes ] +challengePassword = A challenge password + +[ v3_ca ] +basicConstraints = CA:TRUE diff --git a/test/fixtures/keys/dh1024.pem b/test/fixtures/keys/dh1024.pem index 2ceb5d97765800..67c8cbc9231718 100644 --- a/test/fixtures/keys/dh1024.pem +++ b/test/fixtures/keys/dh1024.pem @@ -1,5 +1,5 @@ -----BEGIN DH PARAMETERS----- -MIGHAoGBANbhtynvkH1sZ2K9dLEyZ3keteaBUab1GvFeCgJV9akoxmtjSuD9o6bS -pD+y+GstQb1WqiPICSraJs+uX1NNzxYQTFz3Ur0vR20RN6i3aJaldnWl+HitRlfa -iEA2DUoPISmOFsrzPQdfdRh6tTYZYGbjElA5KukUsMtMRaTIDSIjAgEC +MIGHAoGBAOJ2igPYPdXULPSXaeR40pdGRdQmiWchzxDbzExdaJ4Q/landa7K9jfj +KNV2heMpFoXa6+GkCxXSli+99j0W/ARK1nnZ9YaB42sp3g2oTmMevWyk9hfZTTUC +Pc3AyioJGTQV/5wqYPdSNAu5KdHFZkP26EhbGgnDZ2hg5vFQT6EjAgEC -----END DH PARAMETERS----- diff --git a/test/fixtures/keys/dh2048.pem b/test/fixtures/keys/dh2048.pem index baeb28f3a168c9..cece692e241b28 100644 --- a/test/fixtures/keys/dh2048.pem +++ b/test/fixtures/keys/dh2048.pem @@ -1,8 +1,8 @@ -----BEGIN DH PARAMETERS----- -MIIBCAKCAQEAoKS3RTOlvieMbectTsczMWgZwvO6frAZkIXR+GLI8SKfsr21Xyr6 -5p8YqT5wWpEUhpEAasOxEaOhqQ6qUGWOrxtacqE+HiuM5wTuZs31UGslgLdBDwqx -XF3rRV9DBiNNRhzUlytuVnBNoh2F4YgXxl0OZ4EhldN3VAhQy+3bbI9hCt36uuwE -iGV1i1PEMk0UTZrYKKuZwpaahqznmLQN6Dbg3E5RtmvSjlgQQ8WAse37/CAUiGTx -QLFl2CKUJfEYMQKjlasZ2fPSTTM4VDJByixynzzHQ/YxPRAYCQ/HejbjegaI0b3F -pcMjtKtKYghGRnIo2cb/yj8p9RQyB0TluwIBAg== +MIIBCAKCAQEA+/OlXG2eqOsd9oA6Rg9KDbU22adIXuuwSaVLiUFNIc4WYnzPuyd0 +WcLajZzhXoUpN6GCLqXE+jBphHTh+xx6Y0ztlMldx0mnrLzacd236LCrTX5smojO +CQ3BFmbDn7naG2famOZXF3gLRkcAmUtHrn2hYRbEk+1+GD3yXUm/JgFcnAX2HUQa +b4sDL5NHMJ61+qE65qIIht9jOVovl4b7yOoyDu+JrheV0XBrc8WU03AGKcJnjW6i +YqKXQlpamVvL/QqWfhg3SztBxYADAURePTUmS1H1FTnxSdRoUK9ZwKoTeZFL6krT +3HK76Y0HXhwtjk3aXKTJyEDDLdYaltOCOwIBAg== -----END DH PARAMETERS----- diff --git a/test/fixtures/keys/dh512.pem b/test/fixtures/keys/dh512.pem index de17bcc3c796df..713076ee2ffba6 100644 --- a/test/fixtures/keys/dh512.pem +++ b/test/fixtures/keys/dh512.pem @@ -1,4 +1,4 @@ -----BEGIN DH PARAMETERS----- -MEYCQQCyJYaQNCz0LyNQXKPNKZMq4pcvSNlxZvNLLtdixaA2SYj4nbIxOSths0Nu -ao2AsGzSfAAtMUn1WEKE4VIxzW0rAgEC +MEYCQQDItkdipTrinQp7aKt0GtwY7QE6tMKpg+r1zeucMrq9uNp8uLhHkF1OtqnL +StFTzxQIkjN2s8exIvoWZWiy/9DTAgEC -----END DH PARAMETERS----- diff --git a/test/fixtures/keys/dns-cert1.cnf b/test/fixtures/keys/dns-cert1.cnf new file mode 100644 index 0000000000000000000000000000000000000000..44ce3992f4b7933ea13facd4172a6cb56bd29947 GIT binary patch literal 565 zcmY*V%WlIU5bT++*dM5shbuJ)q+02v7b{YaQG{^3wTUpeW}PN~U%-#VaDd&J-JP8y z>@!i~kL)$UiJfhG7kDEyPFdrCL&z|8gbsf_J~Bn2$id@qSg$rIE9Lz;JK-F5{;*Ox zQl{#atFaVDHW&#!v=*)}E_kMxW|F8=MNhcwHZUI`YdhPtG>w^G4#u+E+iLf`$%t~e zZiOGn!qBHhr{WnOR$l1x`|tCKxOh3>Rq5nxo6#!qP#IjUrPgRFJV@vMY*#Ldy~!EO z6lh0I=rm~c9Y%XHO?mK*!-v#^S?|py(x;wFPkF!AtMxRT@h* dc2V@#Ar`$S@iHF3j3NN0=j%#?*$DiuoG9ZQq(&OMwCEC!2p&@sAzswREQoHAc6og9SweJ<_S>Ihp;J z{UoFNk4fp`0(!O;>-_4RBDrc#+5kt7V!t4Hi(wfP)aX)4a)B7E((!(z!$=>BY8r{LTHEGZeOhR-Q`UIMeeP#dQ3nBrIeWX$hEqx4`51dqv@LD@t51uG=R4KYzJ@EfA26Gavv$bwyb7|M%M260V4xi_P8LGaxNI$=dKRJrogd>^dLET?ssfsaEN{fA*JLvX9CIDPBBBP-SOIS&T8r9%{IR{Z5WH>RMNLc}3mcD@^LzS!dLNgU~J ze?3IfCVH3`QI3?KDQyAon(G5c)!SkqzL9EFcgZx7UN}@Tt$II!d-w8Y)$sk#@UX=w z$aGlt=LjHUooDoWxj_aLY#iR3Ws!PMrFLA5lGosDT6lgH7I-9|R!GlwikTv8Q=HJ* z^EkCJB`_lf2`Yw2hW8Bt2^BFG1Qg%!(`&=$bbQD2`yMkAu567{Uvw}rFd;Ar1_dh) s0|FWa00b0tQIU_%n%Je62`c7Z%EMaO6H^ET2(SH0gCSX5Gy(z$0DcCXJ^%m! delta 866 zcmV-o1D*Wt2kr-uU4KrE>rc{y_%8wi2mpYB0!YSn1K?1R2!b%i?Be5Ew2mhbxT>eE zjQ5rZaj9@XR{gbmcH+@e*h8>WI3V5>G=xxi%c*l1^e?UwO`<5K!RnG!zo)fp2gxK) zsBPPY^~b00Np@Pse#@pZ;{@<6~`+v0w-j#JM-*JCfWh9^AJLp8h<;Y!s}0MiURsLV;Cj;D<0qal1nPp>GsRBD?l=f_L0(Ob8fWj!X5H2 zbS8EWQh+?ALm0e>91_ASvjd7!gHLb&a#LXHtTqq$QqcIDj^3l|#`m*{Y;aK`{0^Z& zz0^tgIth!}YhrVmoZV`?uwsc0luuXgV8qN%s+;>=X^>~VxOOQUSEarz@3pYG39BLjZ5hi}-!>&-W-D~Q zD_tX^weRBFlC#NkL6eO-Nvkg9H12w*b83#rZuYDYa{u&T;^GuzsyYuQoq`*sM>c>5 zbtgVCB`_lf2`Yw2hW8Bt2^BFG1QZboKZ~lGhBa-HkOtFH0?WH%Z!$13Fd;Ar1_dh) s0|FWa00b1{6!<`zq9`HwFnRhDe6@ z4FLxRpn?Y|FoFjp0s#Opf(IQ22`Yw2hW8Bt2LUh~1_~;MNQUS9cTbvm1VrU0>TW6`LThKfR))q}W9CdVQ zN{^@cDbQ4LdkGmjzSTVNQiqmWe+HhL0;FHBo*kk64z zawAbp!bH;mNHuUq9v@^NBjksAn9P`jf`I$F$#(iQGDA{U#N#fhWH%>Qww>S0RQkZ0 zkk%C~tI1m49606Cf53#%zsWbT7LqxSS97A}d=Wh2D zrloD(rBs(E72AbhFh%BzT8%E@CmPdjtytI9qNK_y0mh)Yt)4TV%9D4CIM+)i(j z-#I=4!f>t$ zhtV*JzDV&P8=Xx1g|aE0?@E{-KpM`Y&JDVA4v0uAvkM26XxBzXAN*Q5KPvFWN5V0? zh45JBA-%dQ6(s*16W~QbmG|6Kg9Z}Bwy~>=CI|vh0q#8C19Ud0nj;rj=~;#e@{a9DY12Tj3fSZq#dwFT~t!%!~_&zt;uRddfl zSBZICT_W(R@$%>a4|#^Ub!~V2ra>fjis_Xc047n8p+(Xh_5|b1@bIgPF7~7J*|%#GBy#B2_$I|mrC^l z<{4}IhgvZU8CAN7SbcB_b*}XJ2Q0`r)7Oa4Ei!XQp&2x$2Zi_RgFQ0?gtboi?>MrL7tOkog#OObtK}4Mb1+IT&lgvKg zkkuP_pWQd8&l|qJDb05k_oAjVHPm6si=&k1m^17L@{J7siVAeZ*N&@Ix6|_Twg&RY zuf|9CCLb39R+CC_m4%!d$7GVrc_P!>Uz@c~R2gC_xOEt==%#21en%GTsO#ihVy;|sx@E&l+2=_`rf$hz z8ttj<(qCG*jT%9 z?Uc!HYU2u1f$U~4R_O8#z*3Tz%eTfm>@%BdpQjbZ_Z6rZWGbp(Y^+_C0;wq&)L(hd zd~;%N(6a(8XMc*qk@`67v@O8qoOd?R>2792GhRpP5m``S6Fi#n(mke;;8+E3<`pEF zX~(?&cc9RwS9WDADKC7B(PHy;ZVKVTAeVKsS1qCD+eeN*EBD|tMuyY_hMdmS7$TGM zkKP9O!s}m$u&5=pi*ZQaE}Dp|kQY&v5+%@ImWFf|QA^YhYrZ%tF=MSW0Ph02?=L_x z|D2Im{d{P1Ri)Sw^(@X$%^${D`|GIFjo%fM>7n9~Pi-$j94i}25obBxV$y)#q*g=Y z@?foXbpCmVV8M8ZV1dPt!Y@vy_wnv6_Ru*#n@UScx_ z<;`1*yO+|mSI~Ttx)K!uB1d8q(gx;f#wFuV=;5Ogdlxyf(N{uU)dj`bmJOl*6QbE| z8|wqi+bAPZ8QkHc2ZS`3-z4QTi>(2qB~J|J23_6~F$qvaHC}d1WY@G#y@5XF12%@7 zvkcK~%cv(_IAktkuj3#s^J9M3gTeLlgKGSZXK{kBp-iHHexMohr|#Z13K$p_kDQGf z9__VH2x=e)y*l_*k;L_@0IEjMFoFRB1_>&LNQU zK)=O9G_{fuJZWeUKSr$wJMCK#pGa5UhX=RmHx9~cIZUZBB`_lf2`Yw2hW8Bt2^BFG z1Qe!OrCNQtr4d@PGE7T3B6%a*rSLE@Fd;Ar1_dh)0|FWa00a~XG= Date: Mon, 28 Nov 2016 11:55:29 -0800 Subject: [PATCH 022/316] test: cover tls multi-identity option mixtures Prove that cert and key options do not have to be ordered, and that the pfx option can be used at the same time as the cert/key option (which was claimed to be impossible by some pre-existing documentation). PR-URL: https://github.com/nodejs/node/pull/24374 Reviewed-By: Daniel Bevenius Reviewed-By: Ben Noordhuis Reviewed-By: Franziska Hinkelmann --- test/parallel/test-tls-multi-key.js | 176 +++++++++++++++++++++++----- 1 file changed, 146 insertions(+), 30 deletions(-) diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js index 8c0722f858c748..8ccc0d32d93757 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); + +// Test multi-identity ('key')/multi-algorithm scenarios. + if (!common.hasCrypto) common.skip('missing crypto'); @@ -28,45 +31,158 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const tls = require('tls'); -const options = { +// Key is ordered as ec, rsa, cert is ordered as rsa, ec. +test({ key: [ - fixtures.readKey('ec-key.pem'), + fixtures.readKey('ec10-key.pem'), + fixtures.readKey('agent1-key.pem'), + ], + cert: [ + fixtures.readKey('agent1-cert.pem'), + fixtures.readKey('ec10-cert.pem'), + ], + eccCN: 'agent10.example.com', + client: { ca: [ + fixtures.readKey('ca5-cert.pem'), + fixtures.readKey('ca1-cert.pem'), + ] }, +}); + +// Key and cert are ordered as ec, rsa. +test({ + key: [ + fixtures.readKey('ec10-key.pem'), fixtures.readKey('agent1-key.pem'), ], cert: [ fixtures.readKey('agent1-cert.pem'), + fixtures.readKey('ec10-cert.pem'), + ], + eccCN: 'agent10.example.com', + client: { ca: [ + fixtures.readKey('ca5-cert.pem'), + fixtures.readKey('ca1-cert.pem'), + ] }, +}); + +// Key, cert, and pfx options can be used simultaneously. +test({ + key: [ + fixtures.readKey('ec-key.pem'), + ], + cert: [ fixtures.readKey('ec-cert.pem'), - ] -}; + ], + pfx: fixtures.readKey('agent1.pfx'), + passphrase: 'sample', + client: { ca: [ + fixtures.readKey('ec-cert.pem'), + fixtures.readKey('ca1-cert.pem'), + ] }, +}); -const ciphers = []; +// Key and cert with mixed algorithms, and cert chains with intermediate CAs +test({ + key: [ + fixtures.readKey('ec10-key.pem'), + fixtures.readKey('agent10-key.pem'), + ], + cert: [ + fixtures.readKey('agent10-cert.pem'), + fixtures.readKey('ec10-cert.pem'), + ], + rsaCN: 'agent10.example.com', + eccCN: 'agent10.example.com', + client: { ca: [ + fixtures.readKey('ca2-cert.pem'), + fixtures.readKey('ca5-cert.pem'), + ] }, +}); + +// Key and cert with mixed algorithms, and cert chains with intermediate CAs, +// using PFX for EC. +test({ + key: [ + fixtures.readKey('agent10-key.pem'), + ], + cert: [ + fixtures.readKey('agent10-cert.pem'), + ], + pfx: fixtures.readKey('ec10.pfx'), + passphrase: 'sample', + rsaCN: 'agent10.example.com', + eccCN: 'agent10.example.com', + client: { ca: [ + fixtures.readKey('ca2-cert.pem'), + fixtures.readKey('ca5-cert.pem'), + ] }, +}); + +// Key and cert with mixed algorithms, and cert chains with intermediate CAs, +// using PFX for RSA. +test({ + key: [ + fixtures.readKey('ec10-key.pem'), + ], + cert: [ + fixtures.readKey('ec10-cert.pem'), + ], + pfx: fixtures.readKey('agent10.pfx'), + passphrase: 'sample', + rsaCN: 'agent10.example.com', + eccCN: 'agent10.example.com', + client: { ca: [ + fixtures.readKey('ca2-cert.pem'), + fixtures.readKey('ca5-cert.pem'), + ] }, +}); + +function test(options) { + const rsaCN = options.rsaCN || 'agent1'; + const eccCN = options.eccCN || 'agent2'; + const clientTrustRoots = options.client.ca; + delete options.rsaCN; + delete options.eccCN; + delete options.client; + const server = tls.createServer(options, function(conn) { + conn.end('ok'); + }).listen(0, common.mustCall(connectWithEcdsa)); -const server = tls.createServer(options, function(conn) { - conn.end('ok'); -}).listen(0, function() { - const ecdsa = tls.connect(this.address().port, { - ciphers: 'ECDHE-ECDSA-AES256-GCM-SHA384', - rejectUnauthorized: false - }, function() { - ciphers.push(ecdsa.getCipher()); + function connectWithEcdsa() { + const ecdsa = tls.connect(this.address().port, { + ciphers: 'ECDHE-ECDSA-AES256-GCM-SHA384', + rejectUnauthorized: true, + ca: clientTrustRoots, + checkServerIdentity: (_, c) => assert.strictEqual(c.subject.CN, eccCN), + }, common.mustCall(function() { + assert.deepStrictEqual(ecdsa.getCipher(), { + name: 'ECDHE-ECDSA-AES256-GCM-SHA384', + version: 'TLSv1/SSLv3' + }); + assert.strictEqual(ecdsa.getPeerCertificate().subject.CN, eccCN); + // XXX(sam) certs don't currently include EC key info, so depend on + // absence of RSA key info to indicate key is EC. + assert(!ecdsa.getPeerCertificate().exponent, 'not cert for an RSA key'); + ecdsa.end(); + connectWithRsa(); + })); + } + + function connectWithRsa() { const rsa = tls.connect(server.address().port, { ciphers: 'ECDHE-RSA-AES256-GCM-SHA384', - rejectUnauthorized: false - }, function() { - ciphers.push(rsa.getCipher()); - ecdsa.end(); + rejectUnauthorized: true, + ca: clientTrustRoots, + checkServerIdentity: (_, c) => assert.strictEqual(c.subject.CN, rsaCN), + }, common.mustCall(function() { + assert.deepStrictEqual(rsa.getCipher(), { + name: 'ECDHE-RSA-AES256-GCM-SHA384', + version: 'TLSv1/SSLv3' + }); + assert.strictEqual(rsa.getPeerCertificate().subject.CN, rsaCN); + assert(rsa.getPeerCertificate().exponent, 'cert for an RSA key'); rsa.end(); server.close(); - }); - }); -}); - -process.on('exit', function() { - assert.deepStrictEqual(ciphers, [{ - name: 'ECDHE-ECDSA-AES256-GCM-SHA384', - version: 'TLSv1/SSLv3' - }, { - name: 'ECDHE-RSA-AES256-GCM-SHA384', - version: 'TLSv1/SSLv3' - }]); -}); + })); + } +} From 92f826622bbdcec403f8c8532c4477a373cc1c6c Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Mon, 28 Nov 2016 15:52:08 -0800 Subject: [PATCH 023/316] test: confirm tls server suite default is its own When honorCipherOrder is not explicitly set, it defaults to true, cover this condition in the test. Also, run all tests in parallel, instead of sequentially. PR-URL: https://github.com/nodejs/node/pull/24374 Reviewed-By: Daniel Bevenius Reviewed-By: Ben Noordhuis Reviewed-By: Franziska Hinkelmann --- test/parallel/test-tls-honorcipherorder.js | 101 ++++++++++----------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index 60029bb4bd64b8..8e7c4badcb269d 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -1,41 +1,38 @@ 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); + +// Test the honorCipherOrder property + if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); +const mustCall = common.mustCall; const tls = require('tls'); - -let nconns = 0; +const util = require('util'); // We explicitly set TLS version to 1.2 so as to be safe when the // default method is updated in the future const SSL_Method = 'TLSv1_2_method'; const localhost = '127.0.0.1'; -process.on('exit', function() { - assert.strictEqual(nconns, 6); -}); - -function test(honorCipherOrder, clientCipher, expectedCipher, cb) { +function test(honorCipherOrder, clientCipher, expectedCipher, defaultCiphers) { const soptions = { secureProtocol: SSL_Method, key: fixtures.readKey('agent2-key.pem'), cert: fixtures.readKey('agent2-cert.pem'), ciphers: 'AES256-SHA256:AES128-GCM-SHA256:AES128-SHA256:' + 'ECDHE-RSA-AES128-GCM-SHA256', - honorCipherOrder: !!honorCipherOrder + honorCipherOrder: honorCipherOrder, }; - const server = tls.createServer(soptions, function(cleartextStream) { - nconns++; - + const server = tls.createServer(soptions, mustCall(function(clearTextStream) { // End socket to send CLOSE_NOTIFY and TCP FIN packet, otherwise // it may hang for ~30 seconds in FIN_WAIT_1 state (at least on OSX). - cleartextStream.end(); - }); - server.listen(0, localhost, function() { + clearTextStream.end(); + })); + server.listen(0, localhost, mustCall(function() { const coptions = { rejectUnauthorized: false, secureProtocol: SSL_Method @@ -44,54 +41,50 @@ function test(honorCipherOrder, clientCipher, expectedCipher, cb) { coptions.ciphers = clientCipher; } const port = this.address().port; - const client = tls.connect(port, localhost, coptions, function() { + const savedDefaults = tls.DEFAULT_CIPHERS; + tls.DEFAULT_CIPHERS = defaultCiphers || savedDefaults; + const client = tls.connect(port, localhost, coptions, mustCall(function() { const cipher = client.getCipher(); client.end(); server.close(); - assert.strictEqual(cipher.name, expectedCipher); - if (cb) cb(); - }); - }); + const msg = util.format( + 'honorCipherOrder=%j, clientCipher=%j, expect=%j, got=%j', + honorCipherOrder, clientCipher, expectedCipher, cipher.name); + assert.strictEqual(cipher.name, expectedCipher, msg); + })); + tls.DEFAULT_CIPHERS = savedDefaults; + })); } -test1(); - -function test1() { - // Client has the preference of cipher suites by default - test(false, 'AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256', - 'AES128-GCM-SHA256', test2); -} +// Client explicitly has the preference of cipher suites, not the default. +test(false, 'AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256', + 'AES128-GCM-SHA256'); -function test2() { - // Server has the preference of cipher suites, and AES256-SHA256 is - // the server's top choice. - test(true, 'AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256', - 'AES256-SHA256', test3); -} +// Server has the preference of cipher suites, and AES256-SHA256 is +// the server's top choice. +test(true, 'AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256', + 'AES256-SHA256'); +test(undefined, 'AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256', + 'AES256-SHA256'); -function test3() { - // Server has the preference of cipher suites. AES128-GCM-SHA256 is given - // higher priority over AES128-SHA256 among client cipher suites. - test(true, 'AES128-SHA256:AES128-GCM-SHA256', 'AES128-GCM-SHA256', test4); +// Server has the preference of cipher suites. AES128-GCM-SHA256 is given +// higher priority over AES128-SHA256 among client cipher suites. +test(true, 'AES128-SHA256:AES128-GCM-SHA256', 'AES128-GCM-SHA256'); +test(undefined, 'AES128-SHA256:AES128-GCM-SHA256', 'AES128-GCM-SHA256'); -} -function test4() { - // As client has only one cipher, server has no choice, irrespective - // of honorCipherOrder. - test(true, 'AES128-SHA256', 'AES128-SHA256', test5); -} +// As client has only one cipher, server has no choice, irrespective +// of honorCipherOrder. +test(true, 'AES128-SHA256', 'AES128-SHA256'); +test(undefined, 'AES128-SHA256', 'AES128-SHA256'); -function test5() { - // Client did not explicitly set ciphers and client offers - // tls.DEFAULT_CIPHERS. All ciphers of the server are included in the - // default list so the negotiated cipher is selected according to the - // server's top preference of AES256-SHA256. - test(true, null, 'AES256-SHA256', test6); -} +// Client did not explicitly set ciphers and client offers +// tls.DEFAULT_CIPHERS. All ciphers of the server are included in the +// default list so the negotiated cipher is selected according to the +// server's top preference of AES256-SHA256. +test(true, tls.DEFAULT_CIPHERS, 'AES256-SHA256'); +test(true, null, 'AES256-SHA256'); +test(undefined, null, 'AES256-SHA256'); -function test6() { - // Ensure that `tls.DEFAULT_CIPHERS` is used - tls.DEFAULT_CIPHERS = 'ECDHE-RSA-AES128-GCM-SHA256'; - test(true, null, 'ECDHE-RSA-AES128-GCM-SHA256'); -} +// Ensure that `tls.DEFAULT_CIPHERS` is used when its a limited cipher set. +test(true, null, 'ECDHE-RSA-AES128-GCM-SHA256', 'ECDHE-RSA-AES128-GCM-SHA256'); From cdda7f4f1867e2502f48f0890b46a8f70ca59971 Mon Sep 17 00:00:00 2001 From: Osmond van Hemert Date: Thu, 8 Nov 2018 15:04:09 +0100 Subject: [PATCH 024/316] test: https agent clientcertengine coverage PR-URL: https://github.com/nodejs/node/pull/24248 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-https-agent-getname.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index c29e09731df0b2..b68850f21d57ca 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -22,6 +22,7 @@ const options = { localAddress: '192.168.1.1', ca: 'ca', cert: 'cert', + clientCertEngine: 'dynamic', ciphers: 'ciphers', crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')], dhparam: 'dhparam', @@ -38,6 +39,6 @@ const options = { assert.strictEqual( agent.getName(options), - '0.0.0.0:443:192.168.1.1:ca:cert::ciphers:key:pfx:false:localhost:' + + '0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' + 'secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext' ); From 7e2a2849db496864d90f61b39de48a8bf00dc07e Mon Sep 17 00:00:00 2001 From: Julia Date: Wed, 14 Nov 2018 20:34:16 -0500 Subject: [PATCH 025/316] test: use destructuring and remove unused arguments Use destructuring consistently and remove unused function arguments in test-pipewrap.js PR-URL: https://github.com/nodejs/node/pull/24375 Reviewed-By: Rich Trott Reviewed-By: Weijia Wang Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann Reviewed-By: Trivikram Kamat --- test/async-hooks/test-pipewrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-pipewrap.js b/test/async-hooks/test-pipewrap.js index f04f900606a3de..a632115d228d64 100644 --- a/test/async-hooks/test-pipewrap.js +++ b/test/async-hooks/test-pipewrap.js @@ -8,7 +8,7 @@ const assert = require('assert'); const tick = require('../common/tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -const spawn = require('child_process').spawn; +const { spawn } = require('child_process'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); @@ -45,7 +45,7 @@ checkInvocations(processwrap, { init: 1 }, checkInvocations(x, { init: 1 }, 'pipe wrap when sleep.spawn was called'); }); -function onsleepExit(code) { +function onsleepExit() { checkInvocations(processwrap, { init: 1, before: 1 }, 'processwrap while in onsleepExit callback'); } From 4dc1e785a3948516c2a8139fcff9fb52521118f1 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 8 Nov 2018 13:49:40 -0500 Subject: [PATCH 026/316] build: check minimum ICU in configure for system-icu - check the version number coming out of pkg-config PR-URL: https://github.com/nodejs/node/pull/24255 Fixes: https://github.com/nodejs/node/issues/24253 Reviewed-By: Gus Caplan Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- configure.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index 065e31fd9cac51..e6e1810d130573 100755 --- a/configure.py +++ b/configure.py @@ -434,7 +434,7 @@ dest='with_icu_source', help='Intl mode: optional local path to icu/ dir, or path/URL of ' 'the icu4c source archive. ' - 'v%d.x or later recommended.' % icu_versions["minimum_icu"]) + 'v%d.x or later recommended.' % icu_versions['minimum_icu']) parser.add_option('--with-ltcg', action='store_true', @@ -622,9 +622,13 @@ def b(value): def pkg_config(pkg): + """Run pkg-config on the specified package + Returns ("-l flags", "-I flags", "-L flags", "version") + otherwise (None, None, None, None)""" pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') retval = () - for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']: + for flag in ['--libs-only-l', '--cflags-only-I', + '--libs-only-L', '--modversion']: try: proc = subprocess.Popen( shlex.split(pkg_config) + ['--silence-errors', flag, pkg], @@ -632,7 +636,7 @@ def pkg_config(pkg): val = proc.communicate()[0].strip() except OSError as e: if e.errno != errno.ENOENT: raise e # Unexpected error. - return (None, None, None) # No pkg-config/pkgconf installed. + return (None, None, None, None) # No pkg-config/pkgconf installed. retval += (val,) return retval @@ -1119,7 +1123,7 @@ def configure_library(lib, output): output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) if getattr(options, shared_lib): - (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) + (pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = pkg_config(lib) if options.__dict__[shared_lib + '_includes']: output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] @@ -1354,7 +1358,12 @@ def write_config(data, name): if pkgicu[0] is None: error('''Could not load pkg-config data for "icu-i18n". See above errors or the README.md.''') - (libs, cflags, libpath) = pkgicu + (libs, cflags, libpath, icuversion) = pkgicu + icu_ver_major = icuversion.split('.')[0] + o['variables']['icu_ver_major'] = icu_ver_major + if int(icu_ver_major) < icu_versions['minimum_icu']: + error('icu4c v%s is too old, v%d.x or later is required.' % + (icuversion, icu_versions['minimum_icu'])) # libpath provides linker path which may contain spaces if libpath: o['libraries'] += [libpath] @@ -1473,9 +1482,9 @@ def write_config(data, name): icu_ver_major = m.group(1) if not icu_ver_major: error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) - elif int(icu_ver_major) < icu_versions["minimum_icu"]: - error('icu4c v%d.x is too old, v%d.x or later is required.' % (int(icu_ver_major), - icu_versions["minimum_icu"])) + elif int(icu_ver_major) < icu_versions['minimum_icu']: + error('icu4c v%s.x is too old, v%d.x or later is required.' % + (icu_ver_major, icu_versions['minimum_icu'])) icu_endianness = sys.byteorder[0]; o['variables']['icu_ver_major'] = icu_ver_major o['variables']['icu_endianness'] = icu_endianness From 81ec97ba3d3ba820db97b374a2bb190c3e1ebc59 Mon Sep 17 00:00:00 2001 From: Thomas Hunter II Date: Mon, 12 Nov 2018 12:09:39 -0800 Subject: [PATCH 027/316] doc: adjusting formatting when printing - reduces page margins - removes emphasis from links - hides expandable history items - removes horizontal scrollbar from bottom of print output - reduce stability rectangle sizes - shrink headlines slightly - hide ToC (as it's unclickable when printed) Ref: https://thomashunter.name/nodejs-documentation-pdf PR-URL: https://github.com/nodejs/node/pull/24325 Reviewed-By: Rich Trott Reviewed-By: Bryan English --- doc/api_assets/style.css | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 7d65b7405b41d1..d5220e816810f6 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -533,12 +533,51 @@ th > *:last-child, td > *:last-child { @media print { html { height: auto; + font-size: 0.75em; } #column2.interior { display: none; } #column1.interior { - margin-left: auto; + margin-left: 0px; + padding: 0px; overflow-y: auto; } + .api_metadata, + #toc, + .srclink, + #gtoc, + .mark { + display: none; + } + h1 { + font-size: 2rem; + } + h2 { + font-size: 1.75rem; + } + h3 { + font-size: 1.5rem; + } + h4 { + font-size: 1.3rem; + } + h5 { + font-size: 1.2rem; + } + h6 { + font-size: 1.1rem; + } + .api_stability { + display: inline-block; + } + .api_stability a { + text-decoration: none; + } + a { + color: inherit; + } + #apicontent { + overflow: hidden; + } } From a7f6c043a4a0b7b443c47fa33c516ecb065593d5 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 16 Nov 2018 09:40:40 -0500 Subject: [PATCH 028/316] Revert "src: enable detailed source positions in V8" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e2a8e3221b2580c44579c738c12d00fb37298f4a. This reverts commit 715bbb9d04a320b4c1a234e1f9d878c116beb3f4. PR-URL: https://github.com/nodejs/node/pull/24394 Fixes: https://github.com/nodejs/node/issues/24393 Reviewed-By: Rich Trott Reviewed-By: Joyee Cheung Reviewed-By: Ujjwal Sharma Reviewed-By: Michaël Zasso --- deps/v8/include/v8-profiler.h | 6 ---- deps/v8/src/api.cc | 5 --- deps/v8/src/isolate.cc | 3 +- deps/v8/src/isolate.h | 3 +- deps/v8/test/cctest/test-cpu-profiler.cc | 41 ------------------------ src/node.cc | 1 - 6 files changed, 2 insertions(+), 57 deletions(-) diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 3689a122725f89..9981061a44bf06 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -341,12 +341,6 @@ class V8_EXPORT CpuProfiler { V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.", void SetIdle(bool is_idle)); - /** - * Generate more detailed source positions to code objects. This results in - * better results when mapping profiling samples to script source. - */ - static void UseDetailedSourcePositionsForProfiling(Isolate* isolate); - private: CpuProfiler(); ~CpuProfiler(); diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 8f8aaf7bc628ac..c1afe8d93b9d0d 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -10132,11 +10132,6 @@ void CpuProfiler::SetIdle(bool is_idle) { isolate->SetIdle(is_idle); } -void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) { - reinterpret_cast(isolate) - ->set_detailed_source_positions_for_profiling(true); -} - uintptr_t CodeEvent::GetCodeStartAddress() { return reinterpret_cast(this)->code_start_address; } diff --git a/deps/v8/src/isolate.cc b/deps/v8/src/isolate.cc index eed52d9c19fb1a..89fecce80431c5 100644 --- a/deps/v8/src/isolate.cc +++ b/deps/v8/src/isolate.cc @@ -3257,8 +3257,7 @@ bool Isolate::use_optimizer() { } bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { - return NeedsSourcePositionsForProfiling() || - detailed_source_positions_for_profiling(); + return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; } bool Isolate::NeedsSourcePositionsForProfiling() const { diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index efd479c41ee4a5..e199a93ec47859 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -553,8 +553,7 @@ typedef std::vector DebugObjectCache; V(int, last_console_context_id, 0) \ V(v8_inspector::V8Inspector*, inspector, nullptr) \ V(bool, next_v8_call_is_safe_for_termination, false) \ - V(bool, only_terminate_in_safe_scope, false) \ - V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) + V(bool, only_terminate_in_safe_scope, false) #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 851099607945e6..75af3f6d98f127 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -40,7 +40,6 @@ #include "src/objects-inl.h" #include "src/profiler/cpu-profiler-inl.h" #include "src/profiler/profiler-listener.h" -#include "src/source-position-table.h" #include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" @@ -2545,46 +2544,6 @@ TEST(MultipleProfilers) { profiler2->StopProfiling("2"); } -UNINITIALIZED_TEST(DetailedSourcePositionAPI) { - i::FLAG_detailed_line_info = false; - i::FLAG_allow_natives_syntax = true; - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); - v8::Isolate* isolate = v8::Isolate::New(create_params); - - const char* source = - "function fib(i) {" - " if (i <= 1) return 1; " - " return fib(i - 1) +" - " fib(i - 2);" - "}" - "fib(5);" - "%OptimizeFunctionOnNextCall(fib);" - "fib(5);" - "fib"; - { - v8::Isolate::Scope isolate_scope(isolate); - v8::HandleScope handle_scope(isolate); - v8::Local context = v8::Context::New(isolate); - v8::Context::Scope context_scope(context); - i::Isolate* i_isolate = reinterpret_cast(isolate); - - CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo()); - - int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source); - - v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); - CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo()); - - int detailed_positions = GetSourcePositionEntryCount(i_isolate, source); - - CHECK((non_detailed_positions == -1 && detailed_positions == -1) || - non_detailed_positions < detailed_positions); - } - - isolate->Dispose(); -} - } // namespace test_cpu_profiler } // namespace internal } // namespace v8 diff --git a/src/node.cc b/src/node.cc index 153399f1b61777..af11953250ec11 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2608,7 +2608,6 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop) { isolate->SetMicrotasksPolicy(MicrotasksPolicy::kExplicit); isolate->SetFatalErrorHandler(OnFatalError); isolate->SetAllowWasmCodeGenerationCallback(AllowWasmCodeGenerationCallback); - v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); return isolate; } From b44623e776919f9b280eb60f8c57f0d5beb786d1 Mon Sep 17 00:00:00 2001 From: Kanika Singhal Date: Sat, 17 Nov 2018 17:10:27 +0530 Subject: [PATCH 029/316] src: elevate v8 namespaces of referenced artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24424 Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- src/node_perf.cc | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/node_perf.cc b/src/node_perf.cc index d3ee881f59d257..5881b2be69a664 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -10,17 +10,24 @@ namespace performance { using v8::Array; using v8::Context; +using v8::DontDelete; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; +using v8::GCCallbackFlags; +using v8::GCType; using v8::HandleScope; using v8::Integer; using v8::Isolate; using v8::Local; using v8::Name; +using v8::NewStringType; using v8::Number; using v8::Object; +using v8::PropertyAttribute; +using v8::ReadOnly; using v8::String; +using v8::Uint32Array; using v8::Value; // Microseconds in a second, as a float. @@ -36,7 +43,7 @@ uint64_t performance_node_start; uint64_t performance_v8_start; uint64_t performance_last_gc_start_mark_ = 0; -v8::GCType performance_last_gc_type_ = v8::GCType::kGCTypeAll; +GCType performance_last_gc_type_ = GCType::kGCTypeAll; void performance_state::Mark(enum PerformanceMilestone milestone, uint64_t ts) { @@ -69,13 +76,13 @@ inline void InitObject(const PerformanceEntry& entry, Local obj) { Environment* env = entry.env(); Isolate* isolate = env->isolate(); Local context = env->context(); - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); obj->DefineOwnProperty(context, env->name_string(), String::NewFromUtf8(isolate, entry.name().c_str(), - v8::NewStringType::kNormal) + NewStringType::kNormal) .ToLocalChecked(), attr) .FromJust(); @@ -83,7 +90,7 @@ inline void InitObject(const PerformanceEntry& entry, Local obj) { env->entry_type_string(), String::NewFromUtf8(isolate, entry.type().c_str(), - v8::NewStringType::kNormal) + NewStringType::kNormal) .ToLocalChecked(), attr) .FromJust(); @@ -124,7 +131,7 @@ void PerformanceEntry::Notify(Environment* env, PerformanceEntryType type, Local object) { Context::Scope scope(env->context()); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID && observers[type]) { @@ -242,12 +249,12 @@ void PerformanceGCCallback(Environment* env, void* ptr) { HandleScope scope(env->isolate()); Local context = env->context(); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) { Local obj = entry->ToObject(); - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); obj->DefineOwnProperty(context, env->kind_string(), Integer::New(env->isolate(), entry->gckind()), @@ -260,16 +267,16 @@ void PerformanceGCCallback(Environment* env, void* ptr) { // Marks the start of a GC cycle void MarkGarbageCollectionStart(Isolate* isolate, - v8::GCType type, - v8::GCCallbackFlags flags) { + GCType type, + GCCallbackFlags flags) { performance_last_gc_start_mark_ = PERFORMANCE_NOW(); performance_last_gc_type_ = type; } // Marks the end of a GC cycle void MarkGarbageCollectionEnd(Isolate* isolate, - v8::GCType type, - v8::GCCallbackFlags flags, + GCType type, + GCCallbackFlags flags, void* data) { Environment* env = static_cast(data); // If no one is listening to gc performance entries, do not create them. @@ -341,7 +348,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { return; args.GetReturnValue().Set(ret.ToLocalChecked()); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION]) return; @@ -414,18 +421,18 @@ void Initialize(Local target, NODE_PERFORMANCE_MILESTONES(V) #undef V - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); target->DefineOwnProperty(context, FIXED_ONE_BYTE_STRING(isolate, "timeOrigin"), - v8::Number::New(isolate, timeOrigin / 1e6), + Number::New(isolate, timeOrigin / 1e6), attr).ToChecked(); target->DefineOwnProperty( context, FIXED_ONE_BYTE_STRING(isolate, "timeOriginTimestamp"), - v8::Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS), + Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS), attr).ToChecked(); target->DefineOwnProperty(context, From af3c7efffc43894a789b2460b60ea95fc70f51db Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Fri, 19 Oct 2018 15:10:59 -0400 Subject: [PATCH 030/316] src: factor out Node.js-agnostic N-APIs Split the Node.js ECMAScript API (N-EAPI?) into its own header and implementation files. The motivation is that the ECMAScript API stand on its own so it might be embedded separately, implementation and all. Portions of the implementation used by both files are stored in `node_api_impl.h`. The checked boxes below indicate that the given API remains in `node_api.h`, whereas the lack of a checkbox indicates that the API was moved to `node_ecma_api.h`. * [x] NAPI_MODULE * [x] NAPI_MODULE_INIT * [x] napi_acquire_threadsafe_function * [x] napi_add_env_cleanup_hook * [x] napi_async_destroy * [x] napi_async_init * [x] napi_call_threadsafe_function * [x] napi_cancel_async_work * [x] napi_close_callback_scope * [x] napi_create_async_work * [x] napi_create_buffer * [x] napi_create_buffer_copy * [x] napi_create_external_buffer * [x] napi_create_threadsafe_function * [x] napi_delete_async_work * [x] napi_fatal_error * [x] napi_fatal_exception * [x] napi_get_buffer_info * [x] napi_get_node_version * [x] napi_get_threadsafe_function_context * [x] napi_get_uv_event_loop * [x] napi_is_buffer * [x] napi_make_callback * [x] napi_module_register * [x] napi_open_callback_scope * [x] napi_queue_async_work * [x] napi_ref_threadsafe_function * [x] napi_release_threadsafe_function * [x] napi_remove_env_cleanup_hook * [x] napi_unref_threadsafe_function * [ ] napi_add_finalizer * [ ] napi_adjust_external_memory * [ ] napi_call_function * [ ] napi_close_escapable_handle_scope * [ ] napi_close_handle_scope * [ ] napi_coerce_to_bool * [ ] napi_coerce_to_number * [ ] napi_coerce_to_object * [ ] napi_coerce_to_string * [ ] napi_create_array * [ ] napi_create_arraybuffer * [ ] napi_create_array_with_length * [ ] napi_create_bigint_int64 * [ ] napi_create_bigint_uint64 * [ ] napi_create_bigint_words * [ ] napi_create_dataview * [ ] napi_create_double * [ ] napi_create_error * [ ] napi_create_external * [ ] napi_create_external_arraybuffer * [ ] napi_create_function * [ ] napi_create_int32 * [ ] napi_create_int64 * [ ] napi_create_object * [ ] napi_create_promise * [ ] napi_create_range_error * [ ] napi_create_reference * [ ] napi_create_string_latin1 * [ ] napi_create_string_utf16 * [ ] napi_create_string_utf8 * [ ] napi_create_symbol * [ ] napi_create_typedarray * [ ] napi_create_type_error * [ ] napi_create_uint32 * [ ] napi_define_class * [ ] napi_define_properties * [ ] napi_delete_element * [ ] napi_delete_property * [ ] napi_delete_reference * [ ] napi_escape_handle * [ ] napi_get_and_clear_last_exception * [ ] napi_get_arraybuffer_info * [ ] napi_get_array_length * [ ] napi_get_boolean * [ ] napi_get_cb_info * [ ] napi_get_dataview_info * [ ] napi_get_element * [ ] napi_get_global * [ ] napi_get_last_error_info * [ ] napi_get_named_property * [ ] napi_get_new_target * [ ] napi_get_null * [ ] napi_get_property * [ ] napi_get_property_names * [ ] napi_get_prototype * [ ] napi_get_reference_value * [ ] napi_get_typedarray_info * [ ] napi_get_undefined * [ ] napi_get_value_bigint_int64 * [ ] napi_get_value_bigint_uint64 * [ ] napi_get_value_bigint_words * [ ] napi_get_value_bool * [ ] napi_get_value_double * [ ] napi_get_value_external * [ ] napi_get_value_int32 * [ ] napi_get_value_int64 * [ ] napi_get_value_string_latin1 * [ ] napi_get_value_string_utf16 * [ ] napi_get_value_string_utf8 * [ ] napi_get_value_uint32 * [ ] napi_get_version * [ ] napi_has_element * [ ] napi_has_named_property * [ ] napi_has_own_property * [ ] napi_has_property * [ ] napi_instanceof * [ ] napi_is_array * [ ] napi_is_arraybuffer * [ ] napi_is_dataview * [ ] napi_is_error * [ ] napi_is_exception_pending * [ ] napi_is_promise * [ ] napi_is_typedarray * [ ] napi_new_instance * [ ] napi_open_escapable_handle_scope * [ ] napi_open_handle_scope * [ ] napi_reference_ref * [ ] napi_reference_unref * [ ] napi_reject_deferred * [ ] napi_remove_wrap * [ ] napi_resolve_deferred * [ ] napi_run_script * [ ] napi_set_element * [ ] napi_set_named_property * [ ] napi_set_property * [ ] napi_strict_equals * [ ] napi_throw * [ ] napi_throw_error * [ ] napi_throw_range_error * [ ] napi_throw_type_error * [ ] napi_typeof * [ ] napi_unwrap * [ ] napi_wrap PR-URL: https://github.com/nodejs/node/pull/23786 Reviewed-By: Yazhong Liu Reviewed-By: Michael Dawson --- Makefile | 3 +- doc/api/n-api.md | 59 + node.gyp | 5 + src/js_native_api.h | 485 +++ src/js_native_api_types.h | 108 + src/js_native_api_v8.cc | 2907 +++++++++++++++ src/js_native_api_v8.h | 202 + src/js_native_api_v8_internals.h | 35 + src/node_api.cc | 3276 +---------------- src/node_api.h | 521 +-- src/node_api_types.h | 103 +- test/addons-napi/6_object_wrap/binding.cc | 1 + test/addons-napi/6_object_wrap/myobject.h | 2 +- test/addons-napi/7_factory_wrap/binding.cc | 1 + test/addons-napi/7_factory_wrap/myobject.h | 2 +- test/addons-napi/8_passing_wrapped/binding.cc | 1 + test/addons-napi/8_passing_wrapped/myobject.h | 2 +- tools/install.py | 2 + 18 files changed, 3927 insertions(+), 3788 deletions(-) create mode 100644 src/js_native_api.h create mode 100644 src/js_native_api_types.h create mode 100644 src/js_native_api_v8.cc create mode 100644 src/js_native_api_v8.h create mode 100644 src/js_native_api_v8_internals.h diff --git a/Makefile b/Makefile index 3d828f71f80bb6..3dc34995cce213 100644 --- a/Makefile +++ b/Makefile @@ -393,7 +393,8 @@ ADDONS_NAPI_BINDING_SOURCES := \ # Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale. test/addons-napi/.buildstamp: $(ADDONS_PREREQS) \ $(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \ - src/node_api.h src/node_api_types.h + src/node_api.h src/node_api_types.h src/js_native_api.h \ + src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h @$(call run_build_addons,"$$PWD/test/addons-napi",$@) .PHONY: build-addons-napi diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 27ebefb4b56b3e..33d9f561bec313 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -155,6 +155,65 @@ available to the module code. \* Indicates that the N-API version was released as experimental +The N-APIs associated strictly with accessing ECMAScript features from native +code can be found separately in `js_native_api.h` and `js_native_api_types.h`. +The APIs defined in these headers are included in `node_api.h` and +`node_api_types.h`. The headers are structured in this way in order to allow +implementations of N-API outside of Node.js. For those implementations the +Node.js specific APIs may not be applicable. + +The Node.js-specific parts of an addon can be separated from the code that +exposes the actual functionality to the JavaScript environment so that the +latter may be used with multiple implementations of N-API. In the example below, +`addon.c` and `addon.h` refer only to `js_native_api.h`. This ensures that +`addon.c` can be reused to compile against either the Node.js implementation of +N-API or any implementation of N-API outside of Node.js. + +`addon_node.c` is a separate file that contains the Node.js specific entry point +to the addon and which instantiates the addon by calling into `addon.c` when the +addon is loaded into a Node.js environment. + +```C +// addon.h +#ifndef _ADDON_H_ +#define _ADDON_H_ +#include +napi_value create_addon(napi_env env); +#endif // _ADDON_H_ +``` + +```C +// addon.c +#include "addon.h" +napi_value create_addon(napi_env env) { + napi_value result; + assert(napi_create_object(env, &result) == napi_ok); + napi_value exported_function; + assert(napi_create_function(env, + "doSomethingUseful", + NAPI_AUTO_LENGTH, + DoSomethingUseful, + NULL, + &exported_function) == napi_ok); + assert(napi_set_named_property(env, + result, + "doSomethingUseful", + exported_function) == napi_ok); + return result; +} +``` + +```C +// addon_node.c +#include + +static napi_value Init(napi_env env, napi_value exports) { + return create_addon(env); +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) +``` + ## Basic N-API Data Types N-API exposes the following fundamental datatypes as abstractions that are diff --git a/node.gyp b/node.gyp index 5b68281de45790..b40933a0ebc0c4 100644 --- a/node.gyp +++ b/node.gyp @@ -334,6 +334,11 @@ 'src/fs_event_wrap.cc', 'src/handle_wrap.cc', 'src/heap_utils.cc', + 'src/js_native_api.h', + 'src/js_native_api_types.h', + 'src/js_native_api_v8.cc', + 'src/js_native_api_v8.h', + 'src/js_native_api_v8_internals.h', 'src/js_stream.cc', 'src/module_wrap.cc', 'src/node.cc', diff --git a/src/js_native_api.h b/src/js_native_api.h new file mode 100644 index 00000000000000..01707d78ccaa46 --- /dev/null +++ b/src/js_native_api.h @@ -0,0 +1,485 @@ +#ifndef SRC_JS_NATIVE_API_H_ +#define SRC_JS_NATIVE_API_H_ + +#include +#include +#include "js_native_api_types.h" + +#ifndef NAPI_VERSION +#ifdef NAPI_EXPERIMENTAL +// Use INT_MAX, this should only be consumed by the pre-processor anyway. +#define NAPI_VERSION 2147483647 +#else +// The baseline version for N-API +#define NAPI_VERSION 3 +#endif +#endif + +// If you need __declspec(dllimport), either include instead, or +// define NAPI_EXTERN as __declspec(dllimport) on the compiler's command line. +#ifndef NAPI_EXTERN + #ifdef _WIN32 + #define NAPI_EXTERN __declspec(dllexport) + #else + #define NAPI_EXTERN /* nothing */ + #endif +#endif + +#define NAPI_AUTO_LENGTH SIZE_MAX + +#ifdef __cplusplus +#define EXTERN_C_START extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_START +#define EXTERN_C_END +#endif + +EXTERN_C_START + +NAPI_EXTERN napi_status +napi_get_last_error_info(napi_env env, + const napi_extended_error_info** result); + +// Getters for defined singletons +NAPI_EXTERN napi_status napi_get_undefined(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_get_null(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_get_global(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_get_boolean(napi_env env, + bool value, + napi_value* result); + +// Methods to create Primitive types/Objects +NAPI_EXTERN napi_status napi_create_object(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_create_array(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_create_array_with_length(napi_env env, + size_t length, + napi_value* result); +NAPI_EXTERN napi_status napi_create_double(napi_env env, + double value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_int32(napi_env env, + int32_t value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_uint32(napi_env env, + uint32_t value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_int64(napi_env env, + int64_t value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_string_latin1(napi_env env, + const char* str, + size_t length, + napi_value* result); +NAPI_EXTERN napi_status napi_create_string_utf8(napi_env env, + const char* str, + size_t length, + napi_value* result); +NAPI_EXTERN napi_status napi_create_string_utf16(napi_env env, + const char16_t* str, + size_t length, + napi_value* result); +NAPI_EXTERN napi_status napi_create_symbol(napi_env env, + napi_value description, + napi_value* result); +NAPI_EXTERN napi_status napi_create_function(napi_env env, + const char* utf8name, + size_t length, + napi_callback cb, + void* data, + napi_value* result); +NAPI_EXTERN napi_status napi_create_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); +NAPI_EXTERN napi_status napi_create_type_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); +NAPI_EXTERN napi_status napi_create_range_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); + +// Methods to get the native napi_value from Primitive type +NAPI_EXTERN napi_status napi_typeof(napi_env env, + napi_value value, + napi_valuetype* result); +NAPI_EXTERN napi_status napi_get_value_double(napi_env env, + napi_value value, + double* result); +NAPI_EXTERN napi_status napi_get_value_int32(napi_env env, + napi_value value, + int32_t* result); +NAPI_EXTERN napi_status napi_get_value_uint32(napi_env env, + napi_value value, + uint32_t* result); +NAPI_EXTERN napi_status napi_get_value_int64(napi_env env, + napi_value value, + int64_t* result); +NAPI_EXTERN napi_status napi_get_value_bool(napi_env env, + napi_value value, + bool* result); + +// Copies LATIN-1 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env, + napi_value value, + char* buf, + size_t bufsize, + size_t* result); + +// Copies UTF-8 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status napi_get_value_string_utf8(napi_env env, + napi_value value, + char* buf, + size_t bufsize, + size_t* result); + +// Copies UTF-16 encoded bytes from a string into a buffer. +NAPI_EXTERN napi_status napi_get_value_string_utf16(napi_env env, + napi_value value, + char16_t* buf, + size_t bufsize, + size_t* result); + +// Methods to coerce values +// These APIs may execute user scripts +NAPI_EXTERN napi_status napi_coerce_to_bool(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status napi_coerce_to_number(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status napi_coerce_to_object(napi_env env, + napi_value value, + napi_value* result); +NAPI_EXTERN napi_status napi_coerce_to_string(napi_env env, + napi_value value, + napi_value* result); + +// Methods to work with Objects +NAPI_EXTERN napi_status napi_get_prototype(napi_env env, + napi_value object, + napi_value* result); +NAPI_EXTERN napi_status napi_get_property_names(napi_env env, + napi_value object, + napi_value* result); +NAPI_EXTERN napi_status napi_set_property(napi_env env, + napi_value object, + napi_value key, + napi_value value); +NAPI_EXTERN napi_status napi_has_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status napi_get_property(napi_env env, + napi_value object, + napi_value key, + napi_value* result); +NAPI_EXTERN napi_status napi_delete_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status napi_has_own_property(napi_env env, + napi_value object, + napi_value key, + bool* result); +NAPI_EXTERN napi_status napi_set_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value value); +NAPI_EXTERN napi_status napi_has_named_property(napi_env env, + napi_value object, + const char* utf8name, + bool* result); +NAPI_EXTERN napi_status napi_get_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value* result); +NAPI_EXTERN napi_status napi_set_element(napi_env env, + napi_value object, + uint32_t index, + napi_value value); +NAPI_EXTERN napi_status napi_has_element(napi_env env, + napi_value object, + uint32_t index, + bool* result); +NAPI_EXTERN napi_status napi_get_element(napi_env env, + napi_value object, + uint32_t index, + napi_value* result); +NAPI_EXTERN napi_status napi_delete_element(napi_env env, + napi_value object, + uint32_t index, + bool* result); +NAPI_EXTERN napi_status +napi_define_properties(napi_env env, + napi_value object, + size_t property_count, + const napi_property_descriptor* properties); + +// Methods to work with Arrays +NAPI_EXTERN napi_status napi_is_array(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status napi_get_array_length(napi_env env, + napi_value value, + uint32_t* result); + +// Methods to compare values +NAPI_EXTERN napi_status napi_strict_equals(napi_env env, + napi_value lhs, + napi_value rhs, + bool* result); + +// Methods to work with Functions +NAPI_EXTERN napi_status napi_call_function(napi_env env, + napi_value recv, + napi_value func, + size_t argc, + const napi_value* argv, + napi_value* result); +NAPI_EXTERN napi_status napi_new_instance(napi_env env, + napi_value constructor, + size_t argc, + const napi_value* argv, + napi_value* result); +NAPI_EXTERN napi_status napi_instanceof(napi_env env, + napi_value object, + napi_value constructor, + bool* result); + +// Methods to work with napi_callbacks + +// Gets all callback info in a single call. (Ugly, but faster.) +NAPI_EXTERN napi_status napi_get_cb_info( + napi_env env, // [in] NAPI environment handle + napi_callback_info cbinfo, // [in] Opaque callback-info handle + size_t* argc, // [in-out] Specifies the size of the provided argv array + // and receives the actual count of args. + napi_value* argv, // [out] Array of values + napi_value* this_arg, // [out] Receives the JS 'this' arg for the call + void** data); // [out] Receives the data pointer for the callback. + +NAPI_EXTERN napi_status napi_get_new_target(napi_env env, + napi_callback_info cbinfo, + napi_value* result); +NAPI_EXTERN napi_status +napi_define_class(napi_env env, + const char* utf8name, + size_t length, + napi_callback constructor, + void* data, + size_t property_count, + const napi_property_descriptor* properties, + napi_value* result); + +// Methods to work with external data objects +NAPI_EXTERN napi_status napi_wrap(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result); +NAPI_EXTERN napi_status napi_unwrap(napi_env env, + napi_value js_object, + void** result); +NAPI_EXTERN napi_status napi_remove_wrap(napi_env env, + napi_value js_object, + void** result); +NAPI_EXTERN napi_status napi_create_external(napi_env env, + void* data, + napi_finalize finalize_cb, + void* finalize_hint, + napi_value* result); +NAPI_EXTERN napi_status napi_get_value_external(napi_env env, + napi_value value, + void** result); + +// Methods to control object lifespan + +// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. +NAPI_EXTERN napi_status napi_create_reference(napi_env env, + napi_value value, + uint32_t initial_refcount, + napi_ref* result); + +// Deletes a reference. The referenced value is released, and may +// be GC'd unless there are other references to it. +NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref); + +// Increments the reference count, optionally returning the resulting count. +// After this call the reference will be a strong reference because its +// refcount is >0, and the referenced object is effectively "pinned". +// Calling this when the refcount is 0 and the object is unavailable +// results in an error. +NAPI_EXTERN napi_status napi_reference_ref(napi_env env, + napi_ref ref, + uint32_t* result); + +// Decrements the reference count, optionally returning the resulting count. +// If the result is 0 the reference is now weak and the object may be GC'd +// at any time if there are no other references. Calling this when the +// refcount is already 0 results in an error. +NAPI_EXTERN napi_status napi_reference_unref(napi_env env, + napi_ref ref, + uint32_t* result); + +// Attempts to get a referenced value. If the reference is weak, +// the value might no longer be available, in that case the call +// is still successful but the result is NULL. +NAPI_EXTERN napi_status napi_get_reference_value(napi_env env, + napi_ref ref, + napi_value* result); + +NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env, + napi_handle_scope* result); +NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env, + napi_handle_scope scope); +NAPI_EXTERN napi_status +napi_open_escapable_handle_scope(napi_env env, + napi_escapable_handle_scope* result); +NAPI_EXTERN napi_status +napi_close_escapable_handle_scope(napi_env env, + napi_escapable_handle_scope scope); + +NAPI_EXTERN napi_status napi_escape_handle(napi_env env, + napi_escapable_handle_scope scope, + napi_value escapee, + napi_value* result); + +// Methods to support error handling +NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error); +NAPI_EXTERN napi_status napi_throw_error(napi_env env, + const char* code, + const char* msg); +NAPI_EXTERN napi_status napi_throw_type_error(napi_env env, + const char* code, + const char* msg); +NAPI_EXTERN napi_status napi_throw_range_error(napi_env env, + const char* code, + const char* msg); +NAPI_EXTERN napi_status napi_is_error(napi_env env, + napi_value value, + bool* result); + +// Methods to support catching exceptions +NAPI_EXTERN napi_status napi_is_exception_pending(napi_env env, bool* result); +NAPI_EXTERN napi_status napi_get_and_clear_last_exception(napi_env env, + napi_value* result); + +// Methods to work with array buffers and typed arrays +NAPI_EXTERN napi_status napi_is_arraybuffer(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status napi_create_arraybuffer(napi_env env, + size_t byte_length, + void** data, + napi_value* result); +NAPI_EXTERN napi_status +napi_create_external_arraybuffer(napi_env env, + void* external_data, + size_t byte_length, + napi_finalize finalize_cb, + void* finalize_hint, + napi_value* result); +NAPI_EXTERN napi_status napi_get_arraybuffer_info(napi_env env, + napi_value arraybuffer, + void** data, + size_t* byte_length); +NAPI_EXTERN napi_status napi_is_typedarray(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status napi_create_typedarray(napi_env env, + napi_typedarray_type type, + size_t length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result); +NAPI_EXTERN napi_status napi_get_typedarray_info(napi_env env, + napi_value typedarray, + napi_typedarray_type* type, + size_t* length, + void** data, + napi_value* arraybuffer, + size_t* byte_offset); + +NAPI_EXTERN napi_status napi_create_dataview(napi_env env, + size_t length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result); +NAPI_EXTERN napi_status napi_is_dataview(napi_env env, + napi_value value, + bool* result); +NAPI_EXTERN napi_status napi_get_dataview_info(napi_env env, + napi_value dataview, + size_t* bytelength, + void** data, + napi_value* arraybuffer, + size_t* byte_offset); + +// version management +NAPI_EXTERN napi_status napi_get_version(napi_env env, uint32_t* result); + +// Promises +NAPI_EXTERN napi_status napi_create_promise(napi_env env, + napi_deferred* deferred, + napi_value* promise); +NAPI_EXTERN napi_status napi_resolve_deferred(napi_env env, + napi_deferred deferred, + napi_value resolution); +NAPI_EXTERN napi_status napi_reject_deferred(napi_env env, + napi_deferred deferred, + napi_value rejection); +NAPI_EXTERN napi_status napi_is_promise(napi_env env, + napi_value promise, + bool* is_promise); + +// Running a script +NAPI_EXTERN napi_status napi_run_script(napi_env env, + napi_value script, + napi_value* result); + +// Memory management +NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, + int64_t change_in_bytes, + int64_t* adjusted_value); + +#ifdef NAPI_EXPERIMENTAL + +NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, + int64_t value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_bigint_uint64(napi_env env, + uint64_t value, + napi_value* result); +NAPI_EXTERN napi_status napi_create_bigint_words(napi_env env, + int sign_bit, + size_t word_count, + const uint64_t* words, + napi_value* result); +NAPI_EXTERN napi_status napi_get_value_bigint_int64(napi_env env, + napi_value value, + int64_t* result, + bool* lossless); +NAPI_EXTERN napi_status napi_get_value_bigint_uint64(napi_env env, + napi_value value, + uint64_t* result, + bool* lossless); +NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, + napi_value value, + int* sign_bit, + size_t* word_count, + uint64_t* words); +NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result); +#endif // NAPI_EXPERIMENTAL + +EXTERN_C_END + +#endif // SRC_JS_NATIVE_API_H_ diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h new file mode 100644 index 00000000000000..a4739957991e3f --- /dev/null +++ b/src/js_native_api_types.h @@ -0,0 +1,108 @@ +#ifndef SRC_JS_NATIVE_API_TYPES_H_ +#define SRC_JS_NATIVE_API_TYPES_H_ + +#include +#include + +#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) + typedef uint16_t char16_t; +#endif + +// JSVM API types are all opaque pointers for ABI stability +// typedef undefined structs instead of void* for compile time type safety +typedef struct napi_env__* napi_env; +typedef struct napi_value__* napi_value; +typedef struct napi_ref__* napi_ref; +typedef struct napi_handle_scope__* napi_handle_scope; +typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; +typedef struct napi_callback_info__* napi_callback_info; +typedef struct napi_deferred__* napi_deferred; + +typedef enum { + napi_default = 0, + napi_writable = 1 << 0, + napi_enumerable = 1 << 1, + napi_configurable = 1 << 2, + + // Used with napi_define_class to distinguish static properties + // from instance properties. Ignored by napi_define_properties. + napi_static = 1 << 10, +} napi_property_attributes; + +typedef enum { + // ES6 types (corresponds to typeof) + napi_undefined, + napi_null, + napi_boolean, + napi_number, + napi_string, + napi_symbol, + napi_object, + napi_function, + napi_external, + napi_bigint, +} napi_valuetype; + +typedef enum { + napi_int8_array, + napi_uint8_array, + napi_uint8_clamped_array, + napi_int16_array, + napi_uint16_array, + napi_int32_array, + napi_uint32_array, + napi_float32_array, + napi_float64_array, + napi_bigint64_array, + napi_biguint64_array, +} napi_typedarray_type; + +typedef enum { + napi_ok, + napi_invalid_arg, + napi_object_expected, + napi_string_expected, + napi_name_expected, + napi_function_expected, + napi_number_expected, + napi_boolean_expected, + napi_array_expected, + napi_generic_failure, + napi_pending_exception, + napi_cancelled, + napi_escape_called_twice, + napi_handle_scope_mismatch, + napi_callback_scope_mismatch, + napi_queue_full, + napi_closing, + napi_bigint_expected, +} napi_status; + +typedef napi_value (*napi_callback)(napi_env env, + napi_callback_info info); +typedef void (*napi_finalize)(napi_env env, + void* finalize_data, + void* finalize_hint); + +typedef struct { + // One of utf8name or name should be NULL. + const char* utf8name; + napi_value name; + + napi_callback method; + napi_callback getter; + napi_callback setter; + napi_value value; + + napi_property_attributes attributes; + void* data; +} napi_property_descriptor; + +typedef struct { + const char* error_message; + void* engine_reserved; + uint32_t engine_error_code; + napi_status error_code; +} napi_extended_error_info; + +#endif // SRC_JS_NATIVE_API_TYPES_H_ diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc new file mode 100644 index 00000000000000..b28376afb7cedd --- /dev/null +++ b/src/js_native_api_v8.cc @@ -0,0 +1,2907 @@ +#include // INT_MAX +#include +#define NAPI_EXPERIMENTAL +#include "js_native_api_v8.h" +#include "js_native_api.h" + +#define CHECK_MAYBE_NOTHING(env, maybe, status) \ + RETURN_STATUS_IF_FALSE((env), !((maybe).IsNothing()), (status)) + +#define CHECK_TO_NUMBER(env, context, result, src) \ + CHECK_TO_TYPE((env), Number, (context), (result), (src), napi_number_expected) + +#define CHECK_TO_BOOL(env, context, result, src) \ + CHECK_TO_TYPE((env), Boolean, (context), (result), (src), \ + napi_boolean_expected) + +// n-api defines NAPI_AUTO_LENGHTH as the indicator that a string +// is null terminated. For V8 the equivalent is -1. The assert +// validates that our cast of NAPI_AUTO_LENGTH results in -1 as +// needed by V8. +#define CHECK_NEW_FROM_UTF8_LEN(env, result, str, len) \ + do { \ + static_assert(static_cast(NAPI_AUTO_LENGTH) == -1, \ + "Casting NAPI_AUTO_LENGTH to int must result in -1"); \ + RETURN_STATUS_IF_FALSE((env), \ + (len == NAPI_AUTO_LENGTH) || len <= INT_MAX, \ + napi_invalid_arg); \ + auto str_maybe = v8::String::NewFromUtf8( \ + (env)->isolate, (str), v8::NewStringType::kInternalized, \ + static_cast(len)); \ + CHECK_MAYBE_EMPTY((env), str_maybe, napi_generic_failure); \ + (result) = str_maybe.ToLocalChecked(); \ + } while (0) + +#define CHECK_NEW_FROM_UTF8(env, result, str) \ + CHECK_NEW_FROM_UTF8_LEN((env), (result), (str), NAPI_AUTO_LENGTH) + +#define CREATE_TYPED_ARRAY( \ + env, type, size_of_element, buffer, byte_offset, length, out) \ + do { \ + if ((size_of_element) > 1) { \ + THROW_RANGE_ERROR_IF_FALSE( \ + (env), (byte_offset) % (size_of_element) == 0, \ + "ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT", \ + "start offset of "#type" should be a multiple of "#size_of_element); \ + } \ + THROW_RANGE_ERROR_IF_FALSE((env), (length) * (size_of_element) + \ + (byte_offset) <= buffer->ByteLength(), \ + "ERR_NAPI_INVALID_TYPEDARRAY_LENGTH", \ + "Invalid typed array length"); \ + (out) = v8::type::New((buffer), (byte_offset), (length)); \ + } while (0) + +namespace v8impl { + +namespace { + +inline static napi_status +V8NameFromPropertyDescriptor(napi_env env, + const napi_property_descriptor* p, + v8::Local* result) { + if (p->utf8name != nullptr) { + CHECK_NEW_FROM_UTF8(env, *result, p->utf8name); + } else { + v8::Local property_value = + v8impl::V8LocalValueFromJsValue(p->name); + + RETURN_STATUS_IF_FALSE(env, property_value->IsName(), napi_name_expected); + *result = property_value.As(); + } + + return napi_ok; +} + +// convert from n-api property attributes to v8::PropertyAttribute +inline static v8::PropertyAttribute V8PropertyAttributesFromDescriptor( + const napi_property_descriptor* descriptor) { + unsigned int attribute_flags = v8::PropertyAttribute::None; + + if (descriptor->getter != nullptr || descriptor->setter != nullptr) { + // The napi_writable attribute is ignored for accessor descriptors, but + // V8 requires the ReadOnly attribute to match nonexistence of a setter. + attribute_flags |= (descriptor->setter == nullptr ? + v8::PropertyAttribute::ReadOnly : v8::PropertyAttribute::None); + } else if ((descriptor->attributes & napi_writable) == 0) { + attribute_flags |= v8::PropertyAttribute::ReadOnly; + } + + if ((descriptor->attributes & napi_enumerable) == 0) { + attribute_flags |= v8::PropertyAttribute::DontEnum; + } + if ((descriptor->attributes & napi_configurable) == 0) { + attribute_flags |= v8::PropertyAttribute::DontDelete; + } + + return static_cast(attribute_flags); +} + +inline static napi_deferred +JsDeferredFromNodePersistent(v8impl::Persistent* local) { + return reinterpret_cast(local); +} + +inline static v8impl::Persistent* +NodePersistentFromJsDeferred(napi_deferred local) { + return reinterpret_cast*>(local); +} + +class HandleScopeWrapper { + public: + explicit HandleScopeWrapper(v8::Isolate* isolate) : scope(isolate) {} + + private: + v8::HandleScope scope; +}; + +// In node v0.10 version of v8, there is no EscapableHandleScope and the +// node v0.10 port use HandleScope::Close(Local v) to mimic the behavior +// of a EscapableHandleScope::Escape(Local v), but it is not the same +// semantics. This is an example of where the api abstraction fail to work +// across different versions. +class EscapableHandleScopeWrapper { + public: + explicit EscapableHandleScopeWrapper(v8::Isolate* isolate) + : scope(isolate), escape_called_(false) {} + bool escape_called() const { + return escape_called_; + } + template + v8::Local Escape(v8::Local handle) { + escape_called_ = true; + return scope.Escape(handle); + } + + private: + v8::EscapableHandleScope scope; + bool escape_called_; +}; + +inline static napi_handle_scope +JsHandleScopeFromV8HandleScope(HandleScopeWrapper* s) { + return reinterpret_cast(s); +} + +inline static HandleScopeWrapper* +V8HandleScopeFromJsHandleScope(napi_handle_scope s) { + return reinterpret_cast(s); +} + +inline static napi_escapable_handle_scope +JsEscapableHandleScopeFromV8EscapableHandleScope( + EscapableHandleScopeWrapper* s) { + return reinterpret_cast(s); +} + +inline static EscapableHandleScopeWrapper* +V8EscapableHandleScopeFromJsEscapableHandleScope( + napi_escapable_handle_scope s) { + return reinterpret_cast(s); +} + +inline static napi_status ConcludeDeferred(napi_env env, + napi_deferred deferred, + napi_value result, + bool is_resolved) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->isolate->GetCurrentContext(); + v8impl::Persistent* deferred_ref = + NodePersistentFromJsDeferred(deferred); + v8::Local v8_deferred = + v8::Local::New(env->isolate, *deferred_ref); + + auto v8_resolver = v8::Local::Cast(v8_deferred); + + v8::Maybe success = is_resolved ? + v8_resolver->Resolve(context, v8impl::V8LocalValueFromJsValue(result)) : + v8_resolver->Reject(context, v8impl::V8LocalValueFromJsValue(result)); + + delete deferred_ref; + + RETURN_STATUS_IF_FALSE(env, success.FromMaybe(false), napi_generic_failure); + + return GET_RETURN_STATUS(env); +} + +// Wrapper around v8impl::Persistent that implements reference counting. +class Reference : private Finalizer { + private: + Reference(napi_env env, + v8::Local value, + uint32_t initial_refcount, + bool delete_self, + napi_finalize finalize_callback, + void* finalize_data, + void* finalize_hint) + : Finalizer(env, finalize_callback, finalize_data, finalize_hint), + _persistent(env->isolate, value), + _refcount(initial_refcount), + _delete_self(delete_self) { + if (initial_refcount == 0) { + _persistent.SetWeak( + this, FinalizeCallback, v8::WeakCallbackType::kParameter); + } + } + + public: + void* Data() { + return _finalize_data; + } + + static Reference* New(napi_env env, + v8::Local value, + uint32_t initial_refcount, + bool delete_self, + napi_finalize finalize_callback = nullptr, + void* finalize_data = nullptr, + void* finalize_hint = nullptr) { + return new Reference(env, + value, + initial_refcount, + delete_self, + finalize_callback, + finalize_data, + finalize_hint); + } + + static void Delete(Reference* reference) { + delete reference; + } + + uint32_t Ref() { + if (++_refcount == 1) { + _persistent.ClearWeak(); + } + + return _refcount; + } + + uint32_t Unref() { + if (_refcount == 0) { + return 0; + } + if (--_refcount == 0) { + _persistent.SetWeak( + this, FinalizeCallback, v8::WeakCallbackType::kParameter); + } + + return _refcount; + } + + uint32_t RefCount() { + return _refcount; + } + + v8::Local Get() { + if (_persistent.IsEmpty()) { + return v8::Local(); + } else { + return v8::Local::New(_env->isolate, _persistent); + } + } + + private: + static void FinalizeCallback(const v8::WeakCallbackInfo& data) { + Reference* reference = data.GetParameter(); + reference->_persistent.Reset(); + + // Check before calling the finalize callback, because the callback might + // delete it. + bool delete_self = reference->_delete_self; + napi_env env = reference->_env; + + if (reference->_finalize_callback != nullptr) { + NAPI_CALL_INTO_MODULE_THROW(env, + reference->_finalize_callback( + reference->_env, + reference->_finalize_data, + reference->_finalize_hint)); + } + + if (delete_self) { + Delete(reference); + } + } + + v8impl::Persistent _persistent; + uint32_t _refcount; + bool _delete_self; +}; + +enum UnwrapAction { + KeepWrap, + RemoveWrap +}; + +inline static napi_status Unwrap(napi_env env, + napi_value js_object, + void** result, + UnwrapAction action) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, js_object); + if (action == KeepWrap) { + CHECK_ARG(env, result); + } + + v8::Isolate* isolate = env->isolate; + v8::Local context = isolate->GetCurrentContext(); + + v8::Local value = v8impl::V8LocalValueFromJsValue(js_object); + RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg); + v8::Local obj = value.As(); + + auto val = obj->GetPrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) + .ToLocalChecked(); + RETURN_STATUS_IF_FALSE(env, val->IsExternal(), napi_invalid_arg); + Reference* reference = + static_cast(val.As()->Value()); + + if (result) { + *result = reference->Data(); + } + + if (action == RemoveWrap) { + CHECK(obj->DeletePrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) + .FromJust()); + Reference::Delete(reference); + } + + return GET_RETURN_STATUS(env); +} + +//=== Function napi_callback wrapper ================================= + +// Use this data structure to associate callback data with each N-API function +// exposed to JavaScript. The structure is stored in a v8::External which gets +// passed into our callback wrapper. This reduces the performance impact of +// calling through N-API. +// Ref: benchmark/misc/function_call +// Discussion (incl. perf. data): https://github.com/nodejs/node/pull/21072 +struct CallbackBundle { + // Bind the lifecycle of `this` C++ object to a JavaScript object. + // We never delete a CallbackBundle C++ object directly. + void BindLifecycleTo(v8::Isolate* isolate, v8::Local target) { + handle.Reset(isolate, target); + handle.SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter); + } + + napi_env env; // Necessary to invoke C++ NAPI callback + void* cb_data; // The user provided callback data + napi_callback function_or_getter; + napi_callback setter; + v8impl::Persistent handle; // Die with this JavaScript object + + private: + static void WeakCallback(v8::WeakCallbackInfo const& info) { + // Use the "WeakCallback mechanism" to delete the C++ `bundle` object. + // This will be called when the v8::External containing `this` pointer + // is being GC-ed. + CallbackBundle* bundle = info.GetParameter(); + if (bundle != nullptr) { + delete bundle; + } + } +}; + +// Base class extended by classes that wrap V8 function and property callback +// info. +class CallbackWrapper { + public: + CallbackWrapper(napi_value this_arg, size_t args_length, void* data) + : _this(this_arg), _args_length(args_length), _data(data) {} + + virtual napi_value GetNewTarget() = 0; + virtual void Args(napi_value* buffer, size_t bufferlength) = 0; + virtual void SetReturnValue(napi_value value) = 0; + + napi_value This() { return _this; } + + size_t ArgsLength() { return _args_length; } + + void* Data() { return _data; } + + protected: + const napi_value _this; + const size_t _args_length; + void* _data; +}; + +template +class CallbackWrapperBase : public CallbackWrapper { + public: + CallbackWrapperBase(const Info& cbinfo, const size_t args_length) + : CallbackWrapper(JsValueFromV8LocalValue(cbinfo.This()), + args_length, + nullptr), + _cbinfo(cbinfo) { + _bundle = reinterpret_cast( + v8::Local::Cast(cbinfo.Data())->Value()); + _data = _bundle->cb_data; + } + + napi_value GetNewTarget() override { return nullptr; } + + protected: + void InvokeCallback() { + napi_callback_info cbinfo_wrapper = reinterpret_cast( + static_cast(this)); + + // All other pointers we need are stored in `_bundle` + napi_env env = _bundle->env; + napi_callback cb = _bundle->*FunctionField; + + napi_value result; + NAPI_CALL_INTO_MODULE_THROW(env, result = cb(env, cbinfo_wrapper)); + + if (result != nullptr) { + this->SetReturnValue(result); + } + } + + const Info& _cbinfo; + CallbackBundle* _bundle; +}; + +class FunctionCallbackWrapper + : public CallbackWrapperBase, + &CallbackBundle::function_or_getter> { + public: + static void Invoke(const v8::FunctionCallbackInfo& info) { + FunctionCallbackWrapper cbwrapper(info); + cbwrapper.InvokeCallback(); + } + + explicit FunctionCallbackWrapper( + const v8::FunctionCallbackInfo& cbinfo) + : CallbackWrapperBase(cbinfo, cbinfo.Length()) {} + + napi_value GetNewTarget() override { + if (_cbinfo.IsConstructCall()) { + return v8impl::JsValueFromV8LocalValue(_cbinfo.NewTarget()); + } else { + return nullptr; + } + } + + /*virtual*/ + void Args(napi_value* buffer, size_t buffer_length) override { + size_t i = 0; + size_t min = std::min(buffer_length, _args_length); + + for (; i < min; i += 1) { + buffer[i] = v8impl::JsValueFromV8LocalValue(_cbinfo[i]); + } + + if (i < buffer_length) { + napi_value undefined = + v8impl::JsValueFromV8LocalValue(v8::Undefined(_cbinfo.GetIsolate())); + for (; i < buffer_length; i += 1) { + buffer[i] = undefined; + } + } + } + + /*virtual*/ + void SetReturnValue(napi_value value) override { + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + _cbinfo.GetReturnValue().Set(val); + } +}; + +class GetterCallbackWrapper + : public CallbackWrapperBase, + &CallbackBundle::function_or_getter> { + public: + static void Invoke(v8::Local property, + const v8::PropertyCallbackInfo& info) { + GetterCallbackWrapper cbwrapper(info); + cbwrapper.InvokeCallback(); + } + + explicit GetterCallbackWrapper( + const v8::PropertyCallbackInfo& cbinfo) + : CallbackWrapperBase(cbinfo, 0) {} + + /*virtual*/ + void Args(napi_value* buffer, size_t buffer_length) override { + if (buffer_length > 0) { + napi_value undefined = + v8impl::JsValueFromV8LocalValue(v8::Undefined(_cbinfo.GetIsolate())); + for (size_t i = 0; i < buffer_length; i += 1) { + buffer[i] = undefined; + } + } + } + + /*virtual*/ + void SetReturnValue(napi_value value) override { + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + _cbinfo.GetReturnValue().Set(val); + } +}; + +class SetterCallbackWrapper + : public CallbackWrapperBase, + &CallbackBundle::setter> { + public: + static void Invoke(v8::Local property, + v8::Local value, + const v8::PropertyCallbackInfo& info) { + SetterCallbackWrapper cbwrapper(info, value); + cbwrapper.InvokeCallback(); + } + + SetterCallbackWrapper(const v8::PropertyCallbackInfo& cbinfo, + const v8::Local& value) + : CallbackWrapperBase(cbinfo, 1), _value(value) {} + + /*virtual*/ + void Args(napi_value* buffer, size_t buffer_length) override { + if (buffer_length > 0) { + buffer[0] = v8impl::JsValueFromV8LocalValue(_value); + + if (buffer_length > 1) { + napi_value undefined = v8impl::JsValueFromV8LocalValue( + v8::Undefined(_cbinfo.GetIsolate())); + for (size_t i = 1; i < buffer_length; i += 1) { + buffer[i] = undefined; + } + } + } + } + + /*virtual*/ + void SetReturnValue(napi_value value) override { + // Ignore any value returned from a setter callback. + } + + private: + const v8::Local& _value; +}; + +// Creates an object to be made available to the static function callback +// wrapper, used to retrieve the native callback function and data pointer. +static +v8::Local CreateFunctionCallbackData(napi_env env, + napi_callback cb, + void* data) { + CallbackBundle* bundle = new CallbackBundle(); + bundle->function_or_getter = cb; + bundle->cb_data = data; + bundle->env = env; + v8::Local cbdata = v8::External::New(env->isolate, bundle); + bundle->BindLifecycleTo(env->isolate, cbdata); + + return cbdata; +} + +// Creates an object to be made available to the static getter/setter +// callback wrapper, used to retrieve the native getter/setter callback +// function and data pointer. +inline v8::Local CreateAccessorCallbackData(napi_env env, + napi_callback getter, + napi_callback setter, + void* data) { + CallbackBundle* bundle = new CallbackBundle(); + bundle->function_or_getter = getter; + bundle->setter = setter; + bundle->cb_data = data; + bundle->env = env; + v8::Local cbdata = v8::External::New(env->isolate, bundle); + bundle->BindLifecycleTo(env->isolate, cbdata); + + return cbdata; +} + +enum WrapType { + retrievable, + anonymous +}; + +template +inline napi_status Wrap(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, js_object); + + v8::Local context = env->context(); + + v8::Local value = v8impl::V8LocalValueFromJsValue(js_object); + RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg); + v8::Local obj = value.As(); + + if (wrap_type == retrievable) { + // If we've already wrapped this object, we error out. + RETURN_STATUS_IF_FALSE(env, + !obj->HasPrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) + .FromJust(), + napi_invalid_arg); + } else if (wrap_type == anonymous) { + // If no finalize callback is provided, we error out. + CHECK_ARG(env, finalize_cb); + } + + v8impl::Reference* reference = nullptr; + if (result != nullptr) { + // The returned reference should be deleted via napi_delete_reference() + // ONLY in response to the finalize callback invocation. (If it is deleted + // before then, then the finalize callback will never be invoked.) + // Therefore a finalize callback is required when returning a reference. + CHECK_ARG(env, finalize_cb); + reference = v8impl::Reference::New( + env, obj, 0, false, finalize_cb, native_object, finalize_hint); + *result = reinterpret_cast(reference); + } else { + // Create a self-deleting reference. + reference = v8impl::Reference::New(env, obj, 0, true, finalize_cb, + native_object, finalize_cb == nullptr ? nullptr : finalize_hint); + } + + if (wrap_type == retrievable) { + CHECK(obj->SetPrivate(context, NAPI_PRIVATE_KEY(context, wrapper), + v8::External::New(env->isolate, reference)).FromJust()); + } + + return GET_RETURN_STATUS(env); +} + +} // end of anonymous namespace + +} // end of namespace v8impl + +// Warning: Keep in-sync with napi_status enum +static +const char* error_messages[] = {nullptr, + "Invalid argument", + "An object was expected", + "A string was expected", + "A string or symbol was expected", + "A function was expected", + "A number was expected", + "A boolean was expected", + "An array was expected", + "Unknown failure", + "An exception is pending", + "The async work item was cancelled", + "napi_escape_handle already called on scope", + "Invalid handle scope usage", + "Invalid callback scope usage", + "Thread-safe function queue is full", + "Thread-safe function handle is closing", + "A bigint was expected", +}; + +napi_status napi_get_last_error_info(napi_env env, + const napi_extended_error_info** result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + // you must update this assert to reference the last message + // in the napi_status enum each time a new error message is added. + // We don't have a napi_status_last as this would result in an ABI + // change each time a message was added. + static_assert( + NAPI_ARRAYSIZE(error_messages) == napi_bigint_expected + 1, + "Count of error messages must match count of error values"); + CHECK_LE(env->last_error.error_code, napi_callback_scope_mismatch); + + // Wait until someone requests the last error information to fetch the error + // message string + env->last_error.error_message = + error_messages[env->last_error.error_code]; + + *result = &(env->last_error); + return napi_ok; +} + +napi_status napi_create_function(napi_env env, + const char* utf8name, + size_t length, + napi_callback cb, + void* callback_data, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + CHECK_ARG(env, cb); + + v8::Isolate* isolate = env->isolate; + v8::Local return_value; + v8::EscapableHandleScope scope(isolate); + v8::Local cbdata = + v8impl::CreateFunctionCallbackData(env, cb, callback_data); + + RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); + + v8::Local context = env->context(); + v8::MaybeLocal maybe_function = + v8::Function::New(context, + v8impl::FunctionCallbackWrapper::Invoke, + cbdata); + CHECK_MAYBE_EMPTY(env, maybe_function, napi_generic_failure); + + return_value = scope.Escape(maybe_function.ToLocalChecked()); + + if (utf8name != nullptr) { + v8::Local name_string; + CHECK_NEW_FROM_UTF8_LEN(env, name_string, utf8name, length); + return_value->SetName(name_string); + } + + *result = v8impl::JsValueFromV8LocalValue(return_value); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_define_class(napi_env env, + const char* utf8name, + size_t length, + napi_callback constructor, + void* callback_data, + size_t property_count, + const napi_property_descriptor* properties, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + CHECK_ARG(env, constructor); + + v8::Isolate* isolate = env->isolate; + + v8::EscapableHandleScope scope(isolate); + v8::Local cbdata = + v8impl::CreateFunctionCallbackData(env, constructor, callback_data); + + RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); + + v8::Local tpl = v8::FunctionTemplate::New( + isolate, v8impl::FunctionCallbackWrapper::Invoke, cbdata); + + v8::Local name_string; + CHECK_NEW_FROM_UTF8_LEN(env, name_string, utf8name, length); + tpl->SetClassName(name_string); + + size_t static_property_count = 0; + for (size_t i = 0; i < property_count; i++) { + const napi_property_descriptor* p = properties + i; + + if ((p->attributes & napi_static) != 0) { + // Static properties are handled separately below. + static_property_count++; + continue; + } + + v8::Local property_name; + napi_status status = + v8impl::V8NameFromPropertyDescriptor(env, p, &property_name); + + if (status != napi_ok) { + return napi_set_last_error(env, status); + } + + v8::PropertyAttribute attributes = + v8impl::V8PropertyAttributesFromDescriptor(p); + + // This code is similar to that in napi_define_properties(); the + // difference is it applies to a template instead of an object. + if (p->getter != nullptr || p->setter != nullptr) { + v8::Local cbdata = v8impl::CreateAccessorCallbackData( + env, p->getter, p->setter, p->data); + + tpl->PrototypeTemplate()->SetAccessor( + property_name, + p->getter ? v8impl::GetterCallbackWrapper::Invoke : nullptr, + p->setter ? v8impl::SetterCallbackWrapper::Invoke : nullptr, + cbdata, + v8::AccessControl::DEFAULT, + attributes); + } else if (p->method != nullptr) { + v8::Local cbdata = + v8impl::CreateFunctionCallbackData(env, p->method, p->data); + + RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); + + v8::Local t = + v8::FunctionTemplate::New(isolate, + v8impl::FunctionCallbackWrapper::Invoke, + cbdata, + v8::Signature::New(isolate, tpl)); + + tpl->PrototypeTemplate()->Set(property_name, t, attributes); + } else { + v8::Local value = v8impl::V8LocalValueFromJsValue(p->value); + tpl->PrototypeTemplate()->Set(property_name, value, attributes); + } + } + + v8::Local context = env->context(); + *result = v8impl::JsValueFromV8LocalValue( + scope.Escape(tpl->GetFunction(context).ToLocalChecked())); + + if (static_property_count > 0) { + std::vector static_descriptors; + static_descriptors.reserve(static_property_count); + + for (size_t i = 0; i < property_count; i++) { + const napi_property_descriptor* p = properties + i; + if ((p->attributes & napi_static) != 0) { + static_descriptors.push_back(*p); + } + } + + napi_status status = + napi_define_properties(env, + *result, + static_descriptors.size(), + static_descriptors.data()); + if (status != napi_ok) return status; + } + + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_property_names(napi_env env, + napi_value object, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local obj; + CHECK_TO_OBJECT(env, context, obj, object); + + auto maybe_propertynames = obj->GetPropertyNames(context); + + CHECK_MAYBE_EMPTY(env, maybe_propertynames, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue( + maybe_propertynames.ToLocalChecked()); + return GET_RETURN_STATUS(env); +} + +napi_status napi_set_property(napi_env env, + napi_value object, + napi_value key, + napi_value value) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, key); + CHECK_ARG(env, value); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local k = v8impl::V8LocalValueFromJsValue(key); + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + v8::Maybe set_maybe = obj->Set(context, k, val); + + RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); + return GET_RETURN_STATUS(env); +} + +napi_status napi_has_property(napi_env env, + napi_value object, + napi_value key, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + CHECK_ARG(env, key); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local k = v8impl::V8LocalValueFromJsValue(key); + v8::Maybe has_maybe = obj->Has(context, k); + + CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); + + *result = has_maybe.FromMaybe(false); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_property(napi_env env, + napi_value object, + napi_value key, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, key); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local k = v8impl::V8LocalValueFromJsValue(key); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + auto get_maybe = obj->Get(context, k); + + CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); + + v8::Local val = get_maybe.ToLocalChecked(); + *result = v8impl::JsValueFromV8LocalValue(val); + return GET_RETURN_STATUS(env); +} + +napi_status napi_delete_property(napi_env env, + napi_value object, + napi_value key, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, key); + + v8::Local context = env->context(); + v8::Local k = v8impl::V8LocalValueFromJsValue(key); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + v8::Maybe delete_maybe = obj->Delete(context, k); + CHECK_MAYBE_NOTHING(env, delete_maybe, napi_generic_failure); + + if (result != nullptr) + *result = delete_maybe.FromMaybe(false); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_has_own_property(napi_env env, + napi_value object, + napi_value key, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, key); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + v8::Local k = v8impl::V8LocalValueFromJsValue(key); + RETURN_STATUS_IF_FALSE(env, k->IsName(), napi_name_expected); + v8::Maybe has_maybe = obj->HasOwnProperty(context, k.As()); + CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); + *result = has_maybe.FromMaybe(false); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_set_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value value) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local key; + CHECK_NEW_FROM_UTF8(env, key, utf8name); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + v8::Maybe set_maybe = obj->Set(context, key, val); + + RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); + return GET_RETURN_STATUS(env); +} + +napi_status napi_has_named_property(napi_env env, + napi_value object, + const char* utf8name, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local key; + CHECK_NEW_FROM_UTF8(env, key, utf8name); + + v8::Maybe has_maybe = obj->Has(context, key); + + CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); + + *result = has_maybe.FromMaybe(false); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_named_property(napi_env env, + napi_value object, + const char* utf8name, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + + v8::Local key; + CHECK_NEW_FROM_UTF8(env, key, utf8name); + + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + auto get_maybe = obj->Get(context, key); + + CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); + + v8::Local val = get_maybe.ToLocalChecked(); + *result = v8impl::JsValueFromV8LocalValue(val); + return GET_RETURN_STATUS(env); +} + +napi_status napi_set_element(napi_env env, + napi_value object, + uint32_t index, + napi_value value) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + auto set_maybe = obj->Set(context, index, val); + + RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_has_element(napi_env env, + napi_value object, + uint32_t index, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Maybe has_maybe = obj->Has(context, index); + + CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); + + *result = has_maybe.FromMaybe(false); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_element(napi_env env, + napi_value object, + uint32_t index, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + + auto get_maybe = obj->Get(context, index); + + CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue(get_maybe.ToLocalChecked()); + return GET_RETURN_STATUS(env); +} + +napi_status napi_delete_element(napi_env env, + napi_value object, + uint32_t index, + bool* result) { + NAPI_PREAMBLE(env); + + v8::Local context = env->context(); + v8::Local obj; + + CHECK_TO_OBJECT(env, context, obj, object); + v8::Maybe delete_maybe = obj->Delete(context, index); + CHECK_MAYBE_NOTHING(env, delete_maybe, napi_generic_failure); + + if (result != nullptr) + *result = delete_maybe.FromMaybe(false); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_define_properties(napi_env env, + napi_value object, + size_t property_count, + const napi_property_descriptor* properties) { + NAPI_PREAMBLE(env); + if (property_count > 0) { + CHECK_ARG(env, properties); + } + + v8::Local context = env->context(); + + v8::Local obj; + CHECK_TO_OBJECT(env, context, obj, object); + + for (size_t i = 0; i < property_count; i++) { + const napi_property_descriptor* p = &properties[i]; + + v8::Local property_name; + napi_status status = + v8impl::V8NameFromPropertyDescriptor(env, p, &property_name); + + if (status != napi_ok) { + return napi_set_last_error(env, status); + } + + v8::PropertyAttribute attributes = + v8impl::V8PropertyAttributesFromDescriptor(p); + + if (p->getter != nullptr || p->setter != nullptr) { + v8::Local cbdata = v8impl::CreateAccessorCallbackData( + env, + p->getter, + p->setter, + p->data); + + auto set_maybe = obj->SetAccessor( + context, + property_name, + p->getter ? v8impl::GetterCallbackWrapper::Invoke : nullptr, + p->setter ? v8impl::SetterCallbackWrapper::Invoke : nullptr, + cbdata, + v8::AccessControl::DEFAULT, + attributes); + + if (!set_maybe.FromMaybe(false)) { + return napi_set_last_error(env, napi_invalid_arg); + } + } else if (p->method != nullptr) { + v8::Local cbdata = + v8impl::CreateFunctionCallbackData(env, p->method, p->data); + + CHECK_MAYBE_EMPTY(env, cbdata, napi_generic_failure); + + v8::MaybeLocal maybe_fn = + v8::Function::New(context, + v8impl::FunctionCallbackWrapper::Invoke, + cbdata); + + CHECK_MAYBE_EMPTY(env, maybe_fn, napi_generic_failure); + + auto define_maybe = obj->DefineOwnProperty( + context, property_name, maybe_fn.ToLocalChecked(), attributes); + + if (!define_maybe.FromMaybe(false)) { + return napi_set_last_error(env, napi_generic_failure); + } + } else { + v8::Local value = v8impl::V8LocalValueFromJsValue(p->value); + + auto define_maybe = + obj->DefineOwnProperty(context, property_name, value, attributes); + + if (!define_maybe.FromMaybe(false)) { + return napi_set_last_error(env, napi_invalid_arg); + } + } + } + + return GET_RETURN_STATUS(env); +} + +napi_status napi_is_array(napi_env env, napi_value value, bool* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + *result = val->IsArray(); + return napi_clear_last_error(env); +} + +napi_status napi_get_array_length(napi_env env, + napi_value value, + uint32_t* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsArray(), napi_array_expected); + + v8::Local arr = val.As(); + *result = arr->Length(); + + return GET_RETURN_STATUS(env); +} + +napi_status napi_strict_equals(napi_env env, + napi_value lhs, + napi_value rhs, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, lhs); + CHECK_ARG(env, rhs); + CHECK_ARG(env, result); + + v8::Local a = v8impl::V8LocalValueFromJsValue(lhs); + v8::Local b = v8impl::V8LocalValueFromJsValue(rhs); + + *result = a->StrictEquals(b); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_prototype(napi_env env, + napi_value object, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + + v8::Local obj; + CHECK_TO_OBJECT(env, context, obj, object); + + v8::Local val = obj->GetPrototype(); + *result = v8impl::JsValueFromV8LocalValue(val); + return GET_RETURN_STATUS(env); +} + +napi_status napi_create_object(napi_env env, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Object::New(env->isolate)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_array(napi_env env, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Array::New(env->isolate)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_array_with_length(napi_env env, + size_t length, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Array::New(env->isolate, length)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_string_latin1(napi_env env, + const char* str, + size_t length, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + auto isolate = env->isolate; + auto str_maybe = + v8::String::NewFromOneByte(isolate, + reinterpret_cast(str), + v8::NewStringType::kInternalized, + length); + CHECK_MAYBE_EMPTY(env, str_maybe, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue(str_maybe.ToLocalChecked()); + return napi_clear_last_error(env); +} + +napi_status napi_create_string_utf8(napi_env env, + const char* str, + size_t length, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + v8::Local s; + CHECK_NEW_FROM_UTF8_LEN(env, s, str, length); + + *result = v8impl::JsValueFromV8LocalValue(s); + return napi_clear_last_error(env); +} + +napi_status napi_create_string_utf16(napi_env env, + const char16_t* str, + size_t length, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + auto isolate = env->isolate; + auto str_maybe = + v8::String::NewFromTwoByte(isolate, + reinterpret_cast(str), + v8::NewStringType::kInternalized, + length); + CHECK_MAYBE_EMPTY(env, str_maybe, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue(str_maybe.ToLocalChecked()); + return napi_clear_last_error(env); +} + +napi_status napi_create_double(napi_env env, + double value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Number::New(env->isolate, value)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_int32(napi_env env, + int32_t value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Integer::New(env->isolate, value)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_uint32(napi_env env, + uint32_t value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Integer::NewFromUnsigned(env->isolate, value)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_int64(napi_env env, + int64_t value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Number::New(env->isolate, static_cast(value))); + + return napi_clear_last_error(env); +} + +napi_status napi_create_bigint_int64(napi_env env, + int64_t value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::BigInt::New(env->isolate, value)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_bigint_uint64(napi_env env, + uint64_t value, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::BigInt::NewFromUnsigned(env->isolate, value)); + + return napi_clear_last_error(env); +} + +napi_status napi_create_bigint_words(napi_env env, + int sign_bit, + size_t word_count, + const uint64_t* words, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, words); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + + if (word_count > INT_MAX) { + napi_throw_range_error(env, nullptr, "Maximum BigInt size exceeded"); + return napi_set_last_error(env, napi_pending_exception); + } + + v8::MaybeLocal b = v8::BigInt::NewFromWords( + context, sign_bit, word_count, words); + + if (try_catch.HasCaught()) { + return napi_set_last_error(env, napi_pending_exception); + } else { + CHECK_MAYBE_EMPTY(env, b, napi_generic_failure); + *result = v8impl::JsValueFromV8LocalValue(b.ToLocalChecked()); + return napi_clear_last_error(env); + } +} + +napi_status napi_get_boolean(napi_env env, bool value, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + v8::Isolate* isolate = env->isolate; + + if (value) { + *result = v8impl::JsValueFromV8LocalValue(v8::True(isolate)); + } else { + *result = v8impl::JsValueFromV8LocalValue(v8::False(isolate)); + } + + return napi_clear_last_error(env); +} + +napi_status napi_create_symbol(napi_env env, + napi_value description, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + v8::Isolate* isolate = env->isolate; + + if (description == nullptr) { + *result = v8impl::JsValueFromV8LocalValue(v8::Symbol::New(isolate)); + } else { + v8::Local desc = v8impl::V8LocalValueFromJsValue(description); + RETURN_STATUS_IF_FALSE(env, desc->IsString(), napi_string_expected); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Symbol::New(isolate, desc.As())); + } + + return napi_clear_last_error(env); +} + +static inline napi_status set_error_code(napi_env env, + v8::Local error, + napi_value code, + const char* code_cstring) { + if ((code != nullptr) || (code_cstring != nullptr)) { + v8::Isolate* isolate = env->isolate; + v8::Local context = env->context(); + v8::Local err_object = error.As(); + + v8::Local code_value = v8impl::V8LocalValueFromJsValue(code); + if (code != nullptr) { + code_value = v8impl::V8LocalValueFromJsValue(code); + RETURN_STATUS_IF_FALSE(env, code_value->IsString(), napi_string_expected); + } else { + CHECK_NEW_FROM_UTF8(env, code_value, code_cstring); + } + + v8::Local code_key; + CHECK_NEW_FROM_UTF8(env, code_key, "code"); + + v8::Maybe set_maybe = err_object->Set(context, code_key, code_value); + RETURN_STATUS_IF_FALSE(env, + set_maybe.FromMaybe(false), + napi_generic_failure); + + // now update the name to be "name [code]" where name is the + // original name and code is the code associated with the Error + v8::Local name_string; + CHECK_NEW_FROM_UTF8(env, name_string, ""); + v8::Local name_key; + CHECK_NEW_FROM_UTF8(env, name_key, "name"); + + auto maybe_name = err_object->Get(context, name_key); + if (!maybe_name.IsEmpty()) { + v8::Local name = maybe_name.ToLocalChecked(); + if (name->IsString()) { + name_string = + v8::String::Concat(isolate, name_string, name.As()); + } + } + name_string = v8::String::Concat( + isolate, name_string, NAPI_FIXED_ONE_BYTE_STRING(isolate, " [")); + name_string = + v8::String::Concat(isolate, name_string, code_value.As()); + name_string = v8::String::Concat( + isolate, name_string, NAPI_FIXED_ONE_BYTE_STRING(isolate, "]")); + + set_maybe = err_object->Set(context, name_key, name_string); + RETURN_STATUS_IF_FALSE(env, + set_maybe.FromMaybe(false), + napi_generic_failure); + } + return napi_ok; +} + +napi_status napi_create_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, msg); + CHECK_ARG(env, result); + + v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); + RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); + + v8::Local error_obj = + v8::Exception::Error(message_value.As()); + napi_status status = set_error_code(env, error_obj, code, nullptr); + if (status != napi_ok) return status; + + *result = v8impl::JsValueFromV8LocalValue(error_obj); + + return napi_clear_last_error(env); +} + +napi_status napi_create_type_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, msg); + CHECK_ARG(env, result); + + v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); + RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); + + v8::Local error_obj = + v8::Exception::TypeError(message_value.As()); + napi_status status = set_error_code(env, error_obj, code, nullptr); + if (status != napi_ok) return status; + + *result = v8impl::JsValueFromV8LocalValue(error_obj); + + return napi_clear_last_error(env); +} + +napi_status napi_create_range_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, msg); + CHECK_ARG(env, result); + + v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); + RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); + + v8::Local error_obj = + v8::Exception::RangeError(message_value.As()); + napi_status status = set_error_code(env, error_obj, code, nullptr); + if (status != napi_ok) return status; + + *result = v8impl::JsValueFromV8LocalValue(error_obj); + + return napi_clear_last_error(env); +} + +napi_status napi_typeof(napi_env env, + napi_value value, + napi_valuetype* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local v = v8impl::V8LocalValueFromJsValue(value); + + if (v->IsNumber()) { + *result = napi_number; + } else if (v->IsBigInt()) { + *result = napi_bigint; + } else if (v->IsString()) { + *result = napi_string; + } else if (v->IsFunction()) { + // This test has to come before IsObject because IsFunction + // implies IsObject + *result = napi_function; + } else if (v->IsExternal()) { + // This test has to come before IsObject because IsExternal + // implies IsObject + *result = napi_external; + } else if (v->IsObject()) { + *result = napi_object; + } else if (v->IsBoolean()) { + *result = napi_boolean; + } else if (v->IsUndefined()) { + *result = napi_undefined; + } else if (v->IsSymbol()) { + *result = napi_symbol; + } else if (v->IsNull()) { + *result = napi_null; + } else { + // Should not get here unless V8 has added some new kind of value. + return napi_set_last_error(env, napi_invalid_arg); + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_undefined(napi_env env, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Undefined(env->isolate)); + + return napi_clear_last_error(env); +} + +napi_status napi_get_null(napi_env env, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue( + v8::Null(env->isolate)); + + return napi_clear_last_error(env); +} + +// Gets all callback info in a single call. (Ugly, but faster.) +napi_status napi_get_cb_info( + napi_env env, // [in] NAPI environment handle + napi_callback_info cbinfo, // [in] Opaque callback-info handle + size_t* argc, // [in-out] Specifies the size of the provided argv array + // and receives the actual count of args. + napi_value* argv, // [out] Array of values + napi_value* this_arg, // [out] Receives the JS 'this' arg for the call + void** data) { // [out] Receives the data pointer for the callback. + CHECK_ENV(env); + CHECK_ARG(env, cbinfo); + + v8impl::CallbackWrapper* info = + reinterpret_cast(cbinfo); + + if (argv != nullptr) { + CHECK_ARG(env, argc); + info->Args(argv, *argc); + } + if (argc != nullptr) { + *argc = info->ArgsLength(); + } + if (this_arg != nullptr) { + *this_arg = info->This(); + } + if (data != nullptr) { + *data = info->Data(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_new_target(napi_env env, + napi_callback_info cbinfo, + napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, cbinfo); + CHECK_ARG(env, result); + + v8impl::CallbackWrapper* info = + reinterpret_cast(cbinfo); + + *result = info->GetNewTarget(); + return napi_clear_last_error(env); +} + +napi_status napi_call_function(napi_env env, + napi_value recv, + napi_value func, + size_t argc, + const napi_value* argv, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, recv); + if (argc > 0) { + CHECK_ARG(env, argv); + } + + v8::Local context = env->context(); + + v8::Local v8recv = v8impl::V8LocalValueFromJsValue(recv); + + v8::Local v8func; + CHECK_TO_FUNCTION(env, v8func, func); + + auto maybe = v8func->Call(context, v8recv, argc, + reinterpret_cast*>(const_cast(argv))); + + if (try_catch.HasCaught()) { + return napi_set_last_error(env, napi_pending_exception); + } else { + if (result != nullptr) { + CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); + *result = v8impl::JsValueFromV8LocalValue(maybe.ToLocalChecked()); + } + return napi_clear_last_error(env); + } +} + +napi_status napi_get_global(napi_env env, napi_value* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsValueFromV8LocalValue(env->context()->Global()); + + return napi_clear_last_error(env); +} + +napi_status napi_throw(napi_env env, napi_value error) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, error); + + v8::Isolate* isolate = env->isolate; + + isolate->ThrowException(v8impl::V8LocalValueFromJsValue(error)); + // any VM calls after this point and before returning + // to the javascript invoker will fail + return napi_clear_last_error(env); +} + +napi_status napi_throw_error(napi_env env, + const char* code, + const char* msg) { + NAPI_PREAMBLE(env); + + v8::Isolate* isolate = env->isolate; + v8::Local str; + CHECK_NEW_FROM_UTF8(env, str, msg); + + v8::Local error_obj = v8::Exception::Error(str); + napi_status status = set_error_code(env, error_obj, nullptr, code); + if (status != napi_ok) return status; + + isolate->ThrowException(error_obj); + // any VM calls after this point and before returning + // to the javascript invoker will fail + return napi_clear_last_error(env); +} + +napi_status napi_throw_type_error(napi_env env, + const char* code, + const char* msg) { + NAPI_PREAMBLE(env); + + v8::Isolate* isolate = env->isolate; + v8::Local str; + CHECK_NEW_FROM_UTF8(env, str, msg); + + v8::Local error_obj = v8::Exception::TypeError(str); + napi_status status = set_error_code(env, error_obj, nullptr, code); + if (status != napi_ok) return status; + + isolate->ThrowException(error_obj); + // any VM calls after this point and before returning + // to the javascript invoker will fail + return napi_clear_last_error(env); +} + +napi_status napi_throw_range_error(napi_env env, + const char* code, + const char* msg) { + NAPI_PREAMBLE(env); + + v8::Isolate* isolate = env->isolate; + v8::Local str; + CHECK_NEW_FROM_UTF8(env, str, msg); + + v8::Local error_obj = v8::Exception::RangeError(str); + napi_status status = set_error_code(env, error_obj, nullptr, code); + if (status != napi_ok) return status; + + isolate->ThrowException(error_obj); + // any VM calls after this point and before returning + // to the javascript invoker will fail + return napi_clear_last_error(env); +} + +napi_status napi_is_error(napi_env env, napi_value value, bool* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot + // throw JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + *result = val->IsNativeError(); + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_double(napi_env env, + napi_value value, + double* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); + + *result = val.As()->Value(); + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_int32(napi_env env, + napi_value value, + int32_t* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + if (val->IsInt32()) { + *result = val.As()->Value(); + } else { + RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); + + // Empty context: https://github.com/nodejs/node/issues/14379 + v8::Local context; + *result = val->Int32Value(context).FromJust(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_uint32(napi_env env, + napi_value value, + uint32_t* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + if (val->IsUint32()) { + *result = val.As()->Value(); + } else { + RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); + + // Empty context: https://github.com/nodejs/node/issues/14379 + v8::Local context; + *result = val->Uint32Value(context).FromJust(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_int64(napi_env env, + napi_value value, + int64_t* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + // This is still a fast path very likely to be taken. + if (val->IsInt32()) { + *result = val.As()->Value(); + return napi_clear_last_error(env); + } + + RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); + + // v8::Value::IntegerValue() converts NaN, +Inf, and -Inf to INT64_MIN, + // inconsistent with v8::Value::Int32Value() which converts those values to 0. + // Special-case all non-finite values to match that behavior. + double doubleValue = val.As()->Value(); + if (std::isfinite(doubleValue)) { + // Empty context: https://github.com/nodejs/node/issues/14379 + v8::Local context; + *result = val->IntegerValue(context).FromJust(); + } else { + *result = 0; + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_bigint_int64(napi_env env, + napi_value value, + int64_t* result, + bool* lossless) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + CHECK_ARG(env, lossless); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); + + *result = val.As()->Int64Value(lossless); + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_bigint_uint64(napi_env env, + napi_value value, + uint64_t* result, + bool* lossless) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + CHECK_ARG(env, lossless); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); + + *result = val.As()->Uint64Value(lossless); + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_bigint_words(napi_env env, + napi_value value, + int* sign_bit, + size_t* word_count, + uint64_t* words) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, word_count); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + + RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); + + v8::Local big = val.As(); + + int word_count_int = *word_count; + + if (sign_bit == nullptr && words == nullptr) { + word_count_int = big->WordCount(); + } else { + CHECK_ARG(env, sign_bit); + CHECK_ARG(env, words); + big->ToWordsArray(sign_bit, &word_count_int, words); + } + + *word_count = word_count_int; + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_bool(napi_env env, napi_value value, bool* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsBoolean(), napi_boolean_expected); + + *result = val.As()->Value(); + + return napi_clear_last_error(env); +} + +// Copies a JavaScript string into a LATIN-1 string buffer. The result is the +// number of bytes (excluding the null terminator) copied into buf. +// A sufficient buffer size should be greater than the length of string, +// reserving space for null terminator. +// If bufsize is insufficient, the string will be truncated and null terminated. +// If buf is NULL, this method returns the length of the string (in bytes) +// via the result parameter. +// The result argument is optional unless buf is NULL. +napi_status napi_get_value_string_latin1(napi_env env, + napi_value value, + char* buf, + size_t bufsize, + size_t* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); + + if (!buf) { + CHECK_ARG(env, result); + *result = val.As()->Length(); + } else { + int copied = + val.As()->WriteOneByte(env->isolate, + reinterpret_cast(buf), + 0, + bufsize - 1, + v8::String::NO_NULL_TERMINATION); + + buf[copied] = '\0'; + if (result != nullptr) { + *result = copied; + } + } + + return napi_clear_last_error(env); +} + +// Copies a JavaScript string into a UTF-8 string buffer. The result is the +// number of bytes (excluding the null terminator) copied into buf. +// A sufficient buffer size should be greater than the length of string, +// reserving space for null terminator. +// If bufsize is insufficient, the string will be truncated and null terminated. +// If buf is NULL, this method returns the length of the string (in bytes) +// via the result parameter. +// The result argument is optional unless buf is NULL. +napi_status napi_get_value_string_utf8(napi_env env, + napi_value value, + char* buf, + size_t bufsize, + size_t* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); + + if (!buf) { + CHECK_ARG(env, result); + *result = val.As()->Utf8Length(env->isolate); + } else { + int copied = val.As()->WriteUtf8( + env->isolate, + buf, + bufsize - 1, + nullptr, + v8::String::REPLACE_INVALID_UTF8 | v8::String::NO_NULL_TERMINATION); + + buf[copied] = '\0'; + if (result != nullptr) { + *result = copied; + } + } + + return napi_clear_last_error(env); +} + +// Copies a JavaScript string into a UTF-16 string buffer. The result is the +// number of 2-byte code units (excluding the null terminator) copied into buf. +// A sufficient buffer size should be greater than the length of string, +// reserving space for null terminator. +// If bufsize is insufficient, the string will be truncated and null terminated. +// If buf is NULL, this method returns the length of the string (in 2-byte +// code units) via the result parameter. +// The result argument is optional unless buf is NULL. +napi_status napi_get_value_string_utf16(napi_env env, + napi_value value, + char16_t* buf, + size_t bufsize, + size_t* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); + + if (!buf) { + CHECK_ARG(env, result); + // V8 assumes UTF-16 length is the same as the number of characters. + *result = val.As()->Length(); + } else { + int copied = val.As()->Write(env->isolate, + reinterpret_cast(buf), + 0, + bufsize - 1, + v8::String::NO_NULL_TERMINATION); + + buf[copied] = '\0'; + if (result != nullptr) { + *result = copied; + } + } + + return napi_clear_last_error(env); +} + +napi_status napi_coerce_to_object(napi_env env, + napi_value value, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local obj; + CHECK_TO_OBJECT(env, context, obj, value); + + *result = v8impl::JsValueFromV8LocalValue(obj); + return GET_RETURN_STATUS(env); +} + +napi_status napi_coerce_to_bool(napi_env env, + napi_value value, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local b; + + CHECK_TO_BOOL(env, context, b, value); + + *result = v8impl::JsValueFromV8LocalValue(b); + return GET_RETURN_STATUS(env); +} + +napi_status napi_coerce_to_number(napi_env env, + napi_value value, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local num; + + CHECK_TO_NUMBER(env, context, num, value); + + *result = v8impl::JsValueFromV8LocalValue(num); + return GET_RETURN_STATUS(env); +} + +napi_status napi_coerce_to_string(napi_env env, + napi_value value, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local context = env->context(); + v8::Local str; + + CHECK_TO_STRING(env, context, str, value); + + *result = v8impl::JsValueFromV8LocalValue(str); + return GET_RETURN_STATUS(env); +} + +napi_status napi_wrap(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result) { + return v8impl::Wrap(env, + js_object, + native_object, + finalize_cb, + finalize_hint, + result); +} + +napi_status napi_unwrap(napi_env env, napi_value obj, void** result) { + return v8impl::Unwrap(env, obj, result, v8impl::KeepWrap); +} + +napi_status napi_remove_wrap(napi_env env, napi_value obj, void** result) { + return v8impl::Unwrap(env, obj, result, v8impl::RemoveWrap); +} + +napi_status napi_create_external(napi_env env, + void* data, + napi_finalize finalize_cb, + void* finalize_hint, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Isolate* isolate = env->isolate; + + v8::Local external_value = v8::External::New(isolate, data); + + // The Reference object will delete itself after invoking the finalizer + // callback. + v8impl::Reference::New(env, + external_value, + 0, + true, + finalize_cb, + data, + finalize_hint); + + *result = v8impl::JsValueFromV8LocalValue(external_value); + + return napi_clear_last_error(env); +} + +napi_status napi_get_value_external(napi_env env, + napi_value value, + void** result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsExternal(), napi_invalid_arg); + + v8::Local external_value = val.As(); + *result = external_value->Value(); + + return napi_clear_last_error(env); +} + +// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. +napi_status napi_create_reference(napi_env env, + napi_value value, + uint32_t initial_refcount, + napi_ref* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local v8_value = v8impl::V8LocalValueFromJsValue(value); + + if (!(v8_value->IsObject() || v8_value->IsFunction())) { + return napi_set_last_error(env, napi_object_expected); + } + + v8impl::Reference* reference = + v8impl::Reference::New(env, v8_value, initial_refcount, false); + + *result = reinterpret_cast(reference); + return napi_clear_last_error(env); +} + +// Deletes a reference. The referenced value is released, and may be GC'd unless +// there are other references to it. +napi_status napi_delete_reference(napi_env env, napi_ref ref) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, ref); + + v8impl::Reference::Delete(reinterpret_cast(ref)); + + return napi_clear_last_error(env); +} + +// Increments the reference count, optionally returning the resulting count. +// After this call the reference will be a strong reference because its +// refcount is >0, and the referenced object is effectively "pinned". +// Calling this when the refcount is 0 and the object is unavailable +// results in an error. +napi_status napi_reference_ref(napi_env env, napi_ref ref, uint32_t* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, ref); + + v8impl::Reference* reference = reinterpret_cast(ref); + uint32_t count = reference->Ref(); + + if (result != nullptr) { + *result = count; + } + + return napi_clear_last_error(env); +} + +// Decrements the reference count, optionally returning the resulting count. If +// the result is 0 the reference is now weak and the object may be GC'd at any +// time if there are no other references. Calling this when the refcount is +// already 0 results in an error. +napi_status napi_reference_unref(napi_env env, napi_ref ref, uint32_t* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, ref); + + v8impl::Reference* reference = reinterpret_cast(ref); + + if (reference->RefCount() == 0) { + return napi_set_last_error(env, napi_generic_failure); + } + + uint32_t count = reference->Unref(); + + if (result != nullptr) { + *result = count; + } + + return napi_clear_last_error(env); +} + +// Attempts to get a referenced value. If the reference is weak, the value might +// no longer be available, in that case the call is still successful but the +// result is NULL. +napi_status napi_get_reference_value(napi_env env, + napi_ref ref, + napi_value* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, ref); + CHECK_ARG(env, result); + + v8impl::Reference* reference = reinterpret_cast(ref); + *result = v8impl::JsValueFromV8LocalValue(reference->Get()); + + return napi_clear_last_error(env); +} + +napi_status napi_open_handle_scope(napi_env env, napi_handle_scope* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsHandleScopeFromV8HandleScope( + new v8impl::HandleScopeWrapper(env->isolate)); + env->open_handle_scopes++; + return napi_clear_last_error(env); +} + +napi_status napi_close_handle_scope(napi_env env, napi_handle_scope scope) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, scope); + if (env->open_handle_scopes == 0) { + return napi_handle_scope_mismatch; + } + + env->open_handle_scopes--; + delete v8impl::V8HandleScopeFromJsHandleScope(scope); + return napi_clear_last_error(env); +} + +napi_status napi_open_escapable_handle_scope( + napi_env env, + napi_escapable_handle_scope* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = v8impl::JsEscapableHandleScopeFromV8EscapableHandleScope( + new v8impl::EscapableHandleScopeWrapper(env->isolate)); + env->open_handle_scopes++; + return napi_clear_last_error(env); +} + +napi_status napi_close_escapable_handle_scope( + napi_env env, + napi_escapable_handle_scope scope) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, scope); + if (env->open_handle_scopes == 0) { + return napi_handle_scope_mismatch; + } + + delete v8impl::V8EscapableHandleScopeFromJsEscapableHandleScope(scope); + env->open_handle_scopes--; + return napi_clear_last_error(env); +} + +napi_status napi_escape_handle(napi_env env, + napi_escapable_handle_scope scope, + napi_value escapee, + napi_value* result) { + // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw + // JS exceptions. + CHECK_ENV(env); + CHECK_ARG(env, scope); + CHECK_ARG(env, escapee); + CHECK_ARG(env, result); + + v8impl::EscapableHandleScopeWrapper* s = + v8impl::V8EscapableHandleScopeFromJsEscapableHandleScope(scope); + if (!s->escape_called()) { + *result = v8impl::JsValueFromV8LocalValue( + s->Escape(v8impl::V8LocalValueFromJsValue(escapee))); + return napi_clear_last_error(env); + } + return napi_set_last_error(env, napi_escape_called_twice); +} + +napi_status napi_new_instance(napi_env env, + napi_value constructor, + size_t argc, + const napi_value* argv, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, constructor); + if (argc > 0) { + CHECK_ARG(env, argv); + } + CHECK_ARG(env, result); + + v8::Local context = env->context(); + + v8::Local ctor; + CHECK_TO_FUNCTION(env, ctor, constructor); + + auto maybe = ctor->NewInstance(context, argc, + reinterpret_cast*>(const_cast(argv))); + + CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue(maybe.ToLocalChecked()); + return GET_RETURN_STATUS(env); +} + +napi_status napi_instanceof(napi_env env, + napi_value object, + napi_value constructor, + bool* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, object); + CHECK_ARG(env, result); + + *result = false; + + v8::Local ctor; + v8::Local context = env->context(); + + CHECK_TO_OBJECT(env, context, ctor, constructor); + + if (!ctor->IsFunction()) { + napi_throw_type_error(env, + "ERR_NAPI_CONS_FUNCTION", + "Constructor must be a function"); + + return napi_set_last_error(env, napi_function_expected); + } + + napi_status status = napi_generic_failure; + + v8::Local val = v8impl::V8LocalValueFromJsValue(object); + auto maybe_result = val->InstanceOf(context, ctor); + CHECK_MAYBE_NOTHING(env, maybe_result, status); + *result = maybe_result.FromJust(); + return GET_RETURN_STATUS(env); +} + +// Methods to support catching exceptions +napi_status napi_is_exception_pending(napi_env env, bool* result) { + // NAPI_PREAMBLE is not used here: this function must execute when there is a + // pending exception. + CHECK_ENV(env); + CHECK_ARG(env, result); + + *result = !env->last_exception.IsEmpty(); + return napi_clear_last_error(env); +} + +napi_status napi_get_and_clear_last_exception(napi_env env, + napi_value* result) { + // NAPI_PREAMBLE is not used here: this function must execute when there is a + // pending exception. + CHECK_ENV(env); + CHECK_ARG(env, result); + + if (env->last_exception.IsEmpty()) { + return napi_get_undefined(env, result); + } else { + *result = v8impl::JsValueFromV8LocalValue( + v8::Local::New(env->isolate, env->last_exception)); + env->last_exception.Reset(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_is_arraybuffer(napi_env env, napi_value value, bool* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + *result = val->IsArrayBuffer(); + + return napi_clear_last_error(env); +} + +napi_status napi_create_arraybuffer(napi_env env, + size_t byte_length, + void** data, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Isolate* isolate = env->isolate; + v8::Local buffer = + v8::ArrayBuffer::New(isolate, byte_length); + + // Optionally return a pointer to the buffer's data, to avoid another call to + // retrieve it. + if (data != nullptr) { + *data = buffer->GetContents().Data(); + } + + *result = v8impl::JsValueFromV8LocalValue(buffer); + return GET_RETURN_STATUS(env); +} + +napi_status napi_create_external_arraybuffer(napi_env env, + void* external_data, + size_t byte_length, + napi_finalize finalize_cb, + void* finalize_hint, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, result); + + v8::Isolate* isolate = env->isolate; + v8::Local buffer = + v8::ArrayBuffer::New(isolate, external_data, byte_length); + + if (finalize_cb != nullptr) { + // Create a self-deleting weak reference that invokes the finalizer + // callback. + v8impl::Reference::New(env, + buffer, + 0, + true, + finalize_cb, + external_data, + finalize_hint); + } + + *result = v8impl::JsValueFromV8LocalValue(buffer); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_arraybuffer_info(napi_env env, + napi_value arraybuffer, + void** data, + size_t* byte_length) { + CHECK_ENV(env); + CHECK_ARG(env, arraybuffer); + + v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); + RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); + + v8::ArrayBuffer::Contents contents = + value.As()->GetContents(); + + if (data != nullptr) { + *data = contents.Data(); + } + + if (byte_length != nullptr) { + *byte_length = contents.ByteLength(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_is_typedarray(napi_env env, napi_value value, bool* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + *result = val->IsTypedArray(); + + return napi_clear_last_error(env); +} + +napi_status napi_create_typedarray(napi_env env, + napi_typedarray_type type, + size_t length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, arraybuffer); + CHECK_ARG(env, result); + + v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); + RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); + + v8::Local buffer = value.As(); + v8::Local typedArray; + + switch (type) { + case napi_int8_array: + CREATE_TYPED_ARRAY( + env, Int8Array, 1, buffer, byte_offset, length, typedArray); + break; + case napi_uint8_array: + CREATE_TYPED_ARRAY( + env, Uint8Array, 1, buffer, byte_offset, length, typedArray); + break; + case napi_uint8_clamped_array: + CREATE_TYPED_ARRAY( + env, Uint8ClampedArray, 1, buffer, byte_offset, length, typedArray); + break; + case napi_int16_array: + CREATE_TYPED_ARRAY( + env, Int16Array, 2, buffer, byte_offset, length, typedArray); + break; + case napi_uint16_array: + CREATE_TYPED_ARRAY( + env, Uint16Array, 2, buffer, byte_offset, length, typedArray); + break; + case napi_int32_array: + CREATE_TYPED_ARRAY( + env, Int32Array, 4, buffer, byte_offset, length, typedArray); + break; + case napi_uint32_array: + CREATE_TYPED_ARRAY( + env, Uint32Array, 4, buffer, byte_offset, length, typedArray); + break; + case napi_float32_array: + CREATE_TYPED_ARRAY( + env, Float32Array, 4, buffer, byte_offset, length, typedArray); + break; + case napi_float64_array: + CREATE_TYPED_ARRAY( + env, Float64Array, 8, buffer, byte_offset, length, typedArray); + break; + case napi_bigint64_array: + CREATE_TYPED_ARRAY( + env, BigInt64Array, 8, buffer, byte_offset, length, typedArray); + break; + case napi_biguint64_array: + CREATE_TYPED_ARRAY( + env, BigUint64Array, 8, buffer, byte_offset, length, typedArray); + break; + default: + return napi_set_last_error(env, napi_invalid_arg); + } + + *result = v8impl::JsValueFromV8LocalValue(typedArray); + return GET_RETURN_STATUS(env); +} + +napi_status napi_get_typedarray_info(napi_env env, + napi_value typedarray, + napi_typedarray_type* type, + size_t* length, + void** data, + napi_value* arraybuffer, + size_t* byte_offset) { + CHECK_ENV(env); + CHECK_ARG(env, typedarray); + + v8::Local value = v8impl::V8LocalValueFromJsValue(typedarray); + RETURN_STATUS_IF_FALSE(env, value->IsTypedArray(), napi_invalid_arg); + + v8::Local array = value.As(); + + if (type != nullptr) { + if (value->IsInt8Array()) { + *type = napi_int8_array; + } else if (value->IsUint8Array()) { + *type = napi_uint8_array; + } else if (value->IsUint8ClampedArray()) { + *type = napi_uint8_clamped_array; + } else if (value->IsInt16Array()) { + *type = napi_int16_array; + } else if (value->IsUint16Array()) { + *type = napi_uint16_array; + } else if (value->IsInt32Array()) { + *type = napi_int32_array; + } else if (value->IsUint32Array()) { + *type = napi_uint32_array; + } else if (value->IsFloat32Array()) { + *type = napi_float32_array; + } else if (value->IsFloat64Array()) { + *type = napi_float64_array; + } else if (value->IsBigInt64Array()) { + *type = napi_bigint64_array; + } else if (value->IsBigUint64Array()) { + *type = napi_biguint64_array; + } + } + + if (length != nullptr) { + *length = array->Length(); + } + + v8::Local buffer = array->Buffer(); + if (data != nullptr) { + *data = static_cast(buffer->GetContents().Data()) + + array->ByteOffset(); + } + + if (arraybuffer != nullptr) { + *arraybuffer = v8impl::JsValueFromV8LocalValue(buffer); + } + + if (byte_offset != nullptr) { + *byte_offset = array->ByteOffset(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_create_dataview(napi_env env, + size_t byte_length, + napi_value arraybuffer, + size_t byte_offset, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, arraybuffer); + CHECK_ARG(env, result); + + v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); + RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); + + v8::Local buffer = value.As(); + if (byte_length + byte_offset > buffer->ByteLength()) { + napi_throw_range_error( + env, + "ERR_NAPI_INVALID_DATAVIEW_ARGS", + "byte_offset + byte_length should be less than or " + "equal to the size in bytes of the array passed in"); + return napi_set_last_error(env, napi_pending_exception); + } + v8::Local DataView = v8::DataView::New(buffer, byte_offset, + byte_length); + + *result = v8impl::JsValueFromV8LocalValue(DataView); + return GET_RETURN_STATUS(env); +} + +napi_status napi_is_dataview(napi_env env, napi_value value, bool* result) { + CHECK_ENV(env); + CHECK_ARG(env, value); + CHECK_ARG(env, result); + + v8::Local val = v8impl::V8LocalValueFromJsValue(value); + *result = val->IsDataView(); + + return napi_clear_last_error(env); +} + +napi_status napi_get_dataview_info(napi_env env, + napi_value dataview, + size_t* byte_length, + void** data, + napi_value* arraybuffer, + size_t* byte_offset) { + CHECK_ENV(env); + CHECK_ARG(env, dataview); + + v8::Local value = v8impl::V8LocalValueFromJsValue(dataview); + RETURN_STATUS_IF_FALSE(env, value->IsDataView(), napi_invalid_arg); + + v8::Local array = value.As(); + + if (byte_length != nullptr) { + *byte_length = array->ByteLength(); + } + + v8::Local buffer = array->Buffer(); + if (data != nullptr) { + *data = static_cast(buffer->GetContents().Data()) + + array->ByteOffset(); + } + + if (arraybuffer != nullptr) { + *arraybuffer = v8impl::JsValueFromV8LocalValue(buffer); + } + + if (byte_offset != nullptr) { + *byte_offset = array->ByteOffset(); + } + + return napi_clear_last_error(env); +} + +napi_status napi_get_version(napi_env env, uint32_t* result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + *result = NAPI_VERSION; + return napi_clear_last_error(env); +} + +napi_status napi_create_promise(napi_env env, + napi_deferred* deferred, + napi_value* promise) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, deferred); + CHECK_ARG(env, promise); + + auto maybe = v8::Promise::Resolver::New(env->context()); + CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); + + auto v8_resolver = maybe.ToLocalChecked(); + auto v8_deferred = new v8impl::Persistent(); + v8_deferred->Reset(env->isolate, v8_resolver); + + *deferred = v8impl::JsDeferredFromNodePersistent(v8_deferred); + *promise = v8impl::JsValueFromV8LocalValue(v8_resolver->GetPromise()); + return GET_RETURN_STATUS(env); +} + +napi_status napi_resolve_deferred(napi_env env, + napi_deferred deferred, + napi_value resolution) { + return v8impl::ConcludeDeferred(env, deferred, resolution, true); +} + +napi_status napi_reject_deferred(napi_env env, + napi_deferred deferred, + napi_value resolution) { + return v8impl::ConcludeDeferred(env, deferred, resolution, false); +} + +napi_status napi_is_promise(napi_env env, + napi_value promise, + bool* is_promise) { + CHECK_ENV(env); + CHECK_ARG(env, promise); + CHECK_ARG(env, is_promise); + + *is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise(); + + return napi_clear_last_error(env); +} + +napi_status napi_run_script(napi_env env, + napi_value script, + napi_value* result) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, script); + CHECK_ARG(env, result); + + v8::Local v8_script = v8impl::V8LocalValueFromJsValue(script); + + if (!v8_script->IsString()) { + return napi_set_last_error(env, napi_string_expected); + } + + v8::Local context = env->context(); + + auto maybe_script = v8::Script::Compile(context, + v8::Local::Cast(v8_script)); + CHECK_MAYBE_EMPTY(env, maybe_script, napi_generic_failure); + + auto script_result = + maybe_script.ToLocalChecked()->Run(context); + CHECK_MAYBE_EMPTY(env, script_result, napi_generic_failure); + + *result = v8impl::JsValueFromV8LocalValue(script_result.ToLocalChecked()); + return GET_RETURN_STATUS(env); +} + +napi_status napi_add_finalizer(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, + napi_ref* result) { + return v8impl::Wrap(env, + js_object, + native_object, + finalize_cb, + finalize_hint, + result); +} + +napi_status napi_adjust_external_memory(napi_env env, + int64_t change_in_bytes, + int64_t* adjusted_value) { + CHECK_ENV(env); + CHECK_ARG(env, adjusted_value); + + *adjusted_value = env->isolate->AdjustAmountOfExternalAllocatedMemory( + change_in_bytes); + + return napi_clear_last_error(env); +} diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h new file mode 100644 index 00000000000000..d5402845dc6af6 --- /dev/null +++ b/src/js_native_api_v8.h @@ -0,0 +1,202 @@ +#ifndef SRC_JS_NATIVE_API_V8_H_ +#define SRC_JS_NATIVE_API_V8_H_ + +#include +#include "js_native_api_types.h" +#include "js_native_api_v8_internals.h" + +struct napi_env__ { + explicit napi_env__(v8::Local context) + : isolate(context->GetIsolate()), + context_persistent(isolate, context) { + CHECK_EQ(isolate, context->GetIsolate()); + } + v8::Isolate* const isolate; // Shortcut for context()->GetIsolate() + v8impl::Persistent context_persistent; + + inline v8::Local context() const { + return v8impl::PersistentToLocal::Strong(context_persistent); + } + + inline void Ref() { refs++; } + inline void Unref() { if ( --refs == 0) delete this; } + + v8impl::Persistent last_exception; + napi_extended_error_info last_error; + int open_handle_scopes = 0; + int open_callback_scopes = 0; + int refs = 1; +}; + +static inline napi_status napi_clear_last_error(napi_env env) { + env->last_error.error_code = napi_ok; + + // TODO(boingoing): Should this be a callback? + env->last_error.engine_error_code = 0; + env->last_error.engine_reserved = nullptr; + return napi_ok; +} + +static inline +napi_status napi_set_last_error(napi_env env, napi_status error_code, + uint32_t engine_error_code = 0, + void* engine_reserved = nullptr) { + env->last_error.error_code = error_code; + env->last_error.engine_error_code = engine_error_code; + env->last_error.engine_reserved = engine_reserved; + return error_code; +} + +#define RETURN_STATUS_IF_FALSE(env, condition, status) \ + do { \ + if (!(condition)) { \ + return napi_set_last_error((env), (status)); \ + } \ + } while (0) + +#define CHECK_ENV(env) \ + do { \ + if ((env) == nullptr) { \ + return napi_invalid_arg; \ + } \ + } while (0) + +#define CHECK_ARG(env, arg) \ + RETURN_STATUS_IF_FALSE((env), ((arg) != nullptr), napi_invalid_arg) + +#define CHECK_MAYBE_EMPTY(env, maybe, status) \ + RETURN_STATUS_IF_FALSE((env), !((maybe).IsEmpty()), (status)) + +// NAPI_PREAMBLE is not wrapped in do..while: try_catch must have function scope +#define NAPI_PREAMBLE(env) \ + CHECK_ENV((env)); \ + RETURN_STATUS_IF_FALSE((env), (env)->last_exception.IsEmpty(), \ + napi_pending_exception); \ + napi_clear_last_error((env)); \ + v8impl::TryCatch try_catch((env)) + +#define CHECK_TO_TYPE(env, type, context, result, src, status) \ + do { \ + CHECK_ARG((env), (src)); \ + auto maybe = v8impl::V8LocalValueFromJsValue((src))->To##type((context)); \ + CHECK_MAYBE_EMPTY((env), maybe, (status)); \ + (result) = maybe.ToLocalChecked(); \ + } while (0) + +#define CHECK_TO_FUNCTION(env, result, src) \ + do { \ + CHECK_ARG((env), (src)); \ + v8::Local v8value = v8impl::V8LocalValueFromJsValue((src)); \ + RETURN_STATUS_IF_FALSE((env), v8value->IsFunction(), napi_invalid_arg); \ + (result) = v8value.As(); \ + } while (0) + +#define CHECK_TO_OBJECT(env, context, result, src) \ + CHECK_TO_TYPE((env), Object, (context), (result), (src), napi_object_expected) + +#define CHECK_TO_STRING(env, context, result, src) \ + CHECK_TO_TYPE((env), String, (context), (result), (src), napi_string_expected) + +#define GET_RETURN_STATUS(env) \ + (!try_catch.HasCaught() ? napi_ok \ + : napi_set_last_error((env), napi_pending_exception)) + +#define THROW_RANGE_ERROR_IF_FALSE(env, condition, error, message) \ + do { \ + if (!(condition)) { \ + napi_throw_range_error((env), (error), (message)); \ + return napi_set_last_error((env), napi_generic_failure); \ + } \ + } while (0) + +#define NAPI_CALL_INTO_MODULE(env, call, handle_exception) \ + do { \ + int open_handle_scopes = (env)->open_handle_scopes; \ + int open_callback_scopes = (env)->open_callback_scopes; \ + napi_clear_last_error((env)); \ + call; \ + CHECK_EQ((env)->open_handle_scopes, open_handle_scopes); \ + CHECK_EQ((env)->open_callback_scopes, open_callback_scopes); \ + if (!(env)->last_exception.IsEmpty()) { \ + handle_exception( \ + v8::Local::New((env)->isolate, (env)->last_exception)); \ + (env)->last_exception.Reset(); \ + } \ + } while (0) + +#define NAPI_CALL_INTO_MODULE_THROW(env, call) \ + NAPI_CALL_INTO_MODULE((env), call, (env)->isolate->ThrowException) + +namespace v8impl { + +//=== Conversion between V8 Handles and napi_value ======================== + +// This asserts v8::Local<> will always be implemented with a single +// pointer field so that we can pass it around as a void*. +static_assert(sizeof(v8::Local) == sizeof(napi_value), + "Cannot convert between v8::Local and napi_value"); + +inline napi_value JsValueFromV8LocalValue(v8::Local local) { + return reinterpret_cast(*local); +} + +inline v8::Local V8LocalValueFromJsValue(napi_value v) { + v8::Local local; + memcpy(&local, &v, sizeof(v)); + return local; +} + +// Adapter for napi_finalize callbacks. +class Finalizer { + protected: + Finalizer(napi_env env, + napi_finalize finalize_callback, + void* finalize_data, + void* finalize_hint) + : _env(env), + _finalize_callback(finalize_callback), + _finalize_data(finalize_data), + _finalize_hint(finalize_hint) { + } + + ~Finalizer() { + } + + public: + static Finalizer* New(napi_env env, + napi_finalize finalize_callback = nullptr, + void* finalize_data = nullptr, + void* finalize_hint = nullptr) { + return new Finalizer( + env, finalize_callback, finalize_data, finalize_hint); + } + + static void Delete(Finalizer* finalizer) { + delete finalizer; + } + + protected: + napi_env _env; + napi_finalize _finalize_callback; + void* _finalize_data; + void* _finalize_hint; +}; + +class TryCatch : public v8::TryCatch { + public: + explicit TryCatch(napi_env env) + : v8::TryCatch(env->isolate), _env(env) {} + + ~TryCatch() { + if (HasCaught()) { + _env->last_exception.Reset(_env->isolate, Exception()); + } + } + + private: + napi_env _env; +}; + +} // end of namespace v8impl + +#endif // SRC_JS_NATIVE_API_V8_H_ diff --git a/src/js_native_api_v8_internals.h b/src/js_native_api_v8_internals.h new file mode 100644 index 00000000000000..91baae6a3b8201 --- /dev/null +++ b/src/js_native_api_v8_internals.h @@ -0,0 +1,35 @@ +#ifndef SRC_JS_NATIVE_API_V8_INTERNALS_H_ +#define SRC_JS_NATIVE_API_V8_INTERNALS_H_ + +// The V8 implementation of N-API, including `js_native_api_v8.h` uses certain +// idioms which require definition here. For example, it uses a variant of +// persistent references which need not be reset in the constructor. It is the +// responsibility of this file to define these idioms. + +// In the case of the Node.js implementation of N-API some of the idioms are +// imported directly from Node.js by including `node_internals.h` below. Others +// are bridged to remove references to the `node` namespace. + +#include "node_version.h" +#include "env.h" +#include "node_internals.h" + +#define NAPI_ARRAYSIZE(array) \ + node::arraysize((array)) + +#define NAPI_FIXED_ONE_BYTE_STRING(isolate, string) \ + node::FIXED_ONE_BYTE_STRING((isolate), (string)) + +#define NAPI_PRIVATE_KEY(context, suffix) \ + (node::Environment::GetCurrent((context))->napi_ ## suffix()) + +namespace v8impl { + +template +using Persistent = node::Persistent; + +using PersistentToLocal = node::PersistentToLocal; + +} // end of namespace v8impl + +#endif // SRC_JS_NATIVE_API_V8_INTERNALS_H_ diff --git a/src/node_api.cc b/src/node_api.cc index 500312750974ef..20428d40fadbdf 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1,359 +1,32 @@ #include -#include -#include // INT_MAX -#include -#include -#include -#include -#define NAPI_EXPERIMENTAL #include "env.h" +#define NAPI_EXPERIMENTAL #include "node_api.h" #include "node_errors.h" #include "node_internals.h" +#include "js_native_api_v8.h" -static -napi_status napi_set_last_error(napi_env env, napi_status error_code, - uint32_t engine_error_code = 0, - void* engine_reserved = nullptr); -static -napi_status napi_clear_last_error(napi_env env); - -struct napi_env__ { - explicit napi_env__(v8::Local context) - : isolate(context->GetIsolate()), - context_persistent(isolate, context) { - CHECK_EQ(isolate, context->GetIsolate()); +struct node_napi_env__ : public napi_env__ { + explicit node_napi_env__(v8::Local context): + napi_env__(context) { CHECK_NOT_NULL(node_env()); } - - v8::Isolate* const isolate; // Shortcut for context()->GetIsolate() - node::Persistent context_persistent; - - inline v8::Local context() const { - return node::PersistentToLocal::Strong(context_persistent); - } - inline node::Environment* node_env() const { return node::Environment::GetCurrent(context()); } - - inline void Ref() { refs++; } - inline void Unref() { if (--refs == 0) delete this; } - - node::Persistent last_exception; - napi_extended_error_info last_error; - int open_handle_scopes = 0; - int open_callback_scopes = 0; - int refs = 1; }; -#define NAPI_PRIVATE_KEY(context, suffix) \ - (node::Environment::GetCurrent((context))->napi_ ## suffix()) - -#define RETURN_STATUS_IF_FALSE(env, condition, status) \ - do { \ - if (!(condition)) { \ - return napi_set_last_error((env), (status)); \ - } \ - } while (0) - -#define CHECK_ENV(env) \ - do { \ - if ((env) == nullptr) { \ - return napi_invalid_arg; \ - } \ - } while (0) - -#define CHECK_ARG(env, arg) \ - RETURN_STATUS_IF_FALSE((env), ((arg) != nullptr), napi_invalid_arg) - -#define CHECK_MAYBE_EMPTY(env, maybe, status) \ - RETURN_STATUS_IF_FALSE((env), !((maybe).IsEmpty()), (status)) - -#define CHECK_MAYBE_NOTHING(env, maybe, status) \ - RETURN_STATUS_IF_FALSE((env), !((maybe).IsNothing()), (status)) - -// NAPI_PREAMBLE is not wrapped in do..while: try_catch must have function scope -#define NAPI_PREAMBLE(env) \ - CHECK_ENV((env)); \ - RETURN_STATUS_IF_FALSE((env), (env)->last_exception.IsEmpty(), \ - napi_pending_exception); \ - napi_clear_last_error((env)); \ - v8impl::TryCatch try_catch((env)) - -#define CHECK_TO_TYPE(env, type, context, result, src, status) \ - do { \ - CHECK_ARG((env), (src)); \ - auto maybe = v8impl::V8LocalValueFromJsValue((src))->To##type((context)); \ - CHECK_MAYBE_EMPTY((env), maybe, (status)); \ - (result) = maybe.ToLocalChecked(); \ - } while (0) - -#define CHECK_TO_FUNCTION(env, result, src) \ - do { \ - CHECK_ARG((env), (src)); \ - v8::Local v8value = v8impl::V8LocalValueFromJsValue((src)); \ - RETURN_STATUS_IF_FALSE((env), v8value->IsFunction(), napi_invalid_arg); \ - (result) = v8value.As(); \ - } while (0) - -#define CHECK_TO_OBJECT(env, context, result, src) \ - CHECK_TO_TYPE((env), Object, (context), (result), (src), napi_object_expected) - -#define CHECK_TO_STRING(env, context, result, src) \ - CHECK_TO_TYPE((env), String, (context), (result), (src), napi_string_expected) - -#define CHECK_TO_NUMBER(env, context, result, src) \ - CHECK_TO_TYPE((env), Number, (context), (result), (src), napi_number_expected) - -#define CHECK_TO_BOOL(env, context, result, src) \ - CHECK_TO_TYPE((env), Boolean, (context), (result), (src), \ - napi_boolean_expected) - -// n-api defines NAPI_AUTO_LENGHTH as the indicator that a string -// is null terminated. For V8 the equivalent is -1. The assert -// validates that our cast of NAPI_AUTO_LENGTH results in -1 as -// needed by V8. -#define CHECK_NEW_FROM_UTF8_LEN(env, result, str, len) \ - do { \ - static_assert(static_cast(NAPI_AUTO_LENGTH) == -1, \ - "Casting NAPI_AUTO_LENGTH to int must result in -1"); \ - RETURN_STATUS_IF_FALSE((env), \ - (len == NAPI_AUTO_LENGTH) || len <= INT_MAX, \ - napi_invalid_arg); \ - auto str_maybe = v8::String::NewFromUtf8( \ - (env)->isolate, (str), v8::NewStringType::kInternalized, \ - static_cast(len)); \ - CHECK_MAYBE_EMPTY((env), str_maybe, napi_generic_failure); \ - (result) = str_maybe.ToLocalChecked(); \ - } while (0) - -#define CHECK_NEW_FROM_UTF8(env, result, str) \ - CHECK_NEW_FROM_UTF8_LEN((env), (result), (str), NAPI_AUTO_LENGTH) - -#define GET_RETURN_STATUS(env) \ - (!try_catch.HasCaught() ? napi_ok \ - : napi_set_last_error((env), napi_pending_exception)) - -#define THROW_RANGE_ERROR_IF_FALSE(env, condition, error, message) \ - do { \ - if (!(condition)) { \ - napi_throw_range_error((env), (error), (message)); \ - return napi_set_last_error((env), napi_generic_failure); \ - } \ - } while (0) - -#define CREATE_TYPED_ARRAY( \ - env, type, size_of_element, buffer, byte_offset, length, out) \ - do { \ - if ((size_of_element) > 1) { \ - THROW_RANGE_ERROR_IF_FALSE( \ - (env), (byte_offset) % (size_of_element) == 0, \ - "ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT", \ - "start offset of "#type" should be a multiple of "#size_of_element); \ - } \ - THROW_RANGE_ERROR_IF_FALSE((env), (length) * (size_of_element) + \ - (byte_offset) <= buffer->ByteLength(), \ - "ERR_NAPI_INVALID_TYPEDARRAY_LENGTH", \ - "Invalid typed array length"); \ - (out) = v8::type::New((buffer), (byte_offset), (length)); \ - } while (0) - -#define NAPI_CALL_INTO_MODULE(env, call, handle_exception) \ - do { \ - int open_handle_scopes = (env)->open_handle_scopes; \ - int open_callback_scopes = (env)->open_callback_scopes; \ - napi_clear_last_error((env)); \ - call; \ - CHECK_EQ((env)->open_handle_scopes, open_handle_scopes); \ - CHECK_EQ((env)->open_callback_scopes, open_callback_scopes); \ - if (!(env)->last_exception.IsEmpty()) { \ - handle_exception( \ - v8::Local::New((env)->isolate, (env)->last_exception)); \ - (env)->last_exception.Reset(); \ - } \ - } while (0) - -#define NAPI_CALL_INTO_MODULE_THROW(env, call) \ - NAPI_CALL_INTO_MODULE((env), call, (env)->isolate->ThrowException) +typedef node_napi_env__* node_napi_env; -namespace { namespace v8impl { -// convert from n-api property attributes to v8::PropertyAttribute -static inline v8::PropertyAttribute V8PropertyAttributesFromDescriptor( - const napi_property_descriptor* descriptor) { - unsigned int attribute_flags = v8::PropertyAttribute::None; - - if (descriptor->getter != nullptr || descriptor->setter != nullptr) { - // The napi_writable attribute is ignored for accessor descriptors, but - // V8 requires the ReadOnly attribute to match nonexistence of a setter. - attribute_flags |= (descriptor->setter == nullptr ? - v8::PropertyAttribute::ReadOnly : v8::PropertyAttribute::None); - } else if ((descriptor->attributes & napi_writable) == 0) { - attribute_flags |= v8::PropertyAttribute::ReadOnly; - } - - if ((descriptor->attributes & napi_enumerable) == 0) { - attribute_flags |= v8::PropertyAttribute::DontEnum; - } - if ((descriptor->attributes & napi_configurable) == 0) { - attribute_flags |= v8::PropertyAttribute::DontDelete; - } - - return static_cast(attribute_flags); -} - -class HandleScopeWrapper { - public: - explicit HandleScopeWrapper(v8::Isolate* isolate) : scope(isolate) {} - - private: - v8::HandleScope scope; -}; - -// In node v0.10 version of v8, there is no EscapableHandleScope and the -// node v0.10 port use HandleScope::Close(Local v) to mimic the behavior -// of a EscapableHandleScope::Escape(Local v), but it is not the same -// semantics. This is an example of where the api abstraction fail to work -// across different versions. -class EscapableHandleScopeWrapper { - public: - explicit EscapableHandleScopeWrapper(v8::Isolate* isolate) - : scope(isolate), escape_called_(false) {} - bool escape_called() const { - return escape_called_; - } - template - v8::Local Escape(v8::Local handle) { - escape_called_ = true; - return scope.Escape(handle); - } - - private: - v8::EscapableHandleScope scope; - bool escape_called_; -}; - -static -napi_handle_scope JsHandleScopeFromV8HandleScope(HandleScopeWrapper* s) { - return reinterpret_cast(s); -} - -static -HandleScopeWrapper* V8HandleScopeFromJsHandleScope(napi_handle_scope s) { - return reinterpret_cast(s); -} - -static -napi_escapable_handle_scope JsEscapableHandleScopeFromV8EscapableHandleScope( - EscapableHandleScopeWrapper* s) { - return reinterpret_cast(s); -} - -static -EscapableHandleScopeWrapper* -V8EscapableHandleScopeFromJsEscapableHandleScope( - napi_escapable_handle_scope s) { - return reinterpret_cast(s); -} - -static -napi_callback_scope JsCallbackScopeFromV8CallbackScope( - node::CallbackScope* s) { - return reinterpret_cast(s); -} - -static -node::CallbackScope* V8CallbackScopeFromJsCallbackScope( - napi_callback_scope s) { - return reinterpret_cast(s); -} - -//=== Conversion between V8 Handles and napi_value ======================== - -// This asserts v8::Local<> will always be implemented with a single -// pointer field so that we can pass it around as a void*. -static_assert(sizeof(v8::Local) == sizeof(napi_value), - "Cannot convert between v8::Local and napi_value"); - -static -napi_deferred JsDeferredFromNodePersistent(node::Persistent* local) { - return reinterpret_cast(local); -} - -static -node::Persistent* NodePersistentFromJsDeferred(napi_deferred local) { - return reinterpret_cast*>(local); -} - -static -napi_value JsValueFromV8LocalValue(v8::Local local) { - return reinterpret_cast(*local); -} - -static -v8::Local V8LocalValueFromJsValue(napi_value v) { - v8::Local local; - memcpy(&local, &v, sizeof(v)); - return local; -} - -static inline void trigger_fatal_exception( - napi_env env, v8::Local local_err) { - v8::Local local_msg = - v8::Exception::CreateMessage(env->isolate, local_err); - node::FatalException(env->isolate, local_err, local_msg); -} - -static inline napi_status V8NameFromPropertyDescriptor(napi_env env, - const napi_property_descriptor* p, - v8::Local* result) { - if (p->utf8name != nullptr) { - CHECK_NEW_FROM_UTF8(env, *result, p->utf8name); - } else { - v8::Local property_value = - v8impl::V8LocalValueFromJsValue(p->name); - - RETURN_STATUS_IF_FALSE(env, property_value->IsName(), napi_name_expected); - *result = property_value.As(); - } - - return napi_ok; -} - -// Adapter for napi_finalize callbacks. -class Finalizer { - protected: - Finalizer(napi_env env, - napi_finalize finalize_callback, - void* finalize_data, - void* finalize_hint) - : _env(env), - _finalize_callback(finalize_callback), - _finalize_data(finalize_data), - _finalize_hint(finalize_hint) { - } - - ~Finalizer() { - } +namespace { +class BufferFinalizer: private Finalizer { public: - static Finalizer* New(napi_env env, - napi_finalize finalize_callback = nullptr, - void* finalize_data = nullptr, - void* finalize_hint = nullptr) { - return new Finalizer( - env, finalize_callback, finalize_data, finalize_hint); - } - - static void Delete(Finalizer* finalizer) { - delete finalizer; - } - // node::Buffer::FreeCallback static void FinalizeBufferCallback(char* data, void* hint) { - Finalizer* finalizer = static_cast(hint); + BufferFinalizer* finalizer = static_cast(hint); if (finalizer->_finalize_callback != nullptr) { NAPI_CALL_INTO_MODULE_THROW(finalizer->_env, finalizer->_finalize_callback( @@ -364,382 +37,10 @@ class Finalizer { Delete(finalizer); } - - protected: - napi_env _env; - napi_finalize _finalize_callback; - void* _finalize_data; - void* _finalize_hint; -}; - -// Wrapper around node::Persistent that implements reference counting. -class Reference : private Finalizer { - private: - Reference(napi_env env, - v8::Local value, - uint32_t initial_refcount, - bool delete_self, - napi_finalize finalize_callback, - void* finalize_data, - void* finalize_hint) - : Finalizer(env, finalize_callback, finalize_data, finalize_hint), - _persistent(env->isolate, value), - _refcount(initial_refcount), - _delete_self(delete_self) { - if (initial_refcount == 0) { - _persistent.SetWeak( - this, FinalizeCallback, v8::WeakCallbackType::kParameter); - } - } - - public: - void* Data() { - return _finalize_data; - } - - static Reference* New(napi_env env, - v8::Local value, - uint32_t initial_refcount, - bool delete_self, - napi_finalize finalize_callback = nullptr, - void* finalize_data = nullptr, - void* finalize_hint = nullptr) { - return new Reference(env, - value, - initial_refcount, - delete_self, - finalize_callback, - finalize_data, - finalize_hint); - } - - static void Delete(Reference* reference) { - delete reference; - } - - uint32_t Ref() { - if (++_refcount == 1) { - _persistent.ClearWeak(); - } - - return _refcount; - } - - uint32_t Unref() { - if (_refcount == 0) { - return 0; - } - if (--_refcount == 0) { - _persistent.SetWeak( - this, FinalizeCallback, v8::WeakCallbackType::kParameter); - } - - return _refcount; - } - - uint32_t RefCount() { - return _refcount; - } - - v8::Local Get() { - if (_persistent.IsEmpty()) { - return v8::Local(); - } else { - return v8::Local::New(_env->isolate, _persistent); - } - } - - private: - static void FinalizeCallback(const v8::WeakCallbackInfo& data) { - Reference* reference = data.GetParameter(); - reference->_persistent.Reset(); - - // Check before calling the finalize callback, because the callback might - // delete it. - bool delete_self = reference->_delete_self; - napi_env env = reference->_env; - - if (reference->_finalize_callback != nullptr) { - NAPI_CALL_INTO_MODULE_THROW(env, - reference->_finalize_callback( - reference->_env, - reference->_finalize_data, - reference->_finalize_hint)); - } - - if (delete_self) { - Delete(reference); - } - } - - node::Persistent _persistent; - uint32_t _refcount; - bool _delete_self; -}; - -class TryCatch : public v8::TryCatch { - public: - explicit TryCatch(napi_env env) - : v8::TryCatch(env->isolate), _env(env) {} - - ~TryCatch() { - if (HasCaught()) { - _env->last_exception.Reset(_env->isolate, Exception()); - } - } - - private: - napi_env _env; -}; - -//=== Function napi_callback wrapper ================================= - -// Use this data structure to associate callback data with each N-API function -// exposed to JavaScript. The structure is stored in a v8::External which gets -// passed into our callback wrapper. This reduces the performance impact of -// calling through N-API. -// Ref: benchmark/misc/function_call -// Discussion (incl. perf. data): https://github.com/nodejs/node/pull/21072 -struct CallbackBundle { - // Bind the lifecycle of `this` C++ object to a JavaScript object. - // We never delete a CallbackBundle C++ object directly. - void BindLifecycleTo(v8::Isolate* isolate, v8::Local target) { - handle.Reset(isolate, target); - handle.SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter); - } - - napi_env env; // Necessary to invoke C++ NAPI callback - void* cb_data; // The user provided callback data - napi_callback function_or_getter; - napi_callback setter; - node::Persistent handle; // Die with this JavaScript object - - private: - static void WeakCallback(v8::WeakCallbackInfo const& info) { - // Use the "WeakCallback mechanism" to delete the C++ `bundle` object. - // This will be called when the v8::External containing `this` pointer - // is being GC-ed. - CallbackBundle* bundle = info.GetParameter(); - if (bundle != nullptr) { - delete bundle; - } - } -}; - -// Base class extended by classes that wrap V8 function and property callback -// info. -class CallbackWrapper { - public: - CallbackWrapper(napi_value this_arg, size_t args_length, void* data) - : _this(this_arg), _args_length(args_length), _data(data) {} - - virtual napi_value GetNewTarget() = 0; - virtual void Args(napi_value* buffer, size_t bufferlength) = 0; - virtual void SetReturnValue(napi_value value) = 0; - - napi_value This() { return _this; } - - size_t ArgsLength() { return _args_length; } - - void* Data() { return _data; } - - protected: - const napi_value _this; - const size_t _args_length; - void* _data; -}; - -template -class CallbackWrapperBase : public CallbackWrapper { - public: - CallbackWrapperBase(const Info& cbinfo, const size_t args_length) - : CallbackWrapper(JsValueFromV8LocalValue(cbinfo.This()), - args_length, - nullptr), - _cbinfo(cbinfo) { - _bundle = reinterpret_cast( - v8::Local::Cast(cbinfo.Data())->Value()); - _data = _bundle->cb_data; - } - - napi_value GetNewTarget() override { return nullptr; } - - protected: - void InvokeCallback() { - napi_callback_info cbinfo_wrapper = reinterpret_cast( - static_cast(this)); - - // All other pointers we need are stored in `_bundle` - napi_env env = _bundle->env; - napi_callback cb = _bundle->*FunctionField; - - napi_value result; - NAPI_CALL_INTO_MODULE_THROW(env, result = cb(env, cbinfo_wrapper)); - - if (result != nullptr) { - this->SetReturnValue(result); - } - } - - const Info& _cbinfo; - CallbackBundle* _bundle; -}; - -class FunctionCallbackWrapper - : public CallbackWrapperBase, - &CallbackBundle::function_or_getter> { - public: - static void Invoke(const v8::FunctionCallbackInfo& info) { - FunctionCallbackWrapper cbwrapper(info); - cbwrapper.InvokeCallback(); - } - - explicit FunctionCallbackWrapper( - const v8::FunctionCallbackInfo& cbinfo) - : CallbackWrapperBase(cbinfo, cbinfo.Length()) {} - - napi_value GetNewTarget() override { - if (_cbinfo.IsConstructCall()) { - return v8impl::JsValueFromV8LocalValue(_cbinfo.NewTarget()); - } else { - return nullptr; - } - } - - /*virtual*/ - void Args(napi_value* buffer, size_t buffer_length) override { - size_t i = 0; - size_t min = std::min(buffer_length, _args_length); - - for (; i < min; i += 1) { - buffer[i] = v8impl::JsValueFromV8LocalValue(_cbinfo[i]); - } - - if (i < buffer_length) { - napi_value undefined = - v8impl::JsValueFromV8LocalValue(v8::Undefined(_cbinfo.GetIsolate())); - for (; i < buffer_length; i += 1) { - buffer[i] = undefined; - } - } - } - - /*virtual*/ - void SetReturnValue(napi_value value) override { - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - _cbinfo.GetReturnValue().Set(val); - } -}; - -class GetterCallbackWrapper - : public CallbackWrapperBase, - &CallbackBundle::function_or_getter> { - public: - static void Invoke(v8::Local property, - const v8::PropertyCallbackInfo& info) { - GetterCallbackWrapper cbwrapper(info); - cbwrapper.InvokeCallback(); - } - - explicit GetterCallbackWrapper( - const v8::PropertyCallbackInfo& cbinfo) - : CallbackWrapperBase(cbinfo, 0) {} - - /*virtual*/ - void Args(napi_value* buffer, size_t buffer_length) override { - if (buffer_length > 0) { - napi_value undefined = - v8impl::JsValueFromV8LocalValue(v8::Undefined(_cbinfo.GetIsolate())); - for (size_t i = 0; i < buffer_length; i += 1) { - buffer[i] = undefined; - } - } - } - - /*virtual*/ - void SetReturnValue(napi_value value) override { - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - _cbinfo.GetReturnValue().Set(val); - } -}; - -class SetterCallbackWrapper - : public CallbackWrapperBase, - &CallbackBundle::setter> { - public: - static void Invoke(v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& info) { - SetterCallbackWrapper cbwrapper(info, value); - cbwrapper.InvokeCallback(); - } - - SetterCallbackWrapper(const v8::PropertyCallbackInfo& cbinfo, - const v8::Local& value) - : CallbackWrapperBase(cbinfo, 1), _value(value) {} - - /*virtual*/ - void Args(napi_value* buffer, size_t buffer_length) override { - if (buffer_length > 0) { - buffer[0] = v8impl::JsValueFromV8LocalValue(_value); - - if (buffer_length > 1) { - napi_value undefined = v8impl::JsValueFromV8LocalValue( - v8::Undefined(_cbinfo.GetIsolate())); - for (size_t i = 1; i < buffer_length; i += 1) { - buffer[i] = undefined; - } - } - } - } - - /*virtual*/ - void SetReturnValue(napi_value value) override { - // Ignore any value returned from a setter callback. - } - - private: - const v8::Local& _value; }; -// Creates an object to be made available to the static function callback -// wrapper, used to retrieve the native callback function and data pointer. -static -v8::Local CreateFunctionCallbackData(napi_env env, - napi_callback cb, - void* data) { - CallbackBundle* bundle = new CallbackBundle(); - bundle->function_or_getter = cb; - bundle->cb_data = data; - bundle->env = env; - v8::Local cbdata = v8::External::New(env->isolate, bundle); - bundle->BindLifecycleTo(env->isolate, cbdata); - - return cbdata; -} - -// Creates an object to be made available to the static getter/setter -// callback wrapper, used to retrieve the native getter/setter callback -// function and data pointer. -static -v8::Local CreateAccessorCallbackData(napi_env env, - napi_callback getter, - napi_callback setter, - void* data) { - CallbackBundle* bundle = new CallbackBundle(); - bundle->function_or_getter = getter; - bundle->setter = setter; - bundle->cb_data = data; - bundle->env = env; - v8::Local cbdata = v8::External::New(env->isolate, bundle); - bundle->BindLifecycleTo(env->isolate, cbdata); - - return cbdata; -} - -static -napi_env GetEnv(v8::Local context) { - napi_env result; +static inline napi_env GetEnv(v8::Local context) { + node_napi_env result; auto isolate = context->GetIsolate(); auto global = context->Global(); @@ -753,9 +54,9 @@ napi_env GetEnv(v8::Local context) { .ToLocalChecked(); if (value->IsExternal()) { - result = static_cast(value.As()->Value()); + result = static_cast(value.As()->Value()); } else { - result = new napi_env__(context); + result = new node_napi_env__(context); auto external = v8::External::New(isolate, result); // We must also stop hard if the result of assigning the env to the global @@ -767,7 +68,7 @@ napi_env GetEnv(v8::Local context) { // napi_env when its v8::Context was garbage collected; // However, as long as N-API addons using this napi_env are in place, // the Context needs to be accessible and alive. - // Ideally, we’d want an on-addon-unload hook that takes care of this + // Ideally, we'd want an on-addon-unload hook that takes care of this // once all N-API addons using this napi_env are unloaded. // For now, a per-Environment cleanup hook is the best we can do. result->node_env()->AddCleanupHook( @@ -780,72 +81,21 @@ napi_env GetEnv(v8::Local context) { return result; } -enum UnwrapAction { - KeepWrap, - RemoveWrap -}; - -static -napi_status Unwrap(napi_env env, - napi_value js_object, - void** result, - UnwrapAction action) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, js_object); - if (action == KeepWrap) { - CHECK_ARG(env, result); - } - - v8::Local context = env->context(); - - v8::Local value = v8impl::V8LocalValueFromJsValue(js_object); - RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg); - v8::Local obj = value.As(); - - auto val = obj->GetPrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) - .ToLocalChecked(); - RETURN_STATUS_IF_FALSE(env, val->IsExternal(), napi_invalid_arg); - Reference* reference = - static_cast(val.As()->Value()); - - if (result) { - *result = reference->Data(); - } - - if (action == RemoveWrap) { - CHECK(obj->DeletePrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) - .FromJust()); - Reference::Delete(reference); - } - - return GET_RETURN_STATUS(env); +static inline napi_callback_scope +JsCallbackScopeFromV8CallbackScope(node::CallbackScope* s) { + return reinterpret_cast(s); } -static -napi_status ConcludeDeferred(napi_env env, - napi_deferred deferred, - napi_value result, - bool is_resolved) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - node::Persistent* deferred_ref = - NodePersistentFromJsDeferred(deferred); - v8::Local v8_deferred = - v8::Local::New(env->isolate, *deferred_ref); - - auto v8_resolver = v8::Local::Cast(v8_deferred); - - v8::Maybe success = is_resolved ? - v8_resolver->Resolve(context, v8impl::V8LocalValueFromJsValue(result)) : - v8_resolver->Reject(context, v8impl::V8LocalValueFromJsValue(result)); - - delete deferred_ref; - - RETURN_STATUS_IF_FALSE(env, success.FromMaybe(false), napi_generic_failure); +static inline node::CallbackScope* +V8CallbackScopeFromJsCallbackScope(napi_callback_scope s) { + return reinterpret_cast(s); +} - return GET_RETURN_STATUS(env); +static inline void trigger_fatal_exception( + napi_env env, v8::Local local_err) { + v8::Local local_msg = + v8::Exception::CreateMessage(env->isolate, local_err); + node::FatalException(env->isolate, local_err, local_msg); } class ThreadSafeFunction : public node::AsyncResource { @@ -856,7 +106,7 @@ class ThreadSafeFunction : public node::AsyncResource { size_t thread_count_, void* context_, size_t max_queue_size_, - napi_env env_, + node_napi_env env_, void* finalize_data_, napi_finalize finalize_cb_, napi_threadsafe_function_call_js call_js_cb_): @@ -958,10 +208,8 @@ class ThreadSafeFunction : public node::AsyncResource { // These methods must only be called from the loop thread. napi_status Init() { - uv_loop_t* loop = nullptr; - CHECK_EQ(napi_get_uv_event_loop(env, &loop), napi_ok); - ThreadSafeFunction* ts_fn = this; + uv_loop_t* loop = env->node_env()->event_loop(); if (uv_async_init(loop, &async, AsyncCb) == 0) { if (max_queue_size > 0) { @@ -1171,85 +419,29 @@ class ThreadSafeFunction : public node::AsyncResource { size_t max_queue_size; // These are variables accessed only from the loop thread. - node::Persistent ref; - napi_env env; + v8impl::Persistent ref; + node_napi_env env; void* finalize_data; napi_finalize finalize_cb; napi_threadsafe_function_call_js call_js_cb; bool handles_closing; }; -enum WrapType { - retrievable, - anonymous -}; - -template static inline -napi_status Wrap(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, js_object); +} // end of anonymous namespace - v8::Local context = env->context(); - - v8::Local value = v8impl::V8LocalValueFromJsValue(js_object); - RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg); - v8::Local obj = value.As(); - - if (wrap_type == retrievable) { - // If we've already wrapped this object, we error out. - RETURN_STATUS_IF_FALSE(env, - !obj->HasPrivate(context, NAPI_PRIVATE_KEY(context, wrapper)) - .FromJust(), - napi_invalid_arg); - } else if (wrap_type == anonymous) { - // If no finalize callback is provided, we error out. - CHECK_ARG(env, finalize_cb); - } - - v8impl::Reference* reference = nullptr; - if (result != nullptr) { - // The returned reference should be deleted via napi_delete_reference() - // ONLY in response to the finalize callback invocation. (If it is deleted - // before then, then the finalize callback will never be invoked.) - // Therefore a finalize callback is required when returning a reference. - CHECK_ARG(env, finalize_cb); - reference = v8impl::Reference::New( - env, obj, 0, false, finalize_cb, native_object, finalize_hint); - *result = reinterpret_cast(reference); - } else { - // Create a self-deleting reference. - reference = v8impl::Reference::New(env, obj, 0, true, finalize_cb, - native_object, finalize_cb == nullptr ? nullptr : finalize_hint); - } - - if (wrap_type == retrievable) { - CHECK(obj->SetPrivate(context, NAPI_PRIVATE_KEY(context, wrapper), - v8::External::New(env->isolate, reference)).FromJust()); - } - - return GET_RETURN_STATUS(env); -} - -} // end of namespace v8impl +} // end of namespace v8impl // Intercepts the Node-V8 module registration callback. Converts parameters // to NAPI equivalents and then calls the registration callback specified // by the NAPI module. -void napi_module_register_cb(v8::Local exports, - v8::Local module, - v8::Local context, - void* priv) { +static void napi_module_register_cb(v8::Local exports, + v8::Local module, + v8::Local context, + void* priv) { napi_module_register_by_symbol(exports, module, context, static_cast(priv)->nm_register_func); } -} // end of anonymous namespace - void napi_module_register_by_symbol(v8::Local exports, v8::Local module, v8::Local context, @@ -1300,1858 +492,58 @@ napi_status napi_add_env_cleanup_hook(napi_env env, void (*fun)(void* arg), void* arg) { CHECK_ENV(env); - CHECK_ARG(env, fun); - - node::AddEnvironmentCleanupHook(env->isolate, fun, arg); - - return napi_ok; -} - -napi_status napi_remove_env_cleanup_hook(napi_env env, - void (*fun)(void* arg), - void* arg) { - CHECK_ENV(env); - CHECK_ARG(env, fun); - - node::RemoveEnvironmentCleanupHook(env->isolate, fun, arg); - - return napi_ok; -} - -// Warning: Keep in-sync with napi_status enum -static -const char* error_messages[] = {nullptr, - "Invalid argument", - "An object was expected", - "A string was expected", - "A string or symbol was expected", - "A function was expected", - "A number was expected", - "A boolean was expected", - "An array was expected", - "Unknown failure", - "An exception is pending", - "The async work item was cancelled", - "napi_escape_handle already called on scope", - "Invalid handle scope usage", - "Invalid callback scope usage", - "Thread-safe function queue is full", - "Thread-safe function handle is closing", - "A bigint was expected", -}; - -static inline napi_status napi_clear_last_error(napi_env env) { - env->last_error.error_code = napi_ok; - - // TODO(boingoing): Should this be a callback? - env->last_error.engine_error_code = 0; - env->last_error.engine_reserved = nullptr; - return napi_ok; -} - -static inline -napi_status napi_set_last_error(napi_env env, napi_status error_code, - uint32_t engine_error_code, - void* engine_reserved) { - env->last_error.error_code = error_code; - env->last_error.engine_error_code = engine_error_code; - env->last_error.engine_reserved = engine_reserved; - return error_code; -} - -napi_status napi_get_last_error_info(napi_env env, - const napi_extended_error_info** result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - // you must update this assert to reference the last message - // in the napi_status enum each time a new error message is added. - // We don't have a napi_status_last as this would result in an ABI - // change each time a message was added. - static_assert( - node::arraysize(error_messages) == napi_bigint_expected + 1, - "Count of error messages must match count of error values"); - CHECK_LE(env->last_error.error_code, napi_callback_scope_mismatch); - - // Wait until someone requests the last error information to fetch the error - // message string - env->last_error.error_message = - error_messages[env->last_error.error_code]; - - *result = &(env->last_error); - return napi_ok; -} - -napi_status napi_fatal_exception(napi_env env, napi_value err) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, err); - - v8::Local local_err = v8impl::V8LocalValueFromJsValue(err); - v8impl::trigger_fatal_exception(env, local_err); - - return napi_clear_last_error(env); -} - -NAPI_NO_RETURN void napi_fatal_error(const char* location, - size_t location_len, - const char* message, - size_t message_len) { - std::string location_string; - std::string message_string; - - if (location_len != NAPI_AUTO_LENGTH) { - location_string.assign( - const_cast(location), location_len); - } else { - location_string.assign( - const_cast(location), strlen(location)); - } - - if (message_len != NAPI_AUTO_LENGTH) { - message_string.assign( - const_cast(message), message_len); - } else { - message_string.assign( - const_cast(message), strlen(message)); - } - - node::FatalError(location_string.c_str(), message_string.c_str()); -} - -napi_status napi_create_function(napi_env env, - const char* utf8name, - size_t length, - napi_callback cb, - void* callback_data, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - CHECK_ARG(env, cb); - - v8::Isolate* isolate = env->isolate; - v8::Local return_value; - v8::EscapableHandleScope scope(isolate); - v8::Local cbdata = - v8impl::CreateFunctionCallbackData(env, cb, callback_data); - - RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); - - v8::Local context = env->context(); - v8::MaybeLocal maybe_function = - v8::Function::New(context, - v8impl::FunctionCallbackWrapper::Invoke, - cbdata); - CHECK_MAYBE_EMPTY(env, maybe_function, napi_generic_failure); - - return_value = scope.Escape(maybe_function.ToLocalChecked()); - - if (utf8name != nullptr) { - v8::Local name_string; - CHECK_NEW_FROM_UTF8_LEN(env, name_string, utf8name, length); - return_value->SetName(name_string); - } - - *result = v8impl::JsValueFromV8LocalValue(return_value); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_define_class(napi_env env, - const char* utf8name, - size_t length, - napi_callback constructor, - void* callback_data, - size_t property_count, - const napi_property_descriptor* properties, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - CHECK_ARG(env, constructor); - - v8::Isolate* isolate = env->isolate; - - v8::EscapableHandleScope scope(isolate); - v8::Local cbdata = - v8impl::CreateFunctionCallbackData(env, constructor, callback_data); - - RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); - - v8::Local tpl = v8::FunctionTemplate::New( - isolate, v8impl::FunctionCallbackWrapper::Invoke, cbdata); - - v8::Local name_string; - CHECK_NEW_FROM_UTF8_LEN(env, name_string, utf8name, length); - tpl->SetClassName(name_string); - - size_t static_property_count = 0; - for (size_t i = 0; i < property_count; i++) { - const napi_property_descriptor* p = properties + i; - - if ((p->attributes & napi_static) != 0) { - // Static properties are handled separately below. - static_property_count++; - continue; - } - - v8::Local property_name; - napi_status status = - v8impl::V8NameFromPropertyDescriptor(env, p, &property_name); - - if (status != napi_ok) { - return napi_set_last_error(env, status); - } - - v8::PropertyAttribute attributes = - v8impl::V8PropertyAttributesFromDescriptor(p); - - // This code is similar to that in napi_define_properties(); the - // difference is it applies to a template instead of an object. - if (p->getter != nullptr || p->setter != nullptr) { - v8::Local cbdata = v8impl::CreateAccessorCallbackData( - env, p->getter, p->setter, p->data); - - tpl->PrototypeTemplate()->SetAccessor( - property_name, - p->getter ? v8impl::GetterCallbackWrapper::Invoke : nullptr, - p->setter ? v8impl::SetterCallbackWrapper::Invoke : nullptr, - cbdata, - v8::AccessControl::DEFAULT, - attributes); - } else if (p->method != nullptr) { - v8::Local cbdata = - v8impl::CreateFunctionCallbackData(env, p->method, p->data); - - RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure); - - v8::Local t = - v8::FunctionTemplate::New(isolate, - v8impl::FunctionCallbackWrapper::Invoke, - cbdata, - v8::Signature::New(isolate, tpl)); - - tpl->PrototypeTemplate()->Set(property_name, t, attributes); - } else { - v8::Local value = v8impl::V8LocalValueFromJsValue(p->value); - tpl->PrototypeTemplate()->Set(property_name, value, attributes); - } - } - - v8::Local context = env->context(); - *result = v8impl::JsValueFromV8LocalValue( - scope.Escape(tpl->GetFunction(context).ToLocalChecked())); - - if (static_property_count > 0) { - std::vector static_descriptors; - static_descriptors.reserve(static_property_count); - - for (size_t i = 0; i < property_count; i++) { - const napi_property_descriptor* p = properties + i; - if ((p->attributes & napi_static) != 0) { - static_descriptors.push_back(*p); - } - } - - napi_status status = - napi_define_properties(env, - *result, - static_descriptors.size(), - static_descriptors.data()); - if (status != napi_ok) return status; - } - - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_property_names(napi_env env, - napi_value object, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local obj; - CHECK_TO_OBJECT(env, context, obj, object); - - auto maybe_propertynames = obj->GetPropertyNames(context); - - CHECK_MAYBE_EMPTY(env, maybe_propertynames, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue( - maybe_propertynames.ToLocalChecked()); - return GET_RETURN_STATUS(env); -} - -napi_status napi_set_property(napi_env env, - napi_value object, - napi_value key, - napi_value value) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, key); - CHECK_ARG(env, value); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local k = v8impl::V8LocalValueFromJsValue(key); - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - v8::Maybe set_maybe = obj->Set(context, k, val); - - RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); - return GET_RETURN_STATUS(env); -} - -napi_status napi_has_property(napi_env env, - napi_value object, - napi_value key, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - CHECK_ARG(env, key); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local k = v8impl::V8LocalValueFromJsValue(key); - v8::Maybe has_maybe = obj->Has(context, k); - - CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); - - *result = has_maybe.FromMaybe(false); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_property(napi_env env, - napi_value object, - napi_value key, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, key); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local k = v8impl::V8LocalValueFromJsValue(key); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - auto get_maybe = obj->Get(context, k); - - CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); - - v8::Local val = get_maybe.ToLocalChecked(); - *result = v8impl::JsValueFromV8LocalValue(val); - return GET_RETURN_STATUS(env); -} - -napi_status napi_delete_property(napi_env env, - napi_value object, - napi_value key, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, key); - - v8::Local context = env->context(); - v8::Local k = v8impl::V8LocalValueFromJsValue(key); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - v8::Maybe delete_maybe = obj->Delete(context, k); - CHECK_MAYBE_NOTHING(env, delete_maybe, napi_generic_failure); - - if (result != nullptr) - *result = delete_maybe.FromMaybe(false); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_has_own_property(napi_env env, - napi_value object, - napi_value key, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, key); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - v8::Local k = v8impl::V8LocalValueFromJsValue(key); - RETURN_STATUS_IF_FALSE(env, k->IsName(), napi_name_expected); - v8::Maybe has_maybe = obj->HasOwnProperty(context, k.As()); - CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); - *result = has_maybe.FromMaybe(false); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_set_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value value) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local key; - CHECK_NEW_FROM_UTF8(env, key, utf8name); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - v8::Maybe set_maybe = obj->Set(context, key, val); - - RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); - return GET_RETURN_STATUS(env); -} - -napi_status napi_has_named_property(napi_env env, - napi_value object, - const char* utf8name, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local key; - CHECK_NEW_FROM_UTF8(env, key, utf8name); - - v8::Maybe has_maybe = obj->Has(context, key); - - CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); - - *result = has_maybe.FromMaybe(false); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - - v8::Local key; - CHECK_NEW_FROM_UTF8(env, key, utf8name); - - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - auto get_maybe = obj->Get(context, key); - - CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); - - v8::Local val = get_maybe.ToLocalChecked(); - *result = v8impl::JsValueFromV8LocalValue(val); - return GET_RETURN_STATUS(env); -} - -napi_status napi_set_element(napi_env env, - napi_value object, - uint32_t index, - napi_value value) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - auto set_maybe = obj->Set(context, index, val); - - RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_has_element(napi_env env, - napi_value object, - uint32_t index, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Maybe has_maybe = obj->Has(context, index); - - CHECK_MAYBE_NOTHING(env, has_maybe, napi_generic_failure); - - *result = has_maybe.FromMaybe(false); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_element(napi_env env, - napi_value object, - uint32_t index, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - - auto get_maybe = obj->Get(context, index); - - CHECK_MAYBE_EMPTY(env, get_maybe, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue(get_maybe.ToLocalChecked()); - return GET_RETURN_STATUS(env); -} - -napi_status napi_delete_element(napi_env env, - napi_value object, - uint32_t index, - bool* result) { - NAPI_PREAMBLE(env); - - v8::Local context = env->context(); - v8::Local obj; - - CHECK_TO_OBJECT(env, context, obj, object); - v8::Maybe delete_maybe = obj->Delete(context, index); - CHECK_MAYBE_NOTHING(env, delete_maybe, napi_generic_failure); - - if (result != nullptr) - *result = delete_maybe.FromMaybe(false); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_define_properties(napi_env env, - napi_value object, - size_t property_count, - const napi_property_descriptor* properties) { - NAPI_PREAMBLE(env); - if (property_count > 0) { - CHECK_ARG(env, properties); - } - - v8::Local context = env->context(); - - v8::Local obj; - CHECK_TO_OBJECT(env, context, obj, object); - - for (size_t i = 0; i < property_count; i++) { - const napi_property_descriptor* p = &properties[i]; - - v8::Local property_name; - napi_status status = - v8impl::V8NameFromPropertyDescriptor(env, p, &property_name); - - if (status != napi_ok) { - return napi_set_last_error(env, status); - } - - v8::PropertyAttribute attributes = - v8impl::V8PropertyAttributesFromDescriptor(p); - - if (p->getter != nullptr || p->setter != nullptr) { - v8::Local cbdata = v8impl::CreateAccessorCallbackData( - env, - p->getter, - p->setter, - p->data); - - auto set_maybe = obj->SetAccessor( - context, - property_name, - p->getter ? v8impl::GetterCallbackWrapper::Invoke : nullptr, - p->setter ? v8impl::SetterCallbackWrapper::Invoke : nullptr, - cbdata, - v8::AccessControl::DEFAULT, - attributes); - - if (!set_maybe.FromMaybe(false)) { - return napi_set_last_error(env, napi_invalid_arg); - } - } else if (p->method != nullptr) { - v8::Local cbdata = - v8impl::CreateFunctionCallbackData(env, p->method, p->data); - - CHECK_MAYBE_EMPTY(env, cbdata, napi_generic_failure); - - v8::MaybeLocal maybe_fn = - v8::Function::New(context, - v8impl::FunctionCallbackWrapper::Invoke, - cbdata); - - CHECK_MAYBE_EMPTY(env, maybe_fn, napi_generic_failure); - - auto define_maybe = obj->DefineOwnProperty( - context, property_name, maybe_fn.ToLocalChecked(), attributes); - - if (!define_maybe.FromMaybe(false)) { - return napi_set_last_error(env, napi_generic_failure); - } - } else { - v8::Local value = v8impl::V8LocalValueFromJsValue(p->value); - - auto define_maybe = - obj->DefineOwnProperty(context, property_name, value, attributes); - - if (!define_maybe.FromMaybe(false)) { - return napi_set_last_error(env, napi_invalid_arg); - } - } - } - - return GET_RETURN_STATUS(env); -} - -napi_status napi_is_array(napi_env env, napi_value value, bool* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - *result = val->IsArray(); - return napi_clear_last_error(env); -} - -napi_status napi_get_array_length(napi_env env, - napi_value value, - uint32_t* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsArray(), napi_array_expected); - - v8::Local arr = val.As(); - *result = arr->Length(); - - return GET_RETURN_STATUS(env); -} - -napi_status napi_strict_equals(napi_env env, - napi_value lhs, - napi_value rhs, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, lhs); - CHECK_ARG(env, rhs); - CHECK_ARG(env, result); - - v8::Local a = v8impl::V8LocalValueFromJsValue(lhs); - v8::Local b = v8impl::V8LocalValueFromJsValue(rhs); - - *result = a->StrictEquals(b); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_prototype(napi_env env, - napi_value object, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - - v8::Local obj; - CHECK_TO_OBJECT(env, context, obj, object); - - v8::Local val = obj->GetPrototype(); - *result = v8impl::JsValueFromV8LocalValue(val); - return GET_RETURN_STATUS(env); -} - -napi_status napi_create_object(napi_env env, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Object::New(env->isolate)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_array(napi_env env, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Array::New(env->isolate)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_array_with_length(napi_env env, - size_t length, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Array::New(env->isolate, length)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_string_latin1(napi_env env, - const char* str, - size_t length, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - auto isolate = env->isolate; - auto str_maybe = - v8::String::NewFromOneByte(isolate, - reinterpret_cast(str), - v8::NewStringType::kInternalized, - length); - CHECK_MAYBE_EMPTY(env, str_maybe, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue(str_maybe.ToLocalChecked()); - return napi_clear_last_error(env); -} - -napi_status napi_create_string_utf8(napi_env env, - const char* str, - size_t length, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - v8::Local s; - CHECK_NEW_FROM_UTF8_LEN(env, s, str, length); - - *result = v8impl::JsValueFromV8LocalValue(s); - return napi_clear_last_error(env); -} - -napi_status napi_create_string_utf16(napi_env env, - const char16_t* str, - size_t length, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - auto isolate = env->isolate; - auto str_maybe = - v8::String::NewFromTwoByte(isolate, - reinterpret_cast(str), - v8::NewStringType::kInternalized, - length); - CHECK_MAYBE_EMPTY(env, str_maybe, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue(str_maybe.ToLocalChecked()); - return napi_clear_last_error(env); -} - -napi_status napi_create_double(napi_env env, - double value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Number::New(env->isolate, value)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_int32(napi_env env, - int32_t value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Integer::New(env->isolate, value)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_uint32(napi_env env, - uint32_t value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Integer::NewFromUnsigned(env->isolate, value)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_int64(napi_env env, - int64_t value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Number::New(env->isolate, static_cast(value))); - - return napi_clear_last_error(env); -} - -napi_status napi_create_bigint_int64(napi_env env, - int64_t value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::BigInt::New(env->isolate, value)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_bigint_uint64(napi_env env, - uint64_t value, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::BigInt::NewFromUnsigned(env->isolate, value)); - - return napi_clear_last_error(env); -} - -napi_status napi_create_bigint_words(napi_env env, - int sign_bit, - size_t word_count, - const uint64_t* words, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, words); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - - if (word_count > INT_MAX) { - napi_throw_range_error(env, nullptr, "Maximum BigInt size exceeded"); - return napi_set_last_error(env, napi_pending_exception); - } - - v8::MaybeLocal b = v8::BigInt::NewFromWords( - context, sign_bit, word_count, words); - - if (try_catch.HasCaught()) { - return napi_set_last_error(env, napi_pending_exception); - } else { - CHECK_MAYBE_EMPTY(env, b, napi_generic_failure); - *result = v8impl::JsValueFromV8LocalValue(b.ToLocalChecked()); - return napi_clear_last_error(env); - } -} - -napi_status napi_get_boolean(napi_env env, bool value, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - v8::Isolate* isolate = env->isolate; - - if (value) { - *result = v8impl::JsValueFromV8LocalValue(v8::True(isolate)); - } else { - *result = v8impl::JsValueFromV8LocalValue(v8::False(isolate)); - } - - return napi_clear_last_error(env); -} - -napi_status napi_create_symbol(napi_env env, - napi_value description, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - v8::Isolate* isolate = env->isolate; - - if (description == nullptr) { - *result = v8impl::JsValueFromV8LocalValue(v8::Symbol::New(isolate)); - } else { - v8::Local desc = v8impl::V8LocalValueFromJsValue(description); - RETURN_STATUS_IF_FALSE(env, desc->IsString(), napi_string_expected); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Symbol::New(isolate, desc.As())); - } - - return napi_clear_last_error(env); -} - -static napi_status set_error_code(napi_env env, - v8::Local error, - napi_value code, - const char* code_cstring) { - if ((code != nullptr) || (code_cstring != nullptr)) { - v8::Isolate* isolate = env->isolate; - v8::Local context = env->context(); - v8::Local err_object = error.As(); - - v8::Local code_value = v8impl::V8LocalValueFromJsValue(code); - if (code != nullptr) { - code_value = v8impl::V8LocalValueFromJsValue(code); - RETURN_STATUS_IF_FALSE(env, code_value->IsString(), napi_string_expected); - } else { - CHECK_NEW_FROM_UTF8(env, code_value, code_cstring); - } - - v8::Local code_key; - CHECK_NEW_FROM_UTF8(env, code_key, "code"); - - v8::Maybe set_maybe = err_object->Set(context, code_key, code_value); - RETURN_STATUS_IF_FALSE(env, - set_maybe.FromMaybe(false), - napi_generic_failure); - - // now update the name to be "name [code]" where name is the - // original name and code is the code associated with the Error - v8::Local name_string; - CHECK_NEW_FROM_UTF8(env, name_string, ""); - v8::Local name_key; - CHECK_NEW_FROM_UTF8(env, name_key, "name"); - - auto maybe_name = err_object->Get(context, name_key); - if (!maybe_name.IsEmpty()) { - v8::Local name = maybe_name.ToLocalChecked(); - if (name->IsString()) { - name_string = - v8::String::Concat(isolate, name_string, name.As()); - } - } - name_string = v8::String::Concat( - isolate, name_string, node::FIXED_ONE_BYTE_STRING(isolate, " [")); - name_string = - v8::String::Concat(isolate, name_string, code_value.As()); - name_string = v8::String::Concat( - isolate, name_string, node::FIXED_ONE_BYTE_STRING(isolate, "]")); - - set_maybe = err_object->Set(context, name_key, name_string); - RETURN_STATUS_IF_FALSE(env, - set_maybe.FromMaybe(false), - napi_generic_failure); - } - return napi_ok; -} - -napi_status napi_create_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, msg); - CHECK_ARG(env, result); - - v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); - RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); - - v8::Local error_obj = - v8::Exception::Error(message_value.As()); - napi_status status = set_error_code(env, error_obj, code, nullptr); - if (status != napi_ok) return status; - - *result = v8impl::JsValueFromV8LocalValue(error_obj); - - return napi_clear_last_error(env); -} - -napi_status napi_create_type_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, msg); - CHECK_ARG(env, result); - - v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); - RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); - - v8::Local error_obj = - v8::Exception::TypeError(message_value.As()); - napi_status status = set_error_code(env, error_obj, code, nullptr); - if (status != napi_ok) return status; - - *result = v8impl::JsValueFromV8LocalValue(error_obj); - - return napi_clear_last_error(env); -} - -napi_status napi_create_range_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, msg); - CHECK_ARG(env, result); - - v8::Local message_value = v8impl::V8LocalValueFromJsValue(msg); - RETURN_STATUS_IF_FALSE(env, message_value->IsString(), napi_string_expected); - - v8::Local error_obj = - v8::Exception::RangeError(message_value.As()); - napi_status status = set_error_code(env, error_obj, code, nullptr); - if (status != napi_ok) return status; - - *result = v8impl::JsValueFromV8LocalValue(error_obj); - - return napi_clear_last_error(env); -} - -napi_status napi_typeof(napi_env env, - napi_value value, - napi_valuetype* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local v = v8impl::V8LocalValueFromJsValue(value); - - if (v->IsNumber()) { - *result = napi_number; - } else if (v->IsBigInt()) { - *result = napi_bigint; - } else if (v->IsString()) { - *result = napi_string; - } else if (v->IsFunction()) { - // This test has to come before IsObject because IsFunction - // implies IsObject - *result = napi_function; - } else if (v->IsExternal()) { - // This test has to come before IsObject because IsExternal - // implies IsObject - *result = napi_external; - } else if (v->IsObject()) { - *result = napi_object; - } else if (v->IsBoolean()) { - *result = napi_boolean; - } else if (v->IsUndefined()) { - *result = napi_undefined; - } else if (v->IsSymbol()) { - *result = napi_symbol; - } else if (v->IsNull()) { - *result = napi_null; - } else { - // Should not get here unless V8 has added some new kind of value. - return napi_set_last_error(env, napi_invalid_arg); - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_undefined(napi_env env, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Undefined(env->isolate)); - - return napi_clear_last_error(env); -} - -napi_status napi_get_null(napi_env env, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsValueFromV8LocalValue( - v8::Null(env->isolate)); - - return napi_clear_last_error(env); -} - -// Gets all callback info in a single call. (Ugly, but faster.) -napi_status napi_get_cb_info( - napi_env env, // [in] NAPI environment handle - napi_callback_info cbinfo, // [in] Opaque callback-info handle - size_t* argc, // [in-out] Specifies the size of the provided argv array - // and receives the actual count of args. - napi_value* argv, // [out] Array of values - napi_value* this_arg, // [out] Receives the JS 'this' arg for the call - void** data) { // [out] Receives the data pointer for the callback. - CHECK_ENV(env); - CHECK_ARG(env, cbinfo); - - v8impl::CallbackWrapper* info = - reinterpret_cast(cbinfo); - - if (argv != nullptr) { - CHECK_ARG(env, argc); - info->Args(argv, *argc); - } - if (argc != nullptr) { - *argc = info->ArgsLength(); - } - if (this_arg != nullptr) { - *this_arg = info->This(); - } - if (data != nullptr) { - *data = info->Data(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_new_target(napi_env env, - napi_callback_info cbinfo, - napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, cbinfo); - CHECK_ARG(env, result); - - v8impl::CallbackWrapper* info = - reinterpret_cast(cbinfo); - - *result = info->GetNewTarget(); - return napi_clear_last_error(env); -} - -napi_status napi_call_function(napi_env env, - napi_value recv, - napi_value func, - size_t argc, - const napi_value* argv, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, recv); - if (argc > 0) { - CHECK_ARG(env, argv); - } - - v8::Local context = env->context(); - - v8::Local v8recv = v8impl::V8LocalValueFromJsValue(recv); - - v8::Local v8func; - CHECK_TO_FUNCTION(env, v8func, func); - - auto maybe = v8func->Call(context, v8recv, argc, - reinterpret_cast*>(const_cast(argv))); - - if (try_catch.HasCaught()) { - return napi_set_last_error(env, napi_pending_exception); - } else { - if (result != nullptr) { - CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); - *result = v8impl::JsValueFromV8LocalValue(maybe.ToLocalChecked()); - } - return napi_clear_last_error(env); - } -} - -napi_status napi_get_global(napi_env env, napi_value* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - *result = v8impl::JsValueFromV8LocalValue(context->Global()); - - return napi_clear_last_error(env); -} - -napi_status napi_throw(napi_env env, napi_value error) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, error); - - v8::Isolate* isolate = env->isolate; - - isolate->ThrowException(v8impl::V8LocalValueFromJsValue(error)); - // any VM calls after this point and before returning - // to the javascript invoker will fail - return napi_clear_last_error(env); -} - -napi_status napi_throw_error(napi_env env, - const char* code, - const char* msg) { - NAPI_PREAMBLE(env); - - v8::Isolate* isolate = env->isolate; - v8::Local str; - CHECK_NEW_FROM_UTF8(env, str, msg); - - v8::Local error_obj = v8::Exception::Error(str); - napi_status status = set_error_code(env, error_obj, nullptr, code); - if (status != napi_ok) return status; - - isolate->ThrowException(error_obj); - // any VM calls after this point and before returning - // to the javascript invoker will fail - return napi_clear_last_error(env); -} - -napi_status napi_throw_type_error(napi_env env, - const char* code, - const char* msg) { - NAPI_PREAMBLE(env); - - v8::Isolate* isolate = env->isolate; - v8::Local str; - CHECK_NEW_FROM_UTF8(env, str, msg); - - v8::Local error_obj = v8::Exception::TypeError(str); - napi_status status = set_error_code(env, error_obj, nullptr, code); - if (status != napi_ok) return status; - - isolate->ThrowException(error_obj); - // any VM calls after this point and before returning - // to the javascript invoker will fail - return napi_clear_last_error(env); -} - -napi_status napi_throw_range_error(napi_env env, - const char* code, - const char* msg) { - NAPI_PREAMBLE(env); - - v8::Isolate* isolate = env->isolate; - v8::Local str; - CHECK_NEW_FROM_UTF8(env, str, msg); - - v8::Local error_obj = v8::Exception::RangeError(str); - napi_status status = set_error_code(env, error_obj, nullptr, code); - if (status != napi_ok) return status; - - isolate->ThrowException(error_obj); - // any VM calls after this point and before returning - // to the javascript invoker will fail - return napi_clear_last_error(env); -} - -napi_status napi_is_error(napi_env env, napi_value value, bool* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot - // throw JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - *result = val->IsNativeError(); - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_double(napi_env env, - napi_value value, - double* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); - - *result = val.As()->Value(); - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_int32(napi_env env, - napi_value value, - int32_t* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - if (val->IsInt32()) { - *result = val.As()->Value(); - } else { - RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); - - // Empty context: https://github.com/nodejs/node/issues/14379 - v8::Local context; - *result = val->Int32Value(context).FromJust(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_uint32(napi_env env, - napi_value value, - uint32_t* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - if (val->IsUint32()) { - *result = val.As()->Value(); - } else { - RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); - - // Empty context: https://github.com/nodejs/node/issues/14379 - v8::Local context; - *result = val->Uint32Value(context).FromJust(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_int64(napi_env env, - napi_value value, - int64_t* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - // This is still a fast path very likely to be taken. - if (val->IsInt32()) { - *result = val.As()->Value(); - return napi_clear_last_error(env); - } - - RETURN_STATUS_IF_FALSE(env, val->IsNumber(), napi_number_expected); - - // v8::Value::IntegerValue() converts NaN, +Inf, and -Inf to INT64_MIN, - // inconsistent with v8::Value::Int32Value() which converts those values to 0. - // Special-case all non-finite values to match that behavior. - double doubleValue = val.As()->Value(); - if (std::isfinite(doubleValue)) { - // Empty context: https://github.com/nodejs/node/issues/14379 - v8::Local context; - *result = val->IntegerValue(context).FromJust(); - } else { - *result = 0; - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_bigint_int64(napi_env env, - napi_value value, - int64_t* result, - bool* lossless) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - CHECK_ARG(env, lossless); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); - - *result = val.As()->Int64Value(lossless); - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_bigint_uint64(napi_env env, - napi_value value, - uint64_t* result, - bool* lossless) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - CHECK_ARG(env, lossless); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); - - *result = val.As()->Uint64Value(lossless); - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_bigint_words(napi_env env, - napi_value value, - int* sign_bit, - size_t* word_count, - uint64_t* words) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, word_count); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - - RETURN_STATUS_IF_FALSE(env, val->IsBigInt(), napi_bigint_expected); - - v8::Local big = val.As(); - - int word_count_int = *word_count; - - if (sign_bit == nullptr && words == nullptr) { - word_count_int = big->WordCount(); - } else { - CHECK_ARG(env, sign_bit); - CHECK_ARG(env, words); - big->ToWordsArray(sign_bit, &word_count_int, words); - } - - *word_count = word_count_int; - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_bool(napi_env env, napi_value value, bool* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsBoolean(), napi_boolean_expected); - - *result = val.As()->Value(); - - return napi_clear_last_error(env); -} - -// Copies a JavaScript string into a LATIN-1 string buffer. The result is the -// number of bytes (excluding the null terminator) copied into buf. -// A sufficient buffer size should be greater than the length of string, -// reserving space for null terminator. -// If bufsize is insufficient, the string will be truncated and null terminated. -// If buf is NULL, this method returns the length of the string (in bytes) -// via the result parameter. -// The result argument is optional unless buf is NULL. -napi_status napi_get_value_string_latin1(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); - - if (!buf) { - CHECK_ARG(env, result); - *result = val.As()->Length(); - } else { - int copied = - val.As()->WriteOneByte(env->isolate, - reinterpret_cast(buf), - 0, - bufsize - 1, - v8::String::NO_NULL_TERMINATION); - - buf[copied] = '\0'; - if (result != nullptr) { - *result = copied; - } - } - - return napi_clear_last_error(env); -} - -// Copies a JavaScript string into a UTF-8 string buffer. The result is the -// number of bytes (excluding the null terminator) copied into buf. -// A sufficient buffer size should be greater than the length of string, -// reserving space for null terminator. -// If bufsize is insufficient, the string will be truncated and null terminated. -// If buf is NULL, this method returns the length of the string (in bytes) -// via the result parameter. -// The result argument is optional unless buf is NULL. -napi_status napi_get_value_string_utf8(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); - - if (!buf) { - CHECK_ARG(env, result); - *result = val.As()->Utf8Length(env->isolate); - } else { - int copied = val.As()->WriteUtf8( - env->isolate, - buf, - bufsize - 1, - nullptr, - v8::String::REPLACE_INVALID_UTF8 | v8::String::NO_NULL_TERMINATION); - - buf[copied] = '\0'; - if (result != nullptr) { - *result = copied; - } - } - - return napi_clear_last_error(env); -} - -// Copies a JavaScript string into a UTF-16 string buffer. The result is the -// number of 2-byte code units (excluding the null terminator) copied into buf. -// A sufficient buffer size should be greater than the length of string, -// reserving space for null terminator. -// If bufsize is insufficient, the string will be truncated and null terminated. -// If buf is NULL, this method returns the length of the string (in 2-byte -// code units) via the result parameter. -// The result argument is optional unless buf is NULL. -napi_status napi_get_value_string_utf16(napi_env env, - napi_value value, - char16_t* buf, - size_t bufsize, - size_t* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); - - if (!buf) { - CHECK_ARG(env, result); - // V8 assumes UTF-16 length is the same as the number of characters. - *result = val.As()->Length(); - } else { - int copied = val.As()->Write(env->isolate, - reinterpret_cast(buf), - 0, - bufsize - 1, - v8::String::NO_NULL_TERMINATION); - - buf[copied] = '\0'; - if (result != nullptr) { - *result = copied; - } - } - - return napi_clear_last_error(env); -} - -napi_status napi_coerce_to_object(napi_env env, - napi_value value, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local obj; - CHECK_TO_OBJECT(env, context, obj, value); - - *result = v8impl::JsValueFromV8LocalValue(obj); - return GET_RETURN_STATUS(env); -} - -napi_status napi_coerce_to_bool(napi_env env, - napi_value value, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local b; - - CHECK_TO_BOOL(env, context, b, value); - - *result = v8impl::JsValueFromV8LocalValue(b); - return GET_RETURN_STATUS(env); -} - -napi_status napi_coerce_to_number(napi_env env, - napi_value value, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local num; - - CHECK_TO_NUMBER(env, context, num, value); - - *result = v8impl::JsValueFromV8LocalValue(num); - return GET_RETURN_STATUS(env); -} - -napi_status napi_coerce_to_string(napi_env env, - napi_value value, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local context = env->context(); - v8::Local str; - - CHECK_TO_STRING(env, context, str, value); - - *result = v8impl::JsValueFromV8LocalValue(str); - return GET_RETURN_STATUS(env); -} - -napi_status napi_wrap(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result) { - return v8impl::Wrap(env, - js_object, - native_object, - finalize_cb, - finalize_hint, - result); -} - -napi_status napi_unwrap(napi_env env, napi_value obj, void** result) { - return v8impl::Unwrap(env, obj, result, v8impl::KeepWrap); -} - -napi_status napi_remove_wrap(napi_env env, napi_value obj, void** result) { - return v8impl::Unwrap(env, obj, result, v8impl::RemoveWrap); -} - -napi_status napi_create_external(napi_env env, - void* data, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Isolate* isolate = env->isolate; - - v8::Local external_value = v8::External::New(isolate, data); - - // The Reference object will delete itself after invoking the finalizer - // callback. - v8impl::Reference::New(env, - external_value, - 0, - true, - finalize_cb, - data, - finalize_hint); - - *result = v8impl::JsValueFromV8LocalValue(external_value); - - return napi_clear_last_error(env); -} - -napi_status napi_get_value_external(napi_env env, - napi_value value, - void** result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsExternal(), napi_invalid_arg); - - v8::Local external_value = val.As(); - *result = external_value->Value(); - - return napi_clear_last_error(env); -} - -// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. -napi_status napi_create_reference(napi_env env, - napi_value value, - uint32_t initial_refcount, - napi_ref* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local v8_value = v8impl::V8LocalValueFromJsValue(value); - - if (!(v8_value->IsObject() || v8_value->IsFunction())) { - return napi_set_last_error(env, napi_object_expected); - } - - v8impl::Reference* reference = - v8impl::Reference::New(env, v8_value, initial_refcount, false); - - *result = reinterpret_cast(reference); - return napi_clear_last_error(env); -} - -// Deletes a reference. The referenced value is released, and may be GC'd unless -// there are other references to it. -napi_status napi_delete_reference(napi_env env, napi_ref ref) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, ref); - - v8impl::Reference::Delete(reinterpret_cast(ref)); - - return napi_clear_last_error(env); -} - -// Increments the reference count, optionally returning the resulting count. -// After this call the reference will be a strong reference because its -// refcount is >0, and the referenced object is effectively "pinned". -// Calling this when the refcount is 0 and the object is unavailable -// results in an error. -napi_status napi_reference_ref(napi_env env, napi_ref ref, uint32_t* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, ref); - - v8impl::Reference* reference = reinterpret_cast(ref); - uint32_t count = reference->Ref(); - - if (result != nullptr) { - *result = count; - } - - return napi_clear_last_error(env); -} - -// Decrements the reference count, optionally returning the resulting count. If -// the result is 0 the reference is now weak and the object may be GC'd at any -// time if there are no other references. Calling this when the refcount is -// already 0 results in an error. -napi_status napi_reference_unref(napi_env env, napi_ref ref, uint32_t* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, ref); - - v8impl::Reference* reference = reinterpret_cast(ref); - - if (reference->RefCount() == 0) { - return napi_set_last_error(env, napi_generic_failure); - } - - uint32_t count = reference->Unref(); - - if (result != nullptr) { - *result = count; - } - - return napi_clear_last_error(env); -} - -// Attempts to get a referenced value. If the reference is weak, the value might -// no longer be available, in that case the call is still successful but the -// result is NULL. -napi_status napi_get_reference_value(napi_env env, - napi_ref ref, - napi_value* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, ref); - CHECK_ARG(env, result); - - v8impl::Reference* reference = reinterpret_cast(ref); - *result = v8impl::JsValueFromV8LocalValue(reference->Get()); - - return napi_clear_last_error(env); -} - -napi_status napi_open_handle_scope(napi_env env, napi_handle_scope* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = v8impl::JsHandleScopeFromV8HandleScope( - new v8impl::HandleScopeWrapper(env->isolate)); - env->open_handle_scopes++; - return napi_clear_last_error(env); -} - -napi_status napi_close_handle_scope(napi_env env, napi_handle_scope scope) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, scope); - if (env->open_handle_scopes == 0) { - return napi_handle_scope_mismatch; - } + CHECK_ARG(env, fun); - env->open_handle_scopes--; - delete v8impl::V8HandleScopeFromJsHandleScope(scope); - return napi_clear_last_error(env); + node::AddEnvironmentCleanupHook(env->isolate, fun, arg); + + return napi_ok; } -napi_status napi_open_escapable_handle_scope( - napi_env env, - napi_escapable_handle_scope* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. +napi_status napi_remove_env_cleanup_hook(napi_env env, + void (*fun)(void* arg), + void* arg) { CHECK_ENV(env); - CHECK_ARG(env, result); + CHECK_ARG(env, fun); - *result = v8impl::JsEscapableHandleScopeFromV8EscapableHandleScope( - new v8impl::EscapableHandleScopeWrapper(env->isolate)); - env->open_handle_scopes++; - return napi_clear_last_error(env); + node::RemoveEnvironmentCleanupHook(env->isolate, fun, arg); + + return napi_ok; } -napi_status napi_close_escapable_handle_scope( - napi_env env, - napi_escapable_handle_scope scope) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, scope); - if (env->open_handle_scopes == 0) { - return napi_handle_scope_mismatch; - } +napi_status napi_fatal_exception(napi_env env, napi_value err) { + NAPI_PREAMBLE(env); + CHECK_ARG(env, err); + + v8::Local local_err = v8impl::V8LocalValueFromJsValue(err); + v8impl::trigger_fatal_exception(env, local_err); - delete v8impl::V8EscapableHandleScopeFromJsEscapableHandleScope(scope); - env->open_handle_scopes--; return napi_clear_last_error(env); } -napi_status napi_escape_handle(napi_env env, - napi_escapable_handle_scope scope, - napi_value escapee, - napi_value* result) { - // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw - // JS exceptions. - CHECK_ENV(env); - CHECK_ARG(env, scope); - CHECK_ARG(env, escapee); - CHECK_ARG(env, result); +NAPI_NO_RETURN void napi_fatal_error(const char* location, + size_t location_len, + const char* message, + size_t message_len) { + std::string location_string; + std::string message_string; + + if (location_len != NAPI_AUTO_LENGTH) { + location_string.assign( + const_cast(location), location_len); + } else { + location_string.assign( + const_cast(location), strlen(location)); + } - v8impl::EscapableHandleScopeWrapper* s = - v8impl::V8EscapableHandleScopeFromJsEscapableHandleScope(scope); - if (!s->escape_called()) { - *result = v8impl::JsValueFromV8LocalValue( - s->Escape(v8impl::V8LocalValueFromJsValue(escapee))); - return napi_clear_last_error(env); + if (message_len != NAPI_AUTO_LENGTH) { + message_string.assign( + const_cast(message), message_len); + } else { + message_string.assign( + const_cast(message), strlen(message)); } - return napi_set_last_error(env, napi_escape_called_twice); + + node::FatalError(location_string.c_str(), message_string.c_str()); } napi_status napi_open_callback_scope(napi_env env, @@ -3194,64 +586,6 @@ napi_status napi_close_callback_scope(napi_env env, napi_callback_scope scope) { return napi_clear_last_error(env); } -napi_status napi_new_instance(napi_env env, - napi_value constructor, - size_t argc, - const napi_value* argv, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, constructor); - if (argc > 0) { - CHECK_ARG(env, argv); - } - CHECK_ARG(env, result); - - v8::Local context = env->context(); - - v8::Local ctor; - CHECK_TO_FUNCTION(env, ctor, constructor); - - auto maybe = ctor->NewInstance(context, argc, - reinterpret_cast*>(const_cast(argv))); - - CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue(maybe.ToLocalChecked()); - return GET_RETURN_STATUS(env); -} - -napi_status napi_instanceof(napi_env env, - napi_value object, - napi_value constructor, - bool* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, object); - CHECK_ARG(env, result); - - *result = false; - - v8::Local ctor; - v8::Local context = env->context(); - - CHECK_TO_OBJECT(env, context, ctor, constructor); - - if (!ctor->IsFunction()) { - napi_throw_type_error(env, - "ERR_NAPI_CONS_FUNCTION", - "Constructor must be a function"); - - return napi_set_last_error(env, napi_function_expected); - } - - napi_status status = napi_generic_failure; - - v8::Local val = v8impl::V8LocalValueFromJsValue(object); - auto maybe_result = val->InstanceOf(context, ctor); - CHECK_MAYBE_NOTHING(env, maybe_result, status); - *result = maybe_result.FromJust(); - return GET_RETURN_STATUS(env); -} - napi_status napi_async_init(napi_env env, napi_value async_resource, napi_value async_resource_name, @@ -3344,35 +678,6 @@ napi_status napi_make_callback(napi_env env, return GET_RETURN_STATUS(env); } -// Methods to support catching exceptions -napi_status napi_is_exception_pending(napi_env env, bool* result) { - // NAPI_PREAMBLE is not used here: this function must execute when there is a - // pending exception. - CHECK_ENV(env); - CHECK_ARG(env, result); - - *result = !env->last_exception.IsEmpty(); - return napi_clear_last_error(env); -} - -napi_status napi_get_and_clear_last_exception(napi_env env, - napi_value* result) { - // NAPI_PREAMBLE is not used here: this function must execute when there is a - // pending exception. - CHECK_ENV(env); - CHECK_ARG(env, result); - - if (env->last_exception.IsEmpty()) { - return napi_get_undefined(env, result); - } else { - *result = v8impl::JsValueFromV8LocalValue( - v8::Local::New(env->isolate, env->last_exception)); - env->last_exception.Reset(); - } - - return napi_clear_last_error(env); -} - napi_status napi_create_buffer(napi_env env, size_t length, void** data, @@ -3411,10 +716,10 @@ napi_status napi_create_external_buffer(napi_env env, env, finalize_cb, nullptr, finalize_hint); auto maybe = node::Buffer::New(isolate, - static_cast(data), - length, - v8impl::Finalizer::FinalizeBufferCallback, - finalizer); + static_cast(data), + length, + v8impl::BufferFinalizer::FinalizeBufferCallback, + finalizer); CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); @@ -3477,314 +782,6 @@ napi_status napi_get_buffer_info(napi_env env, return napi_clear_last_error(env); } -napi_status napi_is_arraybuffer(napi_env env, napi_value value, bool* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - *result = val->IsArrayBuffer(); - - return napi_clear_last_error(env); -} - -napi_status napi_create_arraybuffer(napi_env env, - size_t byte_length, - void** data, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Isolate* isolate = env->isolate; - v8::Local buffer = - v8::ArrayBuffer::New(isolate, byte_length); - - // Optionally return a pointer to the buffer's data, to avoid another call to - // retrieve it. - if (data != nullptr) { - *data = buffer->GetContents().Data(); - } - - *result = v8impl::JsValueFromV8LocalValue(buffer); - return GET_RETURN_STATUS(env); -} - -napi_status napi_create_external_arraybuffer(napi_env env, - void* external_data, - size_t byte_length, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, result); - - v8::Isolate* isolate = env->isolate; - v8::Local buffer = - v8::ArrayBuffer::New(isolate, external_data, byte_length); - - if (finalize_cb != nullptr) { - // Create a self-deleting weak reference that invokes the finalizer - // callback. - v8impl::Reference::New(env, - buffer, - 0, - true, - finalize_cb, - external_data, - finalize_hint); - } - - *result = v8impl::JsValueFromV8LocalValue(buffer); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_arraybuffer_info(napi_env env, - napi_value arraybuffer, - void** data, - size_t* byte_length) { - CHECK_ENV(env); - CHECK_ARG(env, arraybuffer); - - v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); - RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); - - v8::ArrayBuffer::Contents contents = - value.As()->GetContents(); - - if (data != nullptr) { - *data = contents.Data(); - } - - if (byte_length != nullptr) { - *byte_length = contents.ByteLength(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_is_typedarray(napi_env env, napi_value value, bool* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - *result = val->IsTypedArray(); - - return napi_clear_last_error(env); -} - -napi_status napi_create_typedarray(napi_env env, - napi_typedarray_type type, - size_t length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, arraybuffer); - CHECK_ARG(env, result); - - v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); - RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); - - v8::Local buffer = value.As(); - v8::Local typedArray; - - switch (type) { - case napi_int8_array: - CREATE_TYPED_ARRAY( - env, Int8Array, 1, buffer, byte_offset, length, typedArray); - break; - case napi_uint8_array: - CREATE_TYPED_ARRAY( - env, Uint8Array, 1, buffer, byte_offset, length, typedArray); - break; - case napi_uint8_clamped_array: - CREATE_TYPED_ARRAY( - env, Uint8ClampedArray, 1, buffer, byte_offset, length, typedArray); - break; - case napi_int16_array: - CREATE_TYPED_ARRAY( - env, Int16Array, 2, buffer, byte_offset, length, typedArray); - break; - case napi_uint16_array: - CREATE_TYPED_ARRAY( - env, Uint16Array, 2, buffer, byte_offset, length, typedArray); - break; - case napi_int32_array: - CREATE_TYPED_ARRAY( - env, Int32Array, 4, buffer, byte_offset, length, typedArray); - break; - case napi_uint32_array: - CREATE_TYPED_ARRAY( - env, Uint32Array, 4, buffer, byte_offset, length, typedArray); - break; - case napi_float32_array: - CREATE_TYPED_ARRAY( - env, Float32Array, 4, buffer, byte_offset, length, typedArray); - break; - case napi_float64_array: - CREATE_TYPED_ARRAY( - env, Float64Array, 8, buffer, byte_offset, length, typedArray); - break; - case napi_bigint64_array: - CREATE_TYPED_ARRAY( - env, BigInt64Array, 8, buffer, byte_offset, length, typedArray); - break; - case napi_biguint64_array: - CREATE_TYPED_ARRAY( - env, BigUint64Array, 8, buffer, byte_offset, length, typedArray); - break; - default: - return napi_set_last_error(env, napi_invalid_arg); - } - - *result = v8impl::JsValueFromV8LocalValue(typedArray); - return GET_RETURN_STATUS(env); -} - -napi_status napi_get_typedarray_info(napi_env env, - napi_value typedarray, - napi_typedarray_type* type, - size_t* length, - void** data, - napi_value* arraybuffer, - size_t* byte_offset) { - CHECK_ENV(env); - CHECK_ARG(env, typedarray); - - v8::Local value = v8impl::V8LocalValueFromJsValue(typedarray); - RETURN_STATUS_IF_FALSE(env, value->IsTypedArray(), napi_invalid_arg); - - v8::Local array = value.As(); - - if (type != nullptr) { - if (value->IsInt8Array()) { - *type = napi_int8_array; - } else if (value->IsUint8Array()) { - *type = napi_uint8_array; - } else if (value->IsUint8ClampedArray()) { - *type = napi_uint8_clamped_array; - } else if (value->IsInt16Array()) { - *type = napi_int16_array; - } else if (value->IsUint16Array()) { - *type = napi_uint16_array; - } else if (value->IsInt32Array()) { - *type = napi_int32_array; - } else if (value->IsUint32Array()) { - *type = napi_uint32_array; - } else if (value->IsFloat32Array()) { - *type = napi_float32_array; - } else if (value->IsFloat64Array()) { - *type = napi_float64_array; - } else if (value->IsBigInt64Array()) { - *type = napi_bigint64_array; - } else if (value->IsBigUint64Array()) { - *type = napi_biguint64_array; - } - } - - if (length != nullptr) { - *length = array->Length(); - } - - v8::Local buffer = array->Buffer(); - if (data != nullptr) { - *data = static_cast(buffer->GetContents().Data()) + - array->ByteOffset(); - } - - if (arraybuffer != nullptr) { - *arraybuffer = v8impl::JsValueFromV8LocalValue(buffer); - } - - if (byte_offset != nullptr) { - *byte_offset = array->ByteOffset(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_create_dataview(napi_env env, - size_t byte_length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, arraybuffer); - CHECK_ARG(env, result); - - v8::Local value = v8impl::V8LocalValueFromJsValue(arraybuffer); - RETURN_STATUS_IF_FALSE(env, value->IsArrayBuffer(), napi_invalid_arg); - - v8::Local buffer = value.As(); - if (byte_length + byte_offset > buffer->ByteLength()) { - napi_throw_range_error( - env, - "ERR_NAPI_INVALID_DATAVIEW_ARGS", - "byte_offset + byte_length should be less than or " - "equal to the size in bytes of the array passed in"); - return napi_set_last_error(env, napi_pending_exception); - } - v8::Local DataView = v8::DataView::New(buffer, byte_offset, - byte_length); - - *result = v8impl::JsValueFromV8LocalValue(DataView); - return GET_RETURN_STATUS(env); -} - -napi_status napi_is_dataview(napi_env env, napi_value value, bool* result) { - CHECK_ENV(env); - CHECK_ARG(env, value); - CHECK_ARG(env, result); - - v8::Local val = v8impl::V8LocalValueFromJsValue(value); - *result = val->IsDataView(); - - return napi_clear_last_error(env); -} - -napi_status napi_get_dataview_info(napi_env env, - napi_value dataview, - size_t* byte_length, - void** data, - napi_value* arraybuffer, - size_t* byte_offset) { - CHECK_ENV(env); - CHECK_ARG(env, dataview); - - v8::Local value = v8impl::V8LocalValueFromJsValue(dataview); - RETURN_STATUS_IF_FALSE(env, value->IsDataView(), napi_invalid_arg); - - v8::Local array = value.As(); - - if (byte_length != nullptr) { - *byte_length = array->ByteLength(); - } - - v8::Local buffer = array->Buffer(); - if (data != nullptr) { - *data = static_cast(buffer->GetContents().Data()) + - array->ByteOffset(); - } - - if (arraybuffer != nullptr) { - *arraybuffer = v8impl::JsValueFromV8LocalValue(buffer); - } - - if (byte_offset != nullptr) { - *byte_offset = array->ByteOffset(); - } - - return napi_clear_last_error(env); -} - -napi_status napi_get_version(napi_env env, uint32_t* result) { - CHECK_ENV(env); - CHECK_ARG(env, result); - *result = NAPI_VERSION; - return napi_clear_last_error(env); -} - napi_status napi_get_node_version(napi_env env, const napi_node_version** result) { CHECK_ENV(env); @@ -3799,18 +796,6 @@ napi_status napi_get_node_version(napi_env env, return napi_clear_last_error(env); } -napi_status napi_adjust_external_memory(napi_env env, - int64_t change_in_bytes, - int64_t* adjusted_value) { - CHECK_ENV(env); - CHECK_ARG(env, adjusted_value); - - *adjusted_value = env->isolate->AdjustAmountOfExternalAllocatedMemory( - change_in_bytes); - - return napi_clear_last_error(env); -} - namespace { namespace uvimpl { @@ -3830,7 +815,7 @@ static napi_status ConvertUVErrorCode(int code) { // Wrapper around uv_work_t which calls user-provided callbacks. class Work : public node::AsyncResource, public node::ThreadPoolWork { private: - explicit Work(napi_env env, + explicit Work(node_napi_env env, v8::Local async_resource, v8::Local async_resource_name, napi_async_execute_callback execute, @@ -3849,7 +834,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork { virtual ~Work() { } public: - static Work* New(napi_env env, + static Work* New(node_napi_env env, v8::Local async_resource, v8::Local async_resource_name, napi_async_execute_callback execute, @@ -3897,7 +882,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork { } private: - napi_env _env; + node_napi_env _env; void* _data; napi_async_execute_callback _execute; napi_async_complete_callback _complete; @@ -3938,9 +923,12 @@ napi_status napi_create_async_work(napi_env env, v8::Local resource_name; CHECK_TO_STRING(env, context, resource_name, async_resource_name); - uvimpl::Work* work = - uvimpl::Work::New(env, resource, resource_name, - execute, complete, data); + uvimpl::Work* work = uvimpl::Work::New(reinterpret_cast(env), + resource, + resource_name, + execute, + complete, + data); *result = reinterpret_cast(work); @@ -3959,7 +947,7 @@ napi_status napi_delete_async_work(napi_env env, napi_async_work work) { napi_status napi_get_uv_event_loop(napi_env env, uv_loop_t** loop) { CHECK_ENV(env); CHECK_ARG(env, loop); - *loop = env->node_env()->event_loop(); + *loop = reinterpret_cast(env)->node_env()->event_loop(); return napi_clear_last_error(env); } @@ -3991,76 +979,6 @@ napi_status napi_cancel_async_work(napi_env env, napi_async_work work) { return napi_clear_last_error(env); } -napi_status napi_create_promise(napi_env env, - napi_deferred* deferred, - napi_value* promise) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, deferred); - CHECK_ARG(env, promise); - - auto maybe = v8::Promise::Resolver::New(env->context()); - CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure); - - auto v8_resolver = maybe.ToLocalChecked(); - auto v8_deferred = new node::Persistent(); - v8_deferred->Reset(env->isolate, v8_resolver); - - *deferred = v8impl::JsDeferredFromNodePersistent(v8_deferred); - *promise = v8impl::JsValueFromV8LocalValue(v8_resolver->GetPromise()); - return GET_RETURN_STATUS(env); -} - -napi_status napi_resolve_deferred(napi_env env, - napi_deferred deferred, - napi_value resolution) { - return v8impl::ConcludeDeferred(env, deferred, resolution, true); -} - -napi_status napi_reject_deferred(napi_env env, - napi_deferred deferred, - napi_value resolution) { - return v8impl::ConcludeDeferred(env, deferred, resolution, false); -} - -napi_status napi_is_promise(napi_env env, - napi_value promise, - bool* is_promise) { - CHECK_ENV(env); - CHECK_ARG(env, promise); - CHECK_ARG(env, is_promise); - - *is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise(); - - return napi_clear_last_error(env); -} - -napi_status napi_run_script(napi_env env, - napi_value script, - napi_value* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, script); - CHECK_ARG(env, result); - - v8::Local v8_script = v8impl::V8LocalValueFromJsValue(script); - - if (!v8_script->IsString()) { - return napi_set_last_error(env, napi_string_expected); - } - - v8::Local context = env->context(); - - auto maybe_script = v8::Script::Compile(context, - v8::Local::Cast(v8_script)); - CHECK_MAYBE_EMPTY(env, maybe_script, napi_generic_failure); - - auto script_result = - maybe_script.ToLocalChecked()->Run(context); - CHECK_MAYBE_EMPTY(env, script_result, napi_generic_failure); - - *result = v8impl::JsValueFromV8LocalValue(script_result.ToLocalChecked()); - return GET_RETURN_STATUS(env); -} - napi_status napi_create_threadsafe_function(napi_env env, napi_value func, @@ -4103,7 +1021,7 @@ napi_create_threadsafe_function(napi_env env, initial_thread_count, context, max_queue_size, - env, + reinterpret_cast(env), thread_finalize_data, thread_finalize_cb, call_js_cb); @@ -4164,17 +1082,3 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func) { CHECK(func != nullptr); return reinterpret_cast(func)->Ref(); } - -napi_status napi_add_finalizer(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result) { - return v8impl::Wrap(env, - js_object, - native_object, - finalize_cb, - finalize_hint, - result); -} diff --git a/src/node_api.h b/src/node_api.h index e8c1f79de7cd91..b36f6d4b7a4b9e 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -1,39 +1,17 @@ #ifndef SRC_NODE_API_H_ #define SRC_NODE_API_H_ -#include -#include +#ifdef BUILDING_NODE_EXTENSION + #ifdef _WIN32 + // Building native module against node + #define NAPI_EXTERN __declspec(dllimport) + #endif +#endif +#include "js_native_api.h" #include "node_api_types.h" struct uv_loop_s; // Forward declaration. -#ifndef NAPI_VERSION -#ifdef NAPI_EXPERIMENTAL -// Use INT_MAX, this should only be consumed by the pre-processor anyway. -#define NAPI_VERSION 2147483647 -#else -// The baseline version for N-API -#define NAPI_VERSION 3 -#endif -#endif - -#ifdef _WIN32 - #ifdef BUILDING_NODE_EXTENSION - #ifdef EXTERNAL_NAPI - // Building external N-API, or native module against external N-API - #define NAPI_EXTERN /* nothing */ - #else - // Building native module against node with built-in N-API - #define NAPI_EXTERN __declspec(dllimport) - #endif - #else - // Building node with built-in N-API - #define NAPI_EXTERN __declspec(dllexport) - #endif -#else - #define NAPI_EXTERN /* nothing */ -#endif - #ifdef _WIN32 # define NAPI_MODULE_EXPORT __declspec(dllexport) #else @@ -46,7 +24,6 @@ struct uv_loop_s; // Forward declaration. #define NAPI_NO_RETURN #endif - typedef napi_value (*napi_addon_register_func)(napi_env env, napi_value exports); @@ -75,14 +52,6 @@ typedef struct { static void fn(void) #endif -#ifdef __cplusplus -#define EXTERN_C_START extern "C" { -#define EXTERN_C_END } -#else -#define EXTERN_C_START -#define EXTERN_C_END -#endif - #define NAPI_MODULE_X(modname, regfunc, priv, flags) \ EXTERN_C_START \ static napi_module _module = \ @@ -122,347 +91,31 @@ typedef struct { napi_value NAPI_MODULE_INITIALIZER(napi_env env, \ napi_value exports) -#define NAPI_AUTO_LENGTH SIZE_MAX - EXTERN_C_START NAPI_EXTERN void napi_module_register(napi_module* mod); -NAPI_EXTERN napi_status -napi_get_last_error_info(napi_env env, - const napi_extended_error_info** result); - NAPI_EXTERN NAPI_NO_RETURN void napi_fatal_error(const char* location, size_t location_len, const char* message, size_t message_len); -// Getters for defined singletons -NAPI_EXTERN napi_status napi_get_undefined(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_null(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_global(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_get_boolean(napi_env env, - bool value, - napi_value* result); - -// Methods to create Primitive types/Objects -NAPI_EXTERN napi_status napi_create_object(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_create_array(napi_env env, napi_value* result); -NAPI_EXTERN napi_status napi_create_array_with_length(napi_env env, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_double(napi_env env, - double value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_int32(napi_env env, - int32_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_uint32(napi_env env, - uint32_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_int64(napi_env env, - int64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_latin1(napi_env env, - const char* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_utf8(napi_env env, - const char* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_string_utf16(napi_env env, - const char16_t* str, - size_t length, - napi_value* result); -NAPI_EXTERN napi_status napi_create_symbol(napi_env env, - napi_value description, - napi_value* result); -NAPI_EXTERN napi_status napi_create_function(napi_env env, - const char* utf8name, - size_t length, - napi_callback cb, - void* data, - napi_value* result); -NAPI_EXTERN napi_status napi_create_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -NAPI_EXTERN napi_status napi_create_type_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); -NAPI_EXTERN napi_status napi_create_range_error(napi_env env, - napi_value code, - napi_value msg, - napi_value* result); +// Methods for custom handling of async operations +NAPI_EXTERN napi_status napi_async_init(napi_env env, + napi_value async_resource, + napi_value async_resource_name, + napi_async_context* result); -// Methods to get the native napi_value from Primitive type -NAPI_EXTERN napi_status napi_typeof(napi_env env, - napi_value value, - napi_valuetype* result); -NAPI_EXTERN napi_status napi_get_value_double(napi_env env, - napi_value value, - double* result); -NAPI_EXTERN napi_status napi_get_value_int32(napi_env env, - napi_value value, - int32_t* result); -NAPI_EXTERN napi_status napi_get_value_uint32(napi_env env, - napi_value value, - uint32_t* result); -NAPI_EXTERN napi_status napi_get_value_int64(napi_env env, - napi_value value, - int64_t* result); -NAPI_EXTERN napi_status napi_get_value_bool(napi_env env, - napi_value value, - bool* result); - -// Copies LATIN-1 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result); - -// Copies UTF-8 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_utf8(napi_env env, - napi_value value, - char* buf, - size_t bufsize, - size_t* result); - -// Copies UTF-16 encoded bytes from a string into a buffer. -NAPI_EXTERN napi_status napi_get_value_string_utf16(napi_env env, - napi_value value, - char16_t* buf, - size_t bufsize, - size_t* result); - -// Methods to coerce values -// These APIs may execute user scripts -NAPI_EXTERN napi_status napi_coerce_to_bool(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_number(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_object(napi_env env, - napi_value value, - napi_value* result); -NAPI_EXTERN napi_status napi_coerce_to_string(napi_env env, - napi_value value, - napi_value* result); - -// Methods to work with Objects -NAPI_EXTERN napi_status napi_get_prototype(napi_env env, - napi_value object, - napi_value* result); -NAPI_EXTERN napi_status napi_get_property_names(napi_env env, - napi_value object, - napi_value* result); -NAPI_EXTERN napi_status napi_set_property(napi_env env, - napi_value object, - napi_value key, - napi_value value); -NAPI_EXTERN napi_status napi_has_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_get_property(napi_env env, - napi_value object, - napi_value key, - napi_value* result); -NAPI_EXTERN napi_status napi_delete_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_has_own_property(napi_env env, - napi_value object, - napi_value key, - bool* result); -NAPI_EXTERN napi_status napi_set_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value value); -NAPI_EXTERN napi_status napi_has_named_property(napi_env env, - napi_value object, - const char* utf8name, - bool* result); -NAPI_EXTERN napi_status napi_get_named_property(napi_env env, - napi_value object, - const char* utf8name, - napi_value* result); -NAPI_EXTERN napi_status napi_set_element(napi_env env, - napi_value object, - uint32_t index, - napi_value value); -NAPI_EXTERN napi_status napi_has_element(napi_env env, - napi_value object, - uint32_t index, - bool* result); -NAPI_EXTERN napi_status napi_get_element(napi_env env, - napi_value object, - uint32_t index, - napi_value* result); -NAPI_EXTERN napi_status napi_delete_element(napi_env env, - napi_value object, - uint32_t index, - bool* result); -NAPI_EXTERN napi_status -napi_define_properties(napi_env env, - napi_value object, - size_t property_count, - const napi_property_descriptor* properties); - -// Methods to work with Arrays -NAPI_EXTERN napi_status napi_is_array(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_get_array_length(napi_env env, - napi_value value, - uint32_t* result); - -// Methods to compare values -NAPI_EXTERN napi_status napi_strict_equals(napi_env env, - napi_value lhs, - napi_value rhs, - bool* result); - -// Methods to work with Functions -NAPI_EXTERN napi_status napi_call_function(napi_env env, +NAPI_EXTERN napi_status napi_async_destroy(napi_env env, + napi_async_context async_context); + +NAPI_EXTERN napi_status napi_make_callback(napi_env env, + napi_async_context async_context, napi_value recv, napi_value func, size_t argc, const napi_value* argv, napi_value* result); -NAPI_EXTERN napi_status napi_new_instance(napi_env env, - napi_value constructor, - size_t argc, - const napi_value* argv, - napi_value* result); -NAPI_EXTERN napi_status napi_instanceof(napi_env env, - napi_value object, - napi_value constructor, - bool* result); - -// Methods to work with napi_callbacks - -// Gets all callback info in a single call. (Ugly, but faster.) -NAPI_EXTERN napi_status napi_get_cb_info( - napi_env env, // [in] NAPI environment handle - napi_callback_info cbinfo, // [in] Opaque callback-info handle - size_t* argc, // [in-out] Specifies the size of the provided argv array - // and receives the actual count of args. - napi_value* argv, // [out] Array of values - napi_value* this_arg, // [out] Receives the JS 'this' arg for the call - void** data); // [out] Receives the data pointer for the callback. - -NAPI_EXTERN napi_status napi_get_new_target(napi_env env, - napi_callback_info cbinfo, - napi_value* result); -NAPI_EXTERN napi_status -napi_define_class(napi_env env, - const char* utf8name, - size_t length, - napi_callback constructor, - void* data, - size_t property_count, - const napi_property_descriptor* properties, - napi_value* result); - -// Methods to work with external data objects -NAPI_EXTERN napi_status napi_wrap(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result); -NAPI_EXTERN napi_status napi_unwrap(napi_env env, - napi_value js_object, - void** result); -NAPI_EXTERN napi_status napi_remove_wrap(napi_env env, - napi_value js_object, - void** result); -NAPI_EXTERN napi_status napi_create_external(napi_env env, - void* data, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result); -NAPI_EXTERN napi_status napi_get_value_external(napi_env env, - napi_value value, - void** result); - -// Methods to control object lifespan - -// Set initial_refcount to 0 for a weak reference, >0 for a strong reference. -NAPI_EXTERN napi_status napi_create_reference(napi_env env, - napi_value value, - uint32_t initial_refcount, - napi_ref* result); - -// Deletes a reference. The referenced value is released, and may -// be GC'd unless there are other references to it. -NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref); - -// Increments the reference count, optionally returning the resulting count. -// After this call the reference will be a strong reference because its -// refcount is >0, and the referenced object is effectively "pinned". -// Calling this when the refcount is 0 and the object is unavailable -// results in an error. -NAPI_EXTERN napi_status napi_reference_ref(napi_env env, - napi_ref ref, - uint32_t* result); - -// Decrements the reference count, optionally returning the resulting count. -// If the result is 0 the reference is now weak and the object may be GC'd -// at any time if there are no other references. Calling this when the -// refcount is already 0 results in an error. -NAPI_EXTERN napi_status napi_reference_unref(napi_env env, - napi_ref ref, - uint32_t* result); - -// Attempts to get a referenced value. If the reference is weak, -// the value might no longer be available, in that case the call -// is still successful but the result is NULL. -NAPI_EXTERN napi_status napi_get_reference_value(napi_env env, - napi_ref ref, - napi_value* result); - -NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env, - napi_handle_scope* result); -NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env, - napi_handle_scope scope); -NAPI_EXTERN napi_status -napi_open_escapable_handle_scope(napi_env env, - napi_escapable_handle_scope* result); -NAPI_EXTERN napi_status -napi_close_escapable_handle_scope(napi_env env, - napi_escapable_handle_scope scope); - -NAPI_EXTERN napi_status napi_escape_handle(napi_env env, - napi_escapable_handle_scope scope, - napi_value escapee, - napi_value* result); - -// Methods to support error handling -NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error); -NAPI_EXTERN napi_status napi_throw_error(napi_env env, - const char* code, - const char* msg); -NAPI_EXTERN napi_status napi_throw_type_error(napi_env env, - const char* code, - const char* msg); -NAPI_EXTERN napi_status napi_throw_range_error(napi_env env, - const char* code, - const char* msg); -NAPI_EXTERN napi_status napi_is_error(napi_env env, - napi_value value, - bool* result); - -// Methods to support catching exceptions -NAPI_EXTERN napi_status napi_is_exception_pending(napi_env env, bool* result); -NAPI_EXTERN napi_status napi_get_and_clear_last_exception(napi_env env, - napi_value* result); // Methods to provide node::Buffer functionality with napi types NAPI_EXTERN napi_status napi_create_buffer(napi_env env, @@ -488,57 +141,6 @@ NAPI_EXTERN napi_status napi_get_buffer_info(napi_env env, void** data, size_t* length); -// Methods to work with array buffers and typed arrays -NAPI_EXTERN napi_status napi_is_arraybuffer(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_create_arraybuffer(napi_env env, - size_t byte_length, - void** data, - napi_value* result); -NAPI_EXTERN napi_status -napi_create_external_arraybuffer(napi_env env, - void* external_data, - size_t byte_length, - napi_finalize finalize_cb, - void* finalize_hint, - napi_value* result); -NAPI_EXTERN napi_status napi_get_arraybuffer_info(napi_env env, - napi_value arraybuffer, - void** data, - size_t* byte_length); -NAPI_EXTERN napi_status napi_is_typedarray(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_create_typedarray(napi_env env, - napi_typedarray_type type, - size_t length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result); -NAPI_EXTERN napi_status napi_get_typedarray_info(napi_env env, - napi_value typedarray, - napi_typedarray_type* type, - size_t* length, - void** data, - napi_value* arraybuffer, - size_t* byte_offset); - -NAPI_EXTERN napi_status napi_create_dataview(napi_env env, - size_t length, - napi_value arraybuffer, - size_t byte_offset, - napi_value* result); -NAPI_EXTERN napi_status napi_is_dataview(napi_env env, - napi_value value, - bool* result); -NAPI_EXTERN napi_status napi_get_dataview_info(napi_env env, - napi_value dataview, - size_t* bytelength, - void** data, - napi_value* arraybuffer, - size_t* byte_offset); - // Methods to manage simple async operations NAPI_EXTERN napi_status napi_create_async_work(napi_env env, @@ -555,54 +157,11 @@ NAPI_EXTERN napi_status napi_queue_async_work(napi_env env, NAPI_EXTERN napi_status napi_cancel_async_work(napi_env env, napi_async_work work); -// Methods for custom handling of async operations -NAPI_EXTERN napi_status napi_async_init(napi_env env, - napi_value async_resource, - napi_value async_resource_name, - napi_async_context* result); - -NAPI_EXTERN napi_status napi_async_destroy(napi_env env, - napi_async_context async_context); - -NAPI_EXTERN napi_status napi_make_callback(napi_env env, - napi_async_context async_context, - napi_value recv, - napi_value func, - size_t argc, - const napi_value* argv, - napi_value* result); - // version management -NAPI_EXTERN napi_status napi_get_version(napi_env env, uint32_t* result); - NAPI_EXTERN napi_status napi_get_node_version(napi_env env, const napi_node_version** version); -// Promises -NAPI_EXTERN napi_status napi_create_promise(napi_env env, - napi_deferred* deferred, - napi_value* promise); -NAPI_EXTERN napi_status napi_resolve_deferred(napi_env env, - napi_deferred deferred, - napi_value resolution); -NAPI_EXTERN napi_status napi_reject_deferred(napi_env env, - napi_deferred deferred, - napi_value rejection); -NAPI_EXTERN napi_status napi_is_promise(napi_env env, - napi_value promise, - bool* is_promise); - -// Memory management -NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, - int64_t change_in_bytes, - int64_t* adjusted_value); - -// Running a script -NAPI_EXTERN napi_status napi_run_script(napi_env env, - napi_value script, - napi_value* result); - #if NAPI_VERSION >= 2 // Return the current libuv event loop for a given environment @@ -613,14 +172,6 @@ NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, #if NAPI_VERSION >= 3 -NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env, - napi_value resource_object, - napi_async_context context, - napi_callback_scope* result); - -NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, - napi_callback_scope scope); - NAPI_EXTERN napi_status napi_fatal_exception(napi_env env, napi_value err); NAPI_EXTERN napi_status napi_add_env_cleanup_hook(napi_env env, @@ -631,6 +182,14 @@ NAPI_EXTERN napi_status napi_remove_env_cleanup_hook(napi_env env, void (*fun)(void* arg), void* arg); +NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env, + napi_value resource_object, + napi_async_context context, + napi_callback_scope* result); + +NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, + napi_callback_scope scope); + #endif // NAPI_VERSION >= 3 #ifdef NAPI_EXPERIMENTAL @@ -671,36 +230,6 @@ napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func); NAPI_EXTERN napi_status napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); -NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, - int64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_bigint_uint64(napi_env env, - uint64_t value, - napi_value* result); -NAPI_EXTERN napi_status napi_create_bigint_words(napi_env env, - int sign_bit, - size_t word_count, - const uint64_t* words, - napi_value* result); -NAPI_EXTERN napi_status napi_get_value_bigint_int64(napi_env env, - napi_value value, - int64_t* result, - bool* lossless); -NAPI_EXTERN napi_status napi_get_value_bigint_uint64(napi_env env, - napi_value value, - uint64_t* result, - bool* lossless); -NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, - napi_value value, - int* sign_bit, - size_t* word_count, - uint64_t* words); -NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, - napi_value js_object, - void* native_object, - napi_finalize finalize_cb, - void* finalize_hint, - napi_ref* result); #endif // NAPI_EXPERIMENTAL EXTERN_C_END diff --git a/src/node_api_types.h b/src/node_api_types.h index 10215d9aa3a0ff..ab4f7ac58cb3dd 100644 --- a/src/node_api_types.h +++ b/src/node_api_types.h @@ -1,89 +1,15 @@ #ifndef SRC_NODE_API_TYPES_H_ #define SRC_NODE_API_TYPES_H_ -#include -#include +#include "js_native_api_types.h" -#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) - typedef uint16_t char16_t; -#endif - -// JSVM API types are all opaque pointers for ABI stability -// typedef undefined structs instead of void* for compile time type safety -typedef struct napi_env__* napi_env; -typedef struct napi_value__* napi_value; -typedef struct napi_ref__* napi_ref; -typedef struct napi_handle_scope__* napi_handle_scope; -typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; typedef struct napi_callback_scope__* napi_callback_scope; -typedef struct napi_callback_info__* napi_callback_info; typedef struct napi_async_context__* napi_async_context; typedef struct napi_async_work__* napi_async_work; -typedef struct napi_deferred__* napi_deferred; #ifdef NAPI_EXPERIMENTAL typedef struct napi_threadsafe_function__* napi_threadsafe_function; #endif // NAPI_EXPERIMENTAL -typedef enum { - napi_default = 0, - napi_writable = 1 << 0, - napi_enumerable = 1 << 1, - napi_configurable = 1 << 2, - - // Used with napi_define_class to distinguish static properties - // from instance properties. Ignored by napi_define_properties. - napi_static = 1 << 10, -} napi_property_attributes; - -typedef enum { - // ES6 types (corresponds to typeof) - napi_undefined, - napi_null, - napi_boolean, - napi_number, - napi_string, - napi_symbol, - napi_object, - napi_function, - napi_external, - napi_bigint, -} napi_valuetype; - -typedef enum { - napi_int8_array, - napi_uint8_array, - napi_uint8_clamped_array, - napi_int16_array, - napi_uint16_array, - napi_int32_array, - napi_uint32_array, - napi_float32_array, - napi_float64_array, - napi_bigint64_array, - napi_biguint64_array, -} napi_typedarray_type; - -typedef enum { - napi_ok, - napi_invalid_arg, - napi_object_expected, - napi_string_expected, - napi_name_expected, - napi_function_expected, - napi_number_expected, - napi_boolean_expected, - napi_array_expected, - napi_generic_failure, - napi_pending_exception, - napi_cancelled, - napi_escape_called_twice, - napi_handle_scope_mismatch, - napi_callback_scope_mismatch, - napi_queue_full, - napi_closing, - napi_bigint_expected, -} napi_status; - #ifdef NAPI_EXPERIMENTAL typedef enum { napi_tsfn_release, @@ -96,17 +22,11 @@ typedef enum { } napi_threadsafe_function_call_mode; #endif // NAPI_EXPERIMENTAL -typedef napi_value (*napi_callback)(napi_env env, - napi_callback_info info); -typedef void (*napi_finalize)(napi_env env, - void* finalize_data, - void* finalize_hint); typedef void (*napi_async_execute_callback)(napi_env env, void* data); typedef void (*napi_async_complete_callback)(napi_env env, napi_status status, void* data); - #ifdef NAPI_EXPERIMENTAL typedef void (*napi_threadsafe_function_call_js)(napi_env env, napi_value js_callback, @@ -114,27 +34,6 @@ typedef void (*napi_threadsafe_function_call_js)(napi_env env, void* data); #endif // NAPI_EXPERIMENTAL -typedef struct { - // One of utf8name or name should be NULL. - const char* utf8name; - napi_value name; - - napi_callback method; - napi_callback getter; - napi_callback setter; - napi_value value; - - napi_property_attributes attributes; - void* data; -} napi_property_descriptor; - -typedef struct { - const char* error_message; - void* engine_reserved; - uint32_t engine_error_code; - napi_status error_code; -} napi_extended_error_info; - typedef struct { uint32_t major; uint32_t minor; diff --git a/test/addons-napi/6_object_wrap/binding.cc b/test/addons-napi/6_object_wrap/binding.cc index ec4a4f347afc88..380ca6b27bb306 100644 --- a/test/addons-napi/6_object_wrap/binding.cc +++ b/test/addons-napi/6_object_wrap/binding.cc @@ -1,3 +1,4 @@ +#include #include "myobject.h" #include "../common.h" diff --git a/test/addons-napi/6_object_wrap/myobject.h b/test/addons-napi/6_object_wrap/myobject.h index b7f425951dda7f..f67dddf406299f 100644 --- a/test/addons-napi/6_object_wrap/myobject.h +++ b/test/addons-napi/6_object_wrap/myobject.h @@ -1,7 +1,7 @@ #ifndef TEST_ADDONS_NAPI_6_OBJECT_WRAP_MYOBJECT_H_ #define TEST_ADDONS_NAPI_6_OBJECT_WRAP_MYOBJECT_H_ -#include +#include class MyObject { public: diff --git a/test/addons-napi/7_factory_wrap/binding.cc b/test/addons-napi/7_factory_wrap/binding.cc index e937516c894a90..a5df612393ccec 100644 --- a/test/addons-napi/7_factory_wrap/binding.cc +++ b/test/addons-napi/7_factory_wrap/binding.cc @@ -1,3 +1,4 @@ +#include #include "myobject.h" #include "../common.h" diff --git a/test/addons-napi/7_factory_wrap/myobject.h b/test/addons-napi/7_factory_wrap/myobject.h index 172fcd3ca49295..24883dfa3a0c29 100644 --- a/test/addons-napi/7_factory_wrap/myobject.h +++ b/test/addons-napi/7_factory_wrap/myobject.h @@ -1,7 +1,7 @@ #ifndef TEST_ADDONS_NAPI_7_FACTORY_WRAP_MYOBJECT_H_ #define TEST_ADDONS_NAPI_7_FACTORY_WRAP_MYOBJECT_H_ -#include +#include class MyObject { public: diff --git a/test/addons-napi/8_passing_wrapped/binding.cc b/test/addons-napi/8_passing_wrapped/binding.cc index 48e94f10ec4838..f978fe151954ae 100644 --- a/test/addons-napi/8_passing_wrapped/binding.cc +++ b/test/addons-napi/8_passing_wrapped/binding.cc @@ -1,3 +1,4 @@ +#include #include "myobject.h" #include "../common.h" diff --git a/test/addons-napi/8_passing_wrapped/myobject.h b/test/addons-napi/8_passing_wrapped/myobject.h index 7c6a35aa853cc5..f1637b8dfee34e 100644 --- a/test/addons-napi/8_passing_wrapped/myobject.h +++ b/test/addons-napi/8_passing_wrapped/myobject.h @@ -1,7 +1,7 @@ #ifndef TEST_ADDONS_NAPI_8_PASSING_WRAPPED_MYOBJECT_H_ #define TEST_ADDONS_NAPI_8_PASSING_WRAPPED_MYOBJECT_H_ -#include +#include class MyObject { public: diff --git a/tools/install.py b/tools/install.py index c97518d4220788..af8e9e27086d96 100755 --- a/tools/install.py +++ b/tools/install.py @@ -169,6 +169,8 @@ def ignore_inspector_headers(files, dest): 'config.gypi', 'src/node.h', 'src/node_api.h', + 'src/js_native_api.h', + 'src/js_native_api_types.h', 'src/node_api_types.h', 'src/node_buffer.h', 'src/node_object_wrap.h', From 7c29e9b83bf923e51d750eaad9603f2d86934b13 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Sun, 18 Nov 2018 00:30:24 +0530 Subject: [PATCH 031/316] crypto: remove unnecessary fully qualified names PR-URL: https://github.com/nodejs/node/pull/24452 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann --- src/node_crypto.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index eab8aae1809b83..972e1d0f37cccd 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3201,7 +3201,7 @@ void CipherBase::Final(const FunctionCallbackInfo& args) { } -void Hmac::Initialize(Environment* env, v8::Local target) { +void Hmac::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3323,7 +3323,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { } -void Hash::Initialize(Environment* env, v8::Local target) { +void Hash::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3518,7 +3518,7 @@ static bool ApplyRSAOptions(const EVPKeyPointer& pkey, -void Sign::Initialize(Environment* env, v8::Local target) { +void Sign::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3750,7 +3750,7 @@ static ParsePublicKeyResult ParsePublicKey(EVPKeyPointer* pkey, }); } -void Verify::Initialize(Environment* env, v8::Local target) { +void Verify::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3969,7 +3969,7 @@ void DiffieHellman::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(callback); const PropertyAttribute attributes = - static_cast(v8::ReadOnly | v8::DontDelete); + static_cast(ReadOnly | DontDelete); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -4247,7 +4247,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo& args) { Buffer::New(env->isolate(), data.release(), data.size).ToLocalChecked()); } -void DiffieHellman::SetKey(const v8::FunctionCallbackInfo& args, +void DiffieHellman::SetKey(const FunctionCallbackInfo& args, int (*set_field)(DH*, BIGNUM*), const char* what) { Environment* env = Environment::GetCurrent(args); From 5c4f5698570cd817ebb62c573b6982627ff5e765 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 15 Nov 2018 16:47:44 -0800 Subject: [PATCH 032/316] doc: simplify first-time contributors section of Collaborator Guide PR-URL: https://github.com/nodejs/node/pull/24387 Reviewed-By: Ouyang Yadong Reviewed-By: Weijia Wang Reviewed-By: Refael Ackermann Reviewed-By: Franziska Hinkelmann Reviewed-By: Trivikram Kamat Reviewed-By: Vse Mozhet Byt --- COLLABORATOR_GUIDE.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index deadf87ed15092..1eb75fc1f8d703 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -50,16 +50,14 @@ request. See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). ### Welcoming First-Time Contributors -Courtesy should always be shown to individuals submitting issues and pull -requests to the Node.js project. Be welcoming to first-time contributors, -identified by the GitHub ![First-time contributor](./doc/first_timer_badge.png) -badge. +Always show courtesy to individuals submitting issues and pull requests. Be +welcoming to first-time contributors, identified by the GitHub +![First-time contributor](./doc/first_timer_badge.png) badge. -For first-time contributors, check if the commit author is the same as the -pull request author, and ask if they have configured their git +For first-time contributors, check if the commit author is the same as the pull +request author. This way, once their pull request lands, GitHub will show them +as a _Contributor_. Ask if they have configured their git [username][git-username] and [email][git-email] to their liking. -This is to make sure they would be promoted to "contributor" once their -pull request lands. ### Closing Issues and Pull Requests From 6dd29252c7aedda1c097e813b611f070cd6f2c30 Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Sat, 17 Nov 2018 16:54:37 +0530 Subject: [PATCH 033/316] test: fixed the arguments order in `assert.strictEqual` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24414 Reviewed-By: Michaël Zasso Reviewed-By: Ouyang Yadong Reviewed-By: Gireesh Punathil --- test/internet/test-dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 5c53781fde4a69..1f6639b2d5ce6c 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -693,7 +693,7 @@ req.oncomplete = function(err, domains) { process.on('exit', function() { console.log(`${completed} tests completed`); assert.strictEqual(running, false); - assert.strictEqual(expected, completed); + assert.strictEqual(completed, expected); assert.ok(getaddrinfoCallbackCalled); }); From f112c06b3e132f20b613624f073a9e92a456ff9a Mon Sep 17 00:00:00 2001 From: Jayasankar Date: Sat, 17 Nov 2018 17:03:24 +0530 Subject: [PATCH 034/316] test:replace anonymous closure function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24415 Reviewed-By: Michaël Zasso Reviewed-By: Ouyang Yadong Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- .../test-http-pipeline-socket-parser-typeerror.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-http-pipeline-socket-parser-typeerror.js b/test/parallel/test-http-pipeline-socket-parser-typeerror.js index 0cb20e76172766..8987b822c26496 100644 --- a/test/parallel/test-http-pipeline-socket-parser-typeerror.js +++ b/test/parallel/test-http-pipeline-socket-parser-typeerror.js @@ -20,7 +20,7 @@ let more; let done; const server = http - .createServer(function(req, res) { + .createServer((req, res) => { if (!once) server.close(); once = true; @@ -41,18 +41,18 @@ const server = http } done(); }) - .on('upgrade', function(req, socket) { - second.end(chunk, function() { + .on('upgrade', (req, socket) => { + second.end(chunk, () => { socket.end(); }); first.end('hello'); }) - .listen(0, function() { - const s = net.connect(this.address().port); - more = function() { + .listen(0, () => { + const s = net.connect(server.address().port); + more = () => { s.write('GET / HTTP/1.1\r\n\r\n'); }; - done = function() { + done = () => { s.write( 'GET / HTTP/1.1\r\n\r\n' + 'GET / HTTP/1.1\r\nConnection: upgrade\r\nUpgrade: ws\r\n\r\naaa' From 454883b6ce566ce22aa5f20635e715f1ddaa3f20 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Sun, 18 Nov 2018 01:05:41 +0530 Subject: [PATCH 035/316] http2: elevate v8 namespaces of repeated references PR-URL: https://github.com/nodejs/node/pull/24453 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil --- src/node_http2.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 552903059abce5..f92d39f655b7e2 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -12,11 +12,13 @@ namespace node { using v8::ArrayBuffer; +using v8::ArrayBufferCreationMode; using v8::Boolean; using v8::Context; using v8::Float64Array; using v8::Function; using v8::Integer; +using v8::NewStringType; using v8::Number; using v8::ObjectTemplate; using v8::String; @@ -1401,11 +1403,11 @@ void Http2Session::HandleAltSvcFrame(const nghttp2_frame* frame) { Integer::New(isolate, id), String::NewFromOneByte(isolate, altsvc->origin, - v8::NewStringType::kNormal, + NewStringType::kNormal, altsvc->origin_len).ToLocalChecked(), String::NewFromOneByte(isolate, altsvc->field_value, - v8::NewStringType::kNormal, + NewStringType::kNormal, altsvc->field_value_len).ToLocalChecked(), }; @@ -1430,7 +1432,7 @@ void Http2Session::HandleOriginFrame(const nghttp2_frame* frame) { const nghttp2_origin_entry& entry = origin->ov[i]; origin_v[i] = String::NewFromOneByte( - isolate, entry.origin, v8::NewStringType::kNormal, entry.origin_len) + isolate, entry.origin, NewStringType::kNormal, entry.origin_len) .ToLocalChecked(); } Local holder = Array::New(isolate, origin_v.data(), origin_v.size()); @@ -1813,7 +1815,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf) { ArrayBuffer::New(isolate, buf.base, nread, - v8::ArrayBufferCreationMode::kInternalized); + ArrayBufferCreationMode::kInternalized); statistics_.data_received += nread; ssize_t ret = Write(&stream_buf_, 1); @@ -2316,7 +2318,7 @@ void HttpErrorString(const FunctionCallbackInfo& args) { String::NewFromOneByte( env->isolate(), reinterpret_cast(nghttp2_strerror(val)), - v8::NewStringType::kInternalized).ToLocalChecked()); + NewStringType::kInternalized).ToLocalChecked()); } From 856a0fc8e4dadc47bc03c9318b60b92fb71ad387 Mon Sep 17 00:00:00 2001 From: Pushkal B Date: Sat, 17 Nov 2018 18:19:08 +0530 Subject: [PATCH 036/316] test: use arrow functions for callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24444 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-stream-pipe-flow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-pipe-flow.js b/test/parallel/test-stream-pipe-flow.js index 1f8564182a3107..b696821c0d51fb 100644 --- a/test/parallel/test-stream-pipe-flow.js +++ b/test/parallel/test-stream-pipe-flow.js @@ -41,17 +41,17 @@ const { Readable, Writable, PassThrough } = require('stream'); .pipe(new PassThrough({ objectMode: true, highWaterMark: 2 })) .pipe(new PassThrough({ objectMode: true, highWaterMark: 2 })); - pt.on('end', function() { + pt.on('end', () => { wrapper.push(null); }); const wrapper = new Readable({ objectMode: true, read: () => { - process.nextTick(function() { + process.nextTick(() => { let data = pt.read(); if (data === null) { - pt.once('readable', function() { + pt.once('readable', () => { data = pt.read(); if (data !== null) wrapper.push(data); }); From 3fadc809bb1d4faf187e83aaa01862d0c7b2dda3 Mon Sep 17 00:00:00 2001 From: potham Date: Sat, 17 Nov 2018 17:41:00 +0530 Subject: [PATCH 037/316] test: replace callback functions with arrow functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24432 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-http-client-timeout-option-with-agent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-client-timeout-option-with-agent.js b/test/parallel/test-http-client-timeout-option-with-agent.js index 26c93ec55bc903..7f20eb4e139e56 100644 --- a/test/parallel/test-http-client-timeout-option-with-agent.js +++ b/test/parallel/test-http-client-timeout-option-with-agent.js @@ -24,7 +24,7 @@ const server = http.createServer(() => { // Never respond. }); -server.listen(0, options.host, function() { +server.listen(0, options.host, () => { doRequest(); }); @@ -50,7 +50,7 @@ function doRequest() { })); req.end(); - setTimeout(function() { + setTimeout(() => { req.destroy(); assert.strictEqual(timeout_events, 1); // Ensure the `timeout` event fired only once. From ffb5e5da4bc30c316d04f1e42e2d1d02433c0e81 Mon Sep 17 00:00:00 2001 From: Jayasankar Date: Sat, 17 Nov 2018 17:36:44 +0530 Subject: [PATCH 038/316] test:replace anonymous closure for test-http-expect-handling.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24423 Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-http-expect-handling.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-expect-handling.js b/test/parallel/test-http-expect-handling.js index 11d2b6ecf4e614..0a39d49d923474 100644 --- a/test/parallel/test-http-expect-handling.js +++ b/test/parallel/test-http-expect-handling.js @@ -9,7 +9,7 @@ const tests = [417, 417]; let testsComplete = 0; let testIdx = 0; -const s = http.createServer(function(req, res) { +const s = http.createServer((req, res) => { throw new Error('this should never be executed'); }); @@ -34,13 +34,13 @@ function nextTest() { })); } - http.get(options, function(response) { + http.get(options, (response) => { console.log(`client: expected status: ${test}`); console.log(`client: statusCode: ${response.statusCode}`); assert.strictEqual(response.statusCode, test); assert.strictEqual(response.statusMessage, 'Expectation Failed'); - response.on('end', function() { + response.on('end', () => { testsComplete++; testIdx++; nextTest(); @@ -50,6 +50,6 @@ function nextTest() { } -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(testsComplete, 2); }); From c1777990aef6a86cb57fe4e82b442606c32b164f Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Sat, 17 Nov 2018 17:32:09 +0530 Subject: [PATCH 039/316] test: change callback function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24421 Reviewed-By: Ouyang Yadong Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-stream-unshift-empty-chunk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-unshift-empty-chunk.js b/test/parallel/test-stream-unshift-empty-chunk.js index 9c2c12a41a3958..0f0a13722cab14 100644 --- a/test/parallel/test-stream-unshift-empty-chunk.js +++ b/test/parallel/test-stream-unshift-empty-chunk.js @@ -32,14 +32,14 @@ let nChunks = 10; const chunk = Buffer.alloc(10, 'x'); r._read = function(n) { - setImmediate(function() { + setImmediate(() => { r.push(--nChunks === 0 ? null : chunk); }); }; let readAll = false; const seen = []; -r.on('readable', function() { +r.on('readable', () => { let chunk; while (chunk = r.read()) { seen.push(chunk.toString()); @@ -74,7 +74,7 @@ const expect = 'xxxxxxxxxx', 'yyyyy' ]; -r.on('end', function() { +r.on('end', () => { assert.deepStrictEqual(seen, expect); console.log('ok'); }); From 506161009444ba05d56414217af8f17790d8f2b8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 20 Oct 2018 11:02:37 +0200 Subject: [PATCH 040/316] src: remove `Environment::tracing_agent_writer()` As per the conversation in https://github.com/nodejs/node/issues/22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: https://github.com/nodejs/node/issues/22513 Fixes: https://github.com/nodejs/node/issues/22767 PR-URL: https://github.com/nodejs/node/pull/23781 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Matheus Marchini --- src/env-inl.h | 4 ---- src/env.cc | 16 +++++++--------- src/env.h | 5 +---- src/inspector/tracing_agent.cc | 5 +++-- src/node.cc | 9 ++++++--- src/node_internals.h | 2 ++ src/node_trace_events.cc | 8 ++++---- src/node_worker.cc | 4 +--- 8 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 70a8e052258531..ba5704ed2e9574 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -334,10 +334,6 @@ inline v8::Isolate* Environment::isolate() const { return isolate_; } -inline tracing::AgentWriterHandle* Environment::tracing_agent_writer() const { - return tracing_agent_writer_; -} - inline Environment* Environment::from_timer_handle(uv_timer_t* handle) { return ContainerOf(&Environment::timer_handle_, handle); } diff --git a/src/env.cc b/src/env.cc index 727d13b98b13a1..5c46a56d7730ef 100644 --- a/src/env.cc +++ b/src/env.cc @@ -143,11 +143,9 @@ void Environment::TrackingTraceStateObserver::UpdateTraceCategoryState() { } Environment::Environment(IsolateData* isolate_data, - Local context, - tracing::AgentWriterHandle* tracing_agent_writer) + Local context) : isolate_(context->GetIsolate()), isolate_data_(isolate_data), - tracing_agent_writer_(tracing_agent_writer), immediate_info_(context->GetIsolate()), tick_info_(context->GetIsolate()), timer_base_(uv_now(isolate_data->event_loop())), @@ -183,10 +181,9 @@ Environment::Environment(IsolateData* isolate_data, AssignToContext(context, ContextInfo("")); - if (tracing_agent_writer_ != nullptr) { + if (tracing::AgentWriterHandle* writer = GetTracingAgentWriter()) { trace_state_observer_.reset(new TrackingTraceStateObserver(this)); - v8::TracingController* tracing_controller = - tracing_agent_writer_->GetTracingController(); + v8::TracingController* tracing_controller = writer->GetTracingController(); if (tracing_controller != nullptr) tracing_controller->AddTraceStateObserver(trace_state_observer_.get()); } @@ -235,9 +232,10 @@ Environment::~Environment() { context()->SetAlignedPointerInEmbedderData( ContextEmbedderIndex::kEnvironment, nullptr); - if (tracing_agent_writer_ != nullptr) { - v8::TracingController* tracing_controller = - tracing_agent_writer_->GetTracingController(); + if (trace_state_observer_) { + tracing::AgentWriterHandle* writer = GetTracingAgentWriter(); + CHECK_NOT_NULL(writer); + v8::TracingController* tracing_controller = writer->GetTracingController(); if (tracing_controller != nullptr) tracing_controller->RemoveTraceStateObserver(trace_state_observer_.get()); } diff --git a/src/env.h b/src/env.h index 42a76c1fbe8928..0b8da0c23c1791 100644 --- a/src/env.h +++ b/src/env.h @@ -595,8 +595,7 @@ class Environment { static inline Environment* GetThreadLocalEnv(); Environment(IsolateData* isolate_data, - v8::Local context, - tracing::AgentWriterHandle* tracing_agent_writer); + v8::Local context); ~Environment(); void Start(const std::vector& args, @@ -632,7 +631,6 @@ class Environment { inline bool profiler_idle_notifier_started() const; inline v8::Isolate* isolate() const; - inline tracing::AgentWriterHandle* tracing_agent_writer() const; inline uv_loop_t* event_loop() const; inline uint32_t watched_providers() const; @@ -923,7 +921,6 @@ class Environment { v8::Isolate* const isolate_; IsolateData* const isolate_data_; - tracing::AgentWriterHandle* const tracing_agent_writer_; uv_timer_t timer_handle_; uv_check_t immediate_check_handle_; uv_idle_t immediate_idle_handle_; diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc index fe69e6f863e2a6..1ad67d9b9e7f71 100644 --- a/src/inspector/tracing_agent.cc +++ b/src/inspector/tracing_agent.cc @@ -1,4 +1,5 @@ #include "tracing_agent.h" +#include "node_internals.h" #include "env-inl.h" #include "v8.h" @@ -74,9 +75,9 @@ DispatchResponse TracingAgent::start( if (categories_set.empty()) return DispatchResponse::Error("At least one category should be enabled"); - auto* writer = env_->tracing_agent_writer(); + tracing::AgentWriterHandle* writer = GetTracingAgentWriter(); if (writer != nullptr) { - trace_writer_ = env_->tracing_agent_writer()->agent()->AddClient( + trace_writer_ = writer->agent()->AddClient( categories_set, std::unique_ptr( new InspectorTraceWriter(frontend_.get())), diff --git a/src/node.cc b/src/node.cc index af11953250ec11..faef976e974b4c 100644 --- a/src/node.cc +++ b/src/node.cc @@ -399,6 +399,10 @@ static struct { #endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR } v8_platform; +tracing::AgentWriterHandle* GetTracingAgentWriter() { + return v8_platform.GetTracingAgentWriter(); +} + #ifdef __POSIX__ static const unsigned kMaxSignal = 32; #endif @@ -2442,8 +2446,7 @@ Environment* CreateEnvironment(IsolateData* isolate_data, // options than the global parse call. std::vector args(argv, argv + argc); std::vector exec_args(exec_argv, exec_argv + exec_argc); - Environment* env = new Environment(isolate_data, context, - v8_platform.GetTracingAgentWriter()); + Environment* env = new Environment(isolate_data, context); env->Start(args, exec_args, v8_is_profiling); return env; } @@ -2515,7 +2518,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, HandleScope handle_scope(isolate); Local context = NewContext(isolate); Context::Scope context_scope(context); - Environment env(isolate_data, context, v8_platform.GetTracingAgentWriter()); + Environment env(isolate_data, context); env.Start(args, exec_args, v8_is_profiling); const char* path = args.size() > 1 ? args[1].c_str() : nullptr; diff --git a/src/node_internals.h b/src/node_internals.h index 9d419f01f3925b..cdb7492f437d5c 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -501,6 +501,8 @@ int ThreadPoolWork::CancelWork() { return uv_cancel(reinterpret_cast(&work_req_)); } +tracing::AgentWriterHandle* GetTracingAgentWriter(); + static inline const char* errno_string(int errorno) { #define ERRNO_CASE(e) case e: return #e; switch (errorno) { diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index f51db62ba38ac4..eea9fc612e578e 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -57,7 +57,7 @@ void NodeCategorySet::New(const FunctionCallbackInfo& args) { if (!*val) return; categories.emplace(*val); } - CHECK_NOT_NULL(env->tracing_agent_writer()); + CHECK_NOT_NULL(GetTracingAgentWriter()); new NodeCategorySet(env, args.This(), std::move(categories)); } @@ -68,7 +68,7 @@ void NodeCategorySet::Enable(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(category_set); const auto& categories = category_set->GetCategories(); if (!category_set->enabled_ && !categories.empty()) { - env->tracing_agent_writer()->Enable(categories); + GetTracingAgentWriter()->Enable(categories); category_set->enabled_ = true; } } @@ -80,7 +80,7 @@ void NodeCategorySet::Disable(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(category_set); const auto& categories = category_set->GetCategories(); if (category_set->enabled_ && !categories.empty()) { - env->tracing_agent_writer()->Disable(categories); + GetTracingAgentWriter()->Disable(categories); category_set->enabled_ = false; } } @@ -88,7 +88,7 @@ void NodeCategorySet::Disable(const FunctionCallbackInfo& args) { void GetEnabledCategories(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); std::string categories = - env->tracing_agent_writer()->agent()->GetEnabledCategories(); + GetTracingAgentWriter()->agent()->GetEnabledCategories(); if (!categories.empty()) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), diff --git a/src/node_worker.cc b/src/node_worker.cc index 38a92b34794dd2..e99ac59c01e06d 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -116,9 +116,7 @@ Worker::Worker(Environment* env, Local wrap, const std::string& url) Context::Scope context_scope(context); // TODO(addaleax): Use CreateEnvironment(), or generally another public API. - env_.reset(new Environment(isolate_data_.get(), - context, - nullptr)); + env_.reset(new Environment(isolate_data_.get(), context)); CHECK_NE(env_, nullptr); env_->set_abort_on_uncaught_exception(false); env_->set_worker_context(this); From b6004b365149ce7f01eae63c62f3d1c53994c09a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 20 Oct 2018 11:51:29 +0200 Subject: [PATCH 041/316] trace_events: forbid tracing modifications from worker threads Forbid modifying tracing state from worker threads, either through the built-in module or inspector sessions, since the main thread owns all global state, and at least the `async_hooks` integration is definitely not thread safe in its current state. PR-URL: https://github.com/nodejs/node/pull/23781 Fixes: https://github.com/nodejs/node/issues/22767 Refs: https://github.com/nodejs/node/issues/22513 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Matheus Marchini --- doc/api/tracing.md | 3 ++ doc/api/worker_threads.md | 2 ++ lib/trace_events.js | 3 +- src/env.cc | 13 ++++++++- src/inspector/tracing_agent.cc | 4 +++ .../test-trace-events-api-worker-disabled.js | 11 ++++++++ ...-events-dynamic-enable-workers-disabled.js | 28 +++++++++++++++++++ 7 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-trace-events-api-worker-disabled.js create mode 100644 test/parallel/test-trace-events-dynamic-enable-workers-disabled.js diff --git a/doc/api/tracing.md b/doc/api/tracing.md index 04db3f12f42e2e..10b2f61ea5a5b9 100644 --- a/doc/api/tracing.md +++ b/doc/api/tracing.md @@ -82,6 +82,8 @@ as the one used by `process.hrtime()` however the trace-event timestamps are expressed in microseconds, unlike `process.hrtime()` which returns nanoseconds. +The features from this module are not available in [`Worker`][] threads. + ## The `trace_events` module + +* `string` {string} +* `position` {integer} +* `encoding` {string} **Default:** `'utf8'` +* Returns: {Promise} + +Write `string` to the file. If `string` is not a string, then +the value will be coerced to one. + +The `Promise` is resolved with an object containing a `bytesWritten` property +identifying the number of bytes written, and a `buffer` property containing +a reference to the `string` written. + +`position` refers to the offset from the beginning of the file where this data +should be written. If the type of `position` is not a `number` the data +will be written at the current position. See pwrite(2). + +`encoding` is the expected string encoding. + +It is unsafe to use `filehandle.write()` multiple times on the same file +without waiting for the `Promise` to be resolved (or rejected). For this +scenario, [`fs.createWriteStream()`][] is strongly recommended. + +On Linux, positional writes do not work when the file is opened in append mode. +The kernel ignores the position argument and always appends the data to +the end of the file. + #### filehandle.writeFile(data, options) A certificate object has properties corresponding to the fields of the certificate. @@ -688,7 +694,18 @@ For RSA keys, the following properties may be defined: `'B56CE45CB7...'`. * `pubkey` {Buffer} The public key. - +For EC keys, the following properties may be defined: +* `pubkey` {Buffer} The public key. +* `bits` {number} The key size in bits. Example: `256`. +* `asn1Curve` {string} (Optional) The ASN.1 name of the OID of the elliptic + curve. Well-known curves are identified by an OID. While it is unusual, it is + possible that the curve is identified by its mathematical properties, in which + case it will not have an OID. Example: `'prime256v1'`. +* `nistCurve` {string} (Optional) The NIST name for the elliptic curve, if it + has one (not all well-known curves have been assigned names by NIST). Example: + `'P-256'`. + +Example certificate: ```text { subject: { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], diff --git a/src/env.h b/src/env.h index 6bed104dbb4f31..c99f1d68301b6f 100644 --- a/src/env.h +++ b/src/env.h @@ -124,7 +124,9 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(address_string, "address") \ V(aliases_string, "aliases") \ V(args_string, "args") \ + V(asn1curve_string, "asn1Curve") \ V(async_ids_stack_string, "async_ids_stack") \ + V(bits_string, "bits") \ V(buffer_string, "buffer") \ V(bytes_parsed_string, "bytesParsed") \ V(bytes_read_string, "bytesRead") \ @@ -207,6 +209,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(modulus_string, "modulus") \ V(name_string, "name") \ V(netmask_string, "netmask") \ + V(nistcurve_string, "nistCurve") \ V(nsname_string, "nsname") \ V(ocsp_request_string, "OCSPRequest") \ V(onaltsvc_string, "onaltsvc") \ diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 972e1d0f37cccd..41565da1563805 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -52,6 +52,15 @@ static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL | XN_FLAG_FN_SN; namespace node { +namespace Buffer { +// OpenSSL uses `unsigned char*` for raw data, make this easier for us. +v8::MaybeLocal New(Environment* env, unsigned char* udata, + size_t length) { + char* data = reinterpret_cast(udata); + return Buffer::New(env, data, length); +} +} // namespace Buffer + namespace crypto { using v8::Array; @@ -1629,8 +1638,17 @@ static Local X509ToObject(Environment* env, X509* cert) { EVPKeyPointer pkey(X509_get_pubkey(cert)); RSAPointer rsa; - if (pkey) - rsa.reset(EVP_PKEY_get1_RSA(pkey.get())); + ECPointer ec; + if (pkey) { + switch (EVP_PKEY_id(pkey.get())) { + case EVP_PKEY_RSA: + rsa.reset(EVP_PKEY_get1_RSA(pkey.get())); + break; + case EVP_PKEY_EC: + ec.reset(EVP_PKEY_get1_EC_KEY(pkey.get())); + break; + } + } if (rsa) { const BIGNUM* n; @@ -1666,10 +1684,53 @@ static Local X509ToObject(Environment* env, X509* cert) { reinterpret_cast(Buffer::Data(pubbuff)); i2d_RSA_PUBKEY(rsa.get(), &pubserialized); info->Set(env->context(), env->pubkey_string(), pubbuff).FromJust(); + } else if (ec) { + const EC_GROUP* group = EC_KEY_get0_group(ec.get()); + if (group != nullptr) { + int bits = EC_GROUP_order_bits(group); + if (bits > 0) { + info->Set(context, env->bits_string(), + Integer::New(env->isolate(), bits)).FromJust(); + } + } + + unsigned char* pub = nullptr; + size_t publen = EC_KEY_key2buf(ec.get(), EC_KEY_get_conv_form(ec.get()), + &pub, nullptr); + if (publen > 0) { + Local buf = Buffer::New(env, pub, publen).ToLocalChecked(); + // Ownership of pub pointer accepted by Buffer. + pub = nullptr; + info->Set(context, env->pubkey_string(), buf).FromJust(); + } else { + CHECK_NULL(pub); + } + + if (EC_GROUP_get_asn1_flag(group) != 0) { + // Curve is well-known, get its OID and NIST nick-name (if it has one). + + int nid = EC_GROUP_get_curve_name(group); + if (nid != 0) { + if (const char* sn = OBJ_nid2sn(nid)) { + info->Set(context, env->asn1curve_string(), + OneByteString(env->isolate(), sn)).FromJust(); + } + } + if (nid != 0) { + if (const char* nist = EC_curve_nid2nist(nid)) { + info->Set(context, env->nistcurve_string(), + OneByteString(env->isolate(), nist)).FromJust(); + } + } + } else { + // Unnamed curves can be described by their mathematical properties, + // but aren't used much (at all?) with X.509/TLS. Support later if needed. + } } pkey.reset(); rsa.reset(); + ec.reset(); ASN1_TIME_print(bio.get(), X509_get_notBefore(cert)); BIO_get_mem_ptr(bio.get(), &mem); diff --git a/src/node_crypto.h b/src/node_crypto.h index f85cdd32081895..5f98af754ea727 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -81,6 +81,7 @@ using EVPKeyPointer = DeleteFnPtr; using EVPKeyCtxPointer = DeleteFnPtr; using EVPMDPointer = DeleteFnPtr; using RSAPointer = DeleteFnPtr; +using ECPointer = DeleteFnPtr; using BignumPointer = DeleteFnPtr; using NetscapeSPKIPointer = DeleteFnPtr; using ECGroupPointer = DeleteFnPtr; diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index 0b820b93eb2ada..2a48665e4d9357 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -86,3 +86,48 @@ connect({ return cleanup(); }); + +connect({ + client: { rejectUnauthorized: false }, + server: keys.ec, +}, function(err, pair, cleanup) { + assert.ifError(err); + const socket = pair.client.conn; + let peerCert = socket.getPeerCertificate(true); + assert.ok(peerCert.issuerCertificate); + + peerCert = socket.getPeerCertificate(true); + debug('peerCert:\n', peerCert); + + assert.ok(peerCert.issuerCertificate); + assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org'); + assert.strictEqual(peerCert.serialNumber, 'C1EA7B03D5956D52'); + assert.strictEqual(peerCert.exponent, undefined); + assert.strictEqual(peerCert.pubKey, undefined); + assert.strictEqual(peerCert.modulus, undefined); + assert.strictEqual( + peerCert.fingerprint, + 'DF:F0:D3:6B:C3:E7:74:7C:C7:F3:FB:1E:33:12:AE:6C:8D:53:5F:74' + ); + assert.strictEqual( + peerCert.fingerprint256, + 'AB:08:3C:40:C7:07:D7:D1:79:32:92:3B:96:52:D0:38:4C:22:ED:CD:23:51:D0:A1:' + + '67:AA:33:A0:D5:26:5C:41' + ); + + assert.strictEqual( + sha256(peerCert.pubkey).digest('hex'), + 'ec68fc7d5e32cd4e1da5a7b59c0a2229be6f82fcc9bf8c8691a2262aacb14f53' + ); + assert.strictEqual(peerCert.asn1Curve, 'prime256v1'); + assert.strictEqual(peerCert.nistCurve, 'P-256'); + assert.strictEqual(peerCert.bits, 256); + + assert.deepStrictEqual(peerCert.infoAccess, undefined); + + const issuer = peerCert.issuerCertificate; + assert.strictEqual(issuer.issuerCertificate, issuer); + assert.strictEqual(issuer.serialNumber, 'C1EA7B03D5956D52'); + + return cleanup(); +}); From f30c7c49117e721f1699148ff3985fa3cf6be696 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 15 Nov 2018 10:11:29 -0800 Subject: [PATCH 092/316] tls: include RSA bit size in X.509 public key info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For symmetricality with the EC public key info, and because its useful. PR-URL: https://github.com/nodejs/node/pull/24358 Reviewed-By: Ben Noordhuis Reviewed-By: Tobias Nießen --- doc/api/tls.md | 1 + src/node_crypto.cc | 4 ++++ test/parallel/test-tls-peer-certificate.js | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/doc/api/tls.md b/doc/api/tls.md index 4c6d37224dbb62..1ea6c3799e8940 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -688,6 +688,7 @@ The certificate may contain information about the public key, depending on the key type. For RSA keys, the following properties may be defined: +* `bits` {number} The RSA bit size. Example: `1024`. * `exponent` {string} The RSA exponent, as a string in hexadecimal number notation. Example: `'0x010001'`. * `modulus` {string} The RSA modulus, as a hexadecimal string. Example: diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 41565da1563805..1f8cdc2ef5a93e 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1662,6 +1662,10 @@ static Local X509ToObject(Environment* env, X509* cert) { mem->length).ToLocalChecked()).FromJust(); USE(BIO_reset(bio.get())); + int bits = BN_num_bits(n); + info->Set(context, env->bits_string(), + Integer::New(env->isolate(), bits)).FromJust(); + uint64_t exponent_word = static_cast(BN_get_word(e)); uint32_t lo = static_cast(exponent_word); uint32_t hi = static_cast(exponent_word >> 32); diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index 2a48665e4d9357..523638d4a39649 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -55,6 +55,11 @@ connect({ assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org'); assert.strictEqual(peerCert.serialNumber, 'ECC9B856270DA9A8'); assert.strictEqual(peerCert.exponent, '0x10001'); + assert.strictEqual(peerCert.bits, 1024); + // The conversion to bits is odd because modulus isn't a buffer, its a hex + // string. There are two hex chars for every byte of modulus, and 8 bits per + // byte. + assert.strictEqual(peerCert.modulus.length / 2 * 8, peerCert.bits); assert.strictEqual( peerCert.fingerprint, 'D7:FD:F6:42:92:A8:83:51:8E:80:48:62:66:DA:85:C2:EE:A6:A1:CD' From d34527177cfcb41b24d7264d0be73fdeb43c83f9 Mon Sep 17 00:00:00 2001 From: Beth Griggs Date: Tue, 20 Nov 2018 20:19:39 +0000 Subject: [PATCH 093/316] doc: add Beth Griggs to release team PR-URL: https://github.com/nodejs/node/pull/24532 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 533b36bf8dbd58..b3925e1a2ee3b0 100644 --- a/README.md +++ b/README.md @@ -530,6 +530,8 @@ maintaining the Node.js project. GPG keys used to sign Node.js releases: +* **Beth Griggs** <bethany.griggs@uk.ibm.com> +`4ED778F539E3634C779C87C6D7062848A1AB005C` * **Colin Ihrig** <cjihrig@gmail.com> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5` * **Evan Lucas** <evanlucas@me.com> @@ -550,6 +552,7 @@ GPG keys used to sign Node.js releases: To import the full set of trusted release keys: ```shell +gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9 gpg --keyserver pool.sks-keyservers.net --recv-keys 77984A986EBC2AA786BC0F66B01FBB92821C587A From 48852cc51f1a7bd72979e70cc0ed9b104c757d3c Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 20 Nov 2018 13:42:15 -0800 Subject: [PATCH 094/316] doc: minor cleanup of tls.getProtocol() Improve markup and return value description. PR-URL: https://github.com/nodejs/node/pull/24533 Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt --- doc/api/tls.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 1ea6c3799e8940..eeda97b74ee412 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -756,19 +756,19 @@ to implement the `tls-unique` channel binding from [RFC 5929][]. added: v5.7.0 --> -* Returns: {string} +* Returns: {string|null} Returns a string containing the negotiated SSL/TLS protocol version of the current connection. The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. The value `null` will be returned for server sockets or disconnected client sockets. -Example responses include: +Protocol versions are: -* `TLSv1` -* `TLSv1.1` -* `TLSv1.2` -* `unknown` +* `'TLSv1'` +* `'TLSv1.1'` +* `'TLSv1.2'` +* `'SSLv3'` See for more information. From b8ed930674f6fa82787c50cf73b110a91f6ee418 Mon Sep 17 00:00:00 2001 From: Maya Anilson Date: Sat, 17 Nov 2018 17:59:15 +0530 Subject: [PATCH 095/316] src: elevate namespaces of repeated artifacts PR-URL: https://github.com/nodejs/node/pull/24429 Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- src/node_i18n.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index fda53cc6d4a5d6..d2a8c381820fa2 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -91,6 +91,7 @@ using v8::Int32; using v8::Isolate; using v8::Local; using v8::MaybeLocal; +using v8::NewStringType; using v8::Object; using v8::ObjectTemplate; using v8::String; @@ -257,7 +258,7 @@ class ConverterObject : public BaseObject, Converter { protected: ConverterObject(Environment* env, - v8::Local wrap, + Local wrap, UConverter* converter, bool ignoreBOM, const char* sub = nullptr) : @@ -506,7 +507,7 @@ void ICUErrorName(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), u_errorName(status), - v8::NewStringType::kNormal).ToLocalChecked()); + NewStringType::kNormal).ToLocalChecked()); } #define TYPE_ICU "icu" @@ -552,7 +553,7 @@ void GetVersion(const FunctionCallbackInfo& args) { TYPE_ICU "," TYPE_UNICODE "," TYPE_CLDR "," - TYPE_TZ, v8::NewStringType::kNormal).ToLocalChecked()); + TYPE_TZ, NewStringType::kNormal).ToLocalChecked()); } else { CHECK_GE(args.Length(), 1); CHECK(args[0]->IsString()); @@ -565,7 +566,7 @@ void GetVersion(const FunctionCallbackInfo& args) { // Success. args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), - versionString, v8::NewStringType::kNormal).ToLocalChecked()); + versionString, NewStringType::kNormal).ToLocalChecked()); } } } @@ -722,7 +723,7 @@ static void ToUnicode(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), *buf, - v8::NewStringType::kNormal, + NewStringType::kNormal, len).ToLocalChecked()); } @@ -745,7 +746,7 @@ static void ToASCII(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), *buf, - v8::NewStringType::kNormal, + NewStringType::kNormal, len).ToLocalChecked()); } From ed714a2e79537be5848a9f9f5bc581c451a41153 Mon Sep 17 00:00:00 2001 From: Mrityunjoy Saha Date: Sat, 17 Nov 2018 18:02:25 +0530 Subject: [PATCH 096/316] test: modify order of parameters for assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24430 Reviewed-By: Ruben Bridgewater Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-promises-unhandled-rejections.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 93ac186a3b45f6..fdbf17b9594656 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -634,8 +634,8 @@ asyncTest( const e = new Error('error'); const domainError = new Error('domain error'); onUnhandledSucceed(done, function(reason, promise) { - assert.strictEqual(e, reason); - assert.strictEqual(domainError, domainReceivedError); + assert.strictEqual(reason, e); + assert.strictEqual(domainReceivedError, domainError); }); Promise.reject(e); process.nextTick(function() { From f5e9bb1b3992d4dca1dc7f523dbe8ea1a412ee3c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 16 Nov 2018 15:51:07 -0800 Subject: [PATCH 097/316] http2: replace unreachable error with assertion "That particular `emit('error', ...)` is largely defensively coded and should not ever actually happen." Sounds like an assertion rather than an error event. The code in question has no test coverage because it is believed to be unreachable. Fixes: https://github.com/nodejs/node/issues/20673 PR-URL: https://github.com/nodejs/node/pull/24407 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- lib/internal/http2/compat.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 4622d97614a1bb..145e77410494b6 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -1,5 +1,6 @@ 'use strict'; +const assert = require('assert'); const Stream = require('stream'); const Readable = Stream.Readable; const binding = internalBinding('http2'); @@ -331,15 +332,12 @@ class Http2ServerRequest extends Readable { _read(nread) { const state = this[kState]; - if (!state.closed) { - if (!state.didRead) { - state.didRead = true; - this[kStream].on('data', onStreamData); - } else { - process.nextTick(resumeStream, this[kStream]); - } + assert(!state.closed); + if (!state.didRead) { + state.didRead = true; + this[kStream].on('data', onStreamData); } else { - this.emit('error', new ERR_HTTP2_INVALID_STREAM()); + process.nextTick(resumeStream, this[kStream]); } } From 33b524203b24c9b7ae96eaa91124324898817507 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 17 Nov 2018 05:30:06 +0800 Subject: [PATCH 098/316] test: use Worker scope in WPT Previously, we use the Window scope by default in our WPT test runner. When one of the test fails, the WPT harness would try to use document.getElementsByTagName() etc. to display the failure, which is not going to work for us. This patch switches the scope to DedicatedWorker and use our Worker implementation as a global - this does not test the Worker implementation per se, just tells the WPT harness to pass the results back to us via the callbacks we installed and not try to access a document. We may still need to use a Window scope when we try to run .window.js tests in the future, but for now we only run .any.js tests so it's fine to use a worker scope by default. PR-URL: https://github.com/nodejs/node/pull/24410 Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen --- test/common/wpt.js | 4 +++- test/wpt/test-whatwg-console.js | 2 +- test/wpt/test-whatwg-url.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/common/wpt.js b/test/common/wpt.js index 59dbe26d2abdcb..4f2f39c8e595d2 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -280,7 +280,9 @@ class WPTRunner { sandbox.self = sandbox; // TODO(joyeecheung): we are not a window - work with the upstream to // add a new scope for us. - sandbox.document = {}; // Pretend we are Window + + const { Worker } = require('worker_threads'); + sandbox.DedicatedWorker = Worker; // Pretend we are a Worker return context; } diff --git a/test/wpt/test-whatwg-console.js b/test/wpt/test-whatwg-console.js index 7b23fe8d3e619d..15fb80fc962a63 100644 --- a/test/wpt/test-whatwg-console.js +++ b/test/wpt/test-whatwg-console.js @@ -1,6 +1,6 @@ 'use strict'; -// Flags: --expose-internals +// Flags: --expose-internals --experimental-worker require('../common'); const { WPTRunner } = require('../common/wpt'); diff --git a/test/wpt/test-whatwg-url.js b/test/wpt/test-whatwg-url.js index 8734452940e84e..fbbea2453203c3 100644 --- a/test/wpt/test-whatwg-url.js +++ b/test/wpt/test-whatwg-url.js @@ -1,6 +1,6 @@ 'use strict'; -// Flags: --expose-internals +// Flags: --expose-internals --experimental-worker require('../common'); const { WPTRunner } = require('../common/wpt'); From b22e95d5ed3f214724ba1d8c5e37386ae7c37c7c Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 26 Oct 2018 17:53:04 -0700 Subject: [PATCH 099/316] readline: add support for async iteration Co-authored-by: Ivan Filenko Fixes: https://github.com/nodejs/node/issues/18603 Refs: https://github.com/nodejs/node/pull/18904 PR-URL: https://github.com/nodejs/node/pull/23916 Reviewed-By: Matteo Collina Reviewed-By: Gus Caplan --- doc/api/readline.md | 70 ++++++++++++++++- lib/readline.js | 43 ++++++++++ ...t-readline-async-iterators-backpressure.js | 48 ++++++++++++ .../test-readline-async-iterators-destroy.js | 78 +++++++++++++++++++ .../parallel/test-readline-async-iterators.js | 77 ++++++++++++++++++ tools/doc/type-parser.js | 2 +- 6 files changed, 315 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-readline-async-iterators-backpressure.js create mode 100644 test/parallel/test-readline-async-iterators-destroy.js create mode 100644 test/parallel/test-readline-async-iterators.js diff --git a/doc/api/readline.md b/doc/api/readline.md index 3d00e4ec64351d..17640ae1702619 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -309,6 +309,43 @@ rl.write(null, { ctrl: true, name: 'u' }); The `rl.write()` method will write the data to the `readline` `Interface`'s `input` *as if it were provided by the user*. +### rl\[Symbol.asyncIterator\]() + + +> Stability: 1 - Experimental + +* Returns: {AsyncIterator} + +Create an `AsyncIterator` object that iterates through each line in the input +stream as a string. This method allows asynchronous iteration of +`readline.Interface` objects through `for`-`await`-`of` loops. + +Errors in the input stream are not forwarded. + +If the loop is terminated with `break`, `throw`, or `return`, +[`rl.close()`][] will be called. In other words, iterating over a +`readline.Interface` will always consume the input stream fully. + +A caveat with using this experimental API is that the performance is +currently not on par with the traditional `'line'` event API, and thus it is +not recommended for performance-sensitive applications. We expect this +situation to improve in the future. + +```js +async function processLineByLine() { + const rl = readline.createInterface({ + // ... + }); + + for await (const line of rl) { + // Each line in the readline input will be successively available here as + // `line`. + } +} +``` + ## readline.clearLine(stream, dir) + +* {boolean} + +Is `true` if it is safe to call [`writable.write()`][]. + ##### writable.writableHighWaterMark + +* {boolean} + +Is `true` if it is safe to call [`readable.read()`][]. + ##### readable.readableHighWaterMark -* Returns: {number} +* {number} Returns the value of `highWaterMark` passed when constructing this `Readable`. @@ -1028,7 +1046,7 @@ Returns the value of `highWaterMark` passed when constructing this added: v9.4.0 --> -* Returns: {number} +* {number} This property contains the number of bytes (or objects) in the queue ready to be read. The value provides introspection data regarding From 230eb0dde93e05e97d441a5f84712596963f70c5 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 19 Nov 2018 22:21:04 -0500 Subject: [PATCH 121/316] deps: update llhttp to 1.0.1 Fix callback error reporting PR-URL: https://github.com/nodejs/node/pull/24508 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- deps/llhttp/include/llhttp.h | 2 +- deps/llhttp/src/llhttp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/llhttp/include/llhttp.h b/deps/llhttp/include/llhttp.h index c114d11ffa9353..26aa46e1e78a4b 100644 --- a/deps/llhttp/include/llhttp.h +++ b/deps/llhttp/include/llhttp.h @@ -3,7 +3,7 @@ #define LLHTTP_VERSION_MAJOR 1 #define LLHTTP_VERSION_MINOR 0 -#define LLHTTP_VERSION_PATCH 0 +#define LLHTTP_VERSION_PATCH 1 #ifndef INCLUDE_LLHTTP_ITSELF_H_ #define INCLUDE_LLHTTP_ITSELF_H_ diff --git a/deps/llhttp/src/llhttp.c b/deps/llhttp/src/llhttp.c index cb12c8dfd0f182..7db9b2fdc107f0 100644 --- a/deps/llhttp/src/llhttp.c +++ b/deps/llhttp/src/llhttp.c @@ -6037,6 +6037,7 @@ int llhttp__internal_execute(llhttp__internal_t* state, const char* p, const cha if (error != 0) { state->error = error; state->error_pos = endp; + return error; } } From 7463a7f5cfbc1a9fd677384cbd0ace90d846ed8b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 21 Nov 2018 11:00:52 -0800 Subject: [PATCH 122/316] doc: revise `author ready` explanation Improve the `author ready` text in the COLLABORATOR_GUIDE for scannability, readability, etc. PR-URL: https://github.com/nodejs/node/pull/24558 Reviewed-By: Richard Lau Reviewed-By: Vse Mozhet Byt --- COLLABORATOR_GUIDE.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 4d0be355d5881d..9e4b72ea2e0724 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -69,12 +69,15 @@ issues and pull requests can always be re-opened if necessary. ### Author ready pull requests -A pull request that is still awaiting the minimum review time is considered -_author ready_ as soon as the CI has been started, it has at least two approvals -(one Collaborator approval is enough if the pull request has been open for more -than 7 days), and it has no outstanding review comments. Please always make sure -to add the `author ready` label to the PR in that case and remove it again as -soon as that condition is not met anymore. +A pull request is _author ready_ when: + +* There is a CI run in progress or completed. +* There are at least two Collaborator approvals, or at least one approval if the + pull request is older than 7 days. +* There are no outstanding review comments. + +Please always add the `author ready` label to the PR in that case. Please always +remove it again as soon as the conditions are not met anymore. ### Handling own pull requests From e37c6182e556b415877c69be8bd910255f064d10 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 26 Aug 2018 22:24:22 +0200 Subject: [PATCH 123/316] build: fix Python detection when depot_tools are in PATH in Windows PR-URL: https://github.com/nodejs/node/pull/22539 Reviewed-By: Bartosz Sosnowski Reviewed-By: Refael Ackermann --- tools/msvs/find_python.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 1692ec1c30ad7e..c918be052711fc 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -2,7 +2,7 @@ echo Looking for Python 2.x SETLOCAL :: If python.exe is in %Path%, just validate -FOR /F "delims=" %%a IN ('where python 2^> NUL') DO ( +FOR /F "delims=" %%a IN ('where python.exe 2^> NUL') DO ( SET need_path=0 SET p=%%~dpa IF NOT ERRORLEVEL 1 GOTO :validate From b9bd4e9d0958e2d28289e3d6e8ec1689a9092aa6 Mon Sep 17 00:00:00 2001 From: Gary Hsu Date: Wed, 21 Nov 2018 10:53:22 -0800 Subject: [PATCH 124/316] src: add include for standalone compile - Include algorithm header in js_native_api_v8.cc since std::min requires it. - Add comments to js_native_api_v8_internals.h for NAPI_VERSION PR-URL: https://github.com/nodejs/node/pull/24498 Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Gabriel Schulhof Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- src/js_native_api_v8.cc | 1 + src/js_native_api_v8_internals.h | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index b28376afb7cedd..144cfad8e438b2 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -1,5 +1,6 @@ #include // INT_MAX #include +#include #define NAPI_EXPERIMENTAL #include "js_native_api_v8.h" #include "js_native_api.h" diff --git a/src/js_native_api_v8_internals.h b/src/js_native_api_v8_internals.h index 91baae6a3b8201..dcdc62297f6f59 100644 --- a/src/js_native_api_v8_internals.h +++ b/src/js_native_api_v8_internals.h @@ -4,11 +4,14 @@ // The V8 implementation of N-API, including `js_native_api_v8.h` uses certain // idioms which require definition here. For example, it uses a variant of // persistent references which need not be reset in the constructor. It is the -// responsibility of this file to define these idioms. +// responsibility of this file to define these idioms. Optionally, this file +// may also define `NAPI_VERSION` and set it to the version of N-API to be +// exposed. // In the case of the Node.js implementation of N-API some of the idioms are // imported directly from Node.js by including `node_internals.h` below. Others -// are bridged to remove references to the `node` namespace. +// are bridged to remove references to the `node` namespace. `node_version.h`, +// included below, defines `NAPI_VERSION`. #include "node_version.h" #include "env.h" From 2245e5e484711cfafd00eac6a1f9c5db846c64c8 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 22 Nov 2018 00:38:05 +0200 Subject: [PATCH 125/316] doc,meta: update PR approving info Refs: https://github.com/nodejs/node/pull/22255 PR-URL: https://github.com/nodejs/node/pull/24561 Reviewed-By: Rich Trott Reviewed-By: Anatoli Papirovski --- doc/guides/contributing/pull-requests.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index ea28001b6957d3..959d388de1d0c7 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -347,7 +347,8 @@ unhelpful is likely safe to ignore. ### Step 10: Landing In order to land, a Pull Request needs to be reviewed and [approved][] by -at least one Node.js Collaborator and pass a +at least two Node.js Collaborators (one Collaborator approval is enough if the +pull request has been open for more than 7 days) and pass a [CI (Continuous Integration) test run][]. After that, as long as there are no objections from other contributors, the Pull Request can be merged. If you find your Pull Request waiting longer than you expect, see the From dbf14ce17b9b93a1c02719754bdce4a72fe22d67 Mon Sep 17 00:00:00 2001 From: Sarath Govind K K Date: Mon, 19 Nov 2018 11:07:23 +0530 Subject: [PATCH 126/316] test: replcae anonymous closure with arrow function PR-URL: https://github.com/nodejs/node/pull/24476 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani --- test/known_issues/test-http-path-contains-unicode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/known_issues/test-http-path-contains-unicode.js b/test/known_issues/test-http-path-contains-unicode.js index a51b07210214b9..d899fab07c43bb 100644 --- a/test/known_issues/test-http-path-contains-unicode.js +++ b/test/known_issues/test-http-path-contains-unicode.js @@ -23,9 +23,9 @@ const server = http.createServer(common.mustCall(function(req, res) { })); -server.listen(0, function() { +server.listen(0, () => { http.request({ - port: this.address().port, + port: server.address().port, path: expected, method: 'GET' }, common.mustCall(function(res) { From 4da44ada88c733a94e6fa45961a7b426dae3bb76 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Sun, 18 Nov 2018 12:27:43 -0500 Subject: [PATCH 127/316] doc: clarify who may land on an LTS staging branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current language is a bit confusing PR-URL: https://github.com/nodejs/node/pull/24465 Refs: https://github.com/nodejs/node/pull/24344#issuecomment-439658596 Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Gus Caplan Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Michael Dawson Reviewed-By: Trivikram Kamat Reviewed-By: Matteo Collina --- COLLABORATOR_GUIDE.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 9e4b72ea2e0724..0be47023ea7263 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -803,9 +803,8 @@ pulled from the staging branch into the LTS branch only when a release is being prepared and may be pulled into the LTS branch in a different order than they were landed in staging. -Any Collaborator may land commits into a staging branch, but only the release -team should land commits into the LTS branch while preparing a new -LTS release. +Only the members of the @nodejs/backporters team should land commits onto +LTS staging branches. #### How can I help? From c4f16ddccdc90e654c6f466c49746f4e8ad0d3c6 Mon Sep 17 00:00:00 2001 From: sreepurnajasti Date: Mon, 19 Nov 2018 19:20:11 +0530 Subject: [PATCH 128/316] test: replace callback with arrow functions PR-URL: https://github.com/nodejs/node/pull/24490 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Ruben Bridgewater --- test/pummel/test-keep-alive.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index b62d731c7b4006..0fec1ff877b89b 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -32,7 +32,7 @@ const http = require('http'); const url = require('url'); const body = 'hello world\n'; -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Length': body.length, 'Content-Type': 'text/plain' @@ -45,7 +45,7 @@ let keepAliveReqSec = 0; let normalReqSec = 0; -function runAb(opts, callback) { +const runAb = (opts, callback) => { const args = [ '-c', opts.concurrent || 100, '-t', opts.threads || 2, @@ -66,11 +66,9 @@ function runAb(opts, callback) { let stdout; - child.stdout.on('data', function(data) { - stdout += data; - }); + child.stdout.on('data', (data) => stdout += data); - child.on('close', function(code, signal) { + child.on('close', (code, signal) => { if (code) { console.error(code, signal); process.exit(code); @@ -90,20 +88,20 @@ function runAb(opts, callback) { callback(reqSec, keepAliveRequests); }); -} +}; server.listen(common.PORT, () => { runAb({ keepalive: true }, (reqSec) => { keepAliveReqSec = reqSec; - runAb({ keepalive: false }, function(reqSec) { + runAb({ keepalive: false }, (reqSec) => { normalReqSec = reqSec; server.close(); }); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual( normalReqSec > 50, true, From b309dd2be3c70520561dce3895a84c327c494033 Mon Sep 17 00:00:00 2001 From: suman-mitra Date: Mon, 19 Nov 2018 00:58:49 -0800 Subject: [PATCH 129/316] test: replace anonymous closure with arrow func PR-URL: https://github.com/nodejs/node/pull/24480 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-stream2-unpipe-drain.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index 582ab61b06fb96..ac2a3a5b062c9d 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -51,13 +51,13 @@ const src2 = new TestReader(); src1.pipe(dest); -src1.once('readable', function() { - process.nextTick(function() { +src1.once('readable', () => { + process.nextTick(() => { src2.pipe(dest); - src2.once('readable', function() { - process.nextTick(function() { + src2.once('readable', () => { + process.nextTick(() => { src1.unpipe(dest); }); @@ -66,7 +66,7 @@ src1.once('readable', function() { }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(src1.reads, 2); assert.strictEqual(src2.reads, 2); }); From 1cd73a81fae757563e28167442da4669e102a903 Mon Sep 17 00:00:00 2001 From: NoSkillGirl Date: Wed, 21 Nov 2018 05:14:49 +0530 Subject: [PATCH 130/316] test: using arrow functions - Using arrow functions in test-tls-client-resume.js - Fixed error, Expected parentheses around arrow function argument arrow-parens PR-URL: https://github.com/nodejs/node/pull/24436 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/parallel/test-tls-client-resume.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index 296df88e9f9152..db4c898d746790 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -38,7 +38,7 @@ const options = { }; // create server -const server = tls.Server(options, common.mustCall(function(socket) { +const server = tls.Server(options, common.mustCall((socket) => { socket.end('Goodbye'); }, 2)); @@ -49,13 +49,13 @@ server.listen(0, function() { const client1 = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, function() { + }, () => { console.log('connect1'); assert.ok(!client1.isSessionReused(), 'Session *should not* be reused.'); session1 = client1.getSession(); }); - client1.on('close', function() { + client1.on('close', () => { console.log('close1'); const opts = { @@ -64,12 +64,12 @@ server.listen(0, function() { session: session1 }; - const client2 = tls.connect(opts, function() { + const client2 = tls.connect(opts, () => { console.log('connect2'); assert.ok(client2.isSessionReused(), 'Session *should* be reused.'); }); - client2.on('close', function() { + client2.on('close', () => { console.log('close2'); server.close(); }); From c28ec86c90eaaf547036945faff344bab375aef3 Mon Sep 17 00:00:00 2001 From: Maya Anilson Date: Sat, 17 Nov 2018 17:59:15 +0530 Subject: [PATCH 131/316] test: replace closure with arrow function PR-URL: https://github.com/nodejs/node/pull/24489 Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/pummel/test-net-timeout.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js index e87cdc0b8edf51..524322440a1ea6 100644 --- a/test/pummel/test-net-timeout.js +++ b/test/pummel/test-net-timeout.js @@ -29,46 +29,46 @@ let starttime = null; let timeouttime = null; const timeout = 1000; -const echo_server = net.createServer(function(socket) { +const echo_server = net.createServer((socket) => { socket.setTimeout(timeout); - socket.on('timeout', function() { + socket.on('timeout', () => { console.log('server timeout'); timeouttime = new Date(); console.dir(timeouttime); socket.destroy(); }); - socket.on('error', function(e) { + socket.on('error', (e) => { throw new Error( 'Server side socket should not get error. We disconnect willingly.'); }); - socket.on('data', function(d) { + socket.on('data', (d) => { console.log(d); socket.write(d); }); - socket.on('end', function() { + socket.on('end', () => { socket.end(); }); }); -echo_server.listen(common.PORT, function() { +echo_server.listen(common.PORT, () => { console.log(`server listening at ${common.PORT}`); const client = net.createConnection(common.PORT); client.setEncoding('UTF8'); client.setTimeout(0); // disable the timeout for client - client.on('connect', function() { + client.on('connect', () => { console.log('client connected.'); client.write('hello\r\n'); }); - client.on('data', function(chunk) { + client.on('data', (chunk) => { assert.strictEqual(chunk, 'hello\r\n'); if (exchanges++ < 5) { - setTimeout(function() { + setTimeout(() => { console.log('client write "hello"'); client.write('hello\r\n'); }, 500); @@ -81,22 +81,22 @@ echo_server.listen(common.PORT, function() { } }); - client.on('timeout', function() { + client.on('timeout', () => { throw new Error("client timeout - this shouldn't happen"); }); - client.on('end', function() { + client.on('end', () => { console.log('client end'); client.end(); }); - client.on('close', function() { + client.on('close', () => { console.log('client disconnect'); echo_server.close(); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.ok(starttime != null); assert.ok(timeouttime != null); From 46b5df0f1fd9a7311c72b4ea27c55790f251158c Mon Sep 17 00:00:00 2001 From: sagirk Date: Mon, 19 Nov 2018 14:50:15 +0530 Subject: [PATCH 132/316] test: refactor test to use arrow functions In `test/parallel/test-cluster-send-deadlock.js`, callbacks use anonymous closure functions. It is safe to replace them with arrow functions since these callbacks don't contain references to `this`, `super` or `arguments`. This results in shorter functions. PR-URL: https://github.com/nodejs/node/pull/24479 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-cluster-send-deadlock.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index b02837e7fb1793..b34eb892adb464 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -30,31 +30,31 @@ const net = require('net'); if (cluster.isMaster) { const worker = cluster.fork(); - worker.on('exit', function(code, signal) { + worker.on('exit', (code, signal) => { assert.strictEqual(code, 0, `Worker exited with an error code: ${code}`); assert(!signal, `Worker exited by a signal: ${signal}`); server.close(); }); - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { worker.send('handle', socket); }); - server.listen(0, function() { + server.listen(0, () => { worker.send({ message: 'listen', port: server.address().port }); }); } else { - process.on('message', function(msg, handle) { + process.on('message', (msg, handle) => { if (msg.message && msg.message === 'listen') { assert(msg.port); const client1 = net.connect({ host: 'localhost', port: msg.port - }, function() { + }, () => { const client2 = net.connect({ host: 'localhost', port: msg.port - }, function() { + }, () => { client1.on('close', onclose); client2.on('close', onclose); client1.end(); @@ -62,10 +62,10 @@ if (cluster.isMaster) { }); }); let waiting = 2; - function onclose() { + const onclose = () => { if (--waiting === 0) cluster.worker.disconnect(); - } + }; } else { process.send('reply', handle); } From 8fcf3b3c59deb2a96ce8d0fceb8b9a79df770d64 Mon Sep 17 00:00:00 2001 From: Dan Foley Date: Tue, 20 Nov 2018 20:07:16 -0800 Subject: [PATCH 133/316] test: remove unused reject handlers PR-URL: https://github.com/nodejs/node/pull/24540 Reviewed-By: Rich Trott Reviewed-By: Anatoli Papirovski --- test/common/inspector-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 7cac2b29f9c90c..75b87e9cf91372 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -416,7 +416,7 @@ class NodeInstance extends EventEmitter { async connectInspectorSession() { console.log('[test]', 'Connecting to a child Node process'); const upgradeRequest = await this.sendUpgradeRequest(); - return new Promise((resolve, reject) => { + return new Promise((resolve) => { upgradeRequest .on('upgrade', (message, socket) => resolve(new InspectorSession(socket, this))) @@ -427,7 +427,7 @@ class NodeInstance extends EventEmitter { async expectConnectionDeclined() { console.log('[test]', 'Checking upgrade is not possible'); const upgradeRequest = await this.sendUpgradeRequest(); - return new Promise((resolve, reject) => { + return new Promise((resolve) => { upgradeRequest .on('upgrade', common.mustNotCall('Upgrade was received')) .on('response', (response) => From a1254a3e9004b46278a68de3ef932d8b857d3c36 Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Sun, 21 Oct 2018 15:59:38 +0800 Subject: [PATCH 134/316] net,dgram: add ipv6Only option for net and dgram For TCP servers, the dual-stack support is enable by default, i.e. binding host "::" will also make "0.0.0.0" bound. This commit add ipv6Only option in `net.Server.listen()` and `dgram.createSocket()` methods which allows to disable dual-stack support. Support for cluster module is also provided in this commit. Fixes: https://github.com/nodejs/node/issues/17664 PR-URL: https://github.com/nodejs/node/pull/23798 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- doc/api/dgram.md | 6 ++ doc/api/net.md | 7 +++ lib/dgram.js | 9 ++- lib/internal/cluster/round_robin_handle.js | 14 +++-- lib/internal/cluster/shared_handle.js | 2 +- lib/net.js | 35 ++++++----- src/tcp_wrap.cc | 5 +- src/udp_wrap.cc | 6 ++ test/parallel/test-cluster-dgram-ipv6only.js | 51 ++++++++++++++++ .../test-cluster-net-listen-ipv6only-false.js | 55 ++++++++++++++++++ .../test-cluster-net-listen-ipv6only-none.js | 58 +++++++++++++++++++ .../test-cluster-net-listen-ipv6only-rr.js | 58 +++++++++++++++++++ test/parallel/test-dgram-ipv6only.js | 33 +++++++++++ test/parallel/test-net-listen-ipv6only.js | 30 ++++++++++ 14 files changed, 347 insertions(+), 22 deletions(-) create mode 100644 test/parallel/test-cluster-dgram-ipv6only.js create mode 100644 test/parallel/test-cluster-net-listen-ipv6only-false.js create mode 100644 test/parallel/test-cluster-net-listen-ipv6only-none.js create mode 100644 test/parallel/test-cluster-net-listen-ipv6only-rr.js create mode 100644 test/parallel/test-dgram-ipv6only.js create mode 100644 test/parallel/test-net-listen-ipv6only.js diff --git a/doc/api/dgram.md b/doc/api/dgram.md index e263627723a879..31abaf450c595b 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -601,6 +601,9 @@ changes: pr-url: https://github.com/nodejs/node/pull/13623 description: The `recvBufferSize` and `sendBufferSize` options are supported now. + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/23798 + description: The `ipv6Only` option is supported. --> * `options` {Object} Available options are: @@ -609,6 +612,9 @@ changes: * `reuseAddr` {boolean} When `true` [`socket.bind()`][] will reuse the address, even if another process has already bound a socket on it. **Default:** `false`. + * `ipv6Only` {boolean} Setting `ipv6Only` to `true` will + disable dual-stack support, i.e., binding to address `::` won't make + `0.0.0.0` be bound. **Default:** `false`. * `recvBufferSize` {number} - Sets the `SO_RCVBUF` socket value. * `sendBufferSize` {number} - Sets the `SO_SNDBUF` socket value. * `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][]. diff --git a/doc/api/net.md b/doc/api/net.md index b925245e7a338b..35fb0a6171382e 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -252,6 +252,10 @@ Listening on a file descriptor is not supported on Windows. #### server.listen(options[, callback]) * `options` {Object} Required. Supports the following properties: @@ -266,6 +270,9 @@ added: v0.11.14 for all users. **Default:** `false` * `writableAll` {boolean} For IPC servers makes the pipe writable for all users. **Default:** `false` + * `ipv6Only` {boolean} For TCP servers, setting `ipv6Only` to `true` will + disable dual-stack support, i.e., binding to host `::` won't make + `0.0.0.0` be bound. **Default:** `false`. * `callback` {Function} Common parameter of [`server.listen()`][] functions. * Returns: {net.Server} diff --git a/lib/dgram.js b/lib/dgram.js index 549b6dd738d0fe..55662313d640cd 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -54,7 +54,11 @@ const { } = require('internal/async_hooks'); const { UV_UDP_REUSEADDR } = internalBinding('constants').os; -const { UDP, SendWrap } = internalBinding('udp_wrap'); +const { + constants: { UV_UDP_IPV6ONLY }, + UDP, + SendWrap +} = internalBinding('udp_wrap'); const BIND_STATE_UNBOUND = 0; const BIND_STATE_BINDING = 1; @@ -99,6 +103,7 @@ function Socket(type, listener) { bindState: BIND_STATE_UNBOUND, queue: undefined, reuseAddr: options && options.reuseAddr, // Use UV_UDP_REUSEADDR if true. + ipv6Only: options && options.ipv6Only, recvBufferSize, sendBufferSize }; @@ -270,6 +275,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { var flags = 0; if (state.reuseAddr) flags |= UV_UDP_REUSEADDR; + if (state.ipv6Only) + flags |= UV_UDP_IPV6ONLY; if (cluster.isWorker && !exclusive) { bindServerHandle(this, { diff --git a/lib/internal/cluster/round_robin_handle.js b/lib/internal/cluster/round_robin_handle.js index 6b2bc372545cd9..95f33ad1d09907 100644 --- a/lib/internal/cluster/round_robin_handle.js +++ b/lib/internal/cluster/round_robin_handle.js @@ -3,10 +3,11 @@ const assert = require('assert'); const net = require('net'); const { sendHelper } = require('internal/cluster/utils'); const uv = internalBinding('uv'); +const { constants } = internalBinding('tcp_wrap'); module.exports = RoundRobinHandle; -function RoundRobinHandle(key, address, port, addressType, fd) { +function RoundRobinHandle(key, address, port, addressType, fd, flags) { this.key = key; this.all = new Map(); this.free = []; @@ -16,9 +17,14 @@ function RoundRobinHandle(key, address, port, addressType, fd) { if (fd >= 0) this.server.listen({ fd }); - else if (port >= 0) - this.server.listen(port, address); - else + else if (port >= 0) { + this.server.listen({ + port, + host: address, + // Currently, net module only supports `ipv6Only` option in `flags`. + ipv6Only: Boolean(flags & constants.UV_TCP_IPV6ONLY), + }); + } else this.server.listen(address); // UNIX socket path. this.server.once('listening', () => { diff --git a/lib/internal/cluster/shared_handle.js b/lib/internal/cluster/shared_handle.js index 0bb8c44f5d630b..0b5f1531931b6c 100644 --- a/lib/internal/cluster/shared_handle.js +++ b/lib/internal/cluster/shared_handle.js @@ -15,7 +15,7 @@ function SharedHandle(key, address, port, addressType, fd, flags) { if (addressType === 'udp4' || addressType === 'udp6') rval = dgram._createSocketHandle(address, port, addressType, fd, flags); else - rval = net._createServerHandle(address, port, addressType, fd); + rval = net._createServerHandle(address, port, addressType, fd, flags); if (typeof rval === 'number') this.errno = rval; diff --git a/lib/net.js b/lib/net.js index a1471ef2f25c6c..1d02231701fba2 100644 --- a/lib/net.js +++ b/lib/net.js @@ -97,6 +97,10 @@ const { function noop() {} +function getFlags(ipv6Only) { + return ipv6Only === true ? TCPConstants.UV_TCP_IPV6ONLY : 0; +} + function createHandle(fd, is_server) { validateInt32(fd, 'fd', 0); const type = TTYWrap.guessHandleType(fd); @@ -798,7 +802,7 @@ function checkBindError(err, port, handle) { function internalConnect( - self, address, port, addressType, localAddress, localPort) { + self, address, port, addressType, localAddress, localPort, flags) { // TODO return promise from Socket.prototype.connect which // wraps _connectReq. @@ -812,7 +816,7 @@ function internalConnect( err = self._handle.bind(localAddress, localPort); } else { // addressType === 6 localAddress = localAddress || '::'; - err = self._handle.bind6(localAddress, localPort); + err = self._handle.bind6(localAddress, localPort, flags); } debug('binding to localAddress: %s and localPort: %d (addressType: %d)', localAddress, localPort, addressType); @@ -1148,7 +1152,7 @@ util.inherits(Server, EventEmitter); function toNumber(x) { return (x = Number(x)) >= 0 ? x : false; } // Returns handle if it can be created, or error code if it can't -function createServerHandle(address, port, addressType, fd) { +function createServerHandle(address, port, addressType, fd, flags) { var err = 0; // assign handle in listen, and clean up if bind or listen fails var handle; @@ -1187,14 +1191,14 @@ function createServerHandle(address, port, addressType, fd) { debug('bind to', address || 'any'); if (!address) { // Try binding to ipv6 first - err = handle.bind6('::', port); + err = handle.bind6('::', port, flags); if (err) { handle.close(); // Fallback to ipv4 return createServerHandle('0.0.0.0', port); } } else if (addressType === 6) { - err = handle.bind6(address, port); + err = handle.bind6(address, port, flags); } else { err = handle.bind(address, port); } @@ -1208,7 +1212,7 @@ function createServerHandle(address, port, addressType, fd) { return handle; } -function setupListenHandle(address, port, addressType, backlog, fd) { +function setupListenHandle(address, port, addressType, backlog, fd, flags) { debug('setupListenHandle', address, port, addressType, backlog, fd); // If there is not yet a handle, we need to create one and bind. @@ -1222,7 +1226,7 @@ function setupListenHandle(address, port, addressType, backlog, fd) { // Try to bind to the unspecified IPv6 address, see if IPv6 is available if (!address && typeof fd !== 'number') { - rval = createServerHandle('::', port, 6, fd); + rval = createServerHandle('::', port, 6, fd, flags); if (typeof rval === 'number') { rval = null; @@ -1235,7 +1239,7 @@ function setupListenHandle(address, port, addressType, backlog, fd) { } if (rval === null) - rval = createServerHandle(address, port, addressType, fd); + rval = createServerHandle(address, port, addressType, fd, flags); if (typeof rval === 'number') { var error = uvExceptionWithHostPort(rval, 'listen', address, port); @@ -1294,7 +1298,7 @@ function emitListeningNT(self) { function listenInCluster(server, address, port, addressType, - backlog, fd, exclusive) { + backlog, fd, exclusive, flags) { exclusive = !!exclusive; if (cluster === undefined) cluster = require('cluster'); @@ -1303,7 +1307,7 @@ function listenInCluster(server, address, port, addressType, // Will create a new handle // _listen2 sets up the listened handle, it is still named like this // to avoid breaking code that wraps this method - server._listen2(address, port, addressType, backlog, fd); + server._listen2(address, port, addressType, backlog, fd, flags); return; } @@ -1312,7 +1316,7 @@ function listenInCluster(server, address, port, addressType, port: port, addressType: addressType, fd: fd, - flags: 0 + flags, }; // Get the master's server handle, and listen on it @@ -1330,7 +1334,7 @@ function listenInCluster(server, address, port, addressType, server._handle = handle; // _listen2 sets up the listened handle, it is still named like this // to avoid breaking code that wraps this method - server._listen2(address, port, addressType, backlog, fd); + server._listen2(address, port, addressType, backlog, fd, flags); } } @@ -1353,6 +1357,7 @@ Server.prototype.listen = function(...args) { toNumber(args.length > 2 && args[2]); // (port, host, backlog) options = options._handle || options.handle || options; + const flags = getFlags(options.ipv6Only); // (handle[, backlog][, cb]) where handle is an object with a handle if (options instanceof TCP) { this._handle = options; @@ -1387,7 +1392,7 @@ Server.prototype.listen = function(...args) { // start TCP server listening on host:port if (options.host) { lookupAndListen(this, options.port | 0, options.host, backlog, - options.exclusive); + options.exclusive, flags); } else { // Undefined host, listens on unspecified address // Default addressType 4 will be used to search for master server listenInCluster(this, null, options.port | 0, 4, @@ -1434,7 +1439,7 @@ Server.prototype.listen = function(...args) { throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options)); }; -function lookupAndListen(self, port, address, backlog, exclusive) { +function lookupAndListen(self, port, address, backlog, exclusive, flags) { if (dns === undefined) dns = require('dns'); dns.lookup(address, function doListen(err, ip, addressType) { if (err) { @@ -1442,7 +1447,7 @@ function lookupAndListen(self, port, address, backlog, exclusive) { } else { addressType = ip ? addressType : 4; listenInCluster(self, ip, port, addressType, - backlog, undefined, exclusive); + backlog, undefined, exclusive, flags); } }); } diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index e1316b42cd206b..504fda3de6cf95 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -127,6 +127,7 @@ void TCPWrap::Initialize(Local target, Local constants = Object::New(env->isolate()); NODE_DEFINE_CONSTANT(constants, SOCKET); NODE_DEFINE_CONSTANT(constants, SERVER); + NODE_DEFINE_CONSTANT(constants, UV_TCP_IPV6ONLY); target->Set(context, env->constants_string(), constants).FromJust(); @@ -252,13 +253,15 @@ void TCPWrap::Bind6(const FunctionCallbackInfo& args) { Environment* env = wrap->env(); node::Utf8Value ip6_address(env->isolate(), args[0]); int port; + unsigned int flags; if (!args[1]->Int32Value(env->context()).To(&port)) return; + if (!args[2]->Uint32Value(env->context()).To(&flags)) return; sockaddr_in6 addr; int err = uv_ip6_addr(*ip6_address, port, &addr); if (err == 0) { err = uv_tcp_bind(&wrap->handle_, reinterpret_cast(&addr), - 0); + flags); } args.GetReturnValue().Set(err); } diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 4c7072f2a2b981..b4c859e5947b80 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -149,6 +149,12 @@ void UDPWrap::Initialize(Local target, target->Set(env->context(), sendWrapString, swt->GetFunction(env->context()).ToLocalChecked()).FromJust(); + + Local constants = Object::New(env->isolate()); + NODE_DEFINE_CONSTANT(constants, UV_UDP_IPV6ONLY); + target->Set(context, + env->constants_string(), + constants).FromJust(); } diff --git a/test/parallel/test-cluster-dgram-ipv6only.js b/test/parallel/test-cluster-dgram-ipv6only.js new file mode 100644 index 00000000000000..0906baec929d21 --- /dev/null +++ b/test/parallel/test-cluster-dgram-ipv6only.js @@ -0,0 +1,51 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + +const assert = require('assert'); +const cluster = require('cluster'); +const dgram = require('dgram'); + +// This test ensures that the `ipv6Only` option in `dgram.createSock()` +// works as expected. +if (cluster.isMaster) { + cluster.fork().on('exit', common.mustCall((code) => { + assert.strictEqual(code, 0); + })); +} else { + let waiting = 2; + function close() { + if (--waiting === 0) + cluster.worker.disconnect(); + } + + const socket1 = dgram.createSocket({ + type: 'udp6', + ipv6Only: true + }); + const socket2 = dgram.createSocket({ + type: 'udp4', + }); + socket1.on('error', common.mustNotCall()); + socket2.on('error', common.mustNotCall()); + + socket1.bind({ + port: 0, + address: '::', + }, common.mustCall(() => { + const { port } = socket1.address(); + socket2.bind({ + port, + address: '0.0.0.0', + }, common.mustCall(() => { + process.nextTick(() => { + socket1.close(close); + socket2.close(close); + }); + })); + })); +} diff --git a/test/parallel/test-cluster-net-listen-ipv6only-false.js b/test/parallel/test-cluster-net-listen-ipv6only-false.js new file mode 100644 index 00000000000000..4d495d8faf6ddc --- /dev/null +++ b/test/parallel/test-cluster-net-listen-ipv6only-false.js @@ -0,0 +1,55 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); +const Countdown = require('../common/countdown'); + +// This test ensures that dual-stack support still works for cluster module +// when `ipv6Only` is not `true`. +const host = '::'; +const WORKER_COUNT = 3; + +if (cluster.isMaster) { + const workers = new Map(); + let address; + + const countdown = new Countdown(WORKER_COUNT, () => { + const socket = net.connect({ + port: address.port, + host: '0.0.0.0', + }, common.mustCall(() => { + socket.destroy(); + workers.forEach((worker) => { + worker.disconnect(); + }); + })); + socket.on('error', common.mustNotCall()); + }); + + for (let i = 0; i < WORKER_COUNT; i += 1) { + const worker = cluster.fork().on('exit', common.mustCall((statusCode) => { + assert.strictEqual(statusCode, 0); + })).on('listening', common.mustCall((workerAddress) => { + if (!address) { + address = workerAddress; + } else { + assert.strictEqual(address.addressType, workerAddress.addressType); + assert.strictEqual(address.host, workerAddress.host); + assert.strictEqual(address.port, workerAddress.port); + } + countdown.dec(); + })); + + workers.set(i, worker); + } +} else { + net.createServer().listen({ + host, + port: 0, + }, common.mustCall()); +} diff --git a/test/parallel/test-cluster-net-listen-ipv6only-none.js b/test/parallel/test-cluster-net-listen-ipv6only-none.js new file mode 100644 index 00000000000000..401afbc035e36a --- /dev/null +++ b/test/parallel/test-cluster-net-listen-ipv6only-none.js @@ -0,0 +1,58 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); +const Countdown = require('../common/countdown'); + +// This test ensures that the `ipv6Only` option in `net.Server.listen()` +// works as expected when we use cluster with `SCHED_NONE` schedulingPolicy. +cluster.schedulingPolicy = cluster.SCHED_NONE; +const host = '::'; +const WORKER_ACCOUNT = 3; + +if (cluster.isMaster) { + const workers = new Map(); + let address; + + const countdown = new Countdown(WORKER_ACCOUNT, () => { + // Make sure the `ipv6Only` option works. + const server = net.createServer().listen({ + host: '0.0.0.0', + port: address.port, + }, common.mustCall(() => { + // Exit. + server.close(); + workers.forEach((worker) => { + worker.disconnect(); + }); + })); + }); + + for (let i = 0; i < WORKER_ACCOUNT; i += 1) { + const worker = cluster.fork().on('exit', common.mustCall((statusCode) => { + assert.strictEqual(statusCode, 0); + })).on('listening', common.mustCall((workerAddress) => { + if (!address) { + address = workerAddress; + } else { + assert.strictEqual(address.addressType, workerAddress.addressType); + assert.strictEqual(address.host, workerAddress.host); + assert.strictEqual(address.port, workerAddress.port); + } + countdown.dec(); + })); + + workers.set(i, worker); + } +} else { + net.createServer().listen({ + host, + port: 0, + ipv6Only: true, + }, common.mustCall()); +} diff --git a/test/parallel/test-cluster-net-listen-ipv6only-rr.js b/test/parallel/test-cluster-net-listen-ipv6only-rr.js new file mode 100644 index 00000000000000..de254a4fe9ecd9 --- /dev/null +++ b/test/parallel/test-cluster-net-listen-ipv6only-rr.js @@ -0,0 +1,58 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); +const Countdown = require('../common/countdown'); + +// This test ensures that the `ipv6Only` option in `net.Server.listen()` +// works as expected when we use cluster with `SCHED_RR` schedulingPolicy. +cluster.schedulingPolicy = cluster.SCHED_RR; +const host = '::'; +const WORKER_ACCOUNT = 3; + +if (cluster.isMaster) { + const workers = new Map(); + let address; + + const countdown = new Countdown(WORKER_ACCOUNT, () => { + // Make sure the `ipv6Only` option works. + const server = net.createServer().listen({ + host: '0.0.0.0', + port: address.port, + }, common.mustCall(() => { + // Exit. + server.close(); + workers.forEach((worker) => { + worker.disconnect(); + }); + })); + }); + + for (let i = 0; i < WORKER_ACCOUNT; i += 1) { + const worker = cluster.fork().on('exit', common.mustCall((statusCode) => { + assert.strictEqual(statusCode, 0); + })).on('listening', common.mustCall((workerAddress) => { + if (!address) { + address = workerAddress; + } else { + assert.strictEqual(address.addressType, workerAddress.addressType); + assert.strictEqual(address.host, workerAddress.host); + assert.strictEqual(address.port, workerAddress.port); + } + countdown.dec(); + })); + + workers.set(i, worker); + } +} else { + net.createServer().listen({ + host, + port: 0, + ipv6Only: true, + }, common.mustCall()); +} diff --git a/test/parallel/test-dgram-ipv6only.js b/test/parallel/test-dgram-ipv6only.js new file mode 100644 index 00000000000000..1187f3084ad6f5 --- /dev/null +++ b/test/parallel/test-dgram-ipv6only.js @@ -0,0 +1,33 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + +const dgram = require('dgram'); + +// This test ensures that dual-stack support is disabled when +// we specify the `ipv6Only` option in `dgram.createSocket()`. +const socket = dgram.createSocket({ + type: 'udp6', + ipv6Only: true, +}); + +socket.bind({ + port: 0, + address: '::', +}, common.mustCall(() => { + const { port } = socket.address(); + const client = dgram.createSocket('udp4'); + + // We can still bind to '0.0.0.0'. + client.bind({ + port, + address: '0.0.0.0', + }, common.mustCall(() => { + client.close(); + socket.close(); + })); + + client.on('error', common.mustNotCall()); +})); diff --git a/test/parallel/test-net-listen-ipv6only.js b/test/parallel/test-net-listen-ipv6only.js new file mode 100644 index 00000000000000..a329011bcc8a23 --- /dev/null +++ b/test/parallel/test-net-listen-ipv6only.js @@ -0,0 +1,30 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + +// This test ensures that dual-stack support is disabled when +// we specify the `ipv6Only` option in `net.Server.listen()`. +const assert = require('assert'); +const net = require('net'); + +const host = '::'; +const server = net.createServer(); +server.listen({ + host, + port: 0, + ipv6Only: true, +}, common.mustCall(() => { + const { port } = server.address(); + const socket = net.connect({ + host: '0.0.0.0', + port, + }); + + socket.on('connect', common.mustNotCall()); + socket.on('error', common.mustCall((err) => { + assert.strictEqual(err.code, 'ECONNREFUSED'); + server.close(); + })); +})); From 7b0292a8394523aa52b95cdeeb39e836c542b557 Mon Sep 17 00:00:00 2001 From: Pranay Kothapalli Date: Wed, 21 Nov 2018 11:31:53 +0530 Subject: [PATCH 135/316] test: favor arrow function in callback PR-URL: https://github.com/nodejs/node/pull/24542 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-zlib-close-after-write.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-zlib-close-after-write.js b/test/parallel/test-zlib-close-after-write.js index d89102ed8c7fd9..211318dc5ad6cc 100644 --- a/test/parallel/test-zlib-close-after-write.js +++ b/test/parallel/test-zlib-close-after-write.js @@ -23,7 +23,7 @@ const common = require('../common'); const zlib = require('zlib'); -zlib.gzip('hello', common.mustCall(function(err, out) { +zlib.gzip('hello', common.mustCall((err, out) => { const unzip = zlib.createGunzip(); unzip.write(out); unzip.close(common.mustCall()); From 2c8c7b882defa5d6a7a2c29edc0a734df45c1a9e Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:57:21 +0530 Subject: [PATCH 136/316] test: replace anonymous function with arrow function PR-URL: https://github.com/nodejs/node/pull/24529 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-child-process-fork-dgram.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index 4aa36261dbb24b..a25b4ad1186821 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -38,10 +38,10 @@ const assert = require('assert'); if (process.argv[2] === 'child') { let childServer; - process.once('message', function(msg, clusterServer) { + process.once('message', (msg, clusterServer) => { childServer = clusterServer; - childServer.once('message', function() { + childServer.once('message', () => { process.send('gotMessage'); childServer.close(); }); @@ -59,15 +59,15 @@ if (process.argv[2] === 'child') { let childGotMessage = false; let parentGotMessage = false; - parentServer.once('message', function(msg, rinfo) { + parentServer.once('message', (msg, rinfo) => { parentGotMessage = true; parentServer.close(); }); - parentServer.on('listening', function() { + parentServer.on('listening', () => { child.send('server', parentServer); - child.on('message', function(msg) { + child.on('message', (msg) => { if (msg === 'gotMessage') { childGotMessage = true; } else if (msg = 'handlReceived') { @@ -79,7 +79,7 @@ if (process.argv[2] === 'child') { function sendMessages() { const serverPort = parentServer.address().port; - const timer = setInterval(function() { + const timer = setInterval(() => { /* * Both the parent and the child got at least one message, * test passed, clean up everything. @@ -94,7 +94,7 @@ if (process.argv[2] === 'child') { msg.length, serverPort, '127.0.0.1', - function(err) { + (err) => { assert.ifError(err); } ); @@ -104,7 +104,7 @@ if (process.argv[2] === 'child') { parentServer.bind(0, '127.0.0.1'); - process.once('exit', function() { + process.once('exit', () => { assert(parentGotMessage); assert(childGotMessage); }); From e8c0fcee9548ffba6fbf4b759e9c67c561993616 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 20 Nov 2018 23:34:55 +0530 Subject: [PATCH 137/316] test: replace closure functions with arrow functions PR-URL: https://github.com/nodejs/node/pull/24522 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen --- test/parallel/test-http-write-callbacks.js | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-http-write-callbacks.js b/test/parallel/test-http-write-callbacks.js index 440807a2df7ca0..401017592b67a1 100644 --- a/test/parallel/test-http-write-callbacks.js +++ b/test/parallel/test-http-write-callbacks.js @@ -33,7 +33,7 @@ let clientEndCb = false; let clientIncoming = ''; const clientIncomingExpect = 'asdffoobar'; -process.on('exit', function() { +process.on('exit', () => { assert(serverEndCb); assert.strictEqual(serverIncoming, serverIncomingExpect); assert(clientEndCb); @@ -42,22 +42,22 @@ process.on('exit', function() { }); // Verify that we get a callback when we do res.write(..., cb) -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { res.statusCode = 400; res.end('Bad Request.\nMust send Expect:100-continue\n'); }); -server.on('checkContinue', function(req, res) { +server.on('checkContinue', (req, res) => { server.close(); assert.strictEqual(req.method, 'PUT'); - res.writeContinue(function() { + res.writeContinue(() => { // continue has been written - req.on('end', function() { - res.write('asdf', function(er) { + req.on('end', () => { + res.write('asdf', (er) => { assert.ifError(er); - res.write('foo', 'ascii', function(er) { + res.write('foo', 'ascii', (er) => { assert.ifError(er); - res.end(Buffer.from('bar'), 'buffer', function(er) { + res.end(Buffer.from('bar'), 'buffer', (er) => { serverEndCb = true; }); }); @@ -66,7 +66,7 @@ server.on('checkContinue', function(req, res) { }); req.setEncoding('ascii'); - req.on('data', function(c) { + req.on('data', (c) => { serverIncoming += c; }); }); @@ -77,24 +77,24 @@ server.listen(0, function() { method: 'PUT', headers: { 'expect': '100-continue' } }); - req.on('continue', function() { + req.on('continue', () => { // ok, good to go. - req.write('YmF6', 'base64', function(er) { + req.write('YmF6', 'base64', (er) => { assert.ifError(er); - req.write(Buffer.from('quux'), function(er) { + req.write(Buffer.from('quux'), (er) => { assert.ifError(er); - req.end('626c657267', 'hex', function(er) { + req.end('626c657267', 'hex', (er) => { assert.ifError(er); clientEndCb = true; }); }); }); }); - req.on('response', function(res) { + req.on('response', (res) => { // this should not come until after the end is flushed out assert(clientEndCb); res.setEncoding('ascii'); - res.on('data', function(c) { + res.on('data', (c) => { clientIncoming += c; }); }); From 9bf2659af4d6442480676d1667314c4eb2938e3f Mon Sep 17 00:00:00 2001 From: Nethra Ravindran Date: Sat, 17 Nov 2018 17:42:29 +0530 Subject: [PATCH 138/316] test: change anonymous closure function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24433 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-net-connect-options-port.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index afdfc2ac615ad6..c22630d43354a5 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -76,15 +76,15 @@ const net = require('net'); const expectedConnections = 72; let serverConnected = 0; - const server = net.createServer(common.mustCall(function(socket) { + const server = net.createServer(common.mustCall((socket) => { socket.end('ok'); if (++serverConnected === expectedConnections) { server.close(); } }, expectedConnections)); - server.listen(0, 'localhost', common.mustCall(function() { - const port = this.address().port; + server.listen(0, 'localhost', common.mustCall(() => { + const port = server.address().port; // Total connections = 3 * 4(canConnect) * 6(doConnect) = 72 canConnect(port); @@ -93,7 +93,7 @@ const net = require('net'); })); // Try connecting to random ports, but do so once the server is closed - server.on('close', function() { + server.on('close', () => { asyncFailToConnect(0); asyncFailToConnect(/* undefined */); }); @@ -193,7 +193,7 @@ function canConnect(port) { } function asyncFailToConnect(port) { - const onError = () => common.mustCall(function(err) { + const onError = () => common.mustCall((err) => { const regexp = /^Error: connect E\w+.+$/; assert(regexp.test(String(err)), String(err)); }); From 61179e6cfef1a10c073bfef1b6a024c17cc7e12e Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Tue, 20 Nov 2018 09:16:23 +0100 Subject: [PATCH 139/316] deps: cherry-pick 073073b from upstream V8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [profiler] introduce API to enable detailed source positions This allows Node.js to enable detailed source positions for optimized code early on, without having to pass a flag string. R=petermarshall@chromium.org Change-Id: Ie74ea41f600cf6e31acbe802116df4976ccf1c75 Reviewed-on: https://chromium-review.googlesource.com/c/1319757 Commit-Queue: Yang Guo Reviewed-by: Peter Marshall Cr-Commit-Position: refs/heads/master@{#57380} Refs: https://github.com/v8/v8/commit/073073b4f12b683fc0406cd15b3cb284633fe18e PR-URL: https://github.com/nodejs/node/pull/24515 Refs: https://github.com/nodejs/node/pull/24274 Refs: https://github.com/nodejs/node/pull/24394 Refs: https://github.com/nodejs/node/issues/24393 Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Peter Marshall Reviewed-By: James M Snell Reviewed-By: Refael Ackermann --- common.gypi | 2 +- deps/v8/include/v8-profiler.h | 6 +++ deps/v8/src/api.cc | 5 +++ deps/v8/src/isolate.cc | 3 +- deps/v8/src/isolate.h | 3 +- deps/v8/test/cctest/test-cpu-profiler.cc | 56 ++++++++++++++++++++++++ 6 files changed, 72 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index 4b732704ba2618..99cd4e4e0625d4 100644 --- a/common.gypi +++ b/common.gypi @@ -30,7 +30,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.11', + 'v8_embedder_string': '-node.12', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 9981061a44bf06..3689a122725f89 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -341,6 +341,12 @@ class V8_EXPORT CpuProfiler { V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.", void SetIdle(bool is_idle)); + /** + * Generate more detailed source positions to code objects. This results in + * better results when mapping profiling samples to script source. + */ + static void UseDetailedSourcePositionsForProfiling(Isolate* isolate); + private: CpuProfiler(); ~CpuProfiler(); diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index c1afe8d93b9d0d..8f8aaf7bc628ac 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -10132,6 +10132,11 @@ void CpuProfiler::SetIdle(bool is_idle) { isolate->SetIdle(is_idle); } +void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) { + reinterpret_cast(isolate) + ->set_detailed_source_positions_for_profiling(true); +} + uintptr_t CodeEvent::GetCodeStartAddress() { return reinterpret_cast(this)->code_start_address; } diff --git a/deps/v8/src/isolate.cc b/deps/v8/src/isolate.cc index 89fecce80431c5..eed52d9c19fb1a 100644 --- a/deps/v8/src/isolate.cc +++ b/deps/v8/src/isolate.cc @@ -3257,7 +3257,8 @@ bool Isolate::use_optimizer() { } bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { - return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; + return NeedsSourcePositionsForProfiling() || + detailed_source_positions_for_profiling(); } bool Isolate::NeedsSourcePositionsForProfiling() const { diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index e199a93ec47859..efd479c41ee4a5 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -553,7 +553,8 @@ typedef std::vector DebugObjectCache; V(int, last_console_context_id, 0) \ V(v8_inspector::V8Inspector*, inspector, nullptr) \ V(bool, next_v8_call_is_safe_for_termination, false) \ - V(bool, only_terminate_in_safe_scope, false) + V(bool, only_terminate_in_safe_scope, false) \ + V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 75af3f6d98f127..e08bec375e4a74 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -40,6 +40,7 @@ #include "src/objects-inl.h" #include "src/profiler/cpu-profiler-inl.h" #include "src/profiler/profiler-listener.h" +#include "src/source-position-table.h" #include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" @@ -2544,6 +2545,61 @@ TEST(MultipleProfilers) { profiler2->StopProfiling("2"); } +int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) { + i::Handle function = i::Handle::cast( + v8::Utils::OpenHandle(*CompileRun(source))); + if (function->IsInterpreted()) return -1; + i::Handle code(function->code(), isolate); + i::SourcePositionTableIterator iterator( + ByteArray::cast(code->source_position_table())); + int count = 0; + while (!iterator.done()) { + count++; + iterator.Advance(); + } + return count; +} + +UNINITIALIZED_TEST(DetailedSourcePositionAPI) { + i::FLAG_detailed_line_info = false; + i::FLAG_allow_natives_syntax = true; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate = v8::Isolate::New(create_params); + + const char* source = + "function fib(i) {" + " if (i <= 1) return 1; " + " return fib(i - 1) +" + " fib(i - 2);" + "}" + "fib(5);" + "%OptimizeFunctionOnNextCall(fib);" + "fib(5);" + "fib"; + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Local context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + i::Isolate* i_isolate = reinterpret_cast(isolate); + + CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo()); + + int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source); + + v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); + CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo()); + + int detailed_positions = GetSourcePositionEntryCount(i_isolate, source); + + CHECK((non_detailed_positions == -1 && detailed_positions == -1) || + non_detailed_positions < detailed_positions); + } + + isolate->Dispose(); +} + } // namespace test_cpu_profiler } // namespace internal } // namespace v8 From aa220cf9d738f37d8edd9b824d7851fbb8f68de7 Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Fri, 9 Nov 2018 15:19:27 +0100 Subject: [PATCH 140/316] src: enable detailed source positions in V8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24515 Refs: https://github.com/nodejs/node/pull/24274 Refs: https://github.com/nodejs/node/pull/24394 Refs: https://github.com/nodejs/node/issues/24393 Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Peter Marshall Reviewed-By: James M Snell Reviewed-By: Refael Ackermann --- src/node.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node.cc b/src/node.cc index 20aafe6a050e20..425c1f875dd983 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2613,6 +2613,7 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop) { isolate->SetMicrotasksPolicy(MicrotasksPolicy::kExplicit); isolate->SetFatalErrorHandler(OnFatalError); isolate->SetAllowWasmCodeGenerationCallback(AllowWasmCodeGenerationCallback); + v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); return isolate; } From 759ed86e5ce3872c106019f79b21e0f66d0b3d5d Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 20 Nov 2018 23:53:56 +0530 Subject: [PATCH 141/316] test: replace anonymous function with arrow func PR-URL: https://github.com/nodejs/node/pull/24525 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-https-client-resume.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index 301cb63dc70310..04a89364fe0e94 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -38,7 +38,7 @@ const options = { }; // create server -const server = https.createServer(options, common.mustCall(function(req, res) { +const server = https.createServer(options, common.mustCall((req, res) => { res.end('Goodbye'); }, 2)); @@ -49,7 +49,7 @@ server.listen(0, function() { const client1 = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, function() { + }, () => { console.log('connect1'); assert.ok(!client1.isSessionReused(), 'Session *should not* be reused.'); session1 = client1.getSession(); @@ -58,7 +58,7 @@ server.listen(0, function() { '\r\n'); }); - client1.on('close', function() { + client1.on('close', () => { console.log('close1'); const opts = { @@ -67,7 +67,7 @@ server.listen(0, function() { session: session1 }; - const client2 = tls.connect(opts, function() { + const client2 = tls.connect(opts, () => { console.log('connect2'); assert.ok(client2.isSessionReused(), 'Session *should* be reused.'); client2.write('GET / HTTP/1.0\r\n' + @@ -75,7 +75,7 @@ server.listen(0, function() { '\r\n'); }); - client2.on('close', function() { + client2.on('close', () => { console.log('close2'); server.close(); }); From 765a81e32acc1e2243503a25e5203e25bf240bfb Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 22 Nov 2018 03:33:05 -0800 Subject: [PATCH 142/316] test: add information to assertion test-fs-stat-bigint.js failed once in CI but there wasn't enough information to know what was giong on. Adding a bit of information to the assertion that failed in case it fails again. PR-URL: https://github.com/nodejs/node/pull/24566 Refs: https://github.com/nodejs/node/issues/24565 Reviewed-By: Anna Henningsen Reviewed-By: Daniel Bevenius --- test/parallel/test-fs-stat-bigint.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-stat-bigint.js b/test/parallel/test-fs-stat-bigint.js index 4691b2dd9d267e..e5c21138a2ffe4 100644 --- a/test/parallel/test-fs-stat-bigint.js +++ b/test/parallel/test-fs-stat-bigint.js @@ -7,6 +7,7 @@ const promiseFs = require('fs').promises; const path = require('path'); const tmpdir = require('../common/tmpdir'); const { isDate } = require('util').types; +const { inspect } = require('util'); tmpdir.refresh(); @@ -62,7 +63,11 @@ function verifyStats(bigintStats, numStats) { assert.strictEqual(bigintStats[key], undefined); assert.strictEqual(numStats[key], undefined); } else if (Number.isSafeInteger(val)) { - assert.strictEqual(bigintStats[key], BigInt(val)); + assert.strictEqual( + bigintStats[key], BigInt(val), + `${inspect(bigintStats[key])} !== ${inspect(BigInt(val))}\n` + + `key=${key}, val=${val}` + ); } else { assert( Math.abs(Number(bigintStats[key]) - val) < 1, From 6b88541fe246a75d04189b5a1d10da26f4e05365 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:09:06 +0530 Subject: [PATCH 143/316] test: replace anonymous function with arrow PR-URL: https://github.com/nodejs/node/pull/24526 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-pipe-file-to-http.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 3d326a77a49bc7..4bc71069da413f 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -32,20 +32,20 @@ tmpdir.refresh(); const filename = path.join(tmpdir.path || '/tmp', 'big'); let count = 0; -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { let timeoutId; assert.strictEqual(req.method, 'POST'); req.pause(); - setTimeout(function() { + setTimeout(() => { req.resume(); }, 1000); - req.on('data', function(chunk) { + req.on('data', (chunk) => { count += chunk.length; }); - req.on('end', function() { + req.on('end', () => { if (timeoutId) { clearTimeout(timeoutId); } @@ -55,7 +55,7 @@ const server = http.createServer(function(req, res) { }); server.listen(0); -server.on('listening', function() { +server.on('listening', () => { common.createZeroFilledFile(filename); makeRequest(); }); @@ -73,14 +73,14 @@ function makeRequest() { assert.ifError(err); })); - req.on('response', function(res) { + req.on('response', (res) => { res.resume(); - res.on('end', function() { + res.on('end', () => { server.close(); }); }); } -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(count, 1024 * 10240); }); From 39adfc8d48ab7dd02aabb8feb93cacde4225c13c Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:17:42 +0530 Subject: [PATCH 144/316] test: replace anonymous function with arrow PR-URL: https://github.com/nodejs/node/pull/24527 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/parallel/test-tls-peer-certificate-encoding.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 19c7cde42cdc16..154c31c0a1386b 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -35,14 +35,14 @@ const options = { ca: [ fixtures.readKey('ca2-cert.pem') ] }; -const server = tls.createServer(options, function(cleartext) { +const server = tls.createServer(options, (cleartext) => { cleartext.end('World'); }); server.listen(0, common.mustCall(function() { const socket = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, common.mustCall(function() { + }, common.mustCall(() => { const peerCert = socket.getPeerCertificate(); console.error(util.inspect(peerCert)); From 2a67a49053c7c23a3ec1d6eccb16cf580950ab8b Mon Sep 17 00:00:00 2001 From: potham Date: Wed, 21 Nov 2018 00:36:10 +0530 Subject: [PATCH 145/316] test: replace callback with arrow function PR-URL: https://github.com/nodejs/node/pull/24531 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig --- test/parallel/test-child-process-kill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-kill.js b/test/parallel/test-child-process-kill.js index 6f986c0ffa932f..00aab44dd1318d 100644 --- a/test/parallel/test-child-process-kill.js +++ b/test/parallel/test-child-process-kill.js @@ -29,7 +29,7 @@ cat.stdout.on('end', common.mustCall()); cat.stderr.on('data', common.mustNotCall()); cat.stderr.on('end', common.mustCall()); -cat.on('exit', common.mustCall(function(code, signal) { +cat.on('exit', common.mustCall((code, signal) => { assert.strictEqual(code, null); assert.strictEqual(signal, 'SIGTERM'); })); From 0c51fc51b0074fa96be42dd1133fdb9a4c94147a Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 16 Nov 2018 21:42:31 +0000 Subject: [PATCH 146/316] n-api: handle reference delete before finalize Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: https://github.com/nodejs/node-addon-api/issues/393 PR-URL: https://github.com/nodejs/node/pull/24494 Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Refael Ackermann --- src/js_native_api_v8.cc | 33 ++++++++++++++--- src/js_native_api_v8.h | 1 + test/addons-napi/test_reference/test.js | 26 ++++++++++++++ .../test_reference/test_reference.c | 36 +++++++++++++++++++ 4 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 144cfad8e438b2..6b8d3f91056823 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -227,8 +227,29 @@ class Reference : private Finalizer { finalize_hint); } + // Delete is called in 2 ways. Either from the finalizer or + // from one of Unwrap or napi_delete_reference. + // + // When it is called from Unwrap or napi_delete_reference we only + // want to do the delete if the finalizer has already run, + // otherwise we may crash when the finalizer does run. + // If the finalizer has not already run delay the delete until + // the finalizer runs by not doing the delete + // and setting _delete_self to true so that the finalizer will + // delete it when it runs. + // + // The second way this is called is from + // the finalizer and _delete_self is set. In this case we + // know we need to do the deletion so just do it. static void Delete(Reference* reference) { - delete reference; + if ((reference->_delete_self) || (reference->_finalize_ran)) { + delete reference; + } else { + // reduce the reference count to 0 and defer until + // finalizer runs + reference->_delete_self = true; + while (reference->Unref() != 0) {} + } } uint32_t Ref() { @@ -268,9 +289,6 @@ class Reference : private Finalizer { Reference* reference = data.GetParameter(); reference->_persistent.Reset(); - // Check before calling the finalize callback, because the callback might - // delete it. - bool delete_self = reference->_delete_self; napi_env env = reference->_env; if (reference->_finalize_callback != nullptr) { @@ -281,8 +299,13 @@ class Reference : private Finalizer { reference->_finalize_hint)); } - if (delete_self) { + // this is safe because if a request to delete the reference + // is made in the finalize_callback it will defer deletion + // to this block and set _delete_self to true + if (reference->_delete_self) { Delete(reference); + } else { + reference->_finalize_ran = true; } } diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index d5402845dc6af6..81b00f2aa59b8f 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -180,6 +180,7 @@ class Finalizer { napi_finalize _finalize_callback; void* _finalize_data; void* _finalize_hint; + bool _finalize_ran = false; }; class TryCatch : public v8::TryCatch { diff --git a/test/addons-napi/test_reference/test.js b/test/addons-napi/test_reference/test.js index 14932a74ca70b0..389ee11d7e5f5b 100644 --- a/test/addons-napi/test_reference/test.js +++ b/test/addons-napi/test_reference/test.js @@ -118,3 +118,29 @@ runTests(0, undefined, [ assert.strictEqual(test_reference.finalizeCount, 1); }, ]); + +// This test creates a napi_ref on an object that has +// been wrapped by napi_wrap and for which the finalizer +// for the wrap calls napi_delete_ref on that napi_ref. +// +// Since both the wrap and the reference use the same +// object the finalizer for the wrap and reference +// may run in the same gc and in any order. +// +// It does that to validate that napi_delete_ref can be +// called before the finalizer has been run for the +// reference (there is a finalizer behind the scenes even +// though it cannot be passed to napi_create_reference). +// +// Since the order is not guarranteed, run the +// test a number of times maximize the chance that we +// get a run with the desired order for the test. +// +// 1000 reliably recreated the problem without the fix +// required to ensure delete could be called before +// the finalizer in manual testing. +for (let i = 0; i < 1000; i++) { + const wrapObject = new Object(); + test_reference.validateDeleteBeforeFinalize(wrapObject); + global.gc(); +} diff --git a/test/addons-napi/test_reference/test_reference.c b/test/addons-napi/test_reference/test_reference.c index 75abc49ad3280e..f3dc3644770ab0 100644 --- a/test/addons-napi/test_reference/test_reference.c +++ b/test/addons-napi/test_reference/test_reference.c @@ -1,3 +1,4 @@ +#include #include #include "../common.h" @@ -131,6 +132,39 @@ static napi_value GetReferenceValue(napi_env env, napi_callback_info info) { return result; } +static void DeleteBeforeFinalizeFinalizer( + napi_env env, void* finalize_data, void* finalize_hint) { + napi_ref* ref = (napi_ref*)finalize_data; + napi_delete_reference(env, *ref); + free(ref); +} + +static napi_value ValidateDeleteBeforeFinalize(napi_env env, napi_callback_info info) { + napi_value wrapObject; + size_t argc = 1; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &wrapObject, NULL, NULL)); + + napi_ref* ref_t = malloc(sizeof(napi_ref)); + NAPI_CALL(env, napi_wrap(env, + wrapObject, + ref_t, + DeleteBeforeFinalizeFinalizer, + NULL, + NULL)); + + // Create a reference that will be eligible for collection at the same + // time as the wrapped object by passing in the same wrapObject. + // This means that the FinalizeOrderValidation callback may be run + // before the finalizer for the newly created reference (there is a finalizer + // behind the scenes even though it cannot be passed to napi_create_reference) + // The Finalizer for the wrap (which is different than the finalizer + // for the reference) calls napi_delete_reference validating that + // napi_delete_reference can be called before the finalizer for the + // reference runs. + NAPI_CALL(env, napi_create_reference(env, wrapObject, 0, ref_t)); + return wrapObject; +} + static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_GETTER("finalizeCount", GetFinalizeCount), @@ -143,6 +177,8 @@ static napi_value Init(napi_env env, napi_value exports) { DECLARE_NAPI_PROPERTY("incrementRefcount", IncrementRefcount), DECLARE_NAPI_PROPERTY("decrementRefcount", DecrementRefcount), DECLARE_NAPI_GETTER("referenceValue", GetReferenceValue), + DECLARE_NAPI_PROPERTY("validateDeleteBeforeFinalize", + ValidateDeleteBeforeFinalize), }; NAPI_CALL(env, napi_define_properties( From 40701520ce603cebd6d5afbf3da75f220120e1bc Mon Sep 17 00:00:00 2001 From: sreepurnajasti Date: Tue, 20 Nov 2018 12:49:01 +0530 Subject: [PATCH 147/316] test: replace callback with arrow functions PR-URL: https://github.com/nodejs/node/pull/24541 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/pummel/test-net-throttle.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index acd8e0cc003547..190c242d6e1636 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -34,7 +34,7 @@ const body = 'C'.repeat(N); console.log(`start server on port ${common.PORT}`); -const server = net.createServer(function(connection) { +const server = net.createServer((connection) => { connection.write(body.slice(0, part_N)); connection.write(body.slice(part_N, 2 * part_N)); assert.strictEqual(connection.write(body.slice(2 * part_N, N)), false); @@ -44,11 +44,11 @@ const server = net.createServer(function(connection) { connection.end(); }); -server.listen(common.PORT, function() { +server.listen(common.PORT, () => { let paused = false; const client = net.createConnection(common.PORT); client.setEncoding('ascii'); - client.on('data', function(d) { + client.on('data', (d) => { chars_recved += d.length; console.log(`got ${chars_recved}`); if (!paused) { @@ -57,7 +57,7 @@ server.listen(common.PORT, function() { paused = true; console.log('pause'); const x = chars_recved; - setTimeout(function() { + setTimeout(() => { assert.strictEqual(chars_recved, x); client.resume(); console.log('resume'); @@ -66,14 +66,14 @@ server.listen(common.PORT, function() { } }); - client.on('end', function() { + client.on('end', () => { server.close(); client.end(); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(chars_recved, N); assert.strictEqual(npauses > 2, true); }); From 34b40af5abffc4f421ce01dbbae50af272ec20d2 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Tue, 20 Nov 2018 22:49:51 +0800 Subject: [PATCH 148/316] test: fix test case in test-child-process-fork-dgram.js PR-URL: https://github.com/nodejs/node/pull/24459 Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-child-process-fork-dgram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index a25b4ad1186821..6552a162636aa8 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -70,7 +70,7 @@ if (process.argv[2] === 'child') { child.on('message', (msg) => { if (msg === 'gotMessage') { childGotMessage = true; - } else if (msg = 'handlReceived') { + } else if (msg === 'handleReceived') { sendMessages(); } }); From 363d3c6deb256e596034472211bfced570cc0647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sat, 17 Nov 2018 16:38:44 -0500 Subject: [PATCH 149/316] test: use destructuring on require PR-URL: https://github.com/nodejs/node/pull/24455 Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen --- .../test-tick-processor-polyfill-brokenfile.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js index d0a6eb9f81806e..f61bdbe9a12510 100644 --- a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js +++ b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js @@ -17,9 +17,9 @@ if (isCPPSymbolsNotMapped) { const assert = require('assert'); -const cp = require('child_process'); +const { spawn, spawnSync } = require('child_process'); const path = require('path'); -const fs = require('fs'); +const { writeFileSync } = require('fs'); const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log'); const RETRY_TIMEOUT = 150; @@ -33,7 +33,7 @@ const code = `function f() { }; f();`; -const proc = cp.spawn(process.execPath, [ +const proc = spawn(process.execPath, [ '--no_logfile_per_isolate', '--logfile=-', '--prof', @@ -49,8 +49,8 @@ proc.stdout.on('data', (chunk) => ticks += chunk); function runPolyfill(content) { proc.kill(); content += BROKEN_PART; - fs.writeFileSync(LOG_FILE, content); - const child = cp.spawnSync( + writeFileSync(LOG_FILE, content); + const child = spawnSync( `${process.execPath}`, [ '--prof-process', LOG_FILE From 5796c6aba4a4cdcfa02dab96ba1fa923a57e3140 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 22 Nov 2018 18:47:40 +0000 Subject: [PATCH 150/316] doc: mark napi_add_finalizer experimental This was missed when the function was added. As it is experimental in the code it should also be experimental in the docs. Fixes: https://github.com/nodejs/node/issues/24509 PR-URL: https://github.com/nodejs/node/pull/24572 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- doc/api/n-api.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 33d9f561bec313..ce112b3344ce40 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3799,6 +3799,9 @@ callback was associated with the wrapping, it will no longer be called when the JavaScript object becomes garbage-collected. ### napi_add_finalizer + +> Stability: 1 - Experimental + %s' % (options.icusrc, options.icusmall) + print("will use small datafile %s" % (src_datafile)) +print('%s --> %s' % (options.icusrc, options.icusmall)) shutil.copytree(options.icusrc, options.icusmall, ignore=icu_ignore) -print '%s --> %s' % (src_datafile, dst_datafile) +print('%s --> %s' % (src_datafile, dst_datafile)) # now, make the data dir (since we ignored it) os.mkdir(os.path.join(os.path.join(options.icusmall, "source", "data"))) @@ -114,13 +115,13 @@ def icu_info(icu_full_path): readme_name = os.path.join(options.icusmall, "README-SMALL-ICU.txt" ) fi = open(readme_name, 'wb') -print >>fi, "Small ICU sources - auto generated by shrink-icu-src.py" -print >>fi, "" -print >>fi, "This directory contains the ICU subset used by --with-intl=small-icu (the default)" -print >>fi, "It is a strict subset of ICU %s source files with the following exception(s):" % (icu_ver_major) -print >>fi, "* %s : Reduced-size data file" % (dst_datafile) -print >>fi, "" -print >>fi, "" -print >>fi, "To rebuild this directory, see ../../tools/icu/README.md" -print >>fi, "" +print("Small ICU sources - auto generated by shrink-icu-src.py", file=fi) +print("", file=fi) +print("This directory contains the ICU subset used by --with-intl=small-icu (the default)", file=fi) +print("It is a strict subset of ICU %s source files with the following exception(s):" % (icu_ver_major), file=fi) +print("* %s : Reduced-size data file" % (dst_datafile), file=fi) +print("", file=fi) +print("", file=fi) +print("To rebuild this directory, see ../../tools/icu/README.md", file=fi) +print("", file=fi) fi.close() diff --git a/tools/run-valgrind.py b/tools/run-valgrind.py index cad3e7ec6954d2..67fa424584e63a 100755 --- a/tools/run-valgrind.py +++ b/tools/run-valgrind.py @@ -27,6 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import print_function from os import path import subprocess import sys @@ -40,12 +41,12 @@ ] if len(sys.argv) < 2: - print 'Please provide an executable to analyze.' + print('Please provide an executable to analyze.') sys.exit(1) executable = path.join(NODE_ROOT, sys.argv[1]) if not path.exists(executable): - print 'Cannot find the file specified: %s' % executable + print('Cannot find the file specified: %s' % executable) sys.exit(1) # Compute the command line. diff --git a/tools/specialize_node_d.py b/tools/specialize_node_d.py index bb5ef5a57ce916..d9e8c1fd13ea51 100755 --- a/tools/specialize_node_d.py +++ b/tools/specialize_node_d.py @@ -6,11 +6,12 @@ # Specialize node.d for given flavor (`freebsd`) and arch (`x64` or `ia32`) # +from __future__ import print_function import re import sys if len(sys.argv) != 5: - print "usage: specialize_node_d.py outfile src/node.d flavor arch" + print("usage: specialize_node_d.py outfile src/node.d flavor arch") sys.exit(2); outfile = file(sys.argv[1], 'w'); diff --git a/tools/test.py b/tools/test.py index 67b8cb917e0db6..640206f95cb420 100755 --- a/tools/test.py +++ b/tools/test.py @@ -28,6 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import print_function import imp import logging import optparse @@ -87,11 +88,11 @@ def PrintFailureHeader(self, test): negative_marker = '[negative] ' else: negative_marker = '' - print "=== %(label)s %(negative)s===" % { + print("=== %(label)s %(negative)s===" % { 'label': test.GetLabel(), 'negative': negative_marker - } - print "Path: %s" % "/".join(test.path) + }) + print("Path: %s" % "/".join(test.path)) def Run(self, tasks): self.Starting() @@ -182,40 +183,40 @@ def EscapeCommand(command): class SimpleProgressIndicator(ProgressIndicator): def Starting(self): - print 'Running %i tests' % len(self.cases) + print('Running %i tests' % len(self.cases)) def Done(self): - print + print() for failed in self.failed: self.PrintFailureHeader(failed.test) if failed.output.stderr: - print "--- stderr ---" - print failed.output.stderr.strip() + print("--- stderr ---") + print(failed.output.stderr.strip()) if failed.output.stdout: - print "--- stdout ---" - print failed.output.stdout.strip() - print "Command: %s" % EscapeCommand(failed.command) + print("--- stdout ---") + print(failed.output.stdout.strip()) + print("Command: %s" % EscapeCommand(failed.command)) if failed.HasCrashed(): - print "--- %s ---" % PrintCrashed(failed.output.exit_code) + print("--- %s ---" % PrintCrashed(failed.output.exit_code)) if failed.HasTimedOut(): - print "--- TIMEOUT ---" + print("--- TIMEOUT ---") if len(self.failed) == 0: - print "===" - print "=== All tests succeeded" - print "===" + print("===") + print("=== All tests succeeded") + print("===") else: - print - print "===" - print "=== %i tests failed" % len(self.failed) + print() + print("===") + print("=== %i tests failed" % len(self.failed)) if self.crashed > 0: - print "=== %i tests CRASHED" % self.crashed - print "===" + print("=== %i tests CRASHED" % self.crashed) + print("===") class VerboseProgressIndicator(SimpleProgressIndicator): def AboutToRun(self, case): - print 'Starting %s...' % case.GetLabel() + print('Starting %s...' % case.GetLabel()) sys.stdout.flush() def HasRun(self, output): @@ -226,7 +227,7 @@ def HasRun(self, output): outcome = 'FAIL' else: outcome = 'pass' - print 'Done running %s: %s' % (output.test.GetLabel(), outcome) + print('Done running %s: %s' % (output.test.GetLabel(), outcome)) class DotsProgressIndicator(SimpleProgressIndicator): @@ -362,9 +363,9 @@ def HasRun(self, output): ("because:" in line or "reason:" in line): if not printed_file: printed_file = True - print '==== %s ====' % command + print('==== %s ====' % command) self.failed.append(output) - print ' %s' % line + print(' %s' % line) def Done(self): pass @@ -393,15 +394,15 @@ def HasRun(self, output): self.PrintFailureHeader(output.test) stdout = output.output.stdout.strip() if len(stdout): - print self.templates['stdout'] % stdout + print(self.templates['stdout'] % stdout) stderr = output.output.stderr.strip() if len(stderr): - print self.templates['stderr'] % stderr - print "Command: %s" % EscapeCommand(output.command) + print(self.templates['stderr'] % stderr) + print("Command: %s" % EscapeCommand(output.command)) if output.HasCrashed(): - print "--- %s ---" % PrintCrashed(output.output.exit_code) + print("--- %s ---" % PrintCrashed(output.output.exit_code)) if output.HasTimedOut(): - print "--- TIMEOUT ---" + print("--- TIMEOUT ---") def Truncate(self, str, length): if length and (len(str) > (length - 3)): @@ -422,7 +423,7 @@ def PrintProgress(self, name): } status = self.Truncate(status, 78) self.last_status_length = len(status) - print status, + print(status, end=' ') sys.stdout.flush() @@ -437,7 +438,7 @@ def __init__(self, cases, flaky_tests_mode): super(ColorProgressIndicator, self).__init__(cases, flaky_tests_mode, templates) def ClearLine(self, last_line_length): - print "\033[1K\r", + print("\033[1K\r", end=' ') class MonochromeProgressIndicator(CompactProgressIndicator): @@ -453,7 +454,7 @@ def __init__(self, cases, flaky_tests_mode): super(MonochromeProgressIndicator, self).__init__(cases, flaky_tests_mode, templates) def ClearLine(self, last_line_length): - print ("\r" + (" " * last_line_length) + "\r"), + print(("\r" + (" " * last_line_length) + "\r"), end=' ') PROGRESS_INDICATORS = { @@ -616,7 +617,7 @@ def KillTimedOutProcess(context, pid): def RunProcess(context, timeout, args, **rest): - if context.verbose: print "#", " ".join(args) + if context.verbose: print("#", " ".join(args)) popen_args = args prev_error_mode = SEM_INVALID_VALUE; if utils.IsWindows(): @@ -1181,15 +1182,15 @@ def ParseCondition(expr): """Parses a logical expression into an Expression object""" tokens = Tokenizer(expr).Tokenize() if not tokens: - print "Malformed expression: '%s'" % expr + print("Malformed expression: '%s'" % expr) return None scan = Scanner(tokens) ast = ParseLogicalExpression(scan) if not ast: - print "Malformed expression: '%s'" % expr + print("Malformed expression: '%s'" % expr) return None if scan.HasMore(): - print "Malformed expression: '%s'" % expr + print("Malformed expression: '%s'" % expr) return None return ast @@ -1387,19 +1388,19 @@ def ProcessOptions(options): if options.run == [""]: options.run = None elif len(options.run) != 2: - print "The run argument must be two comma-separated integers." + print("The run argument must be two comma-separated integers.") return False else: try: options.run = map(int, options.run) except ValueError: - print "Could not parse the integers from the run argument." + print("Could not parse the integers from the run argument.") return False if options.run[0] < 0 or options.run[1] < 0: - print "The run argument cannot have negative integers." + print("The run argument cannot have negative integers.") return False if options.run[0] >= options.run[1]: - print "The test group to run (n) must be smaller than number of groups (m)." + print("The test group to run (n) must be smaller than number of groups (m).") return False if options.J: # inherit JOBS from environment if provided. some virtualised systems @@ -1407,7 +1408,7 @@ def ProcessOptions(options): cores = os.environ.get('JOBS') options.j = int(cores) if cores is not None else multiprocessing.cpu_count() if options.flaky_tests not in [RUN, SKIP, DONTCARE]: - print "Unknown flaky-tests mode %s" % options.flaky_tests + print("Unknown flaky-tests mode %s" % options.flaky_tests) return False return True @@ -1606,13 +1607,13 @@ def Main(): for mode in options.mode: vm = context.GetVm(arch, mode) if not exists(vm): - print "Can't find shell executable: '%s'" % vm + print("Can't find shell executable: '%s'" % vm) continue archEngineContext = Execute([vm, "-p", "process.arch"], context) vmArch = archEngineContext.stdout.rstrip() if archEngineContext.exit_code is not 0 or vmArch == "undefined": - print "Can't determine the arch of: '%s'" % vm - print archEngineContext.stderr.rstrip() + print("Can't determine the arch of: '%s'" % vm) + print(archEngineContext.stderr.rstrip()) continue env = { 'mode': mode, @@ -1649,15 +1650,15 @@ def Main(): if key in visited: continue visited.add(key) - print "--- begin source: %s ---" % test.GetLabel() + print("--- begin source: %s ---" % test.GetLabel()) source = test.GetSource().strip() - print source - print "--- end source: %s ---" % test.GetLabel() + print(source) + print("--- end source: %s ---" % test.GetLabel()) return 0 if options.warn_unused: for rule in globally_unused_rules: - print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]) + print("Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path])) tempdir = os.environ.get('NODE_TEST_DIR') or options.temp_dir if tempdir: @@ -1666,7 +1667,7 @@ def Main(): os.makedirs(tempdir) except OSError as exception: if exception.errno != errno.EEXIST: - print "Could not create the temporary directory", options.temp_dir + print("Could not create the temporary directory", options.temp_dir) sys.exit(1) def should_keep(case): @@ -1700,7 +1701,7 @@ def should_keep(case): len(cases_to_run), options.run[1]) ] if len(cases_to_run) == 0: - print "No tests to run." + print("No tests to run.") return 1 else: try: @@ -1711,13 +1712,13 @@ def should_keep(case): result = 1 duration = time.time() - start except KeyboardInterrupt: - print "Interrupted" + print("Interrupted") return 1 if options.time: # Write the times to stderr to make it easy to separate from the # test output. - print + print() sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration)) timed_tests = [ t for t in cases_to_run if not t.duration is None ] timed_tests.sort(lambda a, b: a.CompareTime(b)) From d4491a48ba68f865d058a263c9345662fcfb8715 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 23 Nov 2018 15:56:40 -0800 Subject: [PATCH 172/316] doc: revise handling-own-pull-requests text Simplify and clarify the text of the COLLABORATORS_GUIDE where handling one's own pull requests is concerned. PR-URL: https://github.com/nodejs/node/pull/24583 Reviewed-By: Vse Mozhet Byt Reviewed-By: Yuta Hiroto Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- COLLABORATOR_GUIDE.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 0be47023ea7263..90d52105a74219 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -76,22 +76,20 @@ A pull request is _author ready_ when: pull request is older than 7 days. * There are no outstanding review comments. -Please always add the `author ready` label to the PR in that case. Please always -remove it again as soon as the conditions are not met anymore. +Please always add the `author ready` label to the pull request in that case. +Please always remove it again as soon as the conditions are not met anymore. ### Handling own pull requests -When you open a pull request, it is recommended to start a CI right away (see -[testing and CI](#testing-and-ci) for instructions) and to post the link to it -in a comment in the pull request. Starting a new CI after each update is also -recommended (for example, after an additional code change or after rebasing). - -As soon as the PR is ready to land, please do so. Landing your own pull requests -allows other Collaborators to focus on other pull requests. If your pull request -is still awaiting the [minimum time to land](#waiting-for-approvals), add the -`author ready` label so other Collaborators know it can land as soon as the time -ends. If instead you wish to land the PR yourself, indicate this intent by using -the "assign yourself" button, to self-assign the PR. +When you open a pull request, [start a CI](#testing-and-ci) right away and post +the link to it in a comment in the pull request. Later, after new code changes +or rebasing, start a new CI. + +As soon as the pull request is ready to land, please do so. This allows other +Collaborators to focus on other pull requests. If your pull request is not ready +to land but is [author ready](#author-ready-pull-requests), add the +`author ready` label. If you wish to land the pull request yourself, use the +"assign yourself" link to self-assign it. ## Accepting Modifications From b65ffd5b1d5a5017251e4d019b01e86915f20ca2 Mon Sep 17 00:00:00 2001 From: koki-oshima Date: Sat, 24 Nov 2018 16:35:20 +0900 Subject: [PATCH 173/316] doc: use arrow function for anonymous callbacks PR-URL: https://github.com/nodejs/node/pull/24606 Reviewed-By: Ron Korving Reviewed-By: Joyee Cheung Reviewed-By: Vse Mozhet Byt Reviewed-By: Gireesh Punathil --- doc/api/async_hooks.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 1529e33e474084..e95c7f4ef6f6da 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -479,13 +479,12 @@ The ID returned from `executionAsyncId()` is related to execution timing, not causality (which is covered by `triggerAsyncId()`): ```js -const server = net.createServer(function onConnection(conn) { +const server = net.createServer((conn) => { // Returns the ID of the server, not of the new connection, because the - // onConnection callback runs in the execution scope of the server's - // MakeCallback(). + // callback runs in the execution scope of the server's MakeCallback(). async_hooks.executionAsyncId(); -}).listen(port, function onListening() { +}).listen(port, () => { // Returns the ID of a TickObject (i.e. process.nextTick()) because all // callbacks passed to .listen() are wrapped in a nextTick(). async_hooks.executionAsyncId(); From a8e93f769119e2cac2b5db4a2bcc8efec913149f Mon Sep 17 00:00:00 2001 From: takato Date: Sat, 24 Nov 2018 15:49:06 +0900 Subject: [PATCH 174/316] lib: change anonymous function to arrow function PR-URL: https://github.com/nodejs/node/pull/24589 Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Shingo Inoue --- lib/_http_client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index d91b43516fa4ee..5b47f9c72a71b7 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -306,7 +306,7 @@ ClientRequest.prototype.abort = function abort() { if (this.res) { this.res._dump(); } else { - this.once('response', function(res) { + this.once('response', (res) => { res._dump(); }); } From c15efcec926d4f856d62fc3cec74ae31e652624e Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Sat, 24 Nov 2018 16:06:42 +0900 Subject: [PATCH 175/316] crypto: convert to arrow function Changed function expression to arrow function. PR-URL: https://github.com/nodejs/node/pull/24597 Reviewed-By: Ron Korving Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- lib/internal/crypto/cipher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/crypto/cipher.js b/lib/internal/crypto/cipher.js index a3f28c183a46b7..cdb92465ece578 100644 --- a/lib/internal/crypto/cipher.js +++ b/lib/internal/crypto/cipher.js @@ -39,7 +39,7 @@ const { deprecate, normalizeEncoding } = require('internal/util'); let StringDecoder; function rsaFunctionFor(method, defaultPadding) { - return function(options, buffer) { + return (options, buffer) => { const key = options.key || options; const padding = options.padding || defaultPadding; const passphrase = options.passphrase || null; From 955a8a720a52f76a204c1267cf5bce77ae7bb267 Mon Sep 17 00:00:00 2001 From: kohta ito Date: Sat, 24 Nov 2018 16:30:43 +0900 Subject: [PATCH 176/316] src: replace new Array creation PR-URL: https://github.com/nodejs/node/pull/24601 Reviewed-By: Anna Henningsen Reviewed-By: Shingo Inoue Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil --- src/bootstrapper.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index c40b855b9939ca..93c1035617958b 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -50,11 +50,12 @@ void SetupNextTick(const FunctionCallbackInfo& args) { .ToLocalChecked(); run_microtasks_fn->SetName(FIXED_ONE_BYTE_STRING(isolate, "runMicrotasks")); - Local ret = Array::New(isolate, 2); - ret->Set(context, 0, env->tick_info()->fields().GetJSArray()).FromJust(); - ret->Set(context, 1, run_microtasks_fn).FromJust(); + Local ret[] = { + env->tick_info()->fields().GetJSArray(), + run_microtasks_fn + }; - args.GetReturnValue().Set(ret); + args.GetReturnValue().Set(Array::New(isolate, ret, arraysize(ret))); } void PromiseRejectCallback(PromiseRejectMessage message) { From b7aa3126724e45dc1d26e8b12f2583c2cef42b20 Mon Sep 17 00:00:00 2001 From: tottokotkd Date: Sat, 24 Nov 2018 16:41:07 +0900 Subject: [PATCH 177/316] test: fix arguments order in `assert.strictEqual` PR-URL: https://github.com/nodejs/node/pull/24612 Reviewed-By: Anna Henningsen Reviewed-By: Shingo Inoue Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil --- test/parallel/test-http-default-encoding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-default-encoding.js b/test/parallel/test-http-default-encoding.js index 36d3f0a65244fe..8fcbf1a07f26ff 100644 --- a/test/parallel/test-http-default-encoding.js +++ b/test/parallel/test-http-default-encoding.js @@ -54,5 +54,5 @@ server.listen(0, function() { }); process.on('exit', () => { - assert.strictEqual(expected, result); + assert.strictEqual(result, expected); }); From dca1ecffbd64f7baa9db6dd1fb175b087688a220 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sat, 24 Nov 2018 16:54:24 +0900 Subject: [PATCH 178/316] src: replace array implementation replace with C++ API. Refs: https://github.com/nodejs/node/pull/24125 PR-URL: https://github.com/nodejs/node/pull/24614 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Gus Caplan --- src/uv.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uv.cc b/src/uv.cc index 5628719c784653..5405b2058a15d2 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -76,12 +76,13 @@ void Initialize(Local target, Local err_map = Map::New(isolate); #define V(name, msg) do { \ - Local arr = Array::New(isolate, 2); \ - arr->Set(env->context(), 0, OneByteString(isolate, #name)).FromJust(); \ - arr->Set(env->context(), 1, OneByteString(isolate, msg)).FromJust(); \ + Local arr[] = { \ + OneByteString(isolate, #name), \ + OneByteString(isolate, msg) \ + }; \ err_map->Set(context, \ Integer::New(isolate, UV_##name), \ - arr).ToLocalChecked(); \ + Array::New(isolate, arr, arraysize(arr))).ToLocalChecked(); \ } while (0); UV_ERRNO_MAP(V) #undef V From 59c2ee0c379b44b3ad8728ac892659ddfe96204d Mon Sep 17 00:00:00 2001 From: Naojirou Hisada Date: Sat, 24 Nov 2018 16:13:41 +0900 Subject: [PATCH 179/316] lib: convert to arrow function PR-URL: https://github.com/nodejs/node/pull/24596 Reviewed-By: Ron Korving Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- lib/internal/socket_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/socket_list.js b/lib/internal/socket_list.js index d12686e1de107d..8cd7b1e0ed9057 100644 --- a/lib/internal/socket_list.js +++ b/lib/internal/socket_list.js @@ -47,7 +47,7 @@ class SocketListSend extends EventEmitter { this._request({ cmd: 'NODE_SOCKET_GET_COUNT', key: this.key - }, 'NODE_SOCKET_COUNT', false, function(err, msg) { + }, 'NODE_SOCKET_COUNT', false, (err, msg) => { if (err) return callback(err); callback(null, msg.count); }); From bd4df5b3260700b9ea2d312175cbff60a1adec7e Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Mon, 19 Nov 2018 21:36:32 -0500 Subject: [PATCH 180/316] build,src: sync src files with node.gyp PR-URL: https://github.com/nodejs/node/pull/24505 Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius Reviewed-By: Fedor Indutny --- node.gyp | 58 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/node.gyp b/node.gyp index d900ee63ed47f0..3cbbe61e575ca3 100644 --- a/node.gyp +++ b/node.gyp @@ -326,8 +326,8 @@ 'src/bootstrapper.cc', 'src/callback_scope.cc', 'src/cares_wrap.cc', - 'src/connection_wrap.cc', 'src/connect_wrap.cc', + 'src/connection_wrap.cc', 'src/debug_utils.cc', 'src/env.cc', 'src/exceptions.cc', @@ -351,36 +351,37 @@ 'src/node_encoding.cc', 'src/node_errors.cc', 'src/node_file.cc', - 'src/node_http2.cc', 'src/node_http_parser.cc', + 'src/node_http2.cc', + 'src/node_i18n.cc', 'src/node_messaging.cc', + 'src/node_native_module.cc', 'src/node_options.cc', 'src/node_os.cc', - 'src/node_platform.cc', 'src/node_perf.cc', + 'src/node_platform.cc', 'src/node_postmortem_metadata.cc', 'src/node_process.cc', 'src/node_serdes.cc', + 'src/node_stat_watcher.cc', 'src/node_trace_events.cc', 'src/node_types.cc', 'src/node_url.cc', 'src/node_util.cc', 'src/node_v8.cc', - 'src/node_stat_watcher.cc', 'src/node_watchdog.cc', 'src/node_worker.cc', 'src/node_zlib.cc', - 'src/node_i18n.cc', 'src/pipe_wrap.cc', 'src/process_wrap.cc', 'src/sharedarraybuffer_metadata.cc', 'src/signal_wrap.cc', 'src/spawn_sync.cc', - 'src/string_bytes.cc', - 'src/string_decoder.cc', 'src/stream_base.cc', 'src/stream_pipe.cc', 'src/stream_wrap.cc', + 'src/string_bytes.cc', + 'src/string_decoder.cc', 'src/tcp_wrap.cc', 'src/timers.cc', 'src/tracing/agent.cc', @@ -398,70 +399,79 @@ 'src/async_wrap-inl.h', 'src/base_object.h', 'src/base_object-inl.h', - 'src/connection_wrap.h', + 'src/base64.h', 'src/connect_wrap.h', + 'src/connection_wrap.h', 'src/debug_utils.h', 'src/env.h', 'src/env-inl.h', 'src/handle_wrap.h', + 'src/http_parser_adaptor.h', 'src/js_stream.h', + 'src/memory_tracker.h', + 'src/memory_tracker-inl.h', 'src/module_wrap.h', 'src/node.h', 'src/node_api.h', 'src/node_api_types.h', 'src/node_buffer.h', 'src/node_constants.h', + 'src/node_context_data.h', 'src/node_contextify.h', 'src/node_errors.h', 'src/node_file.h', 'src/node_http2.h', 'src/node_http2_state.h', + 'src/node_i18n.h', 'src/node_internals.h', 'src/node_messaging.h', 'src/node_mutex.h', 'src/node_native_module.h', - 'src/node_native_module.cc', + 'src/node_object_wrap.h', 'src/node_options.h', 'src/node_options-inl.h', 'src/node_perf.h', 'src/node_perf_common.h', 'src/node_persistent.h', 'src/node_platform.h', + 'src/node_revert.h', 'src/node_root_certs.h', + 'src/node_stat_watcher.h', 'src/node_union_bytes.h', + 'src/node_url.h', 'src/node_version.h', 'src/node_watchdog.h', - 'src/node_revert.h', - 'src/node_i18n.h', 'src/node_worker.h', - 'src/memory_tracker.h', - 'src/memory_tracker-inl.h', 'src/pipe_wrap.h', - 'src/tty_wrap.h', - 'src/tcp_wrap.h', - 'src/udp_wrap.h', 'src/req_wrap.h', 'src/req_wrap-inl.h', 'src/sharedarraybuffer_metadata.h', - 'src/string_bytes.h', - 'src/string_decoder.h', - 'src/string_decoder-inl.h', + 'src/spawn_sync.h', 'src/stream_base.h', 'src/stream_base-inl.h', 'src/stream_pipe.h', 'src/stream_wrap.h', + 'src/string_bytes.h', + 'src/string_decoder.h', + 'src/string_decoder-inl.h', + 'src/string_search.h', + 'src/tcp_wrap.h', 'src/tracing/agent.h', 'src/tracing/node_trace_buffer.h', 'src/tracing/node_trace_writer.h', 'src/tracing/trace_event.h', + 'src/tracing/trace_event_common.h', 'src/tracing/traced_value.h', + 'src/tty_wrap.h', + 'src/udp_wrap.h', 'src/util.h', 'src/util-inl.h', + # Dependency headers 'deps/http_parser/http_parser.h', 'deps/v8/include/v8.h', # javascript files to make for an even more pleasant IDE experience '<@(library_files)', - # node.gyp is added to the project by default. + # node.gyp is added by default, common.gypi is added for change detection 'common.gypi', ], @@ -525,6 +535,7 @@ 'src/node_win32_etw_provider.h', 'src/node_win32_etw_provider-inl.h', 'src/node_win32_etw_provider.cc', + 'src/node_dtrace.h', 'src/node_dtrace.cc', 'tools/msvs/genfiles/node_etw_provider.h', ], @@ -560,7 +571,10 @@ # below, and the GYP-generated Makefiles will properly build them when # needed. # - 'sources': [ 'src/node_dtrace.cc' ], + 'sources': [ + 'src/node_dtrace.h', + 'src/node_dtrace.cc', + ], 'conditions': [ [ 'OS=="linux"', { 'sources': [ @@ -583,6 +597,8 @@ 'src/node_crypto.h', 'src/node_crypto_bio.h', 'src/node_crypto_clienthello.h', + 'src/node_crypto_clienthello-inl.h', + 'src/node_crypto_groups.h', 'src/tls_wrap.cc', 'src/tls_wrap.h' ], From 5a47c2e7d34521680a04831046f0322c6d4b5722 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 23 Nov 2018 21:00:40 -0800 Subject: [PATCH 181/316] doc: clarify symlink resolution for __filename Make it more explicit that symlinks are resolved in `__filename`. Refs: https://github.com/nodejs/node/issues/22602#issuecomment-440906602 PR-URL: https://github.com/nodejs/node/pull/24587 Reviewed-By: Anna Henningsen Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig --- doc/api/modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index c7d9d4b59c7726..acab51a5f34de9 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -491,8 +491,8 @@ added: v0.0.1 * {string} -The file name of the current module. This is the resolved absolute path of the -current module file. +The file name of the current module. This is the current module file's absolute +path with symlinks resolved. For a main program this is not necessarily the same as the file name used in the command line. From 3df8633b865077525dd14cd6cef05b8c94cc2ecf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 21 Nov 2018 16:23:00 +0100 Subject: [PATCH 182/316] lib: suppress crypto related env vars in help msg This commit adds a crypto check to suppress the crypto related environment variables introduced in Commit 399bb3c95af821350774c18f469ab700387f38e1 ("doc: add NODE_DEBUG_NATIVE to API docs"). Without this check, test/parallel/test-cli-node-print-help.js will fail when configured --without-ssl, as it some of the descriptions for these environment variables contain flags that the test is not expecting to find. PR-URL: https://github.com/nodejs/node/pull/24556 Reviewed-By: Luigi Pinca Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- lib/internal/print_help.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/internal/print_help.js b/lib/internal/print_help.js index 9081a09e4fb027..5d2c1daa075e0d 100644 --- a/lib/internal/print_help.js +++ b/lib/internal/print_help.js @@ -1,6 +1,7 @@ 'use strict'; const { types } = internalBinding('options'); +const hasCrypto = Boolean(process.versions.openssl); const typeLookup = []; for (const key of Object.keys(types)) @@ -33,11 +34,6 @@ const envVars = new Map([ 'certificate validation' }], ['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' + 'to' }], - ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }], - ['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' + - 'certificates when used in conjunction with --use-openssl-ca' }], - ['SSL_CERT_FILE', { helpText: 'sets OpenSSL\'s trusted certificate file ' + - 'when used in conjunction with --use-openssl-ca' }], ['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' + 'libuv\'s threadpool' }] ].concat(hasIntl ? [ @@ -46,6 +42,12 @@ const envVars = new Map([ ] : []).concat(hasNodeOptions ? [ ['NODE_OPTIONS', { helpText: 'set CLI options in the environment via a ' + 'space-separated list' }] +] : []).concat(hasCrypto ? [ + ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }], + ['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' + + 'certificates when used in conjunction with --use-openssl-ca' }], + ['SSL_CERT_FILE', { helpText: 'sets OpenSSL\'s trusted certificate file ' + + 'when used in conjunction with --use-openssl-ca' }], ] : [])); From 9caad06d6f254a47f0eb8175d5092fbbd482dec9 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 22 Nov 2018 00:13:57 -0500 Subject: [PATCH 183/316] src: simplify uptime and ppid return values This commit removes extraneous wrapping of return values in Uptime() and GetParentProcessId(). PR-URL: https://github.com/nodejs/node/pull/24562 Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis Reviewed-By: Jon Moss --- src/node_process.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/node_process.cc b/src/node_process.cc index 017d8d0073ac83..f52e985687c661 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -54,7 +54,6 @@ using v8::Integer; using v8::Isolate; using v8::Local; using v8::Name; -using v8::Number; using v8::PropertyCallbackInfo; using v8::String; using v8::Uint32; @@ -259,7 +258,7 @@ void Uptime(const FunctionCallbackInfo& args) { uv_update_time(env->event_loop()); uptime = uv_now(env->event_loop()) - prog_start_time; - args.GetReturnValue().Set(Number::New(env->isolate(), uptime / 1000)); + args.GetReturnValue().Set(uptime / 1000); } @@ -790,7 +789,7 @@ void EnvEnumerator(const PropertyCallbackInfo& info) { void GetParentProcessId(Local property, const PropertyCallbackInfo& info) { - info.GetReturnValue().Set(Integer::New(info.GetIsolate(), uv_os_getppid())); + info.GetReturnValue().Set(uv_os_getppid()); } void GetActiveRequests(const FunctionCallbackInfo& args) { From 1063e0c92cf0283d964a222c78bb0a952f8b55a9 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 24 Nov 2018 00:31:52 +0200 Subject: [PATCH 184/316] lib: fix comment nits in bootstrap\loaders.js PR-URL: https://github.com/nodejs/node/pull/24641 Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann --- lib/internal/bootstrap/loaders.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 78e1180dde2af2..02abc683072ae2 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -19,7 +19,7 @@ // can be created using NODE_MODULE_CONTEXT_AWARE_CPP() with the flag // NM_F_LINKED. // - internalBinding(): the private internal C++ binding loader, inaccessible -// from user land because they are only available from NativeModule.require() +// from user land because they are only available from NativeModule.require(). // These C++ bindings are created using NODE_MODULE_CONTEXT_AWARE_INTERNAL() // and have their nm_flags set to NM_F_INTERNAL. // @@ -61,7 +61,7 @@ keys: ObjectKeys, } = Object; - // Set up process.moduleLoadList + // Set up process.moduleLoadList. const moduleLoadList = []; ObjectDefineProperty(process, 'moduleLoadList', { value: moduleLoadList, @@ -71,7 +71,7 @@ }); // internalBindingWhitelist contains the name of internalBinding modules - // that are whitelisted for access via process.binding()... this is used + // that are whitelisted for access via process.binding()... This is used // to provide a transition path for modules that are being moved over to // internalBinding. const internalBindingWhitelist = [ @@ -105,7 +105,7 @@ // for checking existence in this list. let internalBindingWhitelistSet; - // Set up process.binding() and process._linkedBinding() + // Set up process.binding() and process._linkedBinding(). { const bindingObj = ObjectCreate(null); @@ -133,7 +133,7 @@ }; } - // Set up internalBinding() in the closure + // Set up internalBinding() in the closure. let internalBinding; { const bindingObj = ObjectCreate(null); @@ -147,10 +147,10 @@ }; } - // Create this WeakMap in js-land because V8 has no C++ API for WeakMap + // Create this WeakMap in js-land because V8 has no C++ API for WeakMap. internalBinding('module_wrap').callbackMap = new WeakMap(); - // Set up NativeModule + // Set up NativeModule. function NativeModule(id) { this.filename = `${id}.js`; this.id = id; @@ -184,7 +184,7 @@ if (!NativeModule.exists(id)) { // Model the error off the internal/errors.js model, but // do not use that module given that it could actually be - // the one causing the error if there's a bug in Node.js + // the one causing the error if there's a bug in Node.js. // eslint-disable-next-line no-restricted-syntax const err = new Error(`No such built-in module: ${id}`); err.code = 'ERR_UNKNOWN_BUILTIN_MODULE'; @@ -225,7 +225,7 @@ if (config.exposeInternals) { NativeModule.nonInternalExists = function(id) { - // Do not expose this to user land even with --expose-internals + // Do not expose this to user land even with --expose-internals. if (id === loaderId) { return false; } @@ -233,7 +233,7 @@ }; NativeModule.isInternal = function(id) { - // Do not expose this to user land even with --expose-internals + // Do not expose this to user land even with --expose-internals. return id === loaderId; }; } else { @@ -267,7 +267,7 @@ }; // Provide named exports for all builtin libraries so that the libraries - // may be imported in a nicer way for esm users. The default export is left + // may be imported in a nicer way for ESM users. The default export is left // as the entire namespace (module.exports) and wrapped in a proxy such // that APMs and other behavior are still left intact. NativeModule.prototype.proxifyExports = function() { @@ -352,7 +352,7 @@ NativeModule._cache[this.id] = this; }; - // coverage must be turned on early, so that we can collect + // Coverage must be turned on early, so that we can collect // it for Node.js' own internal libraries. if (process.env.NODE_V8_COVERAGE) { NativeModule.require('internal/process/coverage').setup(); From 955819e0a3aab27bef2f654e9d044f9b39e2815d Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 11 May 2017 12:33:29 +1000 Subject: [PATCH 185/316] build: only check REPLACEME & DEP...X for releases PR-URL: https://github.com/nodejs/node/pull/24575 Refs: https://github.com/nodejs/node/pull/24551 Refs: https://github.com/nodejs/node/pull/12958 Refs: https://github.com/nodejs/node/pull/12957 Refs: https://github.com/nodejs/node/pull/8325 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius Reviewed-By: Richard Lau --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 71378b21f44058..0bd83a21ba045c 100644 --- a/Makefile +++ b/Makefile @@ -817,12 +817,11 @@ MACOSOUTDIR=out/macos .PHONY: release-only release-only: - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ - `grep -q REPLACEME doc/api/*.md`; then \ + @if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \ echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/releases.md)' ; \ exit 1 ; \ fi - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ + @if [ "$(DISTTYPE)" = "release" ] && \ `grep -q DEP...X doc/api/deprecations.md`; then \ echo 'Please update DEP...X in doc/api/deprecations.md (See doc/releases.md)' ; \ exit 1 ; \ From abb1c64c2d83398cf1f0824fc36bccf1f085a47b Mon Sep 17 00:00:00 2001 From: tpanthera Date: Sat, 17 Nov 2018 18:46:19 +0530 Subject: [PATCH 186/316] test: replace anonymous closure functions with arrow functions PR-URL: https://github.com/nodejs/node/pull/24443 Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-http-localaddress.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 6763fae1265ac3..47af784e9a226e 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -28,26 +28,26 @@ if (!common.hasMultiLocalhost()) const http = require('http'); const assert = require('assert'); -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { console.log(`Connect from: ${req.connection.remoteAddress}`); assert.strictEqual(req.connection.remoteAddress, '127.0.0.2'); - req.on('end', function() { + req.on('end', () => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(`You are from: ${req.connection.remoteAddress}`); }); req.resume(); }); -server.listen(0, '127.0.0.1', function() { +server.listen(0, '127.0.0.1', () => { const options = { host: 'localhost', - port: this.address().port, + port: server.address().port, path: '/', method: 'GET', localAddress: '127.0.0.2' }; const req = http.request(options, function(res) { - res.on('end', function() { + res.on('end', () => { server.close(); process.exit(); }); From 1625329fbfc17fbeeb0932b58cbf24b71927129a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 24 Nov 2018 23:06:55 -0800 Subject: [PATCH 187/316] tools,doc: fix version picker bug in html.js The processing of strings like `8.x` into a major version number and a minor version number results in minor versions that are `NaN`. In that situation, since the picker will link to the latest docs in the major version, include the version in the version picker. Fixes: https://github.com/nodejs/node/issues/23979 PR-URL: https://github.com/nodejs/node/pull/24638 Reviewed-By: Vse Mozhet Byt Reviewed-By: Ruben Bridgewater Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann --- test/doctool/test-doctool-html.js | 7 ++++++- test/fixtures/altdocs.md | 2 ++ tools/doc/html.js | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/altdocs.md diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 499034cd8a3684..703a7dcd21acb0 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -95,6 +95,10 @@ const testData = [ html: '
  1. fish
  2. fish
' + '
  • Red fish
  • Blue fish
', }, + { + file: fixtures.path('altdocs.md'), + html: '
  • 8.x', + }, ]; const spaces = /\s/g; @@ -117,7 +121,8 @@ testData.forEach(({ file, html }) => { const actual = output.replace(spaces, ''); // Assert that the input stripped of all whitespace contains the // expected markup. - assert(actual.includes(expected)); + assert(actual.includes(expected), + `ACTUAL: ${actual}\nEXPECTED: ${expected}`); }) ); })); diff --git a/test/fixtures/altdocs.md b/test/fixtures/altdocs.md new file mode 100644 index 00000000000000..f5320533ad699c --- /dev/null +++ b/test/fixtures/altdocs.md @@ -0,0 +1,2 @@ +# ALTDOCS + diff --git a/tools/doc/html.js b/tools/doc/html.js index 9c9c355574d4e5..ce53bceaa24a15 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -427,6 +427,7 @@ function altDocs(filename, docCreated) { const [versionMajor, versionMinor] = version.num.split('.').map(Number); if (docCreatedMajor > versionMajor) return false; if (docCreatedMajor < versionMajor) return true; + if (Number.isNaN(versionMinor)) return true; return docCreatedMinor <= versionMinor; } From 2ebb32b4806e2169338802fa3ba72b7e3d8354c3 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 22 Nov 2018 17:36:17 +0100 Subject: [PATCH 188/316] doc: document fs.write limitation with TTY Fixes: https://github.com/nodejs/node/issues/24550 PR-URL: https://github.com/nodejs/node/pull/24571 Reviewed-By: Refael Ackermann Reviewed-By: Michael Dawson Reviewed-By: Gireesh Punathil Reviewed-By: Bartosz Sosnowski --- doc/api/fs.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index e73fd1ad26ed27..f7727e88008771 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3528,6 +3528,13 @@ On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file. +On Windows, if the file descriptor is connected to the console (e.g. `fd == 1` +or `stdout`) a string containing non-ASCII characters will not be rendered +properly by default, regardless of the encoding used. +It is possible to configure the console to render UTF-8 properly by changing the +active codepage with the `chcp 65001` command. See the [chcp][] docs for more +details. + ## fs.writeFile(file, data[, options], callback) + +* {number} **Default:** `40000` + +Limit the amount of time the parser will wait to receive the complete HTTP +headers. + +In case of inactivity, the rules defined in [`server.timeout`][] apply. However, +that inactivity based timeout would still allow the connection to be kept open +if the headers are being sent very slowly (by default, up to a byte per 2 +minutes). In order to prevent this, whenever header data arrives an additional +check is made that more than `server.headersTimeout` milliseconds has not +passed since the connection was established. If the check fails, a `'timeout'` +event is emitted on the server object, and (by default) the socket is destroyed. +See [`server.timeout`][] for more information on how timeout behavior can be +customized. + ### server.listen() Starts the HTTP server listening for connections. @@ -958,26 +978,6 @@ added: v0.7.0 Limits maximum incoming headers count. If set to 0, no limit will be applied. -### server.headersTimeout - - -* {number} **Default:** `40000` - -Limit the amount of time the parser will wait to receive the complete HTTP -headers. - -In case of inactivity, the rules defined in [server.timeout][] apply. However, -that inactivity based timeout would still allow the connection to be kept open -if the headers are being sent very slowly (by default, up to a byte per 2 -minutes). In order to prevent this, whenever header data arrives an additional -check is made that more than `server.headersTimeout` milliseconds has not -passed since the connection was established. If the check fails, a `'timeout'` -event is emitted on the server object, and (by default) the socket is destroyed. -See [server.timeout][] for more information on how timeout behaviour can be -customised. - ### server.setTimeout([msecs][, callback]) +- {number} **Default:** `40000` + +See [`http.Server#headersTimeout`][]. + ### server.listen() Starts the HTTPS server listening for encrypted connections. @@ -44,12 +52,6 @@ This method is identical to [`server.listen()`][] from [`net.Server`][]. See [`http.Server#maxHeadersCount`][]. -### server.headersTimeout - -- {number} **Default:** `40000` - -See [`http.Server#headersTimeout`][]. - ### server.setTimeout([msecs][, callback]) Too much HTTP header data was received. In order to protect against malicious or -malconfigured clients, if more than 80KB of HTTP header data is received then +malconfigured clients, if more than 8KB of HTTP header data is received then HTTP parsing will abort without a request or response object being created, and an `Error` with this code will be emitted. From 053f3d6289d8b886a55732630a25bcc23d4bb1d6 Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 28 Nov 2018 12:55:36 -0800 Subject: [PATCH 210/316] test: validate fs.rename() when NODE_TEST_DIR on separate mount When testing fs.rename() of an non-existent file, use a destination path which is in the same directory. Otherwise we might trigger an `EXDEV` error if NODE_TEST_DIR is a separate device than the current working directory. Fixes: https://github.com/nodejs/node/issues/21669 PR-URL: https://github.com/nodejs/node/pull/24707 Reviewed-By: Rich Trott Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- test/parallel/test-fs-error-messages.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 96ff606cccec4e..dd5438c44bfce9 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -299,10 +299,11 @@ function re(literals, ...values) { return true; }; - fs.rename(nonexistentFile, 'foo', common.mustCall(validateError)); + const destFile = path.join(tmpdir.path, 'foo'); + fs.rename(nonexistentFile, destFile, common.mustCall(validateError)); assert.throws( - () => fs.renameSync(nonexistentFile, 'foo'), + () => fs.renameSync(nonexistentFile, destFile), validateError ); } From 1c4bc8638876872151d638d82ab4c0fcc6248824 Mon Sep 17 00:00:00 2001 From: nakashima Date: Sat, 24 Nov 2018 16:27:50 +0900 Subject: [PATCH 211/316] lib: chenged anonymous function to arrow function PR-URL: https://github.com/nodejs/node/pull/24605 Reviewed-By: Anna Henningsen Reviewed-By: Masashi Hirano Reviewed-By: Shingo Inoue --- lib/internal/process/warning.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js index 131d479474f248..637b9ffb54b406 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -20,14 +20,14 @@ function writeOut(message) { } function onClose(fd) { - return function() { + return () => { if (fs === null) fs = require('fs'); fs.close(fd, nop); }; } function onOpen(cb) { - return function(err, fd) { + return (err, fd) => { acquiringFd = false; if (fd !== undefined) { cachedFd = fd; @@ -41,7 +41,7 @@ function onOpen(cb) { function onAcquired(message) { // make a best effort attempt at writing the message // to the fd. Errors are ignored at this point. - return function(err, fd) { + return (err, fd) => { if (err) return writeOut(message); if (fs === null) fs = require('fs'); @@ -70,7 +70,7 @@ function output(message) { } function doEmitWarning(warning) { - return function() { + return () => { process.emit('warning', warning); }; } @@ -104,7 +104,7 @@ function setupProcessWarnings() { // process.emitWarning(error) // process.emitWarning(str[, type[, code]][, ctor]) // process.emitWarning(str[, options]) - process.emitWarning = function(warning, type, code, ctor, now) { + process.emitWarning = (warning, type, code, ctor, now) => { let detail; if (type !== null && typeof type === 'object' && !Array.isArray(type)) { ctor = type.ctor; From c26b10caeb55e74a696d40157e55773997f6655b Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sat, 24 Nov 2018 16:38:22 +0900 Subject: [PATCH 212/316] src: migrate to new V8 array API This change migrates the deprecated V8 Array API to new APIs. PR-URL: https://github.com/nodejs/node/pull/24613 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Gus Caplan Reviewed-By: Tiancheng "Timothy" Gu --- src/node_util.cc | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/node_util.cc b/src/node_util.cc index 1a08c0e255f8d3..496b6cbbcb1573 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -64,13 +64,13 @@ static void GetPromiseDetails(const FunctionCallbackInfo& args) { auto isolate = args.GetIsolate(); Local promise = args[0].As(); - Local ret = Array::New(isolate, 2); int state = promise->State(); - ret->Set(env->context(), 0, Integer::New(isolate, state)).FromJust(); + Local values[2] = { Integer::New(isolate, state) }; + size_t number_of_values = 1; if (state != Promise::PromiseState::kPending) - ret->Set(env->context(), 1, promise->Result()).FromJust(); - + values[number_of_values++] = promise->Result(); + Local ret = Array::New(isolate, values, number_of_values); args.GetReturnValue().Set(ret); } @@ -82,11 +82,13 @@ static void GetProxyDetails(const FunctionCallbackInfo& args) { Local proxy = args[0].As(); - Local ret = Array::New(args.GetIsolate(), 2); - ret->Set(env->context(), 0, proxy->GetTarget()).FromJust(); - ret->Set(env->context(), 1, proxy->GetHandler()).FromJust(); + Local ret[] = { + proxy->GetTarget(), + proxy->GetHandler() + }; - args.GetReturnValue().Set(ret); + args.GetReturnValue().Set( + Array::New(args.GetIsolate(), ret, arraysize(ret))); } static void PreviewEntries(const FunctionCallbackInfo& args) { @@ -101,11 +103,13 @@ static void PreviewEntries(const FunctionCallbackInfo& args) { // Fast path for WeakMap, WeakSet and Set iterators. if (args.Length() == 1) return args.GetReturnValue().Set(entries); - Local ret = Array::New(env->isolate(), 2); - ret->Set(env->context(), 0, entries).FromJust(); - ret->Set(env->context(), 1, Boolean::New(env->isolate(), is_key_value)) - .FromJust(); - return args.GetReturnValue().Set(ret); + + Local ret[] = { + entries, + Boolean::New(env->isolate(), is_key_value) + }; + return args.GetReturnValue().Set( + Array::New(env->isolate(), ret, arraysize(ret))); } // Side effect-free stringification that will never throw exceptions. From 97b803fa13c869e180e88a81ea0116639d07fdcf Mon Sep 17 00:00:00 2001 From: /Jesse Date: Sat, 24 Nov 2018 16:42:51 +0900 Subject: [PATCH 213/316] lib: change callbacks to arrow function PR-URL: https://github.com/nodejs/node/pull/24625 Reviewed-By: Shingo Inoue Reviewed-By: Masashi Hirano --- lib/internal/bootstrap/node.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 21544bceb463d1..a207dd648f7f7c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -240,7 +240,7 @@ // To allow people to extend Node in different ways, this hook allows // one to drop a file lib/_third_party_main.js into the build // directory which will be executed instead of Node's normal loading. - process.nextTick(function() { + process.nextTick(() => { NativeModule.require('_third_party_main'); }); } else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') { @@ -251,7 +251,7 @@ } // Start the debugger agent. - process.nextTick(function() { + process.nextTick(() => { NativeModule.require('internal/deps/node-inspect/lib/_inspect').start(); }); @@ -304,14 +304,14 @@ if (process._forceRepl || NativeModule.require('tty').isatty(0)) { // REPL const cliRepl = NativeModule.require('internal/repl'); - cliRepl.createInternalRepl(process.env, function(err, repl) { + cliRepl.createInternalRepl(process.env, (err, repl) => { if (err) { throw err; } - repl.on('exit', function() { + repl.on('exit', () => { if (repl._flushing) { repl.pause(); - return repl.once('flushHistory', function() { + return repl.once('flushHistory', () => { process.exit(); }); } @@ -328,7 +328,7 @@ process.stdin.setEncoding('utf8'); let code = ''; - process.stdin.on('data', function(d) { + process.stdin.on('data', (d) => { code += d; }); @@ -567,7 +567,7 @@ emitAfter } = NativeModule.require('internal/async_hooks'); - process._fatalException = function(er) { + process._fatalException = (er) => { // It's possible that defaultTriggerAsyncId was set for a constructor // call that threw and was never cleared. So clear it now. clearDefaultTriggerAsyncId(); From e96c60e472046aa853d54586763f2614cb36494d Mon Sep 17 00:00:00 2001 From: Tadhg Creedon Date: Tue, 6 Nov 2018 16:56:34 +0000 Subject: [PATCH 214/316] test: reach res._dump after abort ClientRequest PR-URL: https://github.com/nodejs/node/pull/24191 Reviewed-By: Ouyang Yadong Reviewed-By: Rich Trott --- .../test-http-client-abort-response-event.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/parallel/test-http-client-abort-response-event.js diff --git a/test/parallel/test-http-client-abort-response-event.js b/test/parallel/test-http-client-abort-response-event.js new file mode 100644 index 00000000000000..c8a80f57884fb7 --- /dev/null +++ b/test/parallel/test-http-client-abort-response-event.js @@ -0,0 +1,22 @@ +'use strict'; +const common = require('../common'); +const http = require('http'); +const net = require('net'); +const server = http.createServer(function(req, res) { + res.end(); +}); + +server.listen(0, common.mustCall(function() { + const req = http.request({ + port: this.address().port + }, common.mustCall()); + + req.on('abort', common.mustCall(function() { + server.close(); + })); + + req.end(); + req.abort(); + + req.emit('response', new http.IncomingMessage(new net.Socket())); +})); From b1d3747b5b82e5ec9b47f9f596f115f161c2bfc5 Mon Sep 17 00:00:00 2001 From: exoego Date: Sat, 24 Nov 2018 16:34:14 +0900 Subject: [PATCH 215/316] lib: convert to arrow function in fs.js PR-URL: https://github.com/nodejs/node/pull/24604 Reviewed-By: Ouyang Yadong Reviewed-By: Shingo Inoue Reviewed-By: Gireesh Punathil --- lib/fs.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index a717d794345698..908132e0501555 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -144,7 +144,7 @@ function makeCallback(cb) { throw new ERR_INVALID_CALLBACK(); } - return function(...args) { + return (...args) => { return Reflect.apply(cb, undefined, args); }; } @@ -157,7 +157,7 @@ function makeStatsCallback(cb) { throw new ERR_INVALID_CALLBACK(); } - return function(err, stats) { + return (err, stats) => { if (err) return cb(err); cb(err, getStatsFromBinding(stats)); }; @@ -631,11 +631,11 @@ function truncate(path, len, callback) { validateInteger(len, 'len'); callback = maybeCallback(callback); - fs.open(path, 'r+', function(er, fd) { + fs.open(path, 'r+', (er, fd) => { if (er) return callback(er); const req = new FSReqCallback(); req.oncomplete = function oncomplete(er) { - fs.close(fd, function(er2) { + fs.close(fd, (er2) => { callback(er || er2); }); }; @@ -995,15 +995,15 @@ function fchmodSync(fd, mode) { function lchmod(path, mode, callback) { callback = maybeCallback(callback); - fs.open(path, O_WRONLY | O_SYMLINK, function(err, fd) { + fs.open(path, O_WRONLY | O_SYMLINK, (err, fd) => { if (err) { callback(err); return; } // Prefer to return the chmod error, if one occurs, // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function(err) { - fs.close(fd, function(err2) { + fs.fchmod(fd, mode, (err) => { + fs.close(fd, (err2) => { callback(err || err2); }); }); @@ -1152,7 +1152,7 @@ function futimesSync(fd, atime, mtime) { function writeAll(fd, isUserFd, buffer, offset, length, position, callback) { // write(fd, buffer, offset, length, position, callback) - fs.write(fd, buffer, offset, length, position, function(writeErr, written) { + fs.write(fd, buffer, offset, length, position, (writeErr, written) => { if (writeErr) { if (isUserFd) { callback(writeErr); @@ -1188,7 +1188,7 @@ function writeFile(path, data, options, callback) { return; } - fs.open(path, flag, options.mode, function(openErr, fd) { + fs.open(path, flag, options.mode, (openErr, fd) => { if (openErr) { callback(openErr); } else { @@ -1531,7 +1531,7 @@ function realpathSync(p, options) { } -realpathSync.native = function(path, options) { +realpathSync.native = (path, options) => { options = getOptions(options, {}); path = toPathIfFileURL(path); validatePath(path); @@ -1572,7 +1572,7 @@ function realpath(p, options, callback) { // On windows, check that the root exists. On unix there is no need. if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err, stats) { + fs.lstat(base, (err, stats) => { if (err) return callback(err); knownHard[base] = true; LOOP(); @@ -1636,10 +1636,10 @@ function realpath(p, options, callback) { return gotTarget(null, seenLinks[id], base); } } - fs.stat(base, function(err) { + fs.stat(base, (err) => { if (err) return callback(err); - fs.readlink(base, function(err, target) { + fs.readlink(base, (err, target) => { if (!isWindows) seenLinks[id] = target; gotTarget(err, target); }); @@ -1660,7 +1660,7 @@ function realpath(p, options, callback) { // On windows, check that the root exists. On unix there is no need. if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { + fs.lstat(base, (err) => { if (err) return callback(err); knownHard[base] = true; LOOP(); @@ -1672,7 +1672,7 @@ function realpath(p, options, callback) { } -realpath.native = function(path, options, callback) { +realpath.native = (path, options, callback) => { callback = makeCallback(callback || options); options = getOptions(options, {}); path = toPathIfFileURL(path); From b554ff762073175641db8c8af4e4e56447df65d4 Mon Sep 17 00:00:00 2001 From: kohta ito Date: Sat, 24 Nov 2018 17:02:10 +0900 Subject: [PATCH 216/316] src: replace create new Array PR-URL: https://github.com/nodejs/node/pull/24618 Reviewed-By: Anna Henningsen Reviewed-By: Shingo Inoue Reviewed-By: Gus Caplan Reviewed-By: Gireesh Punathil Reviewed-By: Masashi Hirano --- src/node_serdes.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 0a410944458d99..afeaebdeb29e1d 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -399,10 +399,11 @@ void DeserializerContext::ReadUint64(const FunctionCallbackInfo& args) { Isolate* isolate = ctx->env()->isolate(); Local context = ctx->env()->context(); - Local ret = Array::New(isolate, 2); - ret->Set(context, 0, Integer::NewFromUnsigned(isolate, hi)).FromJust(); - ret->Set(context, 1, Integer::NewFromUnsigned(isolate, lo)).FromJust(); - return args.GetReturnValue().Set(ret); + Local ret[] = { + Integer::NewFromUnsigned(isolate, hi), + Integer::NewFromUnsigned(isolate, lo) + }; + return args.GetReturnValue().Set(Array::New(isolate, ret, arraysize(ret))); } void DeserializerContext::ReadDouble(const FunctionCallbackInfo& args) { From a122ba598e835612dd620fce1292cfb999399d97 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 24 Nov 2018 14:16:54 +0900 Subject: [PATCH 217/316] src: simplify LibuvStreamWrap::DoWrite PR-URL: https://github.com/nodejs/node/pull/24588 Reviewed-By: Gus Caplan Reviewed-By: Colin Ihrig --- src/stream_wrap.cc | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index c7d5e2f23ff900..0435ae3ac1e906 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -359,25 +359,12 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap, size_t count, uv_stream_t* send_handle) { LibuvWriteWrap* w = static_cast(req_wrap); - int r; - if (send_handle == nullptr) { - r = w->Dispatch(uv_write, stream(), bufs, count, AfterUvWrite); - } else { - r = w->Dispatch(uv_write2, - stream(), - bufs, - count, - send_handle, - AfterUvWrite); - } - - if (!r) { - size_t bytes = 0; - for (size_t i = 0; i < count; i++) - bytes += bufs[i].len; - } - - return r; + return w->Dispatch(uv_write2, + stream(), + bufs, + count, + send_handle, + AfterUvWrite); } From 969ae7a5987000c74a5f2d7676ad024f75912310 Mon Sep 17 00:00:00 2001 From: rt33 Date: Sat, 24 Nov 2018 17:13:22 +0900 Subject: [PATCH 218/316] test: fix the arguments order in `assert.strictEqual` PR-URL: https://github.com/nodejs/node/pull/24626 Reviewed-By: Gireesh Punathil Reviewed-By: Shingo Inoue Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Franziska Hinkelmann --- test/parallel/test-http-request-end.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-request-end.js b/test/parallel/test-http-request-end.js index a0cdcf27dd03a9..c9278945b7993b 100644 --- a/test/parallel/test-http-request-end.js +++ b/test/parallel/test-http-request-end.js @@ -35,7 +35,7 @@ const server = http.Server(function(req, res) { }); req.on('end', function() { - assert.strictEqual(expected, result); + assert.strictEqual(result, expected); server.close(); res.writeHead(200); res.end('hello world\n'); From 603bc2751e72b784c2b01c89d33241ddf6d7f9fb Mon Sep 17 00:00:00 2001 From: sigwyg Date: Sat, 24 Nov 2018 17:11:57 +0900 Subject: [PATCH 219/316] test: fix the arguments order in assert.strictEqual I working at "Code and Learn" on Node fest 2018 in Japan. Refs: https://github.com/nodejs/node/pull/24431 PR-URL: https://github.com/nodejs/node/pull/24624 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Shingo Inoue Reviewed-By: Masashi Hirano --- test/parallel/test-fs-write-string-coerce.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js index 4581c319277a78..b9ac82aec026c5 100644 --- a/test/parallel/test-fs-write-string-coerce.js +++ b/test/parallel/test-fs-write-string-coerce.js @@ -17,12 +17,12 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { fs.write(fd, data, 0, 'utf8', common.mustCall(function(err, written) { console.log('write done'); assert.ifError(err); - assert.strictEqual(Buffer.byteLength(expected), written); + assert.strictEqual(written, Buffer.byteLength(expected)); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); console.log(`expected: "${expected}"`); console.log(`found: "${found}"`); fs.unlinkSync(fn); - assert.strictEqual(expected, found); + assert.strictEqual(found, expected); })); })); From 899e7c30b024595b52f86433ae8e4ecf0612fd49 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Tue, 19 Jun 2018 21:17:46 +0200 Subject: [PATCH 220/316] win, build: skip building cctest by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vcbuild will build cctest only if it will be run, or for CI and release builds PR-URL: https://github.com/nodejs/node/pull/21408 Reviewed-By: João Reis Reviewed-By: Refael Ackermann --- vcbuild.bat | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index a22c756200bf17..11f623ad0d35c1 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -55,13 +55,14 @@ set http2_debug= set nghttp2_debug= set link_module= set no_cctest= +set cctest= set openssl_no_asm= set doc= :next-arg if "%1"=="" goto args-done if /i "%1"=="debug" set config=Debug&goto arg-ok -if /i "%1"=="release" set config=Release&set ltcg=1&set "pch="&goto arg-ok +if /i "%1"=="release" set config=Release&set ltcg=1&set "pch="&set cctest=1&goto arg-ok if /i "%1"=="clean" set target=Clean&goto arg-ok if /i "%1"=="ia32" set target_arch=x86&goto arg-ok if /i "%1"=="x86" set target_arch=x86&goto arg-ok @@ -125,6 +126,7 @@ if /i "%1"=="no-NODE-OPTIONS" set no_NODE_OPTIONS=1&goto arg-ok if /i "%1"=="debug-nghttp2" set debug_nghttp2=1&goto arg-ok if /i "%1"=="link-module" set "link_module= --link-module=%2%link_module%"&goto arg-ok-2 if /i "%1"=="no-cctest" set no_cctest=1&goto arg-ok +if /i "%1"=="cctest" set cctest=1&goto arg-ok if /i "%1"=="openssl-no-asm" set openssl_no_asm=1&goto arg-ok if /i "%1"=="doc" set doc=1&goto arg-ok @@ -151,6 +153,7 @@ if defined build_release ( set download_arg="--download=all" set i18n_arg=small-icu set projgen=1 + set cctest=1 set ltcg=1 set "pch=" ) @@ -301,7 +304,12 @@ set "msbcpu=/m:2" if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1" set "msbplatform=Win32" if "%target_arch%"=="x64" set "msbplatform=x64" -if "%target%"=="Build" if defined no_cctest set target=node +if "%target%"=="Build" ( + if defined no_cctest set target=rename_node_bin_win + if "%test_args%"=="" set target=rename_node_bin_win + if defined cctest set target="Build" +) +if "%target%"=="rename_node_bin_win" if exist "%config%\cctest.exe" del "%config%\cctest.exe" msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 ( if not defined project_generated echo Building Node with reused solution failed. To regenerate project files use "vcbuild projgen" @@ -533,7 +541,7 @@ if "%test_args%"=="" goto test-v8 if "%config%"=="Debug" set test_args=--mode=debug %test_args% if "%config%"=="Release" set test_args=--mode=release %test_args% if defined no_cctest echo Skipping cctest because no-cctest was specified && goto run-test-py -if not exist %config%\cctest.exe goto run-test-py +if not exist "%config%\cctest.exe" echo cctest.exe not found. Run "vcbuild test" or "vcbuild cctest" to build it. && goto run-test-py echo running 'cctest %cctest_args%' "%config%\cctest" %cctest_args% :run-test-py @@ -635,7 +643,7 @@ del .used_configure_flags goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build From 383d8092b1faf8380966ae35cf6e6ae9399f5fbc Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 21 Nov 2018 14:28:24 +0100 Subject: [PATCH 221/316] build, tools, win: add .S files support to GYP Makes GYP properly handle .S files. Fixes: https://github.com/nodejs/node-v8/issues/89 PR-URL: https://github.com/nodejs/node/pull/24553 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen --- tools/gyp/pylib/gyp/generator/msvs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py index 8fe9e5af23dd38..923e897e486f7c 100644 --- a/tools/gyp/pylib/gyp/generator/msvs.py +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -2156,6 +2156,7 @@ def _MapFileToMsBuildSourceType(source, rule_dependencies, A pair of (group this file should be part of, the label of element) """ _, ext = os.path.splitext(source) + ext = ext.lower() if ext in extension_to_rule_name: group = 'rule' element = extension_to_rule_name[ext] @@ -2168,7 +2169,7 @@ def _MapFileToMsBuildSourceType(source, rule_dependencies, elif ext == '.rc': group = 'resource' element = 'ResourceCompile' - elif ext == '.asm': + elif ext in ['.s', '.asm']: group = 'masm' element = 'MASM' elif ext == '.idl': From 1035e36de625b19b11d3b0ae9286c6acc33b99c7 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Thu, 29 Nov 2018 10:15:46 +0530 Subject: [PATCH 222/316] test: mark test-vm-timeout-escape-nexttick flaky This is a known failure so mark it such, so that CI is green / amber while the issue is being progressed. PR-URL: https://github.com/nodejs/node/pull/24712 Refs: https://github.com/nodejs/node/pull/24620 Refs: https://github.com/nodejs/node/issues/24120 Reviewed-By: Rich Trott Reviewed-By: Richard Lau --- test/known_issues/known_issues.status | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/known_issues/known_issues.status b/test/known_issues/known_issues.status index a1f66fc6d96fc2..3463f0a0ecfc6a 100644 --- a/test/known_issues/known_issues.status +++ b/test/known_issues/known_issues.status @@ -18,3 +18,7 @@ test-vm-timeout-escape-promise: PASS,FLAKY [$system==freebsd] [$system==aix] + +[$arch==arm] +# https://github.com/nodejs/node/issues/24120 +test-vm-timeout-escape-nexttick: PASS,FLAKY From effe30777b6744272ea2d08989321f51e98b29cf Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 26 Nov 2018 19:40:09 +0900 Subject: [PATCH 223/316] process: fix omitting `--` from `process.execArgv` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was essentially a typo that went unnoticed because we didn’t have tests for this particular situation. Fixes: https://github.com/nodejs/node/issues/24647 PR-URL: https://github.com/nodejs/node/pull/24654 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gus Caplan Reviewed-By: Franziska Hinkelmann --- src/node_options-inl.h | 2 +- test/parallel/test-process-exec-argv.js | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/node_options-inl.h b/src/node_options-inl.h index 277121036e519d..468368ac84f630 100644 --- a/src/node_options-inl.h +++ b/src/node_options-inl.h @@ -253,7 +253,7 @@ struct ArgsInfo { // on the command line (i.e. not generated through alias expansion). // '--' is a special case here since its purpose is to end `exec_argv`, // which is why we do not include it. - if (exec_args != nullptr && first() != "--") + if (exec_args != nullptr && ret != "--") exec_args->push_back(ret); underlying->erase(underlying->begin() + 1); } else { diff --git a/test/parallel/test-process-exec-argv.js b/test/parallel/test-process-exec-argv.js index fec5699933d6f4..578ee7b5d1a5e3 100644 --- a/test/parallel/test-process-exec-argv.js +++ b/test/parallel/test-process-exec-argv.js @@ -27,16 +27,19 @@ const spawn = require('child_process').spawn; if (process.argv[2] === 'child') { process.stdout.write(JSON.stringify(process.execArgv)); } else { - const execArgv = ['--stack-size=256']; - const args = [__filename, 'child', 'arg0']; - const child = spawn(process.execPath, execArgv.concat(args)); - let out = ''; + for (const extra of [ [], [ '--' ] ]) { + const execArgv = ['--stack-size=256']; + const args = [__filename, 'child', 'arg0']; + const child = spawn(process.execPath, [...execArgv, ...extra, ...args]); + let out = ''; - child.stdout.on('data', function(chunk) { - out += chunk; - }); + child.stdout.setEncoding('utf8'); + child.stdout.on('data', function(chunk) { + out += chunk; + }); - child.on('close', function() { - assert.deepStrictEqual(JSON.parse(out), execArgv); - }); + child.on('close', function() { + assert.deepStrictEqual(JSON.parse(out), execArgv); + }); + } } From d5bf7362b9eb81d09b0b45b1686235013dd44921 Mon Sep 17 00:00:00 2001 From: pastak Date: Sat, 24 Nov 2018 16:55:33 +0900 Subject: [PATCH 224/316] test: fix the arguments order in assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/24620 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Shingo Inoue Reviewed-By: Masashi Hirano --- test/parallel/test-stream-writable-destroy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 565a5564e2bc29..a88bf9ab2424e7 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -189,7 +189,7 @@ const { inherits } = require('util'); const expected = new Error('kaboom'); write.destroy(expected, common.mustCall(function(err) { - assert.strictEqual(expected, err); + assert.strictEqual(err, expected); })); } From 61e0103d60aa6d18f5f71879e34da48ff26fcef1 Mon Sep 17 00:00:00 2001 From: Sebastiaan Deckers Date: Tue, 27 Nov 2018 10:45:51 +0800 Subject: [PATCH 225/316] http2: add compat support for nested array headers writeHead supports an array of arrays containing header name and values. Compatibility between http2 & http1 even though this is not documented. Fixes: https://github.com/nodejs/node/issues/24466 PR-URL: https://github.com/nodejs/node/pull/24665 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- lib/internal/http2/compat.js | 10 ++++- ...2-compat-serverresponse-writehead-array.js | 42 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-http2-compat-serverresponse-writehead-array.js diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 145e77410494b6..464f1141066c3a 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -574,10 +574,16 @@ class Http2ServerResponse extends Stream { if (headers === undefined && typeof statusMessage === 'object') headers = statusMessage; - if (typeof headers === 'object') { + var i; + if (Array.isArray(headers)) { + for (i = 0; i < headers.length; i++) { + const header = headers[i]; + this[kSetHeader](header[0], header[1]); + } + } else if (typeof headers === 'object') { const keys = Object.keys(headers); let key = ''; - for (var i = 0; i < keys.length; i++) { + for (i = 0; i < keys.length; i++) { key = keys[i]; this[kSetHeader](key, headers[key]); } diff --git a/test/parallel/test-http2-compat-serverresponse-writehead-array.js b/test/parallel/test-http2-compat-serverresponse-writehead-array.js new file mode 100644 index 00000000000000..e024f8ab3952f0 --- /dev/null +++ b/test/parallel/test-http2-compat-serverresponse-writehead-array.js @@ -0,0 +1,42 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); +const h2 = require('http2'); + +// Http2ServerResponse.writeHead should support nested arrays + +const server = h2.createServer(); +server.listen(0, common.mustCall(() => { + const port = server.address().port; + server.once('request', common.mustCall((request, response) => { + response.writeHead(200, [ + ['foo', 'bar'], + ['ABC', 123] + ]); + response.end(common.mustCall(() => { server.close(); })); + })); + + const url = `http://localhost:${port}`; + const client = h2.connect(url, common.mustCall(() => { + const headers = { + ':path': '/', + ':method': 'GET', + ':scheme': 'http', + ':authority': `localhost:${port}` + }; + const request = client.request(headers); + request.on('response', common.mustCall((headers) => { + assert.strictEqual(headers.foo, 'bar'); + assert.strictEqual(headers.abc, '123'); + assert.strictEqual(headers[':status'], 200); + }, 1)); + request.on('end', common.mustCall(() => { + client.close(); + })); + request.end(); + request.resume(); + })); +})); From b809fa8571bbf5dc49cebdc127ac0987f09704b8 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 27 Nov 2018 09:24:48 +0100 Subject: [PATCH 226/316] stream: make async iterator .next() always resolve See: https://github.com/nodejs/readable-stream/issues/387 PR-URL: https://github.com/nodejs/node/pull/24668 Reviewed-By: Gus Caplan Reviewed-By: Franziska Hinkelmann Reviewed-By: Joyee Cheung Reviewed-By: Ruben Bridgewater --- lib/internal/streams/async_iterator.js | 15 +++-- .../test-stream-readable-async-iterators.js | 65 +++++++++++++++++++ 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index 7eaef69508690d..cc8e218498f995 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -39,6 +39,11 @@ function onReadable(iter) { function wrapForNext(lastPromise, iter) { return (resolve, reject) => { lastPromise.then(() => { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); }, reject); }; @@ -61,7 +66,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ } if (this[kEnded]) { - return Promise.resolve(createIterResult(null, true)); + return Promise.resolve(createIterResult(undefined, true)); } if (this[kStream].destroyed) { @@ -74,7 +79,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ if (this[kError]) { reject(this[kError]); } else { - resolve(createIterResult(null, true)); + resolve(createIterResult(undefined, true)); } }); }); @@ -115,7 +120,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ reject(err); return; } - resolve(createIterResult(null, true)); + resolve(createIterResult(undefined, true)); }); }); }, @@ -131,7 +136,6 @@ const createReadableStreamAsyncIterator = (stream) => { value: stream._readableState.endEmitted, writable: true }, - [kLastPromise]: { value: null, writable: true }, // the function passed to new Promise // is cached so we avoid allocating a new // closure at every run @@ -151,6 +155,7 @@ const createReadableStreamAsyncIterator = (stream) => { writable: true, }, }); + iterator[kLastPromise] = null; finished(stream, (err) => { if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { @@ -172,7 +177,7 @@ const createReadableStreamAsyncIterator = (stream) => { iterator[kLastPromise] = null; iterator[kLastResolve] = null; iterator[kLastReject] = null; - resolve(createIterResult(null, true)); + resolve(createIterResult(undefined, true)); } iterator[kEnded] = true; }); diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index 83540de9defea3..aca1e5bcc9d18d 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -393,6 +393,71 @@ async function tests() { r.destroy(null); } })(); + + await (async () => { + console.log('all next promises must be resolved on end'); + const r = new Readable({ + objectMode: true, + read() { + } + }); + + const b = r[Symbol.asyncIterator](); + const c = b.next(); + const d = b.next(); + r.push(null); + assert.deepStrictEqual(await c, { done: true, value: undefined }); + assert.deepStrictEqual(await d, { done: true, value: undefined }); + })(); + + await (async () => { + console.log('all next promises must be resolved on destroy'); + const r = new Readable({ + objectMode: true, + read() { + } + }); + + const b = r[Symbol.asyncIterator](); + const c = b.next(); + const d = b.next(); + r.destroy(); + assert.deepStrictEqual(await c, { done: true, value: undefined }); + assert.deepStrictEqual(await d, { done: true, value: undefined }); + })(); + + await (async () => { + console.log('all next promises must be resolved on destroy with error'); + const r = new Readable({ + objectMode: true, + read() { + } + }); + + const b = r[Symbol.asyncIterator](); + const c = b.next(); + const d = b.next(); + const err = new Error('kaboom'); + r.destroy(err); + + await Promise.all([(async () => { + let e; + try { + await c; + } catch (_e) { + e = _e; + } + assert.strictEqual(e, err); + })(), (async () => { + let e; + try { + await d; + } catch (_e) { + e = _e; + } + assert.strictEqual(e, err); + })()]); + })(); } // to avoid missing some tests if a promise does not resolve From 654bd65464bb54ce57c49fe1c7b1b1774edf21fd Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Mon, 26 Nov 2018 11:35:51 +0900 Subject: [PATCH 227/316] doc: remove trailing whitespace Backport-PR-URL: https://github.com/nodejs/node/pull/24699 PR-URL: https://github.com/nodejs/node/pull/24642 Reviewed-By: Refael Ackermann Reviewed-By: Franziska Hinkelmann Reviewed-By: Rich Trott --- README.md | 2 +- doc/changelogs/CHANGELOG_V8.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7b38c43fe7a63c..ad096cb9616653 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The open source license grants you the freedom to use Node.js. It does not guarantee commitments of other people's time. Please be respectful and manage your expectations. -## Release Types +## Release Types * **Current**: Under active development. Code for the Current release is in the branch for its major version number (for example, diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index dae53fb97ec425..34dda640b26ad7 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -83,7 +83,7 @@ will be supported actively until April 2019 and maintained until December 2019. - support as and as+ flags in stringToFlags() (Sarat Addepalli) [#18801](https://github.com/nodejs/node/pull/18801) - emit 'ready' for fs streams and sockets (Sameer Srivastava) [#19408](https://github.com/nodejs/node/pull/19408) * **http, http2**: - - add options to http.createServer() (Peter Marton) [#15752](https://github.com/nodejs/node/pull/15752)- + - add options to http.createServer() (Peter Marton) [#15752](https://github.com/nodejs/node/pull/15752)- - add 103 Early Hints status code (Yosuke Furukawa) [#16644](https://github.com/nodejs/node/pull/16644) - add http fallback options to .createServer (Peter Marton) [#15752](https://github.com/nodejs/node/pull/15752) * **n-api**: @@ -250,7 +250,7 @@ will be supported actively until April 2019 and maintained until December 2019. * [[`e17f05a817`](https://github.com/nodejs/node/commit/e17f05a817)] - **src**: create per-isolate strings after platform setup (Ulan Degenbaev) [#20175](https://github.com/nodejs/node/pull/20175) * [[`d38ccbb07f`](https://github.com/nodejs/node/commit/d38ccbb07f)] - **src**: use `unordered\_map` for perf marks (Anna Henningsen) [#19558](https://github.com/nodejs/node/pull/19558) * [[`553e34ef9c`](https://github.com/nodejs/node/commit/553e34ef9c)] - **src**: simplify http2 perf tracking code (Anna Henningsen) [#19470](https://github.com/nodejs/node/pull/19470) -* [[`67182912d7`](https://github.com/nodejs/node/commit/67182912d7)] - **src**: add "icu::" prefix before ICU symbols (Steven R. Loomis) +* [[`67182912d7`](https://github.com/nodejs/node/commit/67182912d7)] - **src**: add "icu::" prefix before ICU symbols (Steven R. Loomis) * [[`2cf263519a`](https://github.com/nodejs/node/commit/2cf263519a)] - **src**: use unique\_ptr for scheduled delayed tasks (Franziska Hinkelmann) [#17083](https://github.com/nodejs/node/pull/17083) * [[`2148b1921e`](https://github.com/nodejs/node/commit/2148b1921e)] - **src**: use unique\_ptr in platform implementation (Franziska Hinkelmann) [#16970](https://github.com/nodejs/node/pull/16970) * [[`e9327541e1`](https://github.com/nodejs/node/commit/e9327541e1)] - **src**: cancel pending delayed platform tasks on exit (Anna Henningsen) [#16700](https://github.com/nodejs/node/pull/16700) From e7fbdf5784123e3c6066ad474657348fd8126c96 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Sun, 25 Nov 2018 21:21:30 +0900 Subject: [PATCH 228/316] tools: update remark-preset-lint-node to v1.3.1 Backport-PR-URL: https://github.com/nodejs/node/pull/24699 PR-URL: https://github.com/nodejs/node/pull/24642 Reviewed-By: Refael Ackermann Reviewed-By: Franziska Hinkelmann Reviewed-By: Rich Trott --- tools/lint-md.js | 213 +++++++++++------- .../node-lint-md-cli-rollup/package-lock.json | 33 ++- tools/node-lint-md-cli-rollup/package.json | 2 +- 3 files changed, 157 insertions(+), 91 deletions(-) diff --git a/tools/lint-md.js b/tools/lint-md.js index 79391bed3cc41f..03d12efbd270f7 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -30708,64 +30708,91 @@ var remark = unified_1() .use(remarkStringify) .freeze(); -const name = "remark"; -const version$1 = "10.0.0"; -const description = "Markdown processor powered by plugins"; -const license = "MIT"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; -const homepage = "http://remark.js.org"; -const repository = "https://github.com/remarkjs/remark/tree/master/packages/remark"; -const bugs = "https://github.com/remarkjs/remark/issues"; -const author = "Titus Wormer (http://wooorm.com)"; -const contributors = ["Titus Wormer (http://wooorm.com)"]; -const files = ["index.js"]; +const _args = [["remark@10.0.0","/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"]]; +const _from = "remark@10.0.0"; +const _id = "remark@10.0.0"; +const _inBundle = false; +const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; +const _location = "/remark"; +const _phantomChildren = {}; +const _requested = {"type":"version","registry":true,"raw":"remark@10.0.0","name":"remark","escapedName":"remark","rawSpec":"10.0.0","saveSpec":null,"fetchSpec":"10.0.0"}; +const _requiredBy = ["/"]; +const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; +const _spec = "10.0.0"; +const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"; +const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; +const bugs = {"url":"https://github.com/remarkjs/remark/issues"}; +const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; +const description = "Markdown processor powered by plugins"; const devDependencies = {"tape":"^4.9.1"}; +const files = ["index.js"]; +const homepage = "http://remark.js.org"; +const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; +const license = "MIT"; +const name = "remark"; +const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"}; const scripts = {"test":"tape test.js"}; +const version$1 = "10.0.0"; const xo = false; -const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; -const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; -const _from = "remark@10.0.0"; var _package = { - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - homepage: homepage, - repository: repository, - bugs: bugs, + _args: _args, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, contributors: contributors, - files: files, dependencies: dependencies, + description: description, devDependencies: devDependencies, + files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, - xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from + version: version$1, + xo: xo }; var _package$1 = Object.freeze({ - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - homepage: homepage, - repository: repository, - bugs: bugs, + _args: _args, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, contributors: contributors, - files: files, dependencies: dependencies, + description: description, devDependencies: devDependencies, + files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, + version: version$1, xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from, default: _package }); @@ -30773,7 +30800,7 @@ const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for node markdown linting"; const version$2 = "1.0.0"; const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.2.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; +const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.3.1","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; var _package$2 = { name: name$1, @@ -32692,50 +32719,56 @@ function noAutoLinkWithoutProtocol(tree, file) { } } -var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret); +var remarkLintNoBlockquoteWithoutMarker = unifiedLintRule( + 'remark-lint:no-blockquote-without-marker', + noBlockquoteWithoutMarker +); + +var reason$4 = 'Missing marker in blockquote'; -function noBlockquoteWithoutCaret(ast, file) { - var contents = file.toString(); +function noBlockquoteWithoutMarker(tree, file) { + var contents = String(file); var location = vfileLocation(file); var last = contents.length; - unistUtilVisit(ast, 'blockquote', visitor); + unistUtilVisit(tree, 'blockquote', visitor); function visitor(node) { - var start = unistUtilPosition.start(node).line; var indent = node.position && node.position.indent; + var start; + var length; + var index; + var line; + var offset; + var character; + var pos; if (unistUtilGenerated(node) || !indent || indent.length === 0) { - return; + return } - indent.forEach(eachLine); + start = unistUtilPosition.start(node).line; + length = indent.length; + index = -1; - function eachLine(column, n) { - var character; - var line = start + n + 1; - var offset = location.toOffset({ - line: line, - column: column - }) - 1; + while (++index < length) { + line = start + index + 1; + pos = {line: line, column: indent[index]}; + offset = location.toOffset(pos) - 1; while (++offset < last) { character = contents.charAt(offset); if (character === '>') { - return; + break } /* istanbul ignore else - just for safety */ if (character !== ' ' && character !== '\t') { - break; + file.message(reason$4, pos); + break } } - - file.message('Missing caret in blockquote', { - line: line, - column: column - }); } } } @@ -32745,7 +32778,7 @@ var remarkLintNoDuplicateDefinitions = unifiedLintRule( noDuplicateDefinitions ); -var reason$4 = 'Do not use definitions with the same identifier'; +var reason$5 = 'Do not use definitions with the same identifier'; function noDuplicateDefinitions(tree, file) { var map = {}; @@ -32762,7 +32795,7 @@ function noDuplicateDefinitions(tree, file) { if (duplicate && duplicate.type) { file.message( - reason$4 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')', + reason$5 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')', node ); } @@ -32787,11 +32820,11 @@ var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( noFileNameConsecutiveDashes ); -var reason$5 = 'Do not use consecutive dashes in a file name'; +var reason$6 = 'Do not use consecutive dashes in a file name'; function noFileNameConsecutiveDashes(tree, file) { if (file.stem && /-{2,}/.test(file.stem)) { - file.message(reason$5); + file.message(reason$6); } } @@ -32800,11 +32833,11 @@ var remarkLintNoFileNameOuterDashes = unifiedLintRule( noFileNameOuterDashes ); -var reason$6 = 'Do not use initial or final dashes in a file name'; +var reason$7 = 'Do not use initial or final dashes in a file name'; function noFileNameOuterDashes(tree, file) { if (file.stem && /^-|-$/.test(file.stem)) { - file.message(reason$6); + file.message(reason$7); } } @@ -33043,7 +33076,7 @@ function noMultipleToplevelHeadings(tree, file, pref) { var remarkLintNoShellDollars = unifiedLintRule('remark-lint:no-shell-dollars', noShellDollars); -var reason$7 = 'Do not use dollar signs before shell-commands'; +var reason$8 = 'Do not use dollar signs before shell-commands'; /* List of shell script file extensions (also used as code * flags for syntax highlighting on GitHub): @@ -33089,7 +33122,7 @@ function noShellDollars(tree, file) { } } - file.message(reason$7, node); + file.message(reason$8, node); } } } @@ -33099,21 +33132,21 @@ var remarkLintNoShortcutReferenceImage = unifiedLintRule( noShortcutReferenceImage ); -var reason$8 = 'Use the trailing [] on reference images'; +var reason$9 = 'Use the trailing [] on reference images'; function noShortcutReferenceImage(tree, file) { unistUtilVisit(tree, 'imageReference', visitor); function visitor(node) { if (!unistUtilGenerated(node) && node.referenceType === 'shortcut') { - file.message(reason$8, node); + file.message(reason$9, node); } } } var remarkLintNoTableIndentation = unifiedLintRule('remark-lint:no-table-indentation', noTableIndentation); -var reason$9 = 'Do not indent table rows'; +var reason$10 = 'Do not indent table rows'; function noTableIndentation(tree, file) { var contents = String(file); @@ -33135,14 +33168,14 @@ function noTableIndentation(tree, file) { ); if (fence.indexOf('|') > 1) { - file.message(reason$9, row); + file.message(reason$10, row); } } } var remarkLintNoTabs = unifiedLintRule('remark-lint:no-tabs', noTabs); -var reason$10 = 'Use spaces instead of hard-tabs'; +var reason$11 = 'Use spaces instead of hard-tabs'; function noTabs(tree, file) { var content = String(file); @@ -33150,14 +33183,37 @@ function noTabs(tree, file) { var index = content.indexOf('\t'); while (index !== -1) { - file.message(reason$10, position(index)); + file.message(reason$11, position(index)); index = content.indexOf('\t', index + 1); } } +var remarkLintNoTrailingSpaces = unifiedLintRule('remark-lint:no-trailing-spaces', noTrailingSpaces); + +/** + * Lines that are just space characters are not present in + * the AST, which is why we loop through lines manually. + */ + +function noTrailingSpaces(ast, file) { + var lines = file.toString().split('\n'); + for (var i = 0; i < lines.length; i++) { + var currentLine = lines[i]; + var lineIndex = i + 1; + if (/\s$/.test(currentLine)) { + file.message('Remove trailing whitespace', { + position: { + start: { line: lineIndex, column: currentLine.length + 1 }, + end: { line: lineIndex } + } + }); + } + } +} + var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions); -var reason$11 = 'Found unused definition'; +var reason$12 = 'Found unused definition'; function noUnusedDefinitions(tree, file) { var map = {}; @@ -33171,7 +33227,7 @@ function noUnusedDefinitions(tree, file) { entry = map[identifier]; if (!entry.used) { - file.message(reason$11, entry.node); + file.message(reason$12, entry.node); } } @@ -33789,7 +33845,7 @@ var plugins$1 = [ ], remarkLintMaximumLineLength, remarkLintNoAutoLinkWithoutProtocol, - remarkLintNoBlockquoteWithoutCaret, + remarkLintNoBlockquoteWithoutMarker, remarkLintNoDuplicateDefinitions, remarkLintNoFileNameArticles, remarkLintNoFileNameConsecutiveDashes, @@ -33802,6 +33858,7 @@ var plugins$1 = [ remarkLintNoShortcutReferenceImage, remarkLintNoTableIndentation, remarkLintNoTabs, + remarkLintNoTrailingSpaces, remarkLintNoUnusedDefinitions, remarkLintRuleStyle, remarkLintTablePipes, diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index e0010d99ef293d..41a5a3085fda46 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -1779,7 +1779,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "parse-entities": { @@ -1845,7 +1845,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-parse": { @@ -2143,10 +2143,10 @@ "unist-util-visit": "^1.1.1" } }, - "remark-lint-no-blockquote-without-caret": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-caret/-/remark-lint-no-blockquote-without-caret-1.0.0.tgz", - "integrity": "sha1-gd0i3V8EVOupwqU3u6Jgh0ShrW8=", + "remark-lint-no-blockquote-without-marker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-2.0.2.tgz", + "integrity": "sha512-jkfZ4hFiviZttEo7Ac7GZWFgMQ/bdVPfSluLeuf+qwL8sQvR4ClklKJ0Xbkk3cLRjvlGsc8U8uZR8qqH5MSLoA==", "requires": { "unified-lint-rule": "^1.0.0", "unist-util-generated": "^1.1.0", @@ -2279,6 +2279,14 @@ "vfile-location": "^2.0.1" } }, + "remark-lint-no-trailing-spaces": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/remark-lint-no-trailing-spaces/-/remark-lint-no-trailing-spaces-2.0.0.tgz", + "integrity": "sha512-UVb0xAFO5lsa/kRNC/qHOz7GuF91TjW7hk+m8hUircj1Nh53BP9rH24DJ/NVPF1Ve+u5k+pfOTJPqJcvD0zgUw==", + "requires": { + "unified-lint-rule": "^1.0.2" + } + }, "remark-lint-no-unused-definitions": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-1.0.2.tgz", @@ -2375,9 +2383,9 @@ } }, "remark-preset-lint-node": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.2.0.tgz", - "integrity": "sha512-1gcp5BMCIPA9DalVlBva+9s9KaB0mCs3mGaJf3lUvDwqGI2TPTovU/2Nxi4Vr9r2iSo/2qVNyXA0v8JqADU70A==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.3.1.tgz", + "integrity": "sha512-Mh9eX1ovpnKQiTy9R/BR8ZKkPJrMOHrLn+vRw7SRs1UooiKwIm1KRp1UaDLO6Z3pCCizhH4Bqln5XZTGnMkNaA==", "requires": { "remark-lint": "^6.0.0", "remark-lint-blockquote-indentation": "^1.0.0", @@ -2396,7 +2404,7 @@ "remark-lint-list-item-indent": "^1.0.3", "remark-lint-maximum-line-length": "^1.1.0", "remark-lint-no-auto-link-without-protocol": "^1.0.0", - "remark-lint-no-blockquote-without-caret": "^1.0.0", + "remark-lint-no-blockquote-without-marker": "^2.0.2", "remark-lint-no-duplicate-definitions": "^1.0.0", "remark-lint-no-file-name-articles": "^1.0.0", "remark-lint-no-file-name-consecutive-dashes": "^1.0.0", @@ -2409,8 +2417,9 @@ "remark-lint-no-shortcut-reference-image": "^1.0.0", "remark-lint-no-table-indentation": "^1.0.0", "remark-lint-no-tabs": "^1.0.0", + "remark-lint-no-trailing-spaces": "^2.0.0", "remark-lint-no-unused-definitions": "^1.0.0", - "remark-lint-prohibited-strings": "^1.0.0", + "remark-lint-prohibited-strings": "^1.0.3", "remark-lint-rule-style": "^1.0.0", "remark-lint-strong-marker": "^1.0.0", "remark-lint-table-cell-padding": "^1.0.0", @@ -2629,7 +2638,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 212b3c97f1211f..2efdb6404b3d2b 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -12,7 +12,7 @@ "markdown-extensions": "^1.1.0", "remark": "^10.0.0", "remark-lint": "^6.0.3", - "remark-preset-lint-node": "^1.2.0", + "remark-preset-lint-node": "^1.3.1", "unified-args": "^6.0.0", "unified-engine": "^5.1.0" }, From 764d76f684468eb3a9c05d048f1ab9bf78f42f18 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 3 Dec 2018 15:11:19 +0100 Subject: [PATCH 229/316] Revert "util: change %o depth default" This reverts commit 1a1fe53e3dbd0042807b75caac94dcae0abe4dc1. PR-URL: https://github.com/nodejs/node/pull/24806 Reviewed-By: Gus Caplan Reviewed-By: Jeremiah Senkpiel --- doc/api/util.md | 3 +++ lib/util.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index 95c66f85cb62c9..83fff459336e1e 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -183,6 +183,9 @@ property take precedence over `--trace-deprecation` and * `callback` {Function} -Stops the server from accepting new connections. See [`net.Server.close()`][]. +Stops the server from accepting new connections. See [`net.Server.close()`][]. Note that this is not analogous to restricting new requests since HTTP/2 connections are persistent. To achieve a similar graceful shutdown behavior, @@ -1871,7 +1871,7 @@ added: v8.4.0 --> * `callback` {Function} -Stops the server from accepting new connections. See [`tls.Server.close()`][]. +Stops the server from accepting new connections. See [`tls.Server.close()`][]. Note that this is not analogous to restricting new requests since HTTP/2 connections are persistent. To achieve a similar graceful shutdown behavior, @@ -2531,7 +2531,7 @@ const server = http2.createServer({ settings }); Once the client receives the `SETTINGS` frame from the server indicating that the extended CONNECT may be used, it may send `CONNECT` requests that use the -`':protocol'` HTTP/2 pseudo-header: +`':protocol'` HTTP/2 pseudo-header: ```js const http2 = require('http2'); diff --git a/doc/api/os.md b/doc/api/os.md index ad5736d7690016..27326c4ea31650 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -891,7 +891,7 @@ The following error constants are exported by `os.constants.errno`: EOPNOTSUPP - Indicates that an operation is not supported on the socket. Note that + Indicates that an operation is not supported on the socket. Note that while ENOTSUP and EOPNOTSUPP have the same value on Linux, according to POSIX.1 these error values should be distinct.) diff --git a/doc/api/tls.md b/doc/api/tls.md index 888b0eeb5a8ace..4481b1ac2c6b7a 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -690,7 +690,7 @@ the key type. For RSA keys, the following properties may be defined: * `bits` {number} The RSA bit size. Example: `1024`. * `exponent` {string} The RSA exponent, as a string in hexadecimal number - notation. Example: `'0x010001'`. + notation. Example: `'0x010001'`. * `modulus` {string} The RSA modulus, as a hexadecimal string. Example: `'B56CE45CB7...'`. * `pubkey` {Buffer} The public key. @@ -1139,7 +1139,7 @@ changes: `secureProtocol` option, use one or the other. **Default:** `'TLSv1.2'`. * `minVersion` {string} Optionally set the minimum TLS version to allow. One of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - `secureProtocol` option, use one or the other. It is not recommended to use + `secureProtocol` option, use one or the other. It is not recommended to use less than TLSv1.2, but it may be required for interoperability. **Default:** `'TLSv1'`. * `passphrase` {string} Shared passphrase used for a single private key and/or From 5a853a093c8de62cf583a8173b13e89b5d10208e Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 12 Nov 2018 15:52:43 -0600 Subject: [PATCH 300/316] Revert "util: change util.inspect depth default" This reverts commit ac7450a09a4c167cd43c14d7c88721d22f077529. This fully reverts the changes to util.inspect depth. It has caused breakage in logging to existing apps, and even something as simple as `console.log(require)` will cause >1m freezes. I've heard nothing but negative feedback (seriously not a single person has expressed anything positive about this change) and personally i find this change extremely annoying. --- doc/api/util.md | 21 ++++----------- lib/internal/util/inspect.js | 2 +- lib/repl.js | 5 ++-- test/parallel/test-stream-buffer-list.js | 9 ------- test/parallel/test-util-inspect-proxy.js | 16 +++++------ test/parallel/test-util-inspect.js | 34 +++++++++--------------- 6 files changed, 27 insertions(+), 60 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index b6b26c6199437d..d071b216ab32bd 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -419,7 +419,7 @@ changes: * `depth` {number} Specifies the number of times to recurse while formatting the `object`. This is useful for inspecting large complicated objects. To make it recurse up to the maximum call stack size pass `Infinity` or `null`. - **Default:** `20`. + **Default:** `2`. * `colors` {boolean} If `true`, the output will be styled with ANSI color codes. Colors are customizable, see [Customizing `util.inspect` colors][]. **Default:** `false`. @@ -476,23 +476,12 @@ util.inspect(new Bar()); // 'Bar {}' util.inspect(baz); // '[foo] {}' ``` -The following example limits the inspected output of the `paths` property: +The following example inspects all properties of the `util` object: ```js const util = require('util'); -console.log(util.inspect(module, { depth: 0 })); -// Instead of showing all entries in `paths` `[Array]` is used to limit the -// output for readability: - -// Module { -// id: '', -// exports: {}, -// parent: undefined, -// filename: null, -// loaded: false, -// children: [], -// paths: [Array] } +console.log(util.inspect(util, { showHidden: true, depth: null })); ``` The following example highlights the difference with the `compact` option: @@ -508,7 +497,7 @@ const o = { 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]) }; -console.log(util.inspect(o, { compact: true, breakLength: 80 })); +console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); // This will print @@ -522,7 +511,7 @@ console.log(util.inspect(o, { compact: true, breakLength: 80 })); // b: Map { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false changes the output to be more reader friendly. -console.log(util.inspect(o, { compact: false, breakLength: 80 })); +console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { // a: [ diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 2e00fafb268bd8..6ec27b9d1d9c05 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -92,7 +92,7 @@ const hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); const inspectDefaultOptions = Object.seal({ showHidden: false, - depth: 20, + depth: 2, colors: false, customInspect: true, showProxy: false, diff --git a/lib/repl.js b/lib/repl.js index 030cb633d3dc57..5dbd02fd231cd1 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -130,9 +130,8 @@ function hasOwnProperty(obj, prop) { // and it can be overridden by custom print functions, such as `probe` or // `eyes.js`. const writer = exports.writer = (obj) => util.inspect(obj, writer.options); -writer.options = Object.assign({}, - util.inspect.defaultOptions, - { showProxy: true, depth: 2 }); +writer.options = + Object.assign({}, util.inspect.defaultOptions, { showProxy: true }); exports._builtinLibs = builtinLibs; diff --git a/test/parallel/test-stream-buffer-list.js b/test/parallel/test-stream-buffer-list.js index 1d3d7dd903d4bb..d7728d1171caa3 100644 --- a/test/parallel/test-stream-buffer-list.js +++ b/test/parallel/test-stream-buffer-list.js @@ -3,7 +3,6 @@ require('../common'); const assert = require('assert'); const BufferList = require('internal/streams/buffer_list'); -const util = require('util'); // Test empty buffer list. const emptyList = new BufferList(); @@ -31,11 +30,3 @@ assert.strictEqual(list.join(','), 'foo'); const shifted = list.shift(); assert.strictEqual(shifted, buf); assert.deepStrictEqual(list, new BufferList()); - -const tmp = util.inspect.defaultOptions.colors; -util.inspect.defaultOptions = { colors: true }; -assert.strictEqual( - util.inspect(list), - 'BufferList { head: \u001b[1mnull\u001b[22m, tail: \u001b[1mnull\u001b[22m,' + - ' length: \u001b[33m0\u001b[39m }'); -util.inspect.defaultOptions = { colors: tmp }; diff --git a/test/parallel/test-util-inspect-proxy.js b/test/parallel/test-util-inspect-proxy.js index 45f7abba213596..b3438a625240a2 100644 --- a/test/parallel/test-util-inspect-proxy.js +++ b/test/parallel/test-util-inspect-proxy.js @@ -50,17 +50,13 @@ const expected1 = 'Proxy [ {}, {} ]'; const expected2 = 'Proxy [ Proxy [ {}, {} ], {} ]'; const expected3 = 'Proxy [ Proxy [ Proxy [ {}, {} ], {} ], Proxy [ {}, {} ] ]'; const expected4 = 'Proxy [ Proxy [ {}, {} ], Proxy [ Proxy [ {}, {} ], {} ] ]'; -const expected5 = 'Proxy [ Proxy [ Proxy [ Proxy [ {}, {} ], {} ],' + +const expected5 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], {} ],' + ' Proxy [ {}, {} ] ],\n Proxy [ Proxy [ {}, {} ]' + - ', Proxy [ Proxy [ {}, {} ], {} ] ] ]'; -const expected6 = 'Proxy [ Proxy [ Proxy [ Proxy [ Proxy [ {}, {} ], {} ], ' + - 'Proxy [ {}, {} ] ],\n' + - ' Proxy [ Proxy [ {}, {} ], ' + - 'Proxy [ Proxy [ {}, {} ], {} ] ] ],\n' + - ' Proxy [ Proxy [ Proxy [ Proxy [ {}, {} ], {} ], ' + - 'Proxy [ {}, {} ] ],\n' + - ' Proxy [ Proxy [ {}, {} ], ' + - 'Proxy [ Proxy [ {}, {} ], {} ] ] ] ]'; + ', Proxy [ Proxy [Array], {} ] ] ]'; +const expected6 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], Proxy [Array]' + + ' ],\n Proxy [ Proxy [Array], Proxy [Array] ] ],\n' + + ' Proxy [ Proxy [ Proxy [Array], Proxy [Array] ],\n' + + ' Proxy [ Proxy [Array], Proxy [Array] ] ] ]'; assert.strictEqual( util.inspect(proxy1, { showProxy: true, depth: null }), expected1); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 713bf047ddd345..c0fc3219ce736f 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -71,7 +71,7 @@ assert.strictEqual(util.inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); assert.strictEqual(util.inspect({ 'a': {} }), '{ a: {} }'); assert.strictEqual(util.inspect({ 'a': { 'b': 2 } }), '{ a: { b: 2 } }'); assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': { 'd': 2 } } } }), - '{ a: { b: { c: { d: 2 } } } }'); + '{ a: { b: { c: [Object] } } }'); assert.strictEqual( util.inspect({ 'a': { 'b': { 'c': { 'd': 2 } } } }, false, null), '{ a: { b: { c: { d: 2 } } } }'); @@ -110,7 +110,7 @@ assert.strictEqual(util.inspect((new JSStream())._externalStream), assert.strictEqual(util.inspect({ a: regexp }, false, 0), '{ a: /regexp/ }'); } -assert(!/Object/.test( +assert(/Object/.test( util.inspect({ a: { a: { a: { a: {} } } } }, undefined, undefined, true) )); assert(!/Object/.test( @@ -1055,15 +1055,15 @@ if (typeof Symbol !== 'undefined') { // Empty and circular before depth. { const arr = [[[[]]]]; - assert.strictEqual(util.inspect(arr, { depth: 2 }), '[ [ [ [] ] ] ]'); + assert.strictEqual(util.inspect(arr), '[ [ [ [] ] ] ]'); arr[0][0][0][0] = []; - assert.strictEqual(util.inspect(arr, { depth: 2 }), '[ [ [ [Array] ] ] ]'); + assert.strictEqual(util.inspect(arr), '[ [ [ [Array] ] ] ]'); arr[0][0][0] = {}; - assert.strictEqual(util.inspect(arr, { depth: 2 }), '[ [ [ {} ] ] ]'); + assert.strictEqual(util.inspect(arr), '[ [ [ {} ] ] ]'); arr[0][0][0] = { a: 2 }; - assert.strictEqual(util.inspect(arr, { depth: 2 }), '[ [ [ [Object] ] ] ]'); + assert.strictEqual(util.inspect(arr), '[ [ [ [Object] ] ] ]'); arr[0][0][0] = arr; - assert.strictEqual(util.inspect(arr, { depth: 2 }), '[ [ [ [Circular] ] ] ]'); + assert.strictEqual(util.inspect(arr), '[ [ [ [Circular] ] ] ]'); } // Corner cases. @@ -1160,10 +1160,10 @@ if (typeof Symbol !== 'undefined') { assert(!/1 more item/.test(util.inspect(arr))); util.inspect.defaultOptions.maxArrayLength = oldOptions.maxArrayLength; assert(/1 more item/.test(util.inspect(arr))); - util.inspect.defaultOptions.depth = 2; - assert(/Object/.test(util.inspect(obj))); - util.inspect.defaultOptions.depth = oldOptions.depth; + util.inspect.defaultOptions.depth = null; assert(!/Object/.test(util.inspect(obj))); + util.inspect.defaultOptions.depth = oldOptions.depth; + assert(/Object/.test(util.inspect(obj))); assert.strictEqual( JSON.stringify(util.inspect.defaultOptions), JSON.stringify(oldOptions) @@ -1175,7 +1175,7 @@ if (typeof Symbol !== 'undefined') { assert(/Object/.test(util.inspect(obj))); util.inspect.defaultOptions = oldOptions; assert(/1 more item/.test(util.inspect(arr))); - assert(!/Object/.test(util.inspect(obj))); + assert(/Object/.test(util.inspect(obj))); assert.strictEqual( JSON.stringify(util.inspect.defaultOptions), JSON.stringify(oldOptions) @@ -1561,19 +1561,11 @@ util.inspect(process); let head = list; // A linked list of length 100k should be inspectable in some way, even though // the real cutoff value is much lower than 100k. - for (let i = 0; i < 100000; i++) { + for (let i = 0; i < 100000; i++) head = head.next = {}; - } - - const res = Array(15) - .fill(0) - .map((_, i) => `{ next:\n${' '.repeat(i + 1)}`) - .join('') + - '{ next: { next: { next: { next: { next: { next:' + - ' [Object] } } } } } } } } } } } } } } } } } } } } }'; assert.strictEqual( util.inspect(list), - res + '{ next: { next: { next: [Object] } } }' ); const longList = util.inspect(list, { depth: Infinity }); const match = longList.match(/next/g); From 88a54497e558dc4677d2c5102d24f0fd026267eb Mon Sep 17 00:00:00 2001 From: Masashi Hirano Date: Tue, 9 Oct 2018 08:10:07 +0900 Subject: [PATCH 301/316] src,lib: make process.binding('config') internal PR-URL: https://github.com/nodejs/node/pull/23400 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- lib/buffer.js | 4 ++-- lib/crypto.js | 2 +- lib/internal/async_hooks.js | 2 +- lib/internal/bootstrap/loaders.js | 3 ++- lib/internal/bootstrap/node.js | 4 ++-- lib/internal/encoding.js | 2 +- lib/internal/inspector_async_hook.js | 2 +- lib/internal/print_help.js | 2 +- lib/internal/process/warning.js | 2 +- lib/internal/readline.js | 2 +- lib/trace_events.js | 2 +- lib/url.js | 2 +- src/node_config.cc | 2 +- test/parallel/test-icu-data-dir.js | 4 +++- test/parallel/test-internal-modules-expose.js | 3 ++- test/parallel/test-readline-position.js | 4 +++- 16 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index af69f43735f26f..ac5e19c40819c1 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -50,7 +50,7 @@ const { } = require('internal/util/types'); const { pendingDeprecation -} = process.binding('config'); +} = internalBinding('config'); const { ERR_BUFFER_OUT_OF_BOUNDS, ERR_OUT_OF_RANGE, @@ -1067,7 +1067,7 @@ Buffer.prototype.swap64 = function swap64() { Buffer.prototype.toLocaleString = Buffer.prototype.toString; let transcode; -if (process.binding('config').hasIntl) { +if (internalBinding('config').hasIntl) { const { icuErrName, transcode: _transcode diff --git a/lib/crypto.js b/lib/crypto.js index cce9bfea86f61a..c1526e20fef8d0 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -40,7 +40,7 @@ const pendingDeprecation = getOptionValue('--pending-deprecation'); const { fipsMode, fipsForced -} = process.binding('config'); +} = internalBinding('config'); const { getFipsCrypto, setFipsCrypto } = internalBinding('crypto'); const { randomBytes, diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index a42f603293c82e..d382fe36e1847f 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -107,7 +107,7 @@ function fatalError(e) { Error.captureStackTrace(o, fatalError); process._rawDebug(o.stack); } - if (process.binding('config').shouldAbortOnUncaughtException) { + if (internalBinding('config').shouldAbortOnUncaughtException) { process.abort(); } process.exit(1); diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 02abc683072ae2..48d83f12e12186 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -79,6 +79,7 @@ 'buffer', 'cares_wrap', 'constants', + 'config', 'contextify', 'crypto', 'fs_event_wrap', @@ -164,7 +165,7 @@ NativeModule._source = getInternalBinding('natives'); NativeModule._cache = {}; - const config = getBinding('config'); + const config = getInternalBinding('config'); // Think of this as module.exports in this file even though it is not // written in CommonJS style. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 1a417658d5de05..3b9e20b2635817 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -177,7 +177,7 @@ { // Install legacy getters on the `util` binding for typechecking. // TODO(addaleax): Turn into a full runtime deprecation. - const { pendingDeprecation } = process.binding('config'); + const { pendingDeprecation } = internalBinding('config'); const utilBinding = internalBinding('util'); const types = internalBinding('types'); for (const name of [ @@ -665,7 +665,7 @@ } function setupProcessICUVersions() { - const icu = process.binding('config').hasIntl ? + const icu = internalBinding('config').hasIntl ? internalBinding('icu') : undefined; if (!icu) return; // no Intl/ICU: nothing to add here. // With no argument, getVersion() returns a comma separated list diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index ce3cc7411a65b8..ad056fd0bd997f 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -342,7 +342,7 @@ Object.defineProperties( } }); const TextDecoder = - process.binding('config').hasIntl ? + internalBinding('config').hasIntl ? makeTextDecoderICU() : makeTextDecoderJS(); diff --git a/lib/internal/inspector_async_hook.js b/lib/internal/inspector_async_hook.js index 6a7489af974a40..1ad0cbf3a533f2 100644 --- a/lib/internal/inspector_async_hook.js +++ b/lib/internal/inspector_async_hook.js @@ -12,7 +12,7 @@ let config; function lazyHookCreation() { const { createHook } = require('async_hooks'); - config = process.binding('config'); + config = internalBinding('config'); hook = createHook({ init(asyncId, type, triggerAsyncId, resource) { diff --git a/lib/internal/print_help.js b/lib/internal/print_help.js index 5d2c1daa075e0d..c3e984dd9f4987 100644 --- a/lib/internal/print_help.js +++ b/lib/internal/print_help.js @@ -9,7 +9,7 @@ for (const key of Object.keys(types)) // Environment variables are parsed ad-hoc throughout the code base, // so we gather the documentation here. -const { hasIntl, hasSmallICU, hasNodeOptions } = process.binding('config'); +const { hasIntl, hasSmallICU, hasNodeOptions } = internalBinding('config'); const envVars = new Map([ ['NODE_DEBUG', { helpText: "','-separated list of core modules that " + 'should print debug information' }], diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js index 637b9ffb54b406..5dac78082bf205 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -1,6 +1,6 @@ 'use strict'; -const config = process.binding('config'); +const config = internalBinding('config'); const prefix = `(${process.release.name}:${process.pid}) `; const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes; diff --git a/lib/internal/readline.js b/lib/internal/readline.js index 0f7d969d20c218..c325f42cf42328 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -30,7 +30,7 @@ CSI.kClearToEnd = CSI`0K`; CSI.kClearLine = CSI`2K`; CSI.kClearScreenDown = CSI`0J`; -if (process.binding('config').hasIntl) { +if (internalBinding('config').hasIntl) { const icu = internalBinding('icu'); getStringWidth = function getStringWidth(str, options) { options = options || {}; diff --git a/lib/trace_events.js b/lib/trace_events.js index 878580c67f5a2f..d2977679e168b8 100644 --- a/lib/trace_events.js +++ b/lib/trace_events.js @@ -1,6 +1,6 @@ 'use strict'; -const { hasTracing } = process.binding('config'); +const { hasTracing } = internalBinding('config'); const kHandle = Symbol('handle'); const kEnabled = Symbol('enabled'); const kCategories = Symbol('categories'); diff --git a/lib/url.js b/lib/url.js index a5f8f45d014841..eac9d1511b9f8c 100644 --- a/lib/url.js +++ b/lib/url.js @@ -21,7 +21,7 @@ 'use strict'; -const { toASCII } = process.binding('config').hasIntl ? +const { toASCII } = internalBinding('config').hasIntl ? internalBinding('icu') : require('punycode'); const { hexTable } = require('internal/querystring'); diff --git a/src/node_config.cc b/src/node_config.cc index 6b7f4e62b7cd94..c2bf3349c46269 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -112,4 +112,4 @@ static void Initialize(Local target, } // namespace node -NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::Initialize) +NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize) diff --git a/test/parallel/test-icu-data-dir.js b/test/parallel/test-icu-data-dir.js index 47c955bc740fb3..daf15ba880ced7 100644 --- a/test/parallel/test-icu-data-dir.js +++ b/test/parallel/test-icu-data-dir.js @@ -1,8 +1,10 @@ +// Flags: --expose-internals 'use strict'; +const { internalBinding } = require('internal/test/binding'); const common = require('../common'); const os = require('os'); -const { hasSmallICU } = process.binding('config'); +const { hasSmallICU } = internalBinding('config'); if (!(common.hasIntl && hasSmallICU)) common.skip('missing Intl'); diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js index ab48e36881268c..5229032573088e 100644 --- a/test/parallel/test-internal-modules-expose.js +++ b/test/parallel/test-internal-modules-expose.js @@ -3,7 +3,8 @@ require('../common'); const assert = require('assert'); -const config = process.binding('config'); +const { internalBinding } = require('internal/test/binding'); +const config = internalBinding('config'); console.log(config, process.argv); diff --git a/test/parallel/test-readline-position.js b/test/parallel/test-readline-position.js index 4e1114418eb380..0e62761ca57b40 100644 --- a/test/parallel/test-readline-position.js +++ b/test/parallel/test-readline-position.js @@ -1,4 +1,6 @@ +// Flags: --expose-internals 'use strict'; +const { internalBinding } = require('internal/test/binding'); require('../common'); const { PassThrough } = require('stream'); const readline = require('readline'); @@ -23,7 +25,7 @@ const ctrlU = { ctrl: true, name: 'u' }; // The non-ICU JS implementation of character width calculation is only aware // of the wide/narrow distinction. Only test these more advanced cases when // ICU is available. - if (process.binding('config').hasIntl) { + if (internalBinding('config').hasIntl) { tests.push( [0, '\u0301'], // COMBINING ACUTE ACCENT [1, 'a\u0301'], // á From 71e520cfa6a62328aa2ff52b08ad8fb79fd383d6 Mon Sep 17 00:00:00 2001 From: Kenigbolo Meya Stephen Date: Sun, 2 Dec 2018 05:24:22 +0200 Subject: [PATCH 302/316] doc: add authority and scheme psuedo headers This pull request adds the request psuedo headers authority and scheme to the http2 documentation PR-URL: https://github.com/nodejs/node/pull/24777 Fixes: https://github.com/nodejs/node/issues/23825 Reviewed-By: Anna Henningsen Reviewed-By: Daniel Bevenius --- doc/api/http2.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index c5a2382a479f6a..4c241268b047f9 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2654,6 +2654,16 @@ added: v10.1.0 The `request.aborted` property will be `true` if the request has been aborted. +#### request.authority + + +* {string} + +The request authority pseudo header field. It can also be accessed via +`req.headers[':authority']`. + #### request.destroy([error]) + +* {string} + +The request scheme pseudo header field indicating the scheme +portion of the target URL. + #### request.setTimeout(msecs, callback) diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs index b21e86fc7c7a0b..b4457e43658d57 100755 --- a/tools/msvs/msi/product.wxs +++ b/tools/msvs/msi/product.wxs @@ -73,7 +73,6 @@ - - - - - From 1ea01c57902db4f6d9bae66edcb3374164871d12 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 3 Dec 2018 11:58:59 -0800 Subject: [PATCH 304/316] tools: replace rollup with ncc Replace rollup + plugins + config file with zeit/ncc package designed to do the particular task that we're leveraging rollup for but with zero-ish configuration. (rollup can do a whole lot more, but we're using a tiny portion of its functionality.) PR-URL: https://github.com/nodejs/node/pull/24813 Reviewed-By: Guy Bedford Reviewed-By: Ruben Bridgewater --- tools/lint-md.js | 53815 +++++++++------- .../node-lint-md-cli-rollup/package-lock.json | 410 +- tools/node-lint-md-cli-rollup/package.json | 10 +- .../node-lint-md-cli-rollup/rollup.config.js | 44 - 4 files changed, 29807 insertions(+), 24472 deletions(-) delete mode 100644 tools/node-lint-md-cli-rollup/rollup.config.js diff --git a/tools/lint-md.js b/tools/lint-md.js index 03d12efbd270f7..ab0eea8a3fb374 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -1,508 +1,755 @@ -'use strict'; +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 95); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var wrapped = __webpack_require__(310) + +module.exports = factory + +function factory(id, rule) { + var parts = id.split(':') + var source = parts[0] + var ruleId = parts[1] + var fn = wrapped(rule) -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + /* istanbul ignore if - possibly useful if externalised later. */ + if (!ruleId) { + ruleId = source + source = null + } -var util = _interopDefault(require('util')); -var os = _interopDefault(require('os')); -var tty = _interopDefault(require('tty')); -var path = _interopDefault(require('path')); -var module$1 = _interopDefault(require('module')); -var fs = _interopDefault(require('fs')); -var assert = _interopDefault(require('assert')); -var events = _interopDefault(require('events')); -var stream = _interopDefault(require('stream')); + attacher.displayName = id -var vfileStatistics = statistics; + return attacher -/* Get stats for a file, list of files, or list of messages. */ -function statistics(files) { - var result = {true: 0, false: 0, null: 0}; + function attacher(raw) { + var config = coerce(ruleId, raw) + var severity = config[0] + var options = config[1] + var fatal = severity === 2 - count(files); + return severity ? transformer : undefined - return { - fatal: result.true, - nonfatal: result.false + result.null, - warn: result.false, - info: result.null, - total: result.true + result.false + result.null - } + function transformer(tree, file, next) { + var index = file.messages.length - function count(value) { - if (value) { - if (value[0] && value[0].messages) { - /* Multiple vfiles */ - countInAll(value); - } else { - /* One vfile / messages */ - countAll(value.messages || value); + fn(tree, file, options, done) + + function done(err) { + var messages = file.messages + var message + + /* Add the error, if not already properly added. */ + /* istanbul ignore if - only happens for incorrect plugins */ + if (err && messages.indexOf(err) === -1) { + try { + file.fail(err) + } catch (err) {} + } + + while (index < messages.length) { + message = messages[index] + message.ruleId = ruleId + message.source = source + message.fatal = fatal + + index++ + } + + next() } } } +} - function countInAll(files) { - var length = files.length; - var index = -1; +/* Coerce a value to a severity--options tuple. */ +function coerce(name, value) { + var def = 1 + var result + var level - while (++index < length) { - count(files[index].messages); - } + /* istanbul ignore if - Handled by unified in v6.0.0 */ + if (typeof value === 'boolean') { + result = [value] + } else if (value == null) { + result = [def] + } else if ( + typeof value === 'object' && + (typeof value[0] === 'number' || + typeof value[0] === 'boolean' || + typeof value[0] === 'string') + ) { + result = value.concat() + } else { + result = [1, value] } - function countAll(messages) { - var length = messages.length; - var index = -1; - var fatal; + level = result[0] - while (++index < length) { - fatal = messages[index].fatal; - result[fatal === null || fatal === undefined ? null : Boolean(fatal)]++; + if (typeof level === 'boolean') { + level = level ? 1 : 0 + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0 + } else if (level === 'on' || level === 'warn') { + level = 1 + } else if (level === 'error') { + level = 2 + } else { + level = 1 + result = [level, result] } } -} -var slice = [].slice; + if (level < 0 || level > 2) { + throw new Error( + 'Invalid severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level -var wrap_1 = wrap; + return result +} -/* Wrap `fn`. Can be sync or async; return a promise, - * receive a completion handler, return new values and - * errors. */ -function wrap(fn, callback) { - var invoked; - return wrapped +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { - function wrapped() { - var params = slice.call(arguments, 0); - var callback = fn.length > params.length; - var result; +"use strict"; - if (callback) { - params.push(done); - } - try { - result = fn.apply(null, params); - } catch (err) { - /* Well, this is quite the pickle. `fn` received - * a callback and invoked it (thus continuing the - * pipeline), but later also threw an error. - * We’re not about to restart the pipeline again, - * so the only thing left to do is to throw the - * thing instea. */ - if (callback && invoked) { - throw err - } +module.exports = visit - return done(err) - } +var visitParents = __webpack_require__(221) - if (!callback) { - if (result && typeof result.then === 'function') { - result.then(then, done); - } else if (result instanceof Error) { - done(result); - } else { - then(result); - } - } - } +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT - /* Invoke `next`, only once. */ - function done() { - if (!invoked) { - invoked = true; +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT - callback.apply(null, arguments); - } +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null } - /* Invoke `done` with one value. - * Tracks if an error is passed, too. */ - function then(value) { - done(null, value); + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) } } -var trough_1 = trough; - -trough.wrap = wrap_1; -var slice$1 = [].slice; +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { -/* Create new middleware. */ -function trough() { - var fns = []; - var middleware = {}; +"use strict"; - middleware.run = run; - middleware.use = use; - return middleware +/* Expose. */ +module.exports = generated - /* Run `fns`. Last argument must be - * a completion handler. */ - function run() { - var index = -1; - var input = slice$1.call(arguments, 0, -1); - var done = arguments[arguments.length - 1]; +/* Detect if a node was available in the original document. */ +function generated(node) { + var position = optional(optional(node).position) + var start = optional(position.start) + var end = optional(position.end) - if (typeof done !== 'function') { - throw new Error('Expected function as last argument, not ' + done) - } + return !start.line || !start.column || !end.line || !end.column +} - next.apply(null, [null].concat(input)); +/* Return `value` if it’s an object, an empty object + * otherwise. */ +function optional(value) { + return value && typeof value === 'object' ? value : {} +} - /* Run the next `fn`, if any. */ - function next(err) { - var fn = fns[++index]; - var params = slice$1.call(arguments, 0); - var values = params.slice(1); - var length = input.length; - var pos = -1; - if (err) { - done(err); - return - } +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { - /* Copy non-nully input into values. */ - while (++pos < length) { - if (values[pos] === null || values[pos] === undefined) { - values[pos] = input[pos]; - } - } +"use strict"; - input = values; - /* Next or done. */ - if (fn) { - wrap_1(fn, next).apply(null, input); - } else { - done.apply(null, [null].concat(input)); - } - } - } +/* Expose. */ +var position = exports - /* Add `fn` to the list. */ - function use(fn) { - if (typeof fn !== 'function') { - throw new Error('Expected `fn` to be a function, not ' + fn) - } +position.start = factory('start') +position.end = factory('end') - fns.push(fn); +/* Factory to get a `type` point in the positional info of a node. */ +function factory(type) { + point.displayName = type - return middleware - } -} + return point -function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); -} + /* Get a point in `node.position` at a bound `type`. */ + function point(node) { + var point = (node && node.position && node.position[type]) || {} -function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + return { + line: point.line || null, + column: point.column || null, + offset: isNaN(point.offset) ? null : point.offset + } + } } -function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; -} -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); -} +/***/ }), +/* 4 */ +/***/ (function(module, exports) { +module.exports = require("path"); -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; - return [ sequence ]; -} +var YAMLException = __webpack_require__(20); +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; -function extend(target, source) { - var index, length, key, sourceKeys; +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; - if (source) { - sourceKeys = Object.keys(source); +function compileStyleAliases(map) { + var result = {}; - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); } - return target; + return result; } +function Type(tag, options) { + options = options || {}; -function repeat(string, count) { - var result = '', cycle; + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - return result; + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } } +module.exports = Type; -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); -} +/***/ }), +/* 6 */ +/***/ (function(module, exports) { -var isNothing_1 = isNothing; -var isObject_1 = isObject; -var toArray_1 = toArray; -var repeat_1 = repeat; -var isNegativeZero_1 = isNegativeZero; -var extend_1 = extend; +module.exports = require("fs"); -var common = { - isNothing: isNothing_1, - isObject: isObject_1, - toArray: toArray_1, - repeat: repeat_1, - isNegativeZero: isNegativeZero_1, - extend: extend_1 -}; +/***/ }), +/* 7 */ +/***/ (function(module, exports) { -// YAML error class. http://stackoverflow.com/questions/8458984 -// -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); +module.exports = extend - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); +var hasOwnProperty = Object.prototype.hasOwnProperty; - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } -} +function extend() { + var target = {} + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + return target +} -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; - result += this.reason || '(unknown reason)'; +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } +"use strict"; - return result; -}; +module.exports = whitespace -var exception = YAMLException; +var fromCode = String.fromCharCode +var re = /\s/ -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; +/* Check if the given character code, or the character + * code at the first character, is a whitespace character. */ +function whitespace(character) { + return re.test( + typeof character === 'number' ? fromCode(character) : character.charAt(0) + ) } -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { - if (!this.buffer) return null; +"use strict"; - indent = indent || 4; - maxLength = maxLength || 75; - head = ''; - start = this.position; +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __webpack_require__(126); +} else { + module.exports = __webpack_require__(128); +} - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } - } - tail = ''; - end = this.position; - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; - } - } +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { - snippet = this.buffer.slice(start, end); +"use strict"; +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; +/** + * Results cache + */ - if (this.name) { - where += 'in "' + this.name + '" '; +var res = ''; +var cache; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); } - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; - if (!compact) { - snippet = this.getSnippet(); + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } - if (snippet) { - where += ':\n' + snippet; + while (max > res.length && num > 1) { + if (num & 1) { + res += str; } + + num >>= 1; + str += str; } - return where; -}; + res += str; + res = res.substr(0, max); + return res; +} -var mark = Mark; +/***/ }), +/* 11 */ +/***/ (function(module, exports) { -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; +module.exports = require("util"); -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { -function compileStyleAliases(map) { - var result = {}; +"use strict"; - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); + +module.exports = statistics + +/* Get stats for a file, list of files, or list of messages. */ +function statistics(files) { + var result = {true: 0, false: 0, null: 0} + + count(files) + + return { + fatal: result.true, + nonfatal: result.false + result.null, + warn: result.false, + info: result.null, + total: result.true + result.false + result.null } - return result; -} + function count(value) { + if (value) { + if (value[0] && value[0].messages) { + /* Multiple vfiles */ + countInAll(value) + } else { + /* One vfile / messages */ + countAll(value.messages || value) + } + } + } -function Type(tag, options) { - options = options || {}; + function countInAll(files) { + var length = files.length + var index = -1 - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + while (++index < length) { + count(files[index].messages) } - }); + } - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + function countAll(messages) { + var length = messages.length + var index = -1 + var fatal - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + while (++index < length) { + fatal = messages[index].fatal + result[fatal === null || fatal === undefined ? null : Boolean(fatal)]++ + } } } -var type = Type; -/*eslint-disable max-len*/ +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { +try { + var util = __webpack_require__(11); + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + module.exports = __webpack_require__(152); +} +/***/ }), +/* 14 */ +/***/ (function(module, exports) { +exports = module.exports = trim; -function compileList(schema, name, result) { - var exclude = []; +function trim(str){ + return str.replace(/^\s*|\s*$/g, ''); +} - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); +exports.left = function(str){ + return str.replace(/^\s*/, ''); +}; - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); +exports.right = function(str){ + return str.replace(/\s*$/, ''); +}; - result.push(currentType); - }); - return result.filter(function (type$$1, index) { - return exclude.indexOf(index) === -1; - }); -} +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; - function collectType(type$$1) { - result[type$$1.kind][type$$1.tag] = result['fallback'][type$$1.tag] = type$$1; - } - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); } -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); +} + + +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; +} + + +function extend(target, source) { + var index, length, key, sourceKeys; + + if (source) { + sourceKeys = Object.keys(source); + + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + + return target; +} + + +function repeat(string, count) { + var result = '', cycle; + + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } + + return result; +} + + +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} + + +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/*eslint-disable max-len*/ + +var common = __webpack_require__(15); +var YAMLException = __webpack_require__(20); +var Type = __webpack_require__(5); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; this.explicit = definition.explicit || []; - this.implicit.forEach(function (type$$1) { - if (type$$1.loadKind && type$$1.loadKind !== 'scalar') { - throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } }); @@ -530,18 +777,18 @@ Schema.create = function createSchema() { break; default: - throw new exception('Wrong number of arguments for Schema.create function'); + throw new YAMLException('Wrong number of arguments for Schema.create function'); } schemas = common.toArray(schemas); types = common.toArray(types); if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new exception('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); } - if (!types.every(function (type$$1) { return type$$1 instanceof type; })) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } return new Schema({ @@ -551,9559 +798,22158 @@ Schema.create = function createSchema() { }; -var schema = Schema; +module.exports = Schema; -var str = new type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); -var seq = new type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); +/***/ }), +/* 17 */ +/***/ (function(module, exports) { -var map = new type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); +var toString = Object.prototype.toString -var failsafe = new schema({ - explicit: [ - str, - seq, - map - ] -}); +module.exports = isString -function resolveYamlNull(data) { - if (data === null) return true; +function isString(obj) { + return toString.call(obj) === "[object String]" +} - var max = data.length; - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { -function constructYamlNull() { - return null; -} +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -function isNull(object) { - return object === null; -} +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. -var _null = new type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); -function resolveYamlBoolean(data) { - if (data === null) return false; - var max = data.length; +/**/ - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} +var pna = __webpack_require__(28); +/**/ -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} +module.exports = Duplex; -var bool = new type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); +/**/ +var util = __webpack_require__(22); +util.inherits = __webpack_require__(13); +/**/ -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} +var Readable = __webpack_require__(67); +var Writable = __webpack_require__(70); -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} +util.inherits(Duplex, Readable); -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } } -function resolveYamlInteger(data) { - if (data === null) return false; +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); - var max = data.length, - index = 0, - hasDigits = false, - ch; + Readable.call(this, options); + Writable.call(this, options); - if (!max) return false; + if (options && options.readable === false) this.readable = false; - ch = data[index]; + if (options && options.writable === false) this.writable = false; - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; } +}); - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; - // base 2, base 8, base 16 + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} - if (ch === 'b') { - // base 2 - index++; +function onEndNT(self) { + self.end(); +} - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; } + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); - if (ch === 'x') { - // base 16 - index++; +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } + pna.nextTick(cb, err); +}; - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { - // base 10 (except 0) or base 60 +"use strict"; - // value should not start with `_`; - if (ch === '_') return false; - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; +/* Expose. */ +module.exports = factory + +/* Factory. */ +function factory(file) { + var contents = indices(String(file)) + + return { + toPosition: offsetToPositionFactory(contents), + toOffset: positionToOffsetFactory(contents) } +} - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; +/* Factory to get the line and column-based `position` for + * `offset` in the bound indices. */ +function offsetToPositionFactory(indices) { + return offsetToPosition - // if !base60 - done; - if (ch !== ':') return true; + /* Get the line and column-based `position` for + * `offset` in the bound indices. */ + function offsetToPosition(offset) { + var index = -1 + var length = indices.length - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} + if (offset < 0) { + return {} + } -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + return {} } +} - ch = value[0]; +/* Factory to get the `offset` for a line and column-based + * `position` in the bound indices. */ +function positionToOffsetFactory(indices) { + return positionToOffset - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } + /* Get the `offset` for a line and column-based + * `position` in the bound indices. */ + function positionToOffset(position) { + var line = position && position.line + var column = position && position.column - if (value === '0') return 0; + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); + return -1 } +} - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); +/* Get indices of line-breaks in `value`. */ +function indices(value) { + var result = [] + var index = value.indexOf('\n') - value = 0; - base = 1; + while (index !== -1) { + result.push(index + 1) + index = value.indexOf('\n', index + 1) + } - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); + result.push(value.length + 1) - return sign * value; + return result +} - } - return sign * parseInt(value, 10); -} +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} +"use strict"; +// YAML error class. http://stackoverflow.com/questions/8458984 +// -var int_1 = new type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); -function resolveYamlFloat(data) { - if (data === null) return false; + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; } - - return true; } -function constructYamlFloat(data) { - var value, sign, base, digits; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - } else if (value === '.nan') { - return NaN; +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); + result += this.reason || '(unknown reason)'; - value = 0.0; - base = 1; + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); + return result; +}; - return sign * value; - } - return sign * parseFloat(value, 10); -} +module.exports = YAMLException; -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { -function representYamlFloat(object, style) { - var res; +"use strict"; +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - res = object.toString(10); - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} +var Schema = __webpack_require__(16); -var float_1 = new type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); -var json = new schema({ +module.exports = new Schema({ include: [ - failsafe + __webpack_require__(48) ], implicit: [ - _null, - bool, - int_1, - float_1 - ] -}); - -var core = new schema({ - include: [ - json + __webpack_require__(112), + __webpack_require__(113) + ], + explicit: [ + __webpack_require__(114), + __webpack_require__(115), + __webpack_require__(116), + __webpack_require__(117) ] }); -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute +/***/ }), +/* 22 */ +/***/ (function(module, exports) { -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - if (match === null) throw new Error('Date resolve error'); +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. - // match: [1] year [2] month [3] day +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - // match: [4] hour [5] minute [6] second [7] fraction +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; - if (delta) date.setTime(date.getTime() - delta); +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - return date; +function isDate(d) { + return objectToString(d) === '[object Date]'; } +exports.isDate = isDate; -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); } +exports.isError = isError; -var timestamp = new type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; -function resolveYamlMerge(data) { - return data === '<<' || data === null; +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; } +exports.isPrimitive = isPrimitive; -var merge = new type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); +exports.isBuffer = Buffer.isBuffer; -/*eslint-disable no-bitwise*/ +function objectToString(o) { + return Object.prototype.toString.call(o); +} -var NodeBuffer; -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = commonjsRequire; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +module.exports = decimal -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; +/* Check if the given character code, or the character + * code at the first character, is decimal. */ +function decimal(character) { + var code = typeof character === 'string' ? character.charCodeAt(0) : character + return code >= 48 && code <= 57 /* 0-9 */ +} -function resolveYamlBinary(data) { - if (data === null) return false; - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); +"use strict"; - // Skip CR/LF - if (code > 64) continue; - // Fail on illegal characters - if (code < 0) return false; +var wrap = __webpack_require__(98) - bitlen += 6; - } +module.exports = trough - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} +trough.wrap = wrap -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; +var slice = [].slice - // Collect by 6*4 bits (3 bytes) +/* Create new middleware. */ +function trough() { + var fns = [] + var middleware = {} - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } + middleware.run = run + middleware.use = use - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } + return middleware - // Dump tail + /* Run `fns`. Last argument must be + * a completion handler. */ + function run() { + var index = -1 + var input = slice.call(arguments, 0, -1) + var done = arguments[arguments.length - 1] - tailbits = (max % 4) * 6; + if (typeof done !== 'function') { + throw new Error('Expected function as last argument, not ' + done) + } - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } + next.apply(null, [null].concat(input)) - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } + /* Run the next `fn`, if any. */ + function next(err) { + var fn = fns[++index] + var params = slice.call(arguments, 0) + var values = params.slice(1) + var length = input.length + var pos = -1 - return result; -} + if (err) { + done(err) + return + } -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; + /* Copy non-nully input into values. */ + while (++pos < length) { + if (values[pos] === null || values[pos] === undefined) { + values[pos] = input[pos] + } + } - // Convert every three bytes to 4 ASCII characters. + input = values - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; + /* Next or done. */ + if (fn) { + wrap(fn, next).apply(null, input) + } else { + done.apply(null, [null].concat(input)) + } } - - bits = (bits << 8) + object[idx]; } - // Dump tail + /* Add `fn` to the list. */ + function use(fn) { + if (typeof fn !== 'function') { + throw new Error('Expected `fn` to be a function, not ' + fn) + } - tail = max % 3; + fns.push(fn) - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; + return middleware } - - return result; } -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} -var binary = new type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; +"use strict"; +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. -function resolveYamlOmap(data) { - if (data === null) return true; - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - if (_toString.call(pair) !== '[object Object]') return false; - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } +var Schema = __webpack_require__(16); - if (!pairHasKey) return false; - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } +module.exports = Schema.DEFAULT = new Schema({ + include: [ + __webpack_require__(21) + ], + explicit: [ + __webpack_require__(118), + __webpack_require__(119), + __webpack_require__(120) + ] +}); - return true; -} -function constructYamlOmap(data) { - return data !== null ? data : []; +/***/ }), +/* 26 */ +/***/ (function(module, exports) { + +module.exports = function isFunction (fn) { + return Object.prototype.toString.call(fn) === '[object Function]' } -var omap = new type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); -var _toString$1 = Object.prototype.toString; +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { -function resolveYamlPairs(data) { - if (data === null) return true; +"use strict"; - var index, length, pair, keys, result, - object = data; - result = new Array(object.length); +var own = {}.hasOwnProperty - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +module.exports = stringify - if (_toString$1.call(pair) !== '[object Object]') return false; +function stringify(value) { + /* Nothing. */ + if (!value || typeof value !== 'object') { + return null + } - keys = Object.keys(pair); + /* Node. */ + if (own.call(value, 'position') || own.call(value, 'type')) { + return position(value.position) + } - if (keys.length !== 1) return false; + /* Position. */ + if (own.call(value, 'start') || own.call(value, 'end')) { + return position(value) + } - result[index] = [ keys[0], pair[keys[0]] ]; + /* Point. */ + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) } - return true; + /* ? */ + return null } -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +function point(point) { + if (!point || typeof point !== 'object') { + point = {} + } - keys = Object.keys(pair); + return index(point.line) + ':' + index(point.column) +} - result[index] = [ keys[0], pair[keys[0]] ]; +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {} } - return result; + return point(pos.start) + '-' + point(pos.end) } -var pairs = new type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); +function index(value) { + return value && typeof value === 'number' ? value : 1 +} -var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; -function resolveYamlSet(data) { - if (data === null) return true; +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { - var key, object = data; +"use strict"; - for (key in object) { - if (_hasOwnProperty$1.call(object, key)) { - if (object[key] !== null) return false; - } - } - return true; +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } } -function constructYamlSet(data) { - return data !== null ? data : {}; -} -var set = new type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); -var default_safe = new schema({ - include: [ - core - ], - implicit: [ - timestamp, - merge - ], - explicit: [ - binary, - omap, - pairs, - set - ] -}); +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { -function resolveJavascriptUndefined() { - return true; -} +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(50) +var Buffer = buffer.Buffer -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } } - -function representJavascriptUndefined() { - return ''; +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer } -function isUndefined(object) { - return typeof object === 'undefined'; +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) } -var _undefined = new type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') } - - return true; + return Buffer(arg, encodingOrOffset, length) } -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') } + return Buffer(size) +} - return new RegExp(regexp, modifiers); +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) } -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { - return result; -} +"use strict"; -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} -var regexp = new type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); +var legacy = __webpack_require__(77) +var invalid = __webpack_require__(213) +var decimal = __webpack_require__(23) +var hexadecimal = __webpack_require__(78) +var alphanumerical = __webpack_require__(79) +var decodeEntity = __webpack_require__(214) -var esprima; +module.exports = parseEntities -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require$1 = commonjsRequire; - esprima = _require$1('esprima'); -} catch (_) { - /*global window */ - if (typeof window !== 'undefined') esprima = window.esprima; +var own = {}.hasOwnProperty +var fromCharCode = String.fromCharCode +var noop = Function.prototype + +/* Default settings. */ +var defaults = { + warning: null, + reference: null, + text: null, + warningContext: null, + referenceContext: null, + textContext: null, + position: {}, + additional: null, + attribute: false, + nonTerminated: true } +/* Reference types. */ +var NAMED = 'named' +var HEXADECIMAL = 'hexadecimal' +var DECIMAL = 'decimal' +/* Map of bases. */ +var BASE = {} -function resolveJavascriptFunction(data) { - if (data === null) return false; +BASE[HEXADECIMAL] = 16 +BASE[DECIMAL] = 10 - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); +/* Map of types to tests. Each type of character reference + * accepts different characters. This test is used to + * detect whether a reference has ended (as the semicolon + * is not strictly needed). */ +var TESTS = {} - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; - } +TESTS[NAMED] = alphanumerical +TESTS[DECIMAL] = decimal +TESTS[HEXADECIMAL] = hexadecimal - return true; - } catch (err) { - return false; - } -} +/* Warning messages. */ +var NAMED_NOT_TERMINATED = 1 +var NUMERIC_NOT_TERMINATED = 2 +var NAMED_EMPTY = 3 +var NUMERIC_EMPTY = 4 +var NAMED_UNKNOWN = 5 +var NUMERIC_DISALLOWED = 6 +var NUMERIC_PROHIBITED = 7 -function constructJavascriptFunction(data) { - /*jslint evil:true*/ +var MESSAGES = {} - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; +MESSAGES[NAMED_NOT_TERMINATED] = + 'Named character references must be terminated by a semicolon' +MESSAGES[NUMERIC_NOT_TERMINATED] = + 'Numeric character references must be terminated by a semicolon' +MESSAGES[NAMED_EMPTY] = 'Named character references cannot be empty' +MESSAGES[NUMERIC_EMPTY] = 'Numeric character references cannot be empty' +MESSAGES[NAMED_UNKNOWN] = 'Named character references must be known' +MESSAGES[NUMERIC_DISALLOWED] = + 'Numeric character references cannot be disallowed' +MESSAGES[NUMERIC_PROHIBITED] = + 'Numeric character references cannot be outside the permissible Unicode range' - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } +/* Wrap to ensure clean parameters are given to `parse`. */ +function parseEntities(value, options) { + var settings = {} + var option + var key - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); + if (!options) { + options = {} + } - body = ast.body[0].expression.body.range; + for (key in defaults) { + option = options[key] + settings[key] = + option === null || option === undefined ? defaults[key] : option + } - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + if (settings.position.indent || settings.position.start) { + settings.indent = settings.position.indent || [] + settings.position = settings.position.start } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} -function representJavascriptFunction(object /*, style*/) { - return object.toString(); + return parse(value, settings) } -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} +/* Parse entities. */ +function parse(value, settings) { + var additional = settings.additional + var nonTerminated = settings.nonTerminated + var handleText = settings.text + var handleReference = settings.reference + var handleWarning = settings.warning + var textContext = settings.textContext + var referenceContext = settings.referenceContext + var warningContext = settings.warningContext + var pos = settings.position + var indent = settings.indent || [] + var length = value.length + var index = 0 + var lines = -1 + var column = pos.column || 1 + var line = pos.line || 1 + var queue = '' + var result = [] + var entityCharacters + var namedEntity + var terminated + var characters + var character + var reference + var following + var warning + var reason + var output + var entity + var begin + var start + var type + var test + var prev + var next + var diff + var end -var _function = new type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); + /* Cache the current point. */ + prev = now() -var default_full = schema.DEFAULT = new schema({ - include: [ - default_safe - ], - explicit: [ - _undefined, - regexp, - _function - ] -}); + /* Wrap `handleWarning`. */ + warning = handleWarning ? parseError : noop -/*eslint-disable max-len,no-use-before-define*/ + /* Ensure the algorithm walks over the first character + * and the end (inclusive). */ + index-- + length++ + while (++index < length) { + /* If the previous character was a newline. */ + if (character === '\n') { + column = indent[lines] || 1 + } + character = at(index) + /* Handle anything other than an ampersand, + * including newlines and EOF. */ + if (character !== '&') { + if (character === '\n') { + line++ + lines++ + column = 0 + } + if (character) { + queue += character + column++ + } else { + flush() + } + } else { + following = at(index + 1) + /* The behaviour depends on the identity of the next + * character. */ + if ( + following === '\t' /* Tab */ || + following === '\n' /* Newline */ || + following === '\f' /* Form feed */ || + following === ' ' /* Space */ || + following === '<' /* Less-than */ || + following === '&' /* Ampersand */ || + following === '' || + (additional && following === additional) + ) { + /* Not a character reference. No characters + * are consumed, and nothing is returned. + * This is not an error, either. */ + queue += character + column++ + continue + } + start = index + 1 + begin = start + end = start -var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + /* Numerical entity. */ + if (following !== '#') { + type = NAMED + } else { + end = ++begin + /* The behaviour further depends on the + * character after the U+0023 NUMBER SIGN. */ + following = at(end) -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; + if (following === 'x' || following === 'X') { + /* ASCII hex digits. */ + type = HEXADECIMAL + end = ++begin + } else { + /* ASCII digits. */ + type = DECIMAL + } + } + entityCharacters = '' + entity = '' + characters = '' + test = TESTS[type] + end-- -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; + while (++end < length) { + following = at(end) + if (!test(following)) { + break + } -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + characters += following + /* Check if we can match a legacy named + * reference. If so, we cache that as the + * last viable named reference. This + * ensures we do not need to walk backwards + * later. */ + if (type === NAMED && own.call(legacy, characters)) { + entityCharacters = characters + entity = legacy[characters] + } + } -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} + terminated = at(end) === ';' -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} + if (terminated) { + end++ -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} + namedEntity = type === NAMED ? decodeEntity(characters) : false -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} + if (namedEntity) { + entityCharacters = characters + entity = namedEntity + } + } -function fromHexCode(c) { - var lc; + diff = 1 + end - start - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } + if (!terminated && !nonTerminated) { + /* Empty. */ + } else if (!characters) { + /* An empty (possible) entity is valid, unless + * its numeric (thus an ampersand followed by + * an octothorp). */ + if (type !== NAMED) { + warning(NUMERIC_EMPTY, diff) + } + } else if (type === NAMED) { + /* An ampersand followed by anything + * unknown, and not terminated, is invalid. */ + if (terminated && !entity) { + warning(NAMED_UNKNOWN, 1) + } else { + /* If theres something after an entity + * name which is not known, cap the + * reference. */ + if (entityCharacters !== characters) { + end = begin + entityCharacters.length + diff = 1 + end - begin + terminated = false + } - /*eslint-disable no-bitwise*/ - lc = c | 0x20; + /* If the reference is not terminated, + * warn. */ + if (!terminated) { + reason = entityCharacters ? NAMED_NOT_TERMINATED : NAMED_EMPTY - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } + if (!settings.attribute) { + warning(reason, diff) + } else { + following = at(end) - return -1; -} + if (following === '=') { + warning(reason, diff) + entity = null + } else if (alphanumerical(following)) { + entity = null + } else { + warning(reason, diff) + } + } + } + } -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} + reference = entity + } else { + if (!terminated) { + /* All non-terminated numeric entities are + * not rendered, and trigger a warning. */ + warning(NUMERIC_NOT_TERMINATED, diff) + } -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } + /* When terminated and number, parse as + * either hexadecimal or decimal. */ + reference = parseInt(characters, BASE[type]) - return -1; -} + /* Trigger a warning when the parsed number + * is prohibited, and replace with + * replacement character. */ + if (prohibited(reference)) { + warning(NUMERIC_PROHIBITED, diff) + reference = '\uFFFD' + } else if (reference in invalid) { + /* Trigger a warning when the parsed number + * is disallowed, and replace by an + * alternative. */ + warning(NUMERIC_DISALLOWED, diff) + reference = invalid[reference] + } else { + /* Parse the number. */ + output = '' -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} + /* Trigger a warning when the parsed + * number should not be used. */ + if (disallowed(reference)) { + warning(NUMERIC_DISALLOWED, diff) + } -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} + /* Stringify the number. */ + if (reference > 0xffff) { + reference -= 0x10000 + output += fromCharCode((reference >>> (10 & 0x3ff)) | 0xd800) + reference = 0xdc00 | (reference & 0x3ff) + } -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} + reference = output + fromCharCode(reference) + } + } + /* If we could not find a reference, queue the + * checked characters (as normal characters), + * and move the pointer to their end. This is + * possible because we can be certain neither + * newlines nor ampersands are included. */ + if (!reference) { + characters = value.slice(start - 1, end) + queue += characters + column += characters.length + index = end - 1 + } else { + /* Found it! First eat the queued + * characters as normal text, then eat + * an entity. */ + flush() -function State(input, options) { - this.input = input; + prev = now() + index = end - 1 + column += end - start + 1 + result.push(reference) + next = now() + next.offset++ - this.filename = options['filename'] || null; - this.schema = options['schema'] || default_full; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; + if (handleReference) { + handleReference.call( + referenceContext, + reference, + {start: prev, end: next}, + value.slice(start - 1, end) + ) + } - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; + prev = next + } + } + } - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; + /* Return the reduced nodes, and any possible warnings. */ + return result.join('') - this.documents = []; + /* Get current position. */ + function now() { + return { + line: line, + column: column, + offset: index + (pos.offset || 0) + } + } - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ + /* “Throw” a parse-error: a warning. */ + function parseError(code, offset) { + var position = now() -} + position.column += offset + position.offset += offset + handleWarning.call(warningContext, MESSAGES[code], position, code) + } -function generateError(state, message) { - return new exception( - message, - new mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); -} + /* Get character at position. */ + function at(position) { + return value.charAt(position) + } -function throwError(state, message) { - throw generateError(state, message); -} + /* Flush `queue` (normal text). Macro invoked before + * each entity and at the end of `value`. + * Does nothing when `queue` is empty. */ + function flush() { + if (queue) { + result.push(queue) -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); + if (handleText) { + handleText.call(textContext, queue, {start: prev, end: now()}) + } + + queue = '' + } } } +/* Check if `character` is outside the permissible unicode range. */ +function prohibited(code) { + return (code >= 0xd800 && code <= 0xdfff) || code > 0x10ffff +} -var directiveHandlers = { +/* Check if `character` is disallowed. */ +function disallowed(code) { + return ( + (code >= 0x0001 && code <= 0x0008) || + code === 0x000b || + (code >= 0x000d && code <= 0x001f) || + (code >= 0x007f && code <= 0x009f) || + (code >= 0xfdd0 && code <= 0xfdef) || + (code & 0xffff) === 0xffff || + (code & 0xffff) === 0xfffe + ) +} - YAML: function handleYamlDirective(state, name, args) { - var match, major, minor; +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } +"use strict"; - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } +const irregularPlurals = __webpack_require__(318); - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); +module.exports = (word, plural, count) => { + if (typeof plural === 'number') { + count = plural; + } - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } + if (irregularPlurals.has(word.toLowerCase())) { + plural = irregularPlurals.get(word.toLowerCase()); - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); + const firstLetter = word.charAt(0); + const isFirstLetterUpperCase = firstLetter === firstLetter.toUpperCase(); + if (isFirstLetterUpperCase) { + plural = firstLetter.toUpperCase() + plural.slice(1); + } - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } + const isWholeWordUpperCase = word === word.toUpperCase(); + if (isWholeWordUpperCase) { + plural = plural.toUpperCase(); + } + } else if (typeof plural !== 'string') { + plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's') + .replace(/i?e?s$/i, m => { + const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase(); + return isTailLowerCase ? m.toLowerCase() : m.toUpperCase(); + }); + } - state.version = args[0]; - state.checkLineBreaks = (minor < 2); + return Math.abs(count) === 1 ? word : plural; +}; - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - TAG: function handleTagDirective(state, name, args) { +/***/ }), +/* 32 */ +/***/ (function(module, exports) { - var handle, prefix; +module.exports = require("stream"); - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { - handle = args[0]; - prefix = args[1]; +"use strict"; +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - if (_hasOwnProperty$2.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - state.tagMap[handle] = prefix; - } -}; +var Schema = __webpack_require__(16); -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - if (start < end) { - _result = state.input.slice(start, end); +module.exports = new Schema({ + explicit: [ + __webpack_require__(105), + __webpack_require__(106), + __webpack_require__(107) + ] +}); - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - state.result += _result; - } -} +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; +"use strict"; - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - sourceKeys = Object.keys(source); +var formatter = __webpack_require__(142) - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; +var fault = create(Error) - if (!_hasOwnProperty$2.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} +module.exports = fault -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; +fault.eval = create(EvalError) +fault.range = create(RangeError) +fault.reference = create(ReferenceError) +fault.syntax = create(SyntaxError) +fault.type = create(TypeError) +fault.uri = create(URIError) - keyNode = String(keyNode); +fault.create = create - if (_result === null) { - _result = {}; - } +/* Create a new `EConstructor`, with the formatted + * `format` as a first argument. */ +function create(EConstructor) { + FormattedError.displayName = EConstructor.displayName || EConstructor.name - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty$2.call(overridableKeys, keyNode) && - _hasOwnProperty$2.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); + return FormattedError + + function FormattedError(format) { + if (format) { + format = formatter.apply(null, arguments) } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - return _result; + return new EConstructor(format) + } } -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { - state.line += 1; - state.lineStart = state.position; -} +"use strict"; -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } +module.exports = function isObject(x) { + return typeof x === "object" && x !== null; +}; - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - if (is_EOL(ch)) { - readLineBreak(state); +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; +module.exports = minimatch +minimatch.Minimatch = Minimatch - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } +var path = { sep: '/' } +try { + path = __webpack_require__(4) +} catch (er) {} - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __webpack_require__(149) - return lineBreaks; +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } } -function testDocumentSeparator(state) { - var _position = state.position, - ch; +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' - ch = state.input.charCodeAt(_position); +// * => any number of characters +var star = qmark + '*?' - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - _position += 3; +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - ch = state.input.charCodeAt(_position); +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) } -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) } } +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch - ch = state.input.charCodeAt(state.position); + var orig = minimatch - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) } - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) } - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); + return m +} - if (is_WS_OR_EOL(preceding)) { - break; - } +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); + if (!options) options = {} - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } + // "" only matches "" + if (pattern.trim() === '') return p === '' - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } + return new Minimatch(pattern, options).match(p) +} - ch = state.input.charCodeAt(++state.position); +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) } - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') } - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); + if (!options) options = {} + pattern = pattern.trim() - if (ch !== 0x27/* ' */) { - return false; + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + // make the set of regexps etc. + this.make() +} - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } +Minimatch.prototype.debug = function () {} - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); + var pattern = this.pattern + var options = this.options - } else { - state.position++; - captureEnd = state.position; - } + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return } - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} + // step 1: figure out negation, etc. + this.parseNegate() -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; + // step 2: expand braces + var set = this.globSet = this.braceExpand() - ch = state.input.charCodeAt(state.position); + if (options.debug) this.debug = console.error - if (ch !== 0x22/* " */) { - return false; - } + this.debug(this.pattern, set) - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; + this.debug(this.pattern, set) - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); + this.debug(this.pattern, set) - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; + this.debug(this.pattern, set) - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); + this.set = set +} - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 - } else { - throwError(state, 'expected hexadecimal character'); - } - } + if (options.nonegate) return - state.result += charFromCodepoint(hexResult); + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); +Minimatch.prototype.braceExpand = braceExpand +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options } else { - state.position++; - captureEnd = state.position; + options = {} } } - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') } - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] } - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); + return expand(pattern) +} - ch = state.input.charCodeAt(state.position); +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } + var options = this.options - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false } + } - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue } - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false - skipSeparationSpace(state, true, nodeIndent); + case '\\': + clearStateChar() + escaping = true + continue - ch = state.input.charCodeAt(state.position); + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } - throwError(state, 'unexpected end of the stream within a flow collection'); -} + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; + case '(': + if (inClass) { + re += '(' + continue + } - ch = state.input.charCodeAt(state.position); + if (!stateChar) { + re += '\\(' + continue + } - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue - state.kind = 'scalar'; - state.result = ''; + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } + clearStateChar() + re += '|' + continue - } else { - break; - } - } + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); + if (inClass) { + re += '\\' + c + continue + } - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } + inClass = true + classStart = i + reClassStart = re.length + re += c + continue - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } - ch = state.input.charCodeAt(state.position); + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } + // finish up the class. + hasMagic = true + inClass = false + re += c + continue - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } + default: + // swallow any state char that wasn't consumed + clearStateChar() - if (is_EOL(ch)) { - emptyLines++; - continue; - } + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } - // End of the scalar. - if (state.lineIndent < textIndent) { + re += c - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' } - // Break this `while` cycle and go to the funciton's epilogue. - break; - } + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) - // Folded style: use fancy rules to handle line breaks. - if (folding) { + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; + nlLast += nlAfter - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') } + nlAfter = cleanAfter - captureSegment(state, captureStart, state.position, false); + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe } - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re } - ch = state.input.charCodeAt(state.position); + if (addPatternStart) { + re = patternStart + re + } - while (ch !== 0) { + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } - if (ch !== 0x2D/* - */) { - break; - } + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } - following = state.input.charCodeAt(state.position + 1); + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } - if (!is_WS_OR_EOL(following)) { - break; - } + regExp._glob = pattern + regExp._src = re - detected = true; - state.position++; + return regExp +} - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - ch = state.input.charCodeAt(state.position); + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } + if (!set.length) { + this.regexp = false + return this.regexp } + var options = this.options - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false } + return this.regexp +} - ch = state.input.charCodeAt(state.position); +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + if (f === '/' && partial) return true - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } + var options = this.options - detected = true; - atExplicitKey = true; - allowCompact = true; + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - state.position += 1; - ch = following; + var set = this.set + this.debug(this.pattern, 'set', set) - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } + this.debug('matchOne', file.length, pattern.length) - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + this.debug(pattern, p, f) - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true } - } else { - break; // Reading is done. Go to the epilogue. - } + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true } else { - valueNode = state.result; + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ } } - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); + return false } - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) } - } - - // - // Epilogue. - // - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + if (!hit) return false } - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd } - return detected; + // should be unreachable. + throw new Error('wtf?') } -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} - ch = state.input.charCodeAt(state.position); +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} - if (ch !== 0x21/* ! */) return false; - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } +/***/ }), +/* 37 */ +/***/ (function(module, exports) { - ch = state.input.charCodeAt(++state.position); +module.exports = require("events"); - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); +"use strict"; - } else { - tagHandle = '!'; - } - _position = state.position; +function posix(path) { + return path.charAt(0) === '/'; +} - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { - ch = state.input.charCodeAt(++state.position); - } +"use strict"; - tagName = state.input.slice(_position, state.position); +module.exports = __webpack_require__(155); - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { - if (isVerbatim) { - state.tag = tagName; +"use strict"; - } else if (_hasOwnProperty$2.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - } else if (tagHandle === '!') { - state.tag = '!' + tagName; +module.exports = trimTrailingLines - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; +var line = '\n' - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); +/* Remove final newline characters from `value`. */ +function trimTrailingLines(value) { + var val = String(value) + var index = val.length + + while (val.charAt(--index) === line) { + /* Empty */ } - return true; + return val.slice(0, index + 1) } -function readAnchorProperty(state) { - var _position, - ch; - ch = state.input.charCodeAt(state.position); +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - if (ch !== 0x26/* & */) return false; +"use strict"; - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - ch = state.input.charCodeAt(++state.position); - _position = state.position; +module.exports = interrupt - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } +function interrupt(interruptors, tokenizers, ctx, params) { + var length = interruptors.length + var index = -1 + var interruptor + var config - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); + while (++index < length) { + interruptor = interruptors[index] + config = interruptor[1] || {} + + if ( + config.pedantic !== undefined && + config.pedantic !== ctx.options.pedantic + ) { + continue + } + + if ( + config.commonmark !== undefined && + config.commonmark !== ctx.options.commonmark + ) { + continue + } + + if (tokenizers[interruptor[0]].apply(ctx, params)) { + return true + } } - state.anchor = state.input.slice(_position, state.position); - return true; + return false } -function readAlias(state) { - var _position, alias, - ch; - ch = state.input.charCodeAt(state.position); +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { - if (ch !== 0x2A/* * */) return false; +"use strict"; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } +var collapseWhiteSpace = __webpack_require__(234) - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } +module.exports = normalize - alias = state.input.slice(_position, state.position); +// Normalize an identifier. Collapses multiple white space characters into a +// single space, and removes casing. +function normalize(value) { + return collapseWhiteSpace(value).toLowerCase() +} - if (!state.anchorMap.hasOwnProperty(alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } +var expression = /\s/ + +// Wrap `url` in angle brackets when needed, or when +// forced. +// In links, images, and definitions, the URL part needs +// to be enclosed when it: +// +// - has a length of `0` +// - contains white-space +// - has more or less opening than closing parentheses +function enclose(uri, always) { + if ( + always || + uri.length === 0 || + expression.test(uri) || + count(uri, leftParenthesis) !== count(uri, rightParenthesis) + ) { + return lessThan + uri + greaterThan } - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; + return uri +} - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; +"use strict"; - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; +module.exports = enclose - if (state.tag === null) { - state.tag = '?'; - } - } +var quotationMark = '"' +var apostrophe = "'" - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } +// There is currently no way to support nested delimiters across Markdown.pl, +// CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl +// and GitHub. +// CommonMark is not supported when mixing double- and single quotes inside a +// title. +function enclose(title) { + var delimiter = + title.indexOf(quotationMark) === -1 ? quotationMark : apostrophe + return delimiter + title + delimiter +} - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only assigned to plain scalars. So, it isn't - // needed to check for 'kind' conformity. +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty$2.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; +"use strict"; - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } +module.exports = toString - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; +/* Get the text content of a node. If the node itself + * does not expose plain-text fields, `toString` will + * recursivly try its children. */ +function toString(node) { + return ( + valueOf(node) || + (node.children && node.children.map(toString).join('')) || + '' + ) } -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; +/* Get the value of `node`. Checks, `value`, + * `alt`, and `title`, in that order. */ +function valueOf(node) { + return ( + (node && node.value ? node.value : node.alt ? node.alt : node.title) || '' + ) +} - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); +/***/ }), +/* 46 */ +/***/ (function(module, exports) { - ch = state.input.charCodeAt(state.position); +module.exports = function(module) { + if (!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if (!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; +/***/ }), +/* 47 */ +/***/ (function(module, exports) { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } +module.exports = require("module"); - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } +"use strict"; +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - if (is_EOL(ch)) break; - _position = state.position; - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } +var Schema = __webpack_require__(16); - directiveArgs.push(state.input.slice(_position, state.position)); - } - if (ch !== 0) readLineBreak(state); +module.exports = new Schema({ + include: [ + __webpack_require__(49) + ] +}); - if (_hasOwnProperty$2.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - skipSeparationSpace(state, true, -1); +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); +"use strict"; +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - state.documents.push(state.result); - if (state.position === state.lineStart && testDocumentSeparator(state)) { +var Schema = __webpack_require__(16); - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} +module.exports = new Schema({ + include: [ + __webpack_require__(33) + ], + implicit: [ + __webpack_require__(108), + __webpack_require__(109), + __webpack_require__(110), + __webpack_require__(111) + ] +}); -function loadDocuments(input, options) { - input = String(input); - options = options || {}; +/***/ }), +/* 50 */ +/***/ (function(module, exports) { - if (input.length !== 0) { +module.exports = require("buffer"); - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } +"use strict"; - var state = new State(input, options); +const errorEx = __webpack_require__(123); +const fallback = __webpack_require__(125); - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; +const JSONError = errorEx('JSONError', { + fileName: errorEx.append('in %s') +}); - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } +module.exports = (input, reviver, filename) => { + if (typeof reviver === 'string') { + filename = reviver; + reviver = null; + } - while (state.position < (state.length - 1)) { - readDocument(state); - } + try { + try { + return JSON.parse(input, reviver); + } catch (err) { + fallback(input, reviver); - return state.documents; -} + throw err; + } + } catch (err) { + err.message = err.message.replace(/\n/g, ''); + const jsonErr = new JSONError(err); + if (filename) { + jsonErr.fileName = filename; + } -function loadAll(input, iterator, options) { - var documents = loadDocuments(input, options), index, length; + throw jsonErr; + } +}; - if (typeof iterator !== 'function') { - return documents; - } - for (index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -function load(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new exception('expected a single document in the stream, but found more'); -} - - -function safeLoadAll(input, output, options) { - if (typeof output === 'function') { - loadAll(input, output, common.extend({ schema: default_safe }, options)); - } else { - return loadAll(input, common.extend({ schema: default_safe }, options)); - } -} +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(127); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ -function safeLoad(input, options) { - return load(input, common.extend({ schema: default_safe }, options)); -} + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ -var loadAll_1 = loadAll; -var load_1 = load; -var safeLoadAll_1 = safeLoadAll; -var safeLoad_1 = safeLoad; + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ -var loader = { - loadAll: loadAll_1, - load: load_1, - safeLoadAll: safeLoadAll_1, - safeLoad: safeLoad_1 -}; + function selectColor(namespace) { + var hash = 0; -/*eslint-disable no-use-before-define*/ + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + var prevTime; + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + // Disabled? + if (!debug.enabled) { + return; + } -var _toString$2 = Object.prototype.toString; -var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; + var self = debug; // Set `diff` timestamp -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); -var ESCAPE_SEQUENCES = {}; + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; + index++; + var formatter = createDebug.formatters[format]; - if (map === null) return {}; + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - result = {}; - keys = Object.keys(map); + args.splice(index, 1); + index--; + } - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); + return match; + }); // Apply env-specific formatting (colors, etc.) - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); } - type = schema.compiledTypeMap['fallback'][tag]; - if (type && _hasOwnProperty$3.call(type.styleAliases, style)) { - style = type.styleAliases[style]; + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); } - result[tag] = style; + createDebug.instances.push(debug); + return debug; } - return result; -} - -function encodeHex(character) { - var string, handle, length; + function destroy() { + var index = createDebug.instances.indexOf(this); - string = character.toString(16).toUpperCase(); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); + return false; } - return '\\' + handle + common.repeat('0', length - string.length) + string; -} + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ -function State$1(options) { - this.schema = options['schema'] || default_full; - this.indent = Math.max(1, (options['indent'] || 2)); - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; - this.tag = null; - this.result = ''; + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } - this.duplicates = []; - this.usedDuplicates = null; -} + namespaces = split[i].replace(/\*/g, '.*?'); -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); } + } + /** + * Disable debug output. + * + * @api public + */ - if (line.length && line !== '\n') result += ind; - result += line; + function disable() { + createDebug.enable(''); } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - return result; -} -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } -function testImplicitResolving(state, str) { - var index, length, type; + var i; + var len; - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } - if (type.resolve(str)) { - return true; + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } } - } - return false; -} + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - && c !== CHAR_COLON - && c !== CHAR_SHARP; -} + return val; + } -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; + createDebug.enable(createDebug.load()); + return createDebug; } -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} +module.exports = setup; -var STYLE_PLAIN = 1; -var STYLE_SINGLE = 2; -var STYLE_LITERAL = 3; -var STYLE_FOLDED = 4; -var STYLE_DOUBLE = 5; -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; -} +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey) { - state.dump = (function () { - if (string.length === 0) { - return "''"; - } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { - return "'" + string + "'"; - } +"use strict"; - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); +const os = __webpack_require__(54); +const hasFlag = __webpack_require__(130); - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } +const env = process.env; - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; - default: - throw new exception('impossible error: invalid scalar style'); - } - }()); -} +const support = level => { + if (level === 0) { + return false; + } -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +}; - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); +let supportLevel = (() => { + if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + return 0; + } - return indentIndicator + chomp + '\n'; -} + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} + if (hasFlag('color=256')) { + return 2; + } -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + return 1; + } - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; + if (process.stdout && !process.stdout.isTTY) { + return 0; + } - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return 2; + } - return result; -} + return 1; + } -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; + return 0; + } - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - return result.slice(1); // drop extra \n joiner -} + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; - } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } - return result; -} + if ('COLORTERM' in env) { + return 1; + } -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; + if (env.TERM === 'dumb') { + return 0; + } - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } + return 0; +})(); - state.tag = _tag; - state.dump = '[' + _result + ']'; +if ('FORCE_COLOR' in env) { + supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : (supportLevel || 1); } -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; +module.exports = process && support(supportLevel); - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } +/***/ }), +/* 54 */ +/***/ (function(module, exports) { - _result += state.dump; - } - } +module.exports = require("os"); - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; +"use strict"; - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = state.condenseFlow ? '"' : ''; - if (index !== 0) pairBuffer += ', '; +var fs = __webpack_require__(6) +var path = __webpack_require__(4) +var resolve = __webpack_require__(131).silent +var npmPrefix = __webpack_require__(132)() - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; +module.exports = loadPlugin +loadPlugin.resolve = resolvePlugin - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } +var electron = process.versions.electron !== undefined +var argv = process.argv[1] || /* istanbul ignore next */ '' +var nvm = process.env.NVM_BIN +var globally = electron || argv.indexOf(npmPrefix) === 0 +var windows = process.platform === 'win32' +var prefix = windows ? /* istanbul ignore next */ '' : 'lib' +var globals = path.resolve(npmPrefix, prefix, 'node_modules') - if (state.dump.length > 1024) pairBuffer += '? '; +/* istanbul ignore next - If we’re in Electron, we’re running in a modified + * Node that cannot really install global node modules. To find the actual + * modules, the user has to either set `prefix` in their `.npmrc` (which is + * picked up by `npm-prefix`). Most people don’t do that, and some use NVM + * instead to manage different versions of Node. Luckily NVM leaks some + * environment variables that we can pick up on to try and detect the actual + * modules. */ +if (electron && nvm && !fs.existsSync(globals)) { + globals = path.resolve(nvm, '..', prefix, 'node_modules') +} - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); +/* Load the plug-in found using `resolvePlugin`. */ +function loadPlugin(name, options) { + return __webpack_require__(141)(resolvePlugin(name, options) || name) +} - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; +/* Find a plugin. + * + * See also: + * + * + * + * Uses the standard node module loading strategy to find $name + * in each given `cwd` (and optionally the global node_modules + * directory). + * + * If a prefix is given and $name is not a path, `$prefix-$name` + * is also searched (preferring these over non-prefixed modules). */ +function resolvePlugin(name, options) { + var settings = options || {} + var prefix = settings.prefix + var cwd = settings.cwd + var filePath + var sources + var length + var index + var plugin - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new exception('sortKeys must be a boolean or a function'); + if (cwd && typeof cwd === 'object') { + sources = cwd.concat() + } else { + sources = [cwd || process.cwd()] } - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. + /* Non-path. */ + if (name.indexOf(path.sep) === -1 && name.charAt(0) !== '.') { + if (settings.global == null ? globally : settings.global) { + sources.push(globals) } - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); + /* Unprefix module. */ + if (prefix) { + prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-' - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; + if (name.slice(0, prefix.length) !== prefix) { + plugin = prefix + name } } + } - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } + length = sources.length + index = -1 - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } + while (++index < length) { + cwd = sources[index] + filePath = (plugin && resolve(cwd, plugin)) || resolve(cwd, name) - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; + if (filePath) { + return filePath } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; } - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. + return null } -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - typeList = explicit ? state.explicitTypes : state.implicitTypes; +/***/ }), +/* 56 */ +/***/ (function(module, exports) { - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; +module.exports = function (args, opts) { + if (!opts) opts = {}; - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { + var flags = { bools : {}, strings : {}, unknownFn: null }; - state.tag = explicit ? type.tag : '?'; + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } - if (_toString$2.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty$3.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); - state.dump = _result; - } + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); - return true; - } - } + var defaults = opts['default'] || {}; - return false; -} + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; + var notFlags = []; - if (!detectType(state, object, false)) { - detectType(state, object, true); - } + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } - var type = _toString$2.call(state.dump); + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } + function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + var key = keys[keys.length - 1]; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; } - } - } else if (type === '[object Array]') { - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; + else if (Array.isArray(o[key])) { + o[key].push(value); } - } else { - writeFlowSequence(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + else { + o[key] = [ o[key], value ]; } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new exception('unacceptable kind of an object to dump ' + type); } - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); } - } - - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - inspectNode(object, objects, duplicatesIndexes); + for (var i = 0; i < args.length; i++) { + var arg = args[i]; - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + var key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } } - } } - } -} -function dump(input, options) { - options = options || {}; + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); - var state = new State$1(options); + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } - if (!state.noRefs) getDuplicateReferences(input, state); + return argv; +}; - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); - return ''; + var key = keys[keys.length - 1]; + return key in o; } -function safeDump(input, options) { - return dump(input, common.extend({ schema: default_safe }, options)); +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); } -var dump_1 = dump; -var safeDump_1 = safeDump; -var dumper = { - dump: dump_1, - safeDump: safeDump_1 -}; -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -var Type$2 = type; -var Schema$2 = schema; -var FAILSAFE_SCHEMA = failsafe; -var JSON_SCHEMA = json; -var CORE_SCHEMA = core; -var DEFAULT_SAFE_SCHEMA$1 = default_safe; -var DEFAULT_FULL_SCHEMA$1 = default_full; -var load$1 = loader.load; -var loadAll$1 = loader.loadAll; -var safeLoad$1 = loader.safeLoad; -var safeLoadAll$1 = loader.safeLoadAll; -var dump$1 = dumper.dump; -var safeDump$1 = dumper.safeDump; -var YAMLException$2 = exception; -// Deprecated schema names from JS-YAML 2.0.x -var MINIMAL_SCHEMA = failsafe; -var SAFE_SCHEMA = default_safe; -var DEFAULT_SCHEMA = default_full; +var fs = __webpack_require__(6); +var path = __webpack_require__(4); +var fault = __webpack_require__(34); +var debug = __webpack_require__(9)('unified-engine:find-up'); +var func = __webpack_require__(26); +var object = __webpack_require__(35); -// Deprecated functions from JS-YAML 1.x.x -var scan = deprecated('scan'); -var parse = deprecated('parse'); -var compose = deprecated('compose'); -var addConstructor = deprecated('addConstructor'); - -var jsYaml = { - Type: Type$2, - Schema: Schema$2, - FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, - JSON_SCHEMA: JSON_SCHEMA, - CORE_SCHEMA: CORE_SCHEMA, - DEFAULT_SAFE_SCHEMA: DEFAULT_SAFE_SCHEMA$1, - DEFAULT_FULL_SCHEMA: DEFAULT_FULL_SCHEMA$1, - load: load$1, - loadAll: loadAll$1, - safeLoad: safeLoad$1, - safeLoadAll: safeLoadAll$1, - dump: dump$1, - safeDump: safeDump$1, - YAMLException: YAMLException$2, - MINIMAL_SCHEMA: MINIMAL_SCHEMA, - SAFE_SCHEMA: SAFE_SCHEMA, - DEFAULT_SCHEMA: DEFAULT_SCHEMA, - scan: scan, - parse: parse, - compose: compose, - addConstructor: addConstructor -}; +module.exports = FindUp; -var jsYaml$2 = jsYaml; +var read = fs.readFile; +var resolve = path.resolve; +var relative = path.relative; +var join = path.join; +var dirname = path.dirname; -var isArrayish = function isArrayish(obj) { - if (!obj) { - return false; - } +FindUp.prototype.load = load; - return obj instanceof Array || Array.isArray(obj) || - (obj.length >= 0 && obj.splice instanceof Function); -}; +function FindUp(options) { + var self = this; + var fp = options.filePath; -var errorEx = function errorEx(name, properties) { - if (!name || name.constructor !== String) { - properties = name || {}; - name = Error.name; - } + self.cache = {}; + self.cwd = options.cwd; + self.detect = options.detect; + self.names = options.names; + self.create = options.create; - var errorExError = function ErrorEXError(message) { - if (!this) { - return new ErrorEXError(message); - } + if (fp) { + self.givenFilePath = resolve(options.cwd, fp); + } +} - message = message instanceof Error - ? message.message - : (message || this.message); +function load(filePath, callback) { + var self = this; + var cache = self.cache; + var givenFilePath = self.givenFilePath; + var givenFile = self.givenFile; + var names = self.names; + var create = self.create; + var cwd = self.cwd; + var parent; - Error.call(this, message); - Error.captureStackTrace(this, errorExError); + if (givenFilePath) { + if (givenFile) { + apply(callback, givenFile); + } else { + givenFile = [callback]; + self.givenFile = givenFile; + debug('Checking given file `%s`', givenFilePath); + read(givenFilePath, loadGiven); + } - this.name = name; + return; + } - Object.defineProperty(this, 'message', { - configurable: true, - enumerable: false, - get: function () { - var newMessage = message.split(/\r?\n/g); + if (!self.detect) { + return callback(); + } - for (var key in properties) { - if (!properties.hasOwnProperty(key)) { - continue; - } + filePath = resolve(cwd, filePath); + parent = dirname(filePath); - var modifier = properties[key]; + if (parent in cache) { + apply(callback, cache[parent]); + } else { + cache[parent] = [callback]; + find(parent); + } - if ('message' in modifier) { - newMessage = modifier.message(this[key], newMessage) || newMessage; - if (!isArrayish(newMessage)) { - newMessage = [newMessage]; - } - } - } + function loadGiven(err, buf) { + var cbs = self.givenFile; + var result; - return newMessage.join('\n'); - }, - set: function (v) { - message = v; - } - }); + if (err) { + result = fault('Cannot read given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); + result.code = 'ENOENT'; + result.path = err.path; + result.syscall = err.syscall; + } else { + try { + result = create(buf, givenFilePath); + debug('Read given file `%s`', givenFilePath); + } catch (err) { + result = fault('Cannot parse given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); + debug(err.message); + } + } - var overwrittenStack = null; + givenFile = result; + self.givenFile = result; + applyAll(cbs, result); + } - var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack'); - var stackGetter = stackDescriptor.get; - var stackValue = stackDescriptor.value; - delete stackDescriptor.value; - delete stackDescriptor.writable; + function find(directory) { + var index = -1; + var length = names.length; - stackDescriptor.set = function (newstack) { - overwrittenStack = newstack; - }; + next(); - stackDescriptor.get = function () { - var stack = (overwrittenStack || ((stackGetter) - ? stackGetter.call(this) - : stackValue)).split(/\r?\n+/g); + function next() { + var parent; - // starting in Node 7, the stack builder caches the message. - // just replace it. - if (!overwrittenStack) { - stack[0] = this.name + ': ' + this.message; - } + /* Try to read the next file. We don’t use `readdir` because on + * huge directories, that could be *very* slow. */ + if (++index < length) { + read(join(directory, names[index]), done); + } else { + parent = dirname(directory); - var lineCount = 1; - for (var key in properties) { - if (!properties.hasOwnProperty(key)) { - continue; - } + if (directory === parent) { + debug('No files found for `%s`', filePath); + found(); + } else if (parent in cache) { + apply(found, cache[parent]); + } else { + cache[parent] = [found]; + find(parent); + } + } + } - var modifier = properties[key]; + function done(err, buf) { + var name = names[index]; + var fp = join(directory, name); + var contents; - if ('line' in modifier) { - var line = modifier.line(this[key]); - if (line) { - stack.splice(lineCount++, 0, ' ' + line); - } - } + /* istanbul ignore if - Hard to test. */ + if (err) { + if (err.code === 'ENOENT') { + return next(); + } - if ('stack' in modifier) { - modifier.stack(this[key], stack); - } - } + err = fault('Cannot read file `%s`\n%s', relative(cwd, fp), err.message); + debug(err.message); + return found(err); + } - return stack.join('\n'); - }; + try { + contents = create(buf, fp); + } catch (err) { + return found(fault('Cannot parse file `%s`\n%s', relative(cwd, fp), err.message)); + } - Object.defineProperty(this, 'stack', stackDescriptor); - }; + /* istanbul ignore else - maybe used in the future. */ + if (contents) { + debug('Read file `%s`', fp); + found(null, contents); + } else { + next(); + } + } - if (Object.setPrototypeOf) { - Object.setPrototypeOf(errorExError.prototype, Error.prototype); - Object.setPrototypeOf(errorExError, Error); - } else { - util.inherits(errorExError, Error); - } + function found(err, result) { + var cbs = cache[directory]; + cache[directory] = err || result; + applyAll(cbs, err || result); + } + } - return errorExError; -}; + function applyAll(cbs, result) { + var index = cbs.length; -errorEx.append = function (str, def) { - return { - message: function (v, message) { - v = v || def; + while (index--) { + apply(cbs[index], result); + } + } - if (v) { - message[0] += ' ' + str.replace('%s', v.toString()); - } + function apply(cb, result) { + if (object(result) && func(result[0])) { + result.push(cb); + } else if (result instanceof Error) { + cb(result); + } else { + cb(null, result); + } + } +} - return message; - } - }; -}; -errorEx.line = function (str, def) { - return { - line: function (v) { - v = v || def; +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { - if (v) { - return str.replace('%s', v.toString()); - } +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. - return null; - } - }; -}; +module.exports = glob + +var fs = __webpack_require__(6) +var rp = __webpack_require__(59) +var minimatch = __webpack_require__(36) +var Minimatch = minimatch.Minimatch +var inherits = __webpack_require__(13) +var EE = __webpack_require__(37).EventEmitter +var path = __webpack_require__(4) +var assert = __webpack_require__(60) +var isAbsolute = __webpack_require__(38) +var globSync = __webpack_require__(153) +var common = __webpack_require__(61) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = __webpack_require__(154) +var util = __webpack_require__(11) +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = __webpack_require__(63) -var errorEx_1 = errorEx; +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} -var jsonParseBetterErrors = parseJson; -function parseJson (txt, reviver, context) { - context = context || 20; - try { - return JSON.parse(txt, reviver) - } catch (e) { - if (typeof txt !== 'string') { - const isEmptyArray = Array.isArray(txt) && txt.length === 0; - const errorMessage = 'Cannot parse ' + - (isEmptyArray ? 'an empty array' : String(txt)); - throw new TypeError(errorMessage) - } - const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i); - const errIdx = syntaxErr - ? +syntaxErr[1] - : e.message.match(/^Unexpected end of JSON.*/i) - ? txt.length - 1 - : null; - if (errIdx != null) { - const start = errIdx <= context - ? 0 - : errIdx - context; - const end = errIdx + context >= txt.length - ? txt.length - : errIdx + context; - e.message += ` while parsing near '${ - start === 0 ? '' : '...' - }${txt.slice(start, end)}${ - end === txt.length ? '' : '...' - }'`; - } else { - e.message += ` while parsing '${txt.slice(0, context * 2)}'`; - } - throw e + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) } -} -var parseJson$1 = createCommonjsModule(function (module) { -const JSONError = errorEx_1('JSONError', { - fileName: errorEx_1.append('in %s') -}); + return new Glob(pattern, options, cb) +} -module.exports = (input, reviver, filename) => { - if (typeof reviver === 'string') { - filename = reviver; - reviver = null; - } +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync - try { - try { - return JSON.parse(input, reviver); - } catch (err) { - jsonParseBetterErrors(input, reviver); +// old api surface +glob.glob = glob - throw err; - } - } catch (err) { - err.message = err.message.replace(/\n/g, ''); +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } - const jsonErr = new JSONError(err); - if (filename) { - jsonErr.fileName = filename; - } + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} - throw jsonErr; - } -}; -}); +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true -/** - * Helpers. - */ + var g = new Glob(pattern, options) + var set = g.minimatch.set -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; + if (!pattern) + return false -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ + if (set.length > 1) + return true -var ms = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse$1(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ + return false +} -function parse$1(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) } -} -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} + setopts(this, pattern, options) + this._didRealPath = false -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + // process each pattern in the minimatch set + var n = this.minimatch.set.length -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } } - return ms + ' ms'; } -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = ms; - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ + if (this.realpath && !this._didRealpath) + return this._realpath() - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ + common.finish(this) + this.emit('end', this.found) +} - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ +Glob.prototype._realpath = function () { + if (this._didRealpath) + return - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ + this._didRealpath = true - function selectColor(namespace) { - var hash = 0; + var n = this.matches.length + if (n === 0) + return this._finish() - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + function next () { + if (--n === 0) + self._finish() } +} - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() - function createDebug(namespace) { - var prevTime; + var found = Object.keys(matchset) + var self = this + var n = found.length - function debug() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + if (n === 0) + return cb() - // Disabled? - if (!debug.enabled) { - return; + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() } + }) + }) +} - var self = debug; // Set `diff` timestamp +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} - var curr = Number(new Date()); - var ms$$1 = curr - (prevTime || curr); - self.diff = ms$$1; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} - index++; - var formatter = createDebug.formatters[format]; +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + if (this.aborted) + return - args.splice(index, 1); - index--; - } + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } - return match; - }); // Apply env-specific formatting (colors, etc.) + //console.error('PROCESS %d', this._processing, pattern) - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break - createDebug.instances.push(debug); - return debug; + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break } - function destroy() { - var index = createDebug.instances.indexOf(this); + var remain = pattern.slice(n) - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix - return false; - } + var abs = this._makeAbs(read) - function extend(namespace, delimiter) { - return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - namespaces = split[i].replace(/\*/g, '.*?'); + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); + m = e.match(pn) } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); + if (m) + matchedEntries.push(e) } } - /** - * Disable debug output. - * - * @api public - */ + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - function disable() { - createDebug.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) - var i; - var len; + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) } + this._emitMatch(index, e) } + // This was the last one, and no stats were needed + return cb() + } - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} - return false; +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ + var abs = isAbsolute(e) ? e : this._makeAbs(e) - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } + if (this.mark) + e = this._mark(e) - return val; + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return } - createDebug.enable(createDebug.load()); - return createDebug; + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) } -var common$3 = setup; +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return -var browser = createCommonjsModule(function (module, exports) { -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) -/* eslint-env browser */ + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) -/** - * This is the web browser implementation of `debug()`. - */ -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -/** - * Colors. - */ - -exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ -// eslint-disable-next-line complexity + if (lstatcb) + fs.lstat(abs, lstatcb) -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); -} -/** - * Colorize log arguments if enabled. - * - * @api public - */ + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() - if (!this.useColors) { - return; + if (Array.isArray(c)) + return cb(null, c) } - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} - index++; +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true } - }); - args.splice(lastC, 0, c); -} -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ + } + this.cache[abs] = entries + return cb(null, entries) +} -function log() { - var _console; +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); -} -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break } + + return cb() } -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -function load() { - var r; - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) - return r; -} -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + var isSym = this.symlinks[abs] + var len = entries.length -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } -} + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() -module.exports = common$3(exports); -var formatters = module.exports.formatters; -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) } -}; -}); -var browser_1 = browser.log; -var browser_2 = browser.formatArgs; -var browser_3 = browser.save; -var browser_4 = browser.load; -var browser_5 = browser.useColors; -var browser_6 = browser.storage; -var browser_7 = browser.colors; + cb() +} -var hasFlag = function (flag, argv) { - argv = argv || process.argv; +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - var terminatorPos = argv.indexOf('--'); - var prefix = /^-{1,2}/.test(flag) ? '' : '--'; - var pos = argv.indexOf(prefix + flag); + //console.error('ps2', prefix, exists) - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; + if (!this.matches[index]) + this.matches[index] = Object.create(null) -var supportsColor = createCommonjsModule(function (module) { -const env = process.env; + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() -const support = level => { - if (level === 0) { - return false; - } + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -}; + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') -let supportLevel = (() => { - if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - return 0; - } - - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} - if (hasFlag('color=256')) { - return 2; - } +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - return 1; - } + if (f.length > this.maxLength) + return cb() - if (process.stdout && !process.stdout.isTTY) { - return 0; - } + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return 2; - } + if (Array.isArray(c)) + c = 'DIR' - return 1; - } + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } + if (needDir && c === 'FILE') + return cb() - return 0; - } + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Hyper': - return 3; - case 'Apple_Terminal': - return 2; - // No default - } - } + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat - if ('COLORTERM' in env) { - return 1; - } + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) - if (env.TERM === 'dumb') { - return 0; - } + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c - return 0; -})(); + if (needDir && c === 'FILE') + return cb() -if ('FORCE_COLOR' in env) { - supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : (supportLevel || 1); + return cb(null, c, stat) } -module.exports = process && support(supportLevel); -}); -var node = createCommonjsModule(function (module, exports) { -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -/** - * Colors. - */ +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { -exports.colors = [6, 2, 3, 4, 5, 1]; +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - var supportsColor$$1 = supportsColor; +var fs = __webpack_require__(6) +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync - if (supportsColor$$1 && (supportsColor$$1.stderr || supportsColor$$1).level >= 2) { - exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; - } -} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = __webpack_require__(148) -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } -exports.inspectOpts = Object.keys(process.env).filter(function (key) { - return /^debug_/i.test(key); -}).reduce(function (obj, key) { - // Camel-case - var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { - return k.toUpperCase(); - }); // Coerce string value into JS value + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} - var val = process.env[key]; +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } } +} - obj[prop] = val; - return obj; -}, {}); -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} -function useColors() { - return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync } -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ -function formatArgs(args) { - var name = this.namespace, - useColors = this.useColors; +/***/ }), +/* 60 */ +/***/ (function(module, exports) { - if (useColors) { - var c = this.color; - var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); - var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } +module.exports = require("assert"); + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { + +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) } -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } +var path = __webpack_require__(4) +var minimatch = __webpack_require__(36) +var isAbsolute = __webpack_require__(38) +var Minimatch = minimatch.Minimatch - return new Date().toISOString() + ' '; +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) } -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ +function alphasort (a, b) { + return a.localeCompare(b) +} -function log() { - return process.stderr.write(util.format.apply(util, arguments) + '\n'); +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } } -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher } } -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } -function load() { - return process.env.DEBUG; + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options } -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) -function init(debug) { - debug.inspectOpts = {}; - var keys = Object.keys(exports.inspectOpts); + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } - for (var i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } } -} -module.exports = common$3(exports); -var formatters = module.exports.formatters; -/** - * Map %o to `util.inspect()`, all on a single line. - */ + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' '); -}; -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ + self.found = all +} +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; -}); + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) -var node_1 = node.init; -var node_2 = node.log; -var node_3 = node.formatArgs; -var node_4 = node.save; -var node_5 = node.load; -var node_6 = node.useColors; -var node_7 = node.colors; -var node_8 = node.inspectOpts; + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } -var src = createCommonjsModule(function (module) { -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = browser; -} else { - module.exports = node; + return m } -}); -var resolveFrom_1 = createCommonjsModule(function (module) { -const resolveFrom = (fromDir, moduleId, silent) => { - if (typeof fromDir !== 'string') { - throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); - } +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } - if (typeof moduleId !== 'string') { - throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); - } + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') - try { - fromDir = fs.realpathSync(fromDir); - } catch (err) { - if (err.code === 'ENOENT') { - fromDir = path.resolve(fromDir); - } else if (silent) { - return null; - } else { - throw err; - } - } + return abs +} - const fromFile = path.join(fromDir, 'noop.js'); - const resolveFileName = () => module$1._resolveFilename(moduleId, { - id: fromFile, - filename: fromFile, - paths: module$1._nodeModulePaths(fromDir) - }); +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false - if (silent) { - try { - return resolveFileName(); - } catch (err) { - return null; - } - } + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} - return resolveFileName(); -}; +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false -module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); -module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); -}); + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} -var resolveFrom_2 = resolveFrom_1.silent; -var ini = createCommonjsModule(function (module, exports) { -exports.parse = exports.decode = decode; +/***/ }), +/* 62 */ +/***/ (function(module, exports) { -exports.stringify = exports.encode = encode; +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) -exports.safe = safe; -exports.unsafe = unsafe; + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') -var eol = typeof process !== 'undefined' && - process.platform === 'win32' ? '\r\n' : '\n'; + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) -function encode (obj, opt) { - var children = []; - var out = ''; + return wrapper - if (typeof opt === 'string') { - opt = { - section: opt, - whitespace: false - }; - } else { - opt = opt || {}; - opt.whitespace = opt.whitespace === true; + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret } +} - var separator = opt.whitespace ? ' = ' : '='; - Object.keys(obj).forEach(function (k, _, __) { - var val = obj[k]; - if (val && Array.isArray(val)) { - val.forEach(function (item) { - out += safe(k + '[]') + separator + safe(item) + '\n'; - }); - } else if (val && typeof val === 'object') { - children.push(k); - } else { - out += safe(k) + separator + safe(val) + eol; - } - }); +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { - if (opt.section && out.length) { - out = '[' + safe(opt.section) + ']' + eol + out; - } +var wrappy = __webpack_require__(62) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) - children.forEach(function (k, _, __) { - var nk = dotSplit(k).join('\\.'); - var section = (opt.section ? opt.section + '.' : '') + nk; - var child = encode(obj[k], { - section: section, - whitespace: opt.whitespace - }); - if (out.length && child.length) { - out += eol; - } - out += child; - }); +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) - return out + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f } -function dotSplit (str) { - return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') - .replace(/\\\./g, '\u0001') - .split(/\./).map(function (part) { - return part.replace(/\1/g, '\\.') - .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001') - }) +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f } -function decode (str) { - var out = {}; - var p = out; - var section = null; - // section |key = value - var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i; - var lines = str.split(/[\r\n]+/g); - lines.forEach(function (line, _, __) { - if (!line || line.match(/^\s*[;#]/)) return - var match = line.match(re); - if (!match) return - if (match[1] !== undefined) { - section = unsafe(match[1]); - p = out[section] = out[section] || {}; - return - } - var key = unsafe(match[2]); - var value = match[3] ? unsafe(match[4]) : true; - switch (value) { - case 'true': - case 'false': - case 'null': value = JSON.parse(value); - } - - // Convert keys with '[]' suffix to an array - if (key.length > 2 && key.slice(-2) === '[]') { - key = key.substring(0, key.length - 2); - if (!p[key]) { - p[key] = []; - } else if (!Array.isArray(p[key])) { - p[key] = [p[key]]; - } - } - - // safeguard against resetting a previously defined - // array by accidentally forgetting the brackets - if (Array.isArray(p[key])) { - p[key].push(value); - } else { - p[key] = value; - } - }); - - // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} - // use a filter to return the keys that have to be deleted. - Object.keys(out).filter(function (k, _, __) { - if (!out[k] || - typeof out[k] !== 'object' || - Array.isArray(out[k])) { - return false - } - // see if the parent section is also an object. - // if so, add it to that, and mark this one for deletion - var parts = dotSplit(k); - var p = out; - var l = parts.pop(); - var nl = l.replace(/\\\./g, '.'); - parts.forEach(function (part, _, __) { - if (!p[part] || typeof p[part] !== 'object') p[part] = {}; - p = p[part]; - }); - if (p === out && nl === l) { - return false - } - p[nl] = out[k]; - return true - }).forEach(function (del, _, __) { - delete out[del]; - }); - - return out -} +/***/ }), +/* 64 */ +/***/ (function(module, exports) { -function isQuoted (val) { - return (val.charAt(0) === '"' && val.slice(-1) === '"') || - (val.charAt(0) === "'" && val.slice(-1) === "'") -} +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ -function safe (val) { - return (typeof val !== 'string' || - val.match(/[=\r\n]/) || - val.match(/^\[/) || - (val.length > 1 && - isQuoted(val)) || - val !== val.trim()) - ? JSON.stringify(val) - : val.replace(/;/g, '\\;').replace(/#/g, '\\#') +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } -function unsafe (val, doUnesc) { - val = (val || '').trim(); - if (isQuoted(val)) { - // remove the single quotes before calling JSON.parse - if (val.charAt(0) === "'") { - val = val.substr(1, val.length - 2); - } - try { val = JSON.parse(val); } catch (_) {} - } else { - // walk the val to find the first not-escaped ; character - var esc = false; - var unesc = ''; - for (var i = 0, l = val.length; i < l; i++) { - var c = val.charAt(i); - if (esc) { - if ('\\;#'.indexOf(c) !== -1) { - unesc += c; - } else { - unesc += '\\' + c; - } - esc = false; - } else if (';#'.indexOf(c) !== -1) { - break - } else if (c === '\\') { - esc = true; - } else { - unesc += c; - } - } - if (esc) { - unesc += '\\'; - } - return unesc.trim() - } - return val +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } -}); - -var ini_1 = ini.parse; -var ini_2 = ini.decode; -var ini_3 = ini.stringify; -var ini_4 = ini.encode; -var ini_5 = ini.safe; -var ini_6 = ini.unsafe; - -var singleComment = 1; -var multiComment = 2; -function stripWithoutWhitespace() { - return ''; +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -function stripWithWhitespace(str, start, end) { - return str.slice(start, end).replace(/\S/g, ' '); -} -var stripJsonComments = function (str, opts) { - opts = opts || {}; +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { - var currentChar; - var nextChar; - var insideString = false; - var insideComment = false; - var offset = 0; - var ret = ''; - var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; +"use strict"; - for (var i = 0; i < str.length; i++) { - currentChar = str[i]; - nextChar = str[i + 1]; - if (!insideComment && currentChar === '"') { - var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\'; - if (!escaped) { - insideString = !insideString; - } - } +var stringify = __webpack_require__(27) - if (insideString) { - continue; - } +module.exports = VMessage - if (!insideComment && currentChar + nextChar === '//') { - ret += str.slice(offset, i); - offset = i; - insideComment = singleComment; - i++; - } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') { - i++; - insideComment = false; - ret += strip(str, offset, i); - offset = i; - continue; - } else if (insideComment === singleComment && currentChar === '\n') { - insideComment = false; - ret += strip(str, offset, i); - offset = i; - } else if (!insideComment && currentChar + nextChar === '/*') { - ret += str.slice(offset, i); - offset = i; - insideComment = multiComment; - i++; - continue; - } else if (insideComment === multiComment && currentChar + nextChar === '*/') { - i++; - insideComment = false; - ret += strip(str, offset, i + 1); - offset = i + 1; - continue; - } - } +/* Inherit from `Error#`. */ +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype +VMessage.prototype = new VMessagePrototype() - return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset)); -}; +/* Message properties. */ +var proto = VMessage.prototype -var utils = createCommonjsModule(function (module, exports) { -var parse = exports.parse = function (content) { +proto.file = '' +proto.name = '' +proto.reason = '' +proto.message = '' +proto.stack = '' +proto.fatal = null +proto.column = null +proto.line = null - //if it ends in .json or starts with { then it must be json. - //must be done this way, because ini accepts everything. - //can't just try and parse it and let it throw if it's not ini. - //everything is ini. even json with a syntax error. +/* Construct a new VMessage. + * + * Note: We cannot invoke `Error` on the created context, + * as that adds readonly `line` and `column` attributes on + * Safari 9, thus throwing and failing the data. */ +function VMessage(reason, position, origin) { + var parts + var range + var location - if(/^\s*{/.test(content)) - return JSON.parse(stripJsonComments(content)) - return ini.parse(content) + if (typeof position === 'string') { + origin = position + position = null + } -}; + parts = parseOrigin(origin) + range = stringify(position) || '1:1' -var file = exports.file = function () { - var args = [].slice.call(arguments).filter(function (arg) { return arg != null }); + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + } - //path.join breaks if it's a not a string, so just skip this. - for(var i in args) - if('string' !== typeof args[i]) - return + /* Node. */ + if (position && position.position) { + position = position.position + } - var file = path.join.apply(null, args); - try { - return fs.readFileSync(file,'utf-8') - } catch (err) { - return + if (position) { + /* Position. */ + if (position.start) { + location = position + position = position.start + } else { + /* Point. */ + location.start = position + } } -}; -var json = exports.json = function () { - var content = file.apply(null, arguments); - return content ? parse(content) : null -}; + if (reason.stack) { + this.stack = reason.stack + reason = reason.message + } -var env = exports.env = function (prefix, env) { - env = env || process.env; - var obj = {}; - var l = prefix.length; - for(var k in env) { - if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) { + this.message = reason + this.name = range + this.reason = reason + this.line = position ? position.line : null + this.column = position ? position.column : null + this.location = location + this.source = parts[0] + this.ruleId = parts[1] +} - var keypath = k.substring(l).split('__'); +function parseOrigin(origin) { + var result = [null, null] + var index - // Trim empty strings from keypath array - var _emptyStringIndex; - while ((_emptyStringIndex=keypath.indexOf('')) > -1) { - keypath.splice(_emptyStringIndex, 1); - } + if (typeof origin === 'string') { + index = origin.indexOf(':') - var cursor = obj; - keypath.forEach(function _buildSubObj(_subkey,i){ + if (index === -1) { + result[1] = origin + } else { + result[0] = origin.slice(0, index) + result[1] = origin.slice(index + 1) + } + } - // (check for _subkey first so we ignore empty strings) - // (check for cursor to avoid assignment to primitive objects) - if (!_subkey || typeof cursor !== 'object') - return + return result +} - // If this is the last key, just stuff the value in there - // Assigns actual value from env variable to final key - // (unless it's just an empty string- in that case use the last valid key) - if (i === keypath.length-1) - cursor[_subkey] = env[k]; +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { - // Build sub-object if nothing already exists at the keypath - if (cursor[_subkey] === undefined) - cursor[_subkey] = {}; +"use strict"; - // Increment cursor used to track the object at the current depth - cursor = cursor[_subkey]; - }); +var path = __webpack_require__(4); - } +function replaceExt(npath, ext) { + if (typeof npath !== 'string') { + return npath; + } + if (npath.length === 0) { + return npath; } - return obj -}; + var nFileName = path.basename(npath, path.extname(npath)) + ext; + return path.join(path.dirname(npath), nFileName); +} -var find = exports.find = function () { - var rel = path.join.apply(null, [].slice.call(arguments)); +module.exports = replaceExt; - function find(start, rel) { - var file = path.join(start, rel); - try { - fs.statSync(file); - return file - } catch (err) { - if(path.dirname(start) !== start) // root - return find(path.dirname(start), rel) - } - } - return find(process.cwd(), rel) -}; -}); -var utils_1 = utils.parse; -var utils_2 = utils.file; -var utils_3 = utils.json; -var utils_4 = utils.env; -var utils_5 = utils.find; +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { -var deepExtend_1 = createCommonjsModule(function (module) { -/*! - * @description Recursive object extending - * @author Viacheslav Lotsmanov - * @license MIT - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Viacheslav Lotsmanov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -function isSpecificValue(val) { - return ( - val instanceof Buffer - || val instanceof Date - || val instanceof RegExp - ) ? true : false; -} -function cloneSpecificValue(val) { - if (val instanceof Buffer) { - var x = Buffer.alloc - ? Buffer.alloc(val.length) - : new Buffer(val.length); - val.copy(x); - return x; - } else if (val instanceof Date) { - return new Date(val.getTime()); - } else if (val instanceof RegExp) { - return new RegExp(val); - } else { - throw new Error('Unexpected situation'); - } + +/**/ + +var pna = __webpack_require__(28); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(163); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = __webpack_require__(37).EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(68); +/**/ + +/**/ + +var Buffer = __webpack_require__(29).Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -/** - * Recursive cloning array. - */ -function deepCloneArray(arr) { - var clone = []; - arr.forEach(function (item, index) { - if (typeof item === 'object' && item !== null) { - if (Array.isArray(item)) { - clone[index] = deepCloneArray(item); - } else if (isSpecificValue(item)) { - clone[index] = cloneSpecificValue(item); - } else { - clone[index] = deepExtend({}, item); - } - } else { - clone[index] = item; - } - }); - return clone; +/**/ + +/**/ +var util = __webpack_require__(22); +util.inherits = __webpack_require__(13); +/**/ + +/**/ +var debugUtil = __webpack_require__(11); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; } +/**/ -function safeGetProperty(object, property) { - return property === '__proto__' ? undefined : object[property]; +var BufferList = __webpack_require__(164); +var destroyImpl = __webpack_require__(69); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } -/** - * Extening object that entered in first argument. - * - * Returns extended object or false if have no target object or incorrect type. - * - * If you wish to clone source object (without modify it), just use empty new - * object as first argument, like this: - * deepExtend({}, yourObj_1, [yourObj_N]); - */ -var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { - if (arguments.length < 1 || typeof arguments[0] !== 'object') { - return false; - } +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(18); - if (arguments.length < 2) { - return arguments[0]; - } + options = options || {}; - var target = arguments[0]; + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; - // convert arguments to array and cut off target object - var args = Array.prototype.slice.call(arguments, 1); + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; - var val, src; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - args.forEach(function (obj) { - // skip argument if isn't an object, is null, or is an array - if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) { - return; - } + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; - Object.keys(obj).forEach(function (key) { - src = safeGetProperty(target, key); // source value - val = safeGetProperty(obj, key); // new value + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; - // recursion prevention - if (val === target) { - return; + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); - /** - * if new value isn't object then just overwrite by new value - * instead of extending. - */ - } else if (typeof val !== 'object' || val === null) { - target[key] = val; - return; + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; - // just clone arrays (and recursive clone objects inside) - } else if (Array.isArray(val)) { - target[key] = deepCloneArray(val); - return; + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; - // custom cloning and overwrite for specific objects - } else if (isSpecificValue(val)) { - target[key] = cloneSpecificValue(val); - return; + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; - // overwrite by new value if source isn't object or array - } else if (typeof src !== 'object' || src === null || Array.isArray(src)) { - target[key] = deepExtend({}, val); - return; + // has it been destroyed + this.destroyed = false; - // source value and new value is objects both, extending... - } else { - target[key] = deepExtend(src, val); - return; - } - }); - }); + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; - return target; -}; -}); + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; -var minimist = function (args, opts) { - if (!opts) opts = {}; + // if true, a maybeReadMore has been scheduled + this.readingMore = false; - var flags = { bools : {}, strings : {}, unknownFn: null }; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(71).StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} - if (typeof opts['unknown'] === 'function') { - flags.unknownFn = opts['unknown']; - } +function Readable(options) { + Duplex = Duplex || __webpack_require__(18); - if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { - flags.allBools = true; - } else { - [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - }); - } + if (!(this instanceof Readable)) return new Readable(options); - var aliases = {}; - Object.keys(opts.alias || {}).forEach(function (key) { - aliases[key] = [].concat(opts.alias[key]); - aliases[key].forEach(function (x) { - aliases[x] = [key].concat(aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); + this._readableState = new ReadableState(options, this); - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); + // legacy + this.readable = true; - var defaults = opts['default'] || {}; + if (options) { + if (typeof options.read === 'function') this._read = options.read; - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } - var notFlags = []; + Stream.call(this); +} - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; } - - function argDefined(key, arg) { - return (flags.allBools && /^--[^=]+$/.test(arg)) || - flags.strings[key] || flags.bools[key] || aliases[key]; + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; } - function setArg (key, val, arg) { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg) === false) return; - } + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); - var value = !flags.strings[key] && isNumber(val) - ? Number(val) : val; - setKey(argv, key.split('.'), value); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), value); - }); +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; } + } else { + skipChunkCheck = true; + } - function setKey (obj, keys, value) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - if (o[key] === undefined) o[key] = {}; - o = o[key]; - }); + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; - var key = keys[keys.length - 1]; - if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); } + } + } else if (!addToFront) { + state.reading = false; } + } - function aliasIsBoolean(key) { - return aliases[key].some(function (x) { - return flags.bools[x]; - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; + return needMoreData(state); +} - if (/^--.+=/.test(arg)) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - var m = arg.match(/^--([^=]+)=([\s\S]*)$/); - var key = m[1]; - var value = m[2]; - if (flags.bools[key]) { - value = value !== 'false'; - } - setArg(key, value, arg); - } - else if (/^--no-.+/.test(arg)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false, arg); - } - else if (/^--.+/.test(arg)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !/^-/.test(next) - && !flags.bools[key] - && !flags.allBools - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, next, arg); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - else if (/^-[^-]+/.test(arg)) { - var letters = arg.slice(1,-1).split(''); +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - var broken = false; - for (var j = 0; j < letters.length; j++) { - var next = arg.slice(j+2); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} - if (next === '-') { - setArg(letters[j], next, arg); - continue; - } +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split('=')[1], arg); - broken = true; - break; - } +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} - if (/[A-Za-z]/.test(letters[j]) - && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next, arg); - broken = true; - break; - } +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2), arg); - broken = true; - break; - } - else { - setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); - } - } +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(71).StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; - var key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) - && !flags.bools[key] - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, args[i+1], arg); - i++; - } - else if (args[i+1] && /true|false/.test(args[i+1])) { - setArg(key, args[i+1] === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - } - else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push( - flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) - ); - } - if (opts.stopEarly) { - argv._.push.apply(argv._, args.slice(i + 1)); - break; - } - } - } +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } - Object.keys(defaults).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) { - setKey(argv, key.split('.'), defaults[key]); + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), defaults[key]); - }); - } - }); + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } - if (opts['--']) { - argv['--'] = new Array(); - notFlags.forEach(function(key) { - argv['--'].push(key); - }); - } - else { - notFlags.forEach(function(key) { - argv._.push(key); - }); - } + if (ret !== null) this.emit('data', ret); - return argv; + return ret; }; -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; - var key = keys[keys.length - 1]; - return key in o; + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); } -function isNumber (x) { - if (typeof x === 'number') return true; - if (/^0x[0-9a-f]+$/i.test(x)) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } } -var join = path.join; +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} -var etc = '/etc'; -var win = process.platform === "win32"; -var home = win - ? process.env.USERPROFILE - : process.env.HOME; +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } +} -var rc = function (name, defaults, argv, parse) { - if('string' !== typeof name) - throw new Error('rc(name): name *must* be string') - if(!argv) - argv = minimist(process.argv.slice(2)); - defaults = ( - 'string' === typeof defaults - ? utils.json(defaults) : defaults - ) || {}; +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} - parse = parse || utils.parse; +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; - var env = utils.env(name + '_'); +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; - var configs = [defaults]; - var configFiles = []; - function addConfigFile (file) { - if (configFiles.indexOf(file) >= 0) return - var fileConfig = utils.file(file); - if (fileConfig) { - configs.push(parse(fileConfig)); - configFiles.push(file); + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } } } - // which files do we look at? - if (!win) - [join(etc, name, 'config'), - join(etc, name + 'rc')].forEach(addConfigFile); - if (home) - [join(home, '.config', name, 'config'), - join(home, '.config', name), - join(home, '.' + name, 'config'), - join(home, '.' + name + 'rc')].forEach(addConfigFile); - addConfigFile(utils.find('.'+name+'rc')); - if (env.config) addConfigFile(env.config); - if (argv.config) addConfigFile(argv.config); + function onend() { + debug('onend'); + dest.end(); + } - return deepExtend_1.apply(null, configs.concat([ - env, - argv, - configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined, - ])) -}; + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); -function homedir() { - var env = process.env; - var home = env.HOME; - var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); - if (process.platform === 'win32') { - return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; - } + cleanedUp = true; - if (process.platform === 'darwin') { - return home || (user ? '/Users/' + user : null); - } + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } - if (process.platform === 'linux') { - return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); - } + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } - return home || null; -} + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); -var osHomedir = typeof os.homedir === 'function' ? os.homedir : homedir; + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); -var home$1 = osHomedir(); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } -var untildify = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } - return home$1 ? str.replace(/^~($|\/|\\)/, home$1 + '$1') : str; + return dest; }; -var shellsubstitute = function (s, vars) { - return s.replace(/(\\*)(\$([_a-z0-9]+)|\${([_a-z0-9]+)})/ig, function (_, escape, varExpression, variable, bracedVariable) { - if (!(escape.length % 2)) { - return escape.substring(Math.ceil(escape.length / 2)) + (vars[variable || bracedVariable] || ''); - } else { - return escape.substring(1) + varExpression; +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); } - }); -}; + }; +} -var npmPrefix = function () { - var rcPrefix = rc('npm', null, []).prefix; +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { hasUnpiped: false }; - if (rcPrefix) { - return untildify(shellsubstitute(rcPrefix, process.env)); - } - else if (process.platform == 'win32') { - return path.dirname(process.execPath); + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; } - else { - return path.resolve(process.execPath, '../..'); + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, unpipeInfo); + }return this; } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this, unpipeInfo); + + return this; }; -var resolve = resolveFrom_1.silent; -var npmPrefix$2 = npmPrefix(); +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); -var loadPlugin_1 = loadPlugin; -loadPlugin.resolve = resolvePlugin; + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } -var electron = process.versions.electron !== undefined; -var argv = process.argv[1] || /* istanbul ignore next */ ''; -var nvm = process.env.NVM_BIN; -var globally = electron || argv.indexOf(npmPrefix$2) === 0; -var windows = process.platform === 'win32'; -var prefix = windows ? /* istanbul ignore next */ '' : 'lib'; -var globals = path.resolve(npmPrefix$2, prefix, 'node_modules'); + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; -/* istanbul ignore next - If we’re in Electron, we’re running in a modified - * Node that cannot really install global node modules. To find the actual - * modules, the user has to either set `prefix` in their `.npmrc` (which is - * picked up by `npm-prefix`). Most people don’t do that, and some use NVM - * instead to manage different versions of Node. Luckily NVM leaks some - * environment variables that we can pick up on to try and detect the actual - * modules. */ -if (electron && nvm && !fs.existsSync(globals)) { - globals = path.resolve(nvm, '..', prefix, 'node_modules'); +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); } -/* Load the plug-in found using `resolvePlugin`. */ -function loadPlugin(name, options) { - return commonjsRequire(resolvePlugin(name, options) || name) +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } } -/* Find a plugin. - * - * See also: - * - * - * - * Uses the standard node module loading strategy to find $name - * in each given `cwd` (and optionally the global node_modules - * directory). - * - * If a prefix is given and $name is not a path, `$prefix-$name` - * is also searched (preferring these over non-prefixed modules). */ -function resolvePlugin(name, options) { - var settings = options || {}; - var prefix = settings.prefix; - var cwd = settings.cwd; - var filePath; - var sources; - var length; - var index; - var plugin; +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } - if (cwd && typeof cwd === 'object') { - sources = cwd.concat(); - } else { - sources = [cwd || process.cwd()]; + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); } + return this; +}; - /* Non-path. */ - if (name.indexOf(path.sep) === -1 && name.charAt(0) !== '.') { - if (settings.global == null ? globally : settings.global) { - sources.push(globals); - } +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} - /* Unprefix module. */ - if (prefix) { - prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-'; +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; - if (name.slice(0, prefix.length) !== prefix) { - plugin = prefix + name; - } + var state = this._readableState; + var paused = false; + + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); } - } - length = sources.length; - index = -1; + _this.push(null); + }); - while (++index < length) { - cwd = sources[index]; - filePath = (plugin && resolve(cwd, plugin)) || resolve(cwd, name); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); - if (filePath) { - return filePath + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); } - } + }); - return null -} + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } -var format = createCommonjsModule(function (module) { -// -// format - printf-like string formatting for JavaScript -// github.com/samsonjs/format -// @_sjs -// -// Copyright 2010 - 2013 Sami Samhuri -// -// MIT License -// http://sjs.mit-license.org -// + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } -(function() { + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; - //// Export the API - var namespace; + return this; +}; - // CommonJS / Node module - { - namespace = module.exports = format; +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; } +}); - namespace.format = format; - namespace.vsprintf = vsprintf; - - if (typeof console !== 'undefined' && typeof console.log === 'function') { - namespace.printf = printf; +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); } - function printf(/* ... */) { - console.log(format.apply(null, arguments)); + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } + return ret; +} - function vsprintf(fmt, replacements) { - return format.apply(null, [fmt].concat(replacements)); +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; } + list.length -= c; + return ret; +} - function format(fmt) { - var argIndex = 1 // skip initial format argument - , args = [].slice.call(arguments) - , i = 0 - , n = fmt.length - , result = '' - , c - , escaped = false - , arg - , tmp - , leadingZero = false - , precision - , nextArg = function() { return args[argIndex++]; } - , slurpNumber = function() { - var digits = ''; - while (/\d/.test(fmt[i])) { - digits += fmt[i++]; - c = fmt[i]; - } - return digits.length > 0 ? parseInt(digits) : null; - }; - for (; i < n; ++i) { - c = fmt[i]; - if (escaped) { - escaped = false; - if (c == '.') { - leadingZero = false; - c = fmt[++i]; - } - else if (c == '0' && fmt[i + 1] == '.') { - leadingZero = true; - i += 2; - c = fmt[i]; - } - else { - leadingZero = true; - } - precision = slurpNumber(); - switch (c) { - case 'b': // number in binary - result += parseInt(nextArg(), 10).toString(2); - break; - case 'c': // character - arg = nextArg(); - if (typeof arg === 'string' || arg instanceof String) - result += arg; - else - result += String.fromCharCode(parseInt(arg, 10)); - break; - case 'd': // number in decimal - result += parseInt(nextArg(), 10); - break; - case 'f': // floating point number - tmp = String(parseFloat(nextArg()).toFixed(precision || 6)); - result += leadingZero ? tmp : tmp.replace(/^0/, ''); - break; - case 'j': // JSON - result += JSON.stringify(nextArg()); - break; - case 'o': // number in octal - result += '0' + parseInt(nextArg(), 10).toString(8); - break; - case 's': // string - result += nextArg(); - break; - case 'x': // lowercase hexadecimal - result += '0x' + parseInt(nextArg(), 10).toString(16); - break; - case 'X': // uppercase hexadecimal - result += '0x' + parseInt(nextArg(), 10).toString(16).toUpperCase(); - break; - default: - result += c; - break; - } - } else if (c === '%') { - escaped = true; +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; } else { - result += c; + list.head = p; + p.data = buf.slice(nb); } + break; } - return result; + ++c; } + list.length -= c; + return ret; +} -}()); -}); +function endReadable(stream) { + var state = stream._readableState; -var fault = create(Error); + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); -var fault_1 = fault; + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } +} -fault.eval = create(EvalError); -fault.range = create(RangeError); -fault.reference = create(ReferenceError); -fault.syntax = create(SyntaxError); -fault.type = create(TypeError); -fault.uri = create(URIError); +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} -fault.create = create; +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} -/* Create a new `EConstructor`, with the formatted - * `format` as a first argument. */ -function create(EConstructor) { - FormattedError.displayName = EConstructor.displayName || EConstructor.name; +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { - return FormattedError +module.exports = __webpack_require__(32); - function FormattedError(format$$1) { - if (format$$1) { - format$$1 = format.apply(null, arguments); - } - return new EConstructor(format$$1) - } -} +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { -var immutable = extend$1; +"use strict"; -var hasOwnProperty = Object.prototype.hasOwnProperty; -function extend$1() { - var target = {}; +/**/ - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i]; +var pna = __webpack_require__(28); +/**/ - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); } + return this; + } - return target -} + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks -var isObject$1 = function isObject(x) { - return typeof x === "object" && x !== null; -}; + if (this._readableState) { + this._readableState.destroyed = true; + } -var toString = Object.prototype.toString; + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } -var xIsString = isString; + this._destroy(err || null, function (err) { + if (!cb && err) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err); + } + }); -function isString(obj) { - return toString.call(obj) === "[object String]" + return this; } -var xIsFunction = function isFunction (fn) { - return Object.prototype.toString.call(fn) === '[object Function]' +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy }; -var debug = src('unified-engine:find-up'); +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. -var findUp = FindUp; -var read = fs.readFile; -var resolve$1 = path.resolve; -var relative = path.relative; -var join$1 = path.join; -var dirname = path.dirname; -FindUp.prototype.load = load$2; +/**/ -function FindUp(options) { - var self = this; - var fp = options.filePath; +var pna = __webpack_require__(28); +/**/ - self.cache = {}; - self.cwd = options.cwd; - self.detect = options.detect; - self.names = options.names; - self.create = options.create; +module.exports = Writable; - if (fp) { - self.givenFilePath = resolve$1(options.cwd, fp); - } +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; } -function load$2(filePath, callback) { - var self = this; - var cache = self.cache; - var givenFilePath = self.givenFilePath; - var givenFile = self.givenFile; - var names = self.names; - var create = self.create; - var cwd = self.cwd; - var parent; +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; - if (givenFilePath) { - if (givenFile) { - apply(callback, givenFile); - } else { - givenFile = [callback]; - self.givenFile = givenFile; - debug('Checking given file `%s`', givenFilePath); - read(givenFilePath, loadGiven); - } + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ - return; - } +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ - if (!self.detect) { - return callback(); - } +/**/ +var Duplex; +/**/ - filePath = resolve$1(cwd, filePath); - parent = dirname(filePath); +Writable.WritableState = WritableState; - if (parent in cache) { - apply(callback, cache[parent]); - } else { - cache[parent] = [callback]; - find(parent); - } +/**/ +var util = __webpack_require__(22); +util.inherits = __webpack_require__(13); +/**/ - function loadGiven(err, buf) { - var cbs = self.givenFile; - var result; +/**/ +var internalUtil = { + deprecate: __webpack_require__(165) +}; +/**/ - if (err) { - result = fault_1('Cannot read given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); - result.code = 'ENOENT'; - result.path = err.path; - result.syscall = err.syscall; - } else { - try { - result = create(buf, givenFilePath); - debug('Read given file `%s`', givenFilePath); - } catch (err) { - result = fault_1('Cannot parse given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); - debug(err.message); - } - } +/**/ +var Stream = __webpack_require__(68); +/**/ - givenFile = result; - self.givenFile = result; - applyAll(cbs, result); - } +/**/ - function find(directory) { - var index = -1; - var length = names.length; +var Buffer = __webpack_require__(29).Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} - next(); +/**/ - function next() { - var parent; +var destroyImpl = __webpack_require__(69); - /* Try to read the next file. We don’t use `readdir` because on - * huge directories, that could be *very* slow. */ - if (++index < length) { - read(join$1(directory, names[index]), done); - } else { - parent = dirname(directory); +util.inherits(Writable, Stream); - if (directory === parent) { - debug('No files found for `%s`', filePath); - found(); - } else if (parent in cache) { - apply(found, cache[parent]); - } else { - cache[parent] = [found]; - find(parent); - } - } - } +function nop() {} - function done(err, buf) { - var name = names[index]; - var fp = join$1(directory, name); - var contents; +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(18); - /* istanbul ignore if - Hard to test. */ - if (err) { - if (err.code === 'ENOENT') { - return next(); - } + options = options || {}; - err = fault_1('Cannot read file `%s`\n%s', relative(cwd, fp), err.message); - debug(err.message); - return found(err); - } + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; - try { - contents = create(buf, fp); - } catch (err) { - return found(fault_1('Cannot parse file `%s`\n%s', relative(cwd, fp), err.message)); - } + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; - /* istanbul ignore else - maybe used in the future. */ - if (contents) { - debug('Read file `%s`', fp); - found(null, contents); - } else { - next(); - } - } + // the amount that is being written when _write is called. + this.writelen = 0; - function found(err, result) { - var cbs = cache[directory]; - cache[directory] = err || result; - applyAll(cbs, err || result); - } - } + this.bufferedRequest = null; + this.lastBufferedRequest = null; - function applyAll(cbs, result) { - var index = cbs.length; + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; - while (index--) { - apply(cbs[index], result); - } + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; } + return out; +}; - function apply(cb, result) { - if (isObject$1(result) && xIsFunction(result[0])) { - result.push(cb); - } else if (result instanceof Error) { - cb(result); - } else { - cb(null, result); +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; } - } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; } -var configuration = createCommonjsModule(function (module) { -var debug = src('unified-engine:configuration'); -var resolve = loadPlugin_1.resolve; +function Writable(options) { + Duplex = Duplex || __webpack_require__(18); + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + this._writableState = new WritableState(options, this); + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; -module.exports = Config; + if (typeof options.destroy === 'function') this._destroy = options.destroy; -var own = {}.hasOwnProperty; -var extname = path.extname; -var basename = path.basename; -var dirname = path.dirname; -var relative = path.relative; + if (typeof options.final === 'function') this._final = options.final; + } -var loaders = { - '.json': loadJSON, - '.js': loadScript, - '.yaml': loadYAML, - '.yml': loadYAML + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); }; -var defaultLoader = loadJSON; +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} -Config.prototype.load = load; +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; -function Config(options) { - var rcName = options.rcName; - var packageField = options.packageField; - var names = []; + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} - this.cwd = options.cwd; - this.packageField = options.packageField; - this.pluginPrefix = options.pluginPrefix; - this.configTransform = options.configTransform; - this.defaultConfig = options.defaultConfig; +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); - if (rcName) { - names.push(rcName, rcName + '.js', rcName + '.yml', rcName + '.yaml'); - debug('Looking for `%s` configuration files', names); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - if (packageField) { - names.push('package.json'); - debug('Looking for `%s` fields in `package.json` files', packageField); + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; } - this.given = {settings: options.settings, plugins: options.plugins}; - this.create = create.bind(this); + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - this.findUp = new findUp({ - filePath: options.rcPath, - cwd: options.cwd, - detect: options.detectConfig, - names: names, - create: this.create - }); -} + if (typeof cb !== 'function') cb = nop; -function load(filePath, callback) { - var searchPath = filePath || path.resolve(this.cwd, 'stdin.js'); - var self = this; + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } - self.findUp.load(searchPath, done); + return ret; +}; - function done(err, res) { - if (err || res) { - return callback(err, res); - } +Writable.prototype.cork = function () { + var state = this._writableState; - callback(null, self.create()); + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } -} +}; -function create(buf, filePath) { - var self = this; - var transform = self.configTransform; - var defaults = self.defaultConfig; - var fn = (filePath && loaders[extname(filePath)]) || defaultLoader; - var options = {prefix: self.pluginPrefix, cwd: self.cwd}; - var result = {settings: {}, plugins: []}; - var contents = buf ? fn.apply(self, arguments) : undefined; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; - if (transform && contents !== undefined) { - contents = transform(contents, filePath); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); } + return chunk; +} - /* Exit if we did find a `package.json`, but it doesn’t have configuration. */ - if (buf && contents === undefined && basename(filePath) === 'package.json') { - return; +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; } +}); - if (contents === undefined) { - if (defaults) { - merge(result, defaults, null, immutable(options, {root: self.cwd})); +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; } + state.bufferedRequestCount += 1; } else { - merge(result, contents, null, immutable(options, {root: dirname(filePath)})); + doWrite(stream, state, false, len, chunk, encoding, cb); } - merge(result, self.given, null, immutable(options, {root: self.cwd})); + return ret; +} - return result; +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; } -/* Basically `Module.prototype.load`, but for a buffer instead - * of a filepath. */ -function loadScript(buf, filePath) { - var submodule = module$1._cache[filePath]; +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; - if (!submodule) { - submodule = new module$1(filePath, module); - submodule.filename = filePath; - submodule.paths = module$1._nodeModulePaths(dirname(filePath)); - submodule._compile(String(buf), filePath); - submodule.loaded = true; - module$1._cache[filePath] = submodule; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); } - - return submodule.exports; } -function loadYAML(buf, filePath) { - return jsYaml$2.safeLoad(buf, {filename: basename(filePath)}); +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; } -function loadJSON(buf, filePath) { - var result = parseJson$1(buf, filePath); +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; - if (basename(filePath) === 'package.json') { - result = result[this.packageField]; - } + onwriteStateUpdate(state); - return result; -} + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); -function merge(target, raw, val, options) { - var root = options.root; - var cwd = options.cwd; - var prefix = options.prefix; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } - if (isObject$1(raw)) { - addPreset(raw); - } else { - throw new Error('Expected preset, not `' + raw + '`'); + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } } +} - return target; - - function addPreset(result) { - var plugins = result.plugins; - - if (plugins === null || plugins === undefined) { - /* Empty. */ - } else if (isObject$1(plugins)) { - if ('length' in plugins) { - addEach(plugins); - } else { - addIn(plugins); - } +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; } else { - throw new Error('Expected a list or object of plugins, not `' + plugins + '`'); + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } } - target.settings = immutable(target.settings, result.settings); + if (entry === null) state.lastBufferedRequest = null; } - function addEach(result) { - var length = result.length; - var index = -1; - var value; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} - while (++index < length) { - value = result[index]; +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; - if (isObject$1(value) && 'length' in value) { - use.apply(null, value); - } else { - use(value); - } - } - } +Writable.prototype._writev = null; - function addIn(result) { - var key; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; - for (key in result) { - use(key, result[key]); - } + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; } - function use(usable, value) { - if (xIsString(usable)) { - addModule(usable, value); - } else if (xIsFunction(usable)) { - addPlugin(usable, value); - } else { - merge(target, usable, value, options); - } - } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - function addModule(id, value) { - var fp = resolve(id, {cwd: root, prefix: prefix}); - var res; + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } - if (fp) { - try { - res = commonjsRequire(fp); // eslint-disable-line import/no-dynamic-require - } catch (err) { - throw fault_1('Cannot parse script `%s`\n%s', relative(root, fp), err.stack); - } + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; - try { - if (xIsFunction(res)) { - addPlugin(res, value); - } else { - merge(target, res, value, immutable(options, {root: dirname(fp)})); - } - } catch (err) { - throw fault_1('Error: Expected preset or plugin, not %s, at `%s`', res, relative(root, fp)); - } +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); } else { - fp = relative(cwd, path.resolve(root, id)); - addPlugin(failingModule(fp, new Error('Could not find module `' + id + '`')), value); + state.prefinished = true; + stream.emit('prefinish'); } } +} - function addPlugin(result, value) { - var entry = find(target.plugins, result); - - if (entry) { - reconfigure(entry, value); - } else { - target.plugins.push([result, value]); +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); } } + return need; } -function reconfigure(entry, value) { - if (value !== false && entry[1] !== false && isObject$1(value)) { - value = immutable(entry[1], value); +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); } - - entry[1] = value; + state.ended = true; + stream.writable = false; } -function find(entries, plugin) { - var length = entries.length; - var index = -1; - var entry; - - while (++index < length) { - entry = entries[index]; - - if (entry[0] === plugin) { - return entry; - } +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; } } -function failingModule(id, err) { - var cache = failingModule.cache || (failingModule.cache = {}); - var submodule = own.call(cache, id) ? cache[id] : (cache[id] = fail); - return submodule; - function fail() { - throw err; +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; } -} }); -var configure_1 = configure; - -function configure(context, settings) { - context.configuration = new configuration(settings); -} +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -var ignore = function () { - return new IgnoreBase(); -}; -// A simple implementation of make-array -function make_array(subject) { - return Array.isArray(subject) ? subject : [subject]; -} -var REGEX_BLANK_LINE = /^\s+$/; -var REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\\!/; -var REGEX_LEADING_EXCAPED_HASH = /^\\#/; -var SLASH = '/'; -var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore') -/* istanbul ignore next */ -: 'node-ignore'; +/**/ -var IgnoreBase = function () { - function IgnoreBase() { - _classCallCheck(this, IgnoreBase); +var Buffer = __webpack_require__(29).Buffer; +/**/ - this._rules = []; - this[KEY_IGNORE] = true; - this._initCache(); +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; } +}; - _createClass(IgnoreBase, [{ - key: '_initCache', - value: function _initCache() { - this._cache = {}; +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; } + } +}; - // @param {Array.|string|Ignore} pattern - - }, { - key: 'add', - value: function add(pattern) { - this._added = false; +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} - if (typeof pattern === 'string') { - pattern = pattern.split(/\r?\n/g); - } +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; - make_array(pattern).forEach(this._addPattern, this); +StringDecoder.prototype.end = utf8End; - // Some rules have just added to the ignore, - // making the behavior changed. - if (this._added) { - this._initCache(); - } +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; - return this; - } +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; - // legacy +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} - }, { - key: 'addPattern', - value: function addPattern(pattern) { - return this.add(pattern); +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; } - }, { - key: '_addPattern', - value: function _addPattern(pattern) { - // #32 - if (pattern && pattern[KEY_IGNORE]) { - this._rules = this._rules.concat(pattern._rules); - this._added = true; - return; - } - - if (this._checkPattern(pattern)) { - var rule = this._createRule(pattern); - this._added = true; - this._rules.push(rule); + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; } } - }, { - key: '_checkPattern', - value: function _checkPattern(pattern) { - // > A blank line matches no files, so it can serve as a separator for readability. - return pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) + } +} - // > A line starting with # serves as a comment. - && pattern.indexOf('#') !== 0; - } - }, { - key: 'filter', - value: function filter(paths) { - var _this = this; +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} - return make_array(paths).filter(function (path$$1) { - return _this._filter(path$$1); - }); - } - }, { - key: 'createFilter', - value: function createFilter() { - var _this2 = this; +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} - return function (path$$1) { - return _this2._filter(path$$1); - }; - } - }, { - key: 'ignores', - value: function ignores(path$$1) { - return !this._filter(path$$1); - } - }, { - key: '_createRule', - value: function _createRule(pattern) { - var origin = pattern; - var negative = false; +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} - // > An optional prefix "!" which negates the pattern; - if (pattern.indexOf('!') === 0) { - negative = true; - pattern = pattern.substr(1); +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} - pattern = pattern - // > Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, `"\!important!.txt"`. - .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') - // > Put a backslash ("\") in front of the first hash for patterns that begin with a hash. - .replace(REGEX_LEADING_EXCAPED_HASH, '#'); +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} - var regex = make_regex(pattern, negative); +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} - return { - origin: origin, - pattern: pattern, - negative: negative, - regex: regex - }; - } +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} - // @returns `Boolean` true if the `path` is NOT ignored +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} - }, { - key: '_filter', - value: function _filter(path$$1, slices) { - if (!path$$1) { - return false; - } +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} - if (path$$1 in this._cache) { - return this._cache[path$$1]; - } +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { - if (!slices) { - // path/to/a.js - // ['path', 'to', 'a.js'] - slices = path$$1.split(SLASH); - } +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - slices.pop(); +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. - return this._cache[path$$1] = slices.length - // > It is not possible to re-include a file if a parent directory of that file is excluded. - // If the path contains a parent directory, check the parent first - ? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path$$1) - // Or only test the path - : this._test(path$$1); - } - // @returns {Boolean} true if a file is NOT ignored +module.exports = Transform; - }, { - key: '_test', - value: function _test(path$$1) { - // Explicitly define variable type by setting matched to `0` - var matched = 0; +var Duplex = __webpack_require__(18); - this._rules.forEach(function (rule) { - // if matched = true, then we only test negative rules - // if matched = false, then we test non-negative rules - if (!(matched ^ rule.negative)) { - matched = rule.negative ^ rule.regex.test(path$$1); - } - }); +/**/ +var util = __webpack_require__(22); +util.inherits = __webpack_require__(13); +/**/ - return !matched; - } - }]); +util.inherits(Transform, Duplex); - return IgnoreBase; -}(); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; -// > If the pattern ends with a slash, -// > it is removed for the purpose of the following description, -// > but it would only find a match with a directory. -// > In other words, foo/ will match a directory foo and paths underneath it, -// > but will not match a regular file or a symbolic link foo -// > (this is consistent with the way how pathspec works in general in Git). -// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' -// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call -// you could use option `mark: true` with `glob` + var cb = ts.writecb; -// '`foo/`' should not continue with the '`..`' + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + ts.writechunk = null; + ts.writecb = null; -var DEFAULT_REPLACER_PREFIX = [ + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); -// > Trailing spaces are ignored unless they are quoted with backslash ("\") -[ -// (a\ ) -> (a ) -// (a ) -> (a) -// (a \ ) -> (a ) -/\\?\s+$/, function (match) { - return match.indexOf('\\') === 0 ? ' ' : ''; -}], + cb(er); -// replace (\ ) with ' ' -[/\\\s/g, function () { - return ' '; -}], + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} -// Escape metacharacters -// which is written down by users but means special for regular expressions. +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); -// > There are 12 characters with special meanings: -// > - the backslash \, -// > - the caret ^, -// > - the dollar sign $, -// > - the period or dot ., -// > - the vertical bar or pipe symbol |, -// > - the question mark ?, -// > - the asterisk or star *, -// > - the plus sign +, -// > - the opening parenthesis (, -// > - the closing parenthesis ), -// > - and the opening square bracket [, -// > - the opening curly brace {, -// > These special characters are often called "metacharacters". -[/[\\\^$.|?*+()\[{]/g, function (match) { - return '\\' + match; -}], + Duplex.call(this, options); -// leading slash -[ + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; -// > A leading slash matches the beginning of the pathname. -// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". -// A leading slash matches the beginning of the pathname -/^\//, function () { - return '^'; -}], + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; -// replace special metacharacter slash after the leading slash -[/\//g, function () { - return '\\/'; -}], [ -// > A leading "**" followed by a slash means match in all directories. -// > For example, "**/foo" matches file or directory "foo" anywhere, -// > the same as pattern "foo". -// > "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". -// Notice that the '*'s have been replaced as '\\*' -/^\^*\\\*\\\*\\\//, + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; -// '**/foo' <-> 'foo' -function () { - return '^(?:.*\\/)?'; -}]]; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; -var DEFAULT_REPLACER_SUFFIX = [ -// starting -[ -// there will be no leading '/' (which has been replaced by section "leading slash") -// If starts with '**', adding a '^' to the regular expression also works -/^(?=[^\^])/, function () { - return !/\/(?!$)/.test(this) - // > If the pattern does not contain a slash /, Git treats it as a shell glob pattern - // Actually, if there is only a trailing slash, git also treats it as a shell glob pattern - ? '(?:^|\\/)' + if (typeof options.flush === 'function') this._flush = options.flush; + } - // > Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) - : '^'; -}], + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} -// two globstars -[ -// Use lookahead assertions so that we could match more than one `'/**'` -/\\\/\\\*\\\*(?=\\\/|$)/g, +function prefinish() { + var _this = this; -// Zero, one or several directories -// should not use '*', or it will be replaced by the next replacer + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} -// Check if it is not the last `'/**'` -function (match, index, str) { - return index + 6 < str.length +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; - // case: /**/ - // > A slash followed by two consecutive asterisks then a slash matches zero or more directories. - // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. - // '/**/' - ? '(?:\\/[^\\/]+)*' +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; - // case: /** - // > A trailing `"/**"` matches everything inside. +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; - // #21: everything inside but it should not include the current folder - : '\\/.+'; -}], +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; -// intermediate wildcards -[ -// Never replace escaped '*' -// ignore rule '\*' will match the path '*' + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; -// 'abc.*/' -> go -// 'abc.*' -> skip this rule -/(^|[^\\]+)\\\*(?=.+)/g, +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; -// '*.js' matches '.js' -// '*.js' doesn't match 'abc' -function (match, p1) { - return p1 + '[^\\/]*'; -}], + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; -// trailing wildcard -[/(\^|\\\/)?\\\*$/, function (match, p1) { - return (p1 - // '\^': - // '/*' does not match '' - // '/*' does not match everything +function done(stream, er, data) { + if (er) return stream.emit('error', er); - // '\\\/': - // 'abc/*' does not match 'abc/' - ? p1 + '[^/]+' + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); - // 'a*' matches 'a' - // 'a*' matches 'aa' - : '[^/]*') + '(?=$|\\/$)'; -}], [ -// unescape -/\\\\\\/g, function () { - return '\\'; -}]]; + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); -var POSITIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [ + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); -// 'f' -// matches -// - /f(end) -// - /f/ -// - (start)f(end) -// - (start)f/ -// doesn't match -// - oof -// - foo -// pseudo: -// -> (^|/)f(/|$) + return stream.push(null); +} -// ending -[ -// 'js' will not match 'js.' -// 'ab' will not match 'abc' -/(?:[^*\/])$/, +/***/ }), +/* 73 */ +/***/ (function(module, exports) { -// 'js*' will not match 'a.js' -// 'js/' will not match 'a.js' -// 'js' will match 'a.js' and 'a.js/' -function (match) { - return match + '(?=$|\\/)'; -}]], DEFAULT_REPLACER_SUFFIX); -var NEGATIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [ +/** + * Has own property. + * + * @type {Function} + */ -// #24, #38 -// The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore) -// A negative pattern without a trailing wildcard should not -// re-include the things inside that directory. +var has = Object.prototype.hasOwnProperty -// eg: -// ['node_modules/*', '!node_modules'] -// should ignore `node_modules/a.js` -[/(?:[^*])$/, function (match) { - return match + '(?=$|\\/$)'; -}]], DEFAULT_REPLACER_SUFFIX); +/** + * To string. + * + * @type {Function} + */ -// A simple cache, because an ignore rule only has only one certain meaning -var cache = {}; +var toString = Object.prototype.toString -// @param {pattern} -function make_regex(pattern, negative) { - var r = cache[pattern]; - if (r) { - return r; - } +/** + * Test whether a value is "empty". + * + * @param {Mixed} val + * @return {Boolean} + */ - var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS; +function isEmpty(val) { + // Null and Undefined... + if (val == null) return true - var source = replacers.reduce(function (prev, current) { - return prev.replace(current[0], current[1].bind(pattern)); - }, pattern); + // Booleans... + if ('boolean' == typeof val) return false - return cache[pattern] = new RegExp(source, 'i'); -} + // Numbers... + if ('number' == typeof val) return val === 0 -// Windows -// -------------------------------------------------------------- -/* istanbul ignore if */ -if ( -// Detect `process` so that it can run in browsers. -typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { + // Strings... + if ('string' == typeof val) return val.length === 0 - var filter = IgnoreBase.prototype._filter; - var make_posix = function make_posix(str) { - return (/^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/') - ); - }; + // Functions... + if ('function' == typeof val) return val.length === 0 - IgnoreBase.prototype._filter = function (path$$1, slices) { - path$$1 = make_posix(path$$1); - return filter.call(this, path$$1, slices); - }; -} + // Arrays... + if (Array.isArray(val)) return val.length === 0 -var ignore$2 = Ignore; + // Errors... + if (val instanceof Error) return val.message === '' -Ignore.prototype.check = check; + // Objects... + if (val.toString == toString) { + switch (val.toString()) { -var dirname$1 = path.dirname; -var relative$1 = path.relative; -var resolve$2 = path.resolve; + // Maps, Sets, Files and Errors... + case '[object File]': + case '[object Map]': + case '[object Set]': { + return val.size === 0 + } -function Ignore(options) { - this.cwd = options.cwd; + // Plain objects... + case '[object Object]': { + for (var key in val) { + if (has.call(val, key)) return false + } - this.findUp = new findUp({ - filePath: options.ignorePath, - cwd: options.cwd, - detect: options.detectIgnore, - names: options.ignoreName ? [options.ignoreName] : [], - create: create$1 - }); + return true + } + } + } + + // Anything else... + return false } -function check(filePath, callback) { - var self = this; +/** + * Export `isEmpty`. + * + * @type {Function} + */ - self.findUp.load(filePath, done); +module.exports = isEmpty - function done(err, ignore$$1) { - var normal; - if (err) { - callback(err); - } else if (ignore$$1) { - normal = relative$1(ignore$$1.filePath, resolve$2(self.cwd, filePath)); - callback(null, normal ? ignore$$1.ignores(normal) : false); - } else { - callback(null, false); - } - } -} +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { -function create$1(buf, filePath) { - var ignore$$1 = ignore().add(String(buf)); - ignore$$1.filePath = dirname$1(filePath); - return ignore$$1; -} +"use strict"; +Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var _unicode=__webpack_require__(196);var unicode=_interopRequireWildcard(_unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)} -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -var isWindows = process.platform === 'win32'; +var xtend = __webpack_require__(7) +var inherits = __webpack_require__(13) -// JavaScript implementation of realpath, ported from node pre-v6 +module.exports = unherit -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); +/* Create a custom constructor which can be modified + * without affecting the original class. */ +function unherit(Super) { + var result + var key + var value -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; + inherits(Of, Super) + inherits(From, Of) - return callback; + /* Clone values. */ + result = Of.prototype - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); + for (key in result) { + value = result[key] + + if (value && typeof value === 'object') { + result[key] = 'concat' in value ? value.concat() : xtend(value) } } - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } + return Of + + /* Constructor accepting a single argument, + * which itself is an `arguments` object. */ + function From(parameters) { + return Super.apply(this, parameters) } -} -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); + /* Constructor accepting variadic arguments. */ + function Of() { + if (!(this instanceof Of)) { + return new From(arguments) + } + + return Super.apply(this, arguments) + } } -var normalize = path.normalize; -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} +"use strict"; -var realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = path.resolve(p); - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } +module.exports = factory - var original = p, - seenLinks = {}, - knownHard = {}; +/* Construct a state `toggler`: a function which inverses + * `property` in context based on its current value. + * The by `toggler` returned function restores that value. */ +function factory(key, state, ctx) { + return enter - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; + function enter() { + var context = ctx || this + var current = context[key] - start(); + context[key] = !state - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; + return exit - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; + function exit() { + context[key] = current } } +} - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } +/***/ }), +/* 77 */ +/***/ (function(module) { - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } +module.exports = {"AElig":"Æ","AMP":"&","Aacute":"Á","Acirc":"Â","Agrave":"À","Aring":"Å","Atilde":"Ã","Auml":"Ä","COPY":"©","Ccedil":"Ç","ETH":"Ð","Eacute":"É","Ecirc":"Ê","Egrave":"È","Euml":"Ë","GT":">","Iacute":"Í","Icirc":"Î","Igrave":"Ì","Iuml":"Ï","LT":"<","Ntilde":"Ñ","Oacute":"Ó","Ocirc":"Ô","Ograve":"Ò","Oslash":"Ø","Otilde":"Õ","Ouml":"Ö","QUOT":"\"","REG":"®","THORN":"Þ","Uacute":"Ú","Ucirc":"Û","Ugrave":"Ù","Uuml":"Ü","Yacute":"Ý","aacute":"á","acirc":"â","acute":"´","aelig":"æ","agrave":"à","amp":"&","aring":"å","atilde":"ã","auml":"ä","brvbar":"¦","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","curren":"¤","deg":"°","divide":"÷","eacute":"é","ecirc":"ê","egrave":"è","eth":"ð","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","iacute":"í","icirc":"î","iexcl":"¡","igrave":"ì","iquest":"¿","iuml":"ï","laquo":"«","lt":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","ntilde":"ñ","oacute":"ó","ocirc":"ô","ograve":"ò","ordf":"ª","ordm":"º","oslash":"ø","otilde":"õ","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","raquo":"»","reg":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","thorn":"þ","times":"×","uacute":"ú","ucirc":"û","ugrave":"ù","uml":"¨","uuml":"ü","yacute":"ý","yen":"¥","yuml":"ÿ"}; - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = hexadecimal + +/* Check if the given character code, or the character + * code at the first character, is hexadecimal. */ +function hexadecimal(character) { + var code = typeof character === 'string' ? character.charCodeAt(0) : character + + return ( + (code >= 97 /* a */ && code <= 102) /* z */ || + (code >= 65 /* A */ && code <= 70) /* Z */ || + (code >= 48 /* A */ && code <= 57) /* Z */ + ) +} + + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var alphabetical = __webpack_require__(80) +var decimal = __webpack_require__(23) + +module.exports = alphanumerical + +/* Check if the given character code, or the character + * code at the first character, is alphanumerical. */ +function alphanumerical(character) { + return alphabetical(character) || decimal(character) +} + + +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = alphabetical + +/* Check if the given character code, or the character + * code at the first character, is alphabetical. */ +function alphabetical(character) { + var code = typeof character === 'string' ? character.charCodeAt(0) : character + + return ( + (code >= 97 && code <= 122) /* a-z */ || + (code >= 65 && code <= 90) /* A-Z */ + ) +} + + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = escapes + +var defaults = [ + '\\', + '`', + '*', + '{', + '}', + '[', + ']', + '(', + ')', + '#', + '+', + '-', + '.', + '!', + '_', + '>' +] + +var gfm = defaults.concat(['~', '|']) + +var commonmark = gfm.concat([ + '\n', + '"', + '$', + '%', + '&', + "'", + ',', + '/', + ':', + ';', + '<', + '=', + '?', + '@', + '^' +]) + +escapes.default = defaults +escapes.gfm = gfm +escapes.commonmark = commonmark + +/* Get markdown escapes. */ +function escapes(options) { + var settings = options || {} + + if (settings.commonmark) { + return commonmark + } + + return settings.gfm ? gfm : defaults +} + + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = { + position: true, + gfm: true, + commonmark: false, + footnotes: false, + pedantic: false, + blocks: __webpack_require__(218) +} + + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = indentation + +var tab = '\t' +var space = ' ' + +var spaceSize = 1 +var tabSize = 4 + +// Gets indentation information for a line. +function indentation(value) { + var index = 0 + var indent = 0 + var character = value.charAt(index) + var stops = {} + var size + + while (character === tab || character === space) { + size = character === tab ? tabSize : spaceSize + + indent += size + + if (size > 1) { + indent = Math.floor(indent / size) * size + } + + stops[indent] = index + character = value.charAt(++index) + } + + return {indent: indent, stops: stops} +} + + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*' +var unquoted = '[^"\'=<>`\\u0000-\\u0020]+' +var singleQuoted = "'[^']*'" +var doubleQuoted = '"[^"]*"' +var attributeValue = + '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')' +var attribute = + '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)' +var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>' +var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>' +var comment = '|' +var processing = '<[?].*?[?]>' +var declaration = ']*>' +var cdata = '' + +exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')') + +exports.tag = new RegExp( + '^(?:' + + openTag + + '|' + + closeTag + + '|' + + comment + + '|' + + processing + + '|' + + declaration + + '|' + + cdata + + ')' +) + + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +function locate(value, fromIndex) { + return value.indexOf('<', fromIndex) +} + + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +function locate(value, fromIndex) { + var link = value.indexOf('[', fromIndex) + var image = value.indexOf('![', fromIndex) + + if (image === -1) { + return link + } + + // Link can never be `-1` if an image is found, so we don’t need to check + // for that :) + return link < image ? link : image +} + + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = identity + +function identity(value) { + return value +} + + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = { + gfm: true, + commonmark: false, + pedantic: false, + entities: 'false', + setext: false, + closeAtx: false, + looseTable: false, + spacedTable: true, + paddedTable: true, + stringLength: stringLength, + incrementListMarker: true, + fences: false, + fence: '`', + bullet: '-', + listItemIndent: 'tab', + rule: '*', + ruleSpaces: true, + ruleRepetition: 3, + strong: '*', + emphasis: '_' +} + +function stringLength(value) { + return value.length +} + + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var decode = __webpack_require__(30) + +module.exports = length + +var ampersand = '&' + +// Returns the length of HTML entity that is a prefix of the given string +// (excluding the ampersand), 0 if it does not start with an entity. +function length(value) { + var prefix + + /* istanbul ignore if - Currently also tested for at implemention, but we + * keep it here because that’s proper. */ + if (value.charAt(0) !== ampersand) { + return 0 + } + + prefix = value.split(ampersand, 2).join(ampersand) + + return prefix.length - decode(prefix).length +} + + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var repeat = __webpack_require__(10) + +module.exports = pad + +var lineFeed = '\n' +var space = ' ' + +var tabSize = 4 + +// Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty +// lines. +function pad(value, level) { + var values = value.split(lineFeed) + var index = values.length + var padding = repeat(space, level * tabSize) + + while (index--) { + if (values[index].length !== 0) { + values[index] = padding + values[index] + } + } + + return values.join(lineFeed) +} + + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* Expose. */ +module.exports = longestStreak; + +/* Get the count of the longest repeating streak of + * `character` in `value`. */ +function longestStreak(value, character) { + var count = 0; + var maximum = 0; + var expected; + var index; + + if (typeof character !== 'string' || character.length !== 1) { + throw new Error('Expected character'); + } + + value = String(value); + index = value.indexOf(character); + expected = index; + + while (index !== -1) { + count++; + + if (index === expected) { + if (count > maximum) { + maximum = count; + } + } else { + count = 1; + } + + expected = index + 1; + index = value.indexOf(character, expected); + } + + return maximum; +} + + +/***/ }), +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = label + +var leftSquareBracket = '[' +var rightSquareBracket = ']' + +var shortcut = 'shortcut' +var collapsed = 'collapsed' + +// Stringify a reference label. +// Because link references are easily, mistakingly, created (for example, +// `[foo]`), reference nodes have an extra property depicting how it looked in +// the original document, so stringification can cause minimal changes. +function label(node) { + var type = node.referenceType + + if (type === shortcut) { + return '' + } + + return ( + leftSquareBracket + + (type === collapsed ? '' : node.label || node.identifier) + + rightSquareBracket + ) +} + + +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module hard-break-spaces + * @fileoverview + * Warn when too many spaces are used to create a hard break. + * + * @example {"name": "valid.md"} + * + * Lorem ipsum·· + * dolor sit amet + * + * @example {"name": "invalid.md", "label": "input"} + * + * Lorem ipsum··· + * dolor sit amet. + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:12-2:1: Use two spaces for hard line breaks + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:hard-break-spaces', hardBreakSpaces) + +var reason = 'Use two spaces for hard line breaks' + +function hardBreakSpaces(tree, file) { + var contents = String(file) + + visit(tree, 'break', visitor) + + function visitor(node) { + var value + + if (!generated(node)) { + value = contents + .slice(position.start(node).offset, position.end(node).offset) + .split('\n', 1)[0] + .replace(/\r$/, '') + + if (value.length > 2) { + file.message(reason, node) + } + } + } +} + + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = style + +function style(node, relative) { + var last = node.children[node.children.length - 1] + var depth = node.depth + var pos = node && node.position && node.position.end + var final = last && last.position && last.position.end + + if (!pos) { + return null + } + + /* This can only occur for `'atx'` and `'atx-closed'` + * headings. This might incorrectly match `'atx'` + * headings with lots of trailing white space as an + * `'atx-closed'` heading. */ + if (!last) { + if (pos.column - 1 <= depth * 2) { + return consolidate(depth, relative) + } + + return 'atx-closed' + } + + if (final.line + 1 === pos.line) { + return 'setext' + } + + if (final.column + depth < pos.column) { + return 'atx-closed' + } + + return consolidate(depth, relative) +} + +/* Get the probable style of an atx-heading, depending on + * preferred style. */ +function consolidate(depth, relative) { + return depth < 3 + ? 'atx' + : relative === 'atx' || relative === 'setext' + ? relative + : null +} + + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const engine = __webpack_require__(96); +const options = __webpack_require__(191); +const extensions = __webpack_require__(199); +const processor = __webpack_require__(201); +const proc = __webpack_require__(302); +const cli = __webpack_require__(303); +const { plugins } = __webpack_require__(304); + +const args = { + processor: processor, + name: proc.name, + description: cli.description, + version: [ + proc.name + ': ' + proc.version, + cli.name + ': ' + cli.version + ].join(', '), + ignoreName: '.' + proc.name + 'ignore', + extensions: extensions +}; +const config = options(process.argv.slice(2), args); +config.detectConfig = false; +config.plugins = plugins; + +engine(config, function done(err, code) { + if (err) console.error(err); + process.exit(code); +}); + + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var PassThrough = __webpack_require__(32).PassThrough; +var statistics = __webpack_require__(12); +var fileSetPipeline = __webpack_require__(97); + +module.exports = run; + +/* Run the file set pipeline once. + * `callback` is invoked with a fatal error, + * or with a status code (`0` on success, `1` on failure). */ +function run(options, callback) { + var settings = {}; + var stdin = new PassThrough(); + var tree; + var detectConfig; + var hasConfig; + var detectIgnore; + var hasIgnore; + + try { + stdin = process.stdin; + } catch (err) { + /* Obscure bug in Node (seen on windows): + * - https://github.com/nodejs/node/blob/f856234/lib/internal/ + * process/stdio.js#L82; + * - https://github.com/AtomLinter/linter-markdown/pull/85. + */ + } + + if (!callback) { + throw new Error('Missing `callback`'); + } + + if (!options || !options.processor) { + return next(new Error('Missing `processor`')); + } + + /* Processor. */ + settings.processor = options.processor; + + /* Path to run as. */ + settings.cwd = options.cwd || process.cwd(); + + /* Input. */ + settings.files = options.files || []; + settings.extensions = (options.extensions || []).map(function (extension) { + return extension.charAt(0) === '.' ? extension : '.' + extension; + }); + + settings.filePath = options.filePath || null; + settings.streamIn = options.streamIn || stdin; + + /* Output. */ + settings.streamOut = options.streamOut || process.stdout; + settings.streamError = options.streamError || process.stderr; + settings.alwaysStringify = options.alwaysStringify; + settings.output = options.output; + settings.out = options.out; + + /* Null overwrites config settings, `undefined` doesn’t. */ + if (settings.output === null || settings.output === undefined) { + settings.output = undefined; + } + + if (settings.output && settings.out) { + return next(new Error('Cannot accept both `output` and `out`')); + } + + /* Process phase management. */ + tree = options.tree || false; + + settings.treeIn = options.treeIn; + settings.treeOut = options.treeOut; + settings.inspect = options.inspect; + + if (settings.treeIn === null || settings.treeIn === undefined) { + settings.treeIn = tree; + } + + if (settings.treeOut === null || settings.treeOut === undefined) { + settings.treeOut = tree; + } + + /* Configuration. */ + detectConfig = options.detectConfig; + hasConfig = Boolean(options.rcName || options.packageField); + + if (detectConfig && !hasConfig) { + return next(new Error( + 'Missing `rcName` or `packageField` with `detectConfig`' + )); + } + + settings.detectConfig = detectConfig === null || detectConfig === undefined ? hasConfig : detectConfig; + settings.rcName = options.rcName || null; + settings.rcPath = options.rcPath || null; + settings.packageField = options.packageField || null; + settings.settings = options.settings || {}; + settings.configTransform = options.configTransform; + settings.defaultConfig = options.defaultConfig; + + /* Ignore. */ + detectIgnore = options.detectIgnore; + hasIgnore = Boolean(options.ignoreName); + + settings.detectIgnore = detectIgnore === null || detectIgnore === undefined ? hasIgnore : detectIgnore; + settings.ignoreName = options.ignoreName || null; + settings.ignorePath = options.ignorePath || null; + settings.silentlyIgnore = Boolean(options.silentlyIgnore); + + if (detectIgnore && !hasIgnore) { + return next(new Error('Missing `ignoreName` with `detectIgnore`')); + } + + /* Plug-ins. */ + settings.pluginPrefix = options.pluginPrefix || null; + settings.plugins = options.plugins || {}; + + /* Reporting. */ + settings.reporter = options.reporter || null; + settings.reporterOptions = options.reporterOptions || null; + settings.color = options.color || false; + settings.silent = options.silent || false; + settings.quiet = options.quiet || false; + settings.frail = options.frail || false; + + /* Process. */ + fileSetPipeline.run({files: options.files || []}, settings, next); + + function next(err, context) { + var stats = statistics((context || {}).files); + var failed = Boolean(settings.frail ? stats.fatal || stats.warn : stats.fatal); + + if (err) { + callback(err); + } else { + callback(null, failed ? 1 : 0, context); + } + } +} + + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var trough = __webpack_require__(24); +var configure = __webpack_require__(99); +var fileSystem = __webpack_require__(144); +var stdin = __webpack_require__(160); +var transform = __webpack_require__(169); +var log = __webpack_require__(183); + +module.exports = trough() + .use(configure) + .use(fileSystem) + .use(stdin) + .use(transform) + .use(log); + + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var slice = [].slice + +module.exports = wrap + +/* Wrap `fn`. Can be sync or async; return a promise, + * receive a completion handler, return new values and + * errors. */ +function wrap(fn, callback) { + var invoked + + return wrapped + + function wrapped() { + var params = slice.call(arguments, 0) + var callback = fn.length > params.length + var result + + if (callback) { + params.push(done) + } + + try { + result = fn.apply(null, params) + } catch (err) { + /* Well, this is quite the pickle. `fn` received + * a callback and invoked it (thus continuing the + * pipeline), but later also threw an error. + * We’re not about to restart the pipeline again, + * so the only thing left to do is to throw the + * thing instea. */ + if (callback && invoked) { + throw err + } + + return done(err) + } + + if (!callback) { + if (result && typeof result.then === 'function') { + result.then(then, done) + } else if (result instanceof Error) { + done(result) + } else { + then(result) + } + } + } + + /* Invoke `next`, only once. */ + function done() { + if (!invoked) { + invoked = true + + callback.apply(null, arguments) + } + } + + /* Invoke `done` with one value. + * Tracks if an error is passed, too. */ + function then(value) { + done(null, value) + } +} + + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Configuration = __webpack_require__(100); + +module.exports = configure; + +function configure(context, settings) { + context.configuration = new Configuration(settings); +} + + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { + +var path = __webpack_require__(4); +var Module = __webpack_require__(47); +var yaml = __webpack_require__(101); +var json = __webpack_require__(51); +var debug = __webpack_require__(9)('unified-engine:configuration'); +var resolve = __webpack_require__(55).resolve; +var fault = __webpack_require__(34); +var xtend = __webpack_require__(7); +var object = __webpack_require__(35); +var string = __webpack_require__(17); +var func = __webpack_require__(26); +var FindUp = __webpack_require__(57); + +module.exports = Config; + +var own = {}.hasOwnProperty; +var extname = path.extname; +var basename = path.basename; +var dirname = path.dirname; +var relative = path.relative; + +var loaders = { + '.json': loadJSON, + '.js': loadScript, + '.yaml': loadYAML, + '.yml': loadYAML +}; + +var defaultLoader = loadJSON; + +Config.prototype.load = load; + +function Config(options) { + var rcName = options.rcName; + var packageField = options.packageField; + var names = []; + + this.cwd = options.cwd; + this.packageField = options.packageField; + this.pluginPrefix = options.pluginPrefix; + this.configTransform = options.configTransform; + this.defaultConfig = options.defaultConfig; + + if (rcName) { + names.push(rcName, rcName + '.js', rcName + '.yml', rcName + '.yaml'); + debug('Looking for `%s` configuration files', names); + } + + if (packageField) { + names.push('package.json'); + debug('Looking for `%s` fields in `package.json` files', packageField); + } + + this.given = {settings: options.settings, plugins: options.plugins}; + this.create = create.bind(this); + + this.findUp = new FindUp({ + filePath: options.rcPath, + cwd: options.cwd, + detect: options.detectConfig, + names: names, + create: this.create + }); +} + +function load(filePath, callback) { + var searchPath = filePath || path.resolve(this.cwd, 'stdin.js'); + var self = this; + + self.findUp.load(searchPath, done); + + function done(err, res) { + if (err || res) { + return callback(err, res); + } + + callback(null, self.create()); + } +} + +function create(buf, filePath) { + var self = this; + var transform = self.configTransform; + var defaults = self.defaultConfig; + var fn = (filePath && loaders[extname(filePath)]) || defaultLoader; + var options = {prefix: self.pluginPrefix, cwd: self.cwd}; + var result = {settings: {}, plugins: []}; + var contents = buf ? fn.apply(self, arguments) : undefined; + + if (transform && contents !== undefined) { + contents = transform(contents, filePath); + } + + /* Exit if we did find a `package.json`, but it doesn’t have configuration. */ + if (buf && contents === undefined && basename(filePath) === 'package.json') { + return; + } + + if (contents === undefined) { + if (defaults) { + merge(result, defaults, null, xtend(options, {root: self.cwd})); + } + } else { + merge(result, contents, null, xtend(options, {root: dirname(filePath)})); + } + + merge(result, self.given, null, xtend(options, {root: self.cwd})); + + return result; +} + +/* Basically `Module.prototype.load`, but for a buffer instead + * of a filepath. */ +function loadScript(buf, filePath) { + var submodule = Module._cache[filePath]; + + if (!submodule) { + submodule = new Module(filePath, module); + submodule.filename = filePath; + submodule.paths = Module._nodeModulePaths(dirname(filePath)); + submodule._compile(String(buf), filePath); + submodule.loaded = true; + Module._cache[filePath] = submodule; + } + + return submodule.exports; +} + +function loadYAML(buf, filePath) { + return yaml.safeLoad(buf, {filename: basename(filePath)}); +} + +function loadJSON(buf, filePath) { + var result = json(buf, filePath); + + if (basename(filePath) === 'package.json') { + result = result[this.packageField]; + } + + return result; +} + +function merge(target, raw, val, options) { + var root = options.root; + var cwd = options.cwd; + var prefix = options.prefix; + + if (object(raw)) { + addPreset(raw); + } else { + throw new Error('Expected preset, not `' + raw + '`'); + } + + return target; + + function addPreset(result) { + var plugins = result.plugins; + + if (plugins === null || plugins === undefined) { + /* Empty. */ + } else if (object(plugins)) { + if ('length' in plugins) { + addEach(plugins); + } else { + addIn(plugins); + } + } else { + throw new Error('Expected a list or object of plugins, not `' + plugins + '`'); + } + + target.settings = xtend(target.settings, result.settings); + } + + function addEach(result) { + var length = result.length; + var index = -1; + var value; + + while (++index < length) { + value = result[index]; + + if (object(value) && 'length' in value) { + use.apply(null, value); + } else { + use(value); + } + } + } + + function addIn(result) { + var key; + + for (key in result) { + use(key, result[key]); + } + } + + function use(usable, value) { + if (string(usable)) { + addModule(usable, value); + } else if (func(usable)) { + addPlugin(usable, value); + } else { + merge(target, usable, value, options); + } + } + + function addModule(id, value) { + var fp = resolve(id, {cwd: root, prefix: prefix}); + var res; + + if (fp) { + try { + res = __webpack_require__(143)(fp); // eslint-disable-line import/no-dynamic-require + } catch (err) { + throw fault('Cannot parse script `%s`\n%s', relative(root, fp), err.stack); + } + + try { + if (func(res)) { + addPlugin(res, value); + } else { + merge(target, res, value, xtend(options, {root: dirname(fp)})); + } + } catch (err) { + throw fault('Error: Expected preset or plugin, not %s, at `%s`', res, relative(root, fp)); + } + } else { + fp = relative(cwd, path.resolve(root, id)); + addPlugin(failingModule(fp, new Error('Could not find module `' + id + '`')), value); + } + } + + function addPlugin(result, value) { + var entry = find(target.plugins, result); + + if (entry) { + reconfigure(entry, value); + } else { + target.plugins.push([result, value]); + } + } +} + +function reconfigure(entry, value) { + if (value !== false && entry[1] !== false && object(value)) { + value = xtend(entry[1], value); + } + + entry[1] = value; +} + +function find(entries, plugin) { + var length = entries.length; + var index = -1; + var entry; + + while (++index < length) { + entry = entries[index]; + + if (entry[0] === plugin) { + return entry; + } + } +} + +function failingModule(id, err) { + var cache = failingModule.cache || (failingModule.cache = {}); + var submodule = own.call(cache, id) ? cache[id] : (cache[id] = fail); + return submodule; + function fail() { + throw err; + } +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(46)(module))) + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + + +var yaml = __webpack_require__(102); + + +module.exports = yaml; + + +/***/ }), +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + + +var loader = __webpack_require__(103); +var dumper = __webpack_require__(122); + + +function deprecated(name) { + return function () { + throw new Error('Function ' + name + ' is deprecated and cannot be used.'); + }; +} + + +module.exports.Type = __webpack_require__(5); +module.exports.Schema = __webpack_require__(16); +module.exports.FAILSAFE_SCHEMA = __webpack_require__(33); +module.exports.JSON_SCHEMA = __webpack_require__(49); +module.exports.CORE_SCHEMA = __webpack_require__(48); +module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(21); +module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(25); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.safeLoad = loader.safeLoad; +module.exports.safeLoadAll = loader.safeLoadAll; +module.exports.dump = dumper.dump; +module.exports.safeDump = dumper.safeDump; +module.exports.YAMLException = __webpack_require__(20); + +// Deprecated schema names from JS-YAML 2.0.x +module.exports.MINIMAL_SCHEMA = __webpack_require__(33); +module.exports.SAFE_SCHEMA = __webpack_require__(21); +module.exports.DEFAULT_SCHEMA = __webpack_require__(25); + +// Deprecated functions from JS-YAML 1.x.x +module.exports.scan = deprecated('scan'); +module.exports.parse = deprecated('parse'); +module.exports.compose = deprecated('compose'); +module.exports.addConstructor = deprecated('addConstructor'); + + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/*eslint-disable max-len,no-use-before-define*/ + +var common = __webpack_require__(15); +var YAMLException = __webpack_require__(20); +var Mark = __webpack_require__(104); +var DEFAULT_SAFE_SCHEMA = __webpack_require__(21); +var DEFAULT_FULL_SCHEMA = __webpack_require__(25); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only assigned to plain scalars. So, it isn't + // needed to check for 'kind' conformity. + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + var documents = loadDocuments(input, options), index, length; + + if (typeof iterator !== 'function') { + return documents; + } + + for (index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, output, options) { + if (typeof output === 'function') { + loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); + } else { + return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); + } +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; + + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + + +var common = __webpack_require__(15); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; + + +/***/ }), +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + + +/***/ }), +/* 107 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); + + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + + +/***/ }), +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var common = __webpack_require__(15); +var Type = __webpack_require__(5); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var common = __webpack_require__(15); +var Type = __webpack_require__(5); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +var require; + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = __webpack_require__(50).Buffer; +} catch (__) {} + +var Type = __webpack_require__(5); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + + +/***/ }), +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + + +/***/ }), +/* 117 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); + + +/***/ }), +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Type = __webpack_require__(5); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +var require; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = __webpack_require__(121); +} catch (_) { + /*global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = __webpack_require__(5); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { +/* istanbul ignore next */ + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/* istanbul ignore if */ +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + /* + Copyright JS Foundation and other contributors, https://js.foundation/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + Object.defineProperty(exports, "__esModule", { value: true }); + var comment_handler_1 = __webpack_require__(1); + var jsx_parser_1 = __webpack_require__(3); + var parser_1 = __webpack_require__(8); + var tokenizer_1 = __webpack_require__(15); + function parse(code, options, delegate) { + var commentHandler = null; + var proxyDelegate = function (node, metadata) { + if (delegate) { + delegate(node, metadata); + } + if (commentHandler) { + commentHandler.visit(node, metadata); + } + }; + var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; + var collectComment = false; + if (options) { + collectComment = (typeof options.comment === 'boolean' && options.comment); + var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); + if (collectComment || attachComment) { + commentHandler = new comment_handler_1.CommentHandler(); + commentHandler.attach = attachComment; + options.comment = true; + parserDelegate = proxyDelegate; + } + } + var isModule = false; + if (options && typeof options.sourceType === 'string') { + isModule = (options.sourceType === 'module'); + } + var parser; + if (options && typeof options.jsx === 'boolean' && options.jsx) { + parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); + } + else { + parser = new parser_1.Parser(code, options, parserDelegate); + } + var program = isModule ? parser.parseModule() : parser.parseScript(); + var ast = program; + if (collectComment && commentHandler) { + ast.comments = commentHandler.comments; + } + if (parser.config.tokens) { + ast.tokens = parser.tokens; + } + if (parser.config.tolerant) { + ast.errors = parser.errorHandler.errors; + } + return ast; + } + exports.parse = parse; + function parseModule(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'module'; + return parse(code, parsingOptions, delegate); + } + exports.parseModule = parseModule; + function parseScript(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'script'; + return parse(code, parsingOptions, delegate); + } + exports.parseScript = parseScript; + function tokenize(code, options, delegate) { + var tokenizer = new tokenizer_1.Tokenizer(code, options); + var tokens; + tokens = []; + try { + while (true) { + var token = tokenizer.getNextToken(); + if (!token) { + break; + } + if (delegate) { + token = delegate(token); + } + tokens.push(token); + } + } + catch (e) { + tokenizer.errorHandler.tolerate(e); + } + if (tokenizer.errorHandler.tolerant) { + tokens.errors = tokenizer.errors(); + } + return tokens; + } + exports.tokenize = tokenize; + var syntax_1 = __webpack_require__(2); + exports.Syntax = syntax_1.Syntax; + // Sync with *.json manifests. + exports.version = '4.0.1'; + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __webpack_require__(2); + var CommentHandler = (function () { + function CommentHandler() { + this.attach = false; + this.comments = []; + this.stack = []; + this.leading = []; + this.trailing = []; + } + CommentHandler.prototype.insertInnerComments = function (node, metadata) { + // innnerComments for properties empty block + // `function a() {/** comments **\/}` + if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { + var innerComments = []; + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (metadata.end.offset >= entry.start) { + innerComments.unshift(entry.comment); + this.leading.splice(i, 1); + this.trailing.splice(i, 1); + } + } + if (innerComments.length) { + node.innerComments = innerComments; + } + } + }; + CommentHandler.prototype.findTrailingComments = function (metadata) { + var trailingComments = []; + if (this.trailing.length > 0) { + for (var i = this.trailing.length - 1; i >= 0; --i) { + var entry_1 = this.trailing[i]; + if (entry_1.start >= metadata.end.offset) { + trailingComments.unshift(entry_1.comment); + } + } + this.trailing.length = 0; + return trailingComments; + } + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.node.trailingComments) { + var firstComment = entry.node.trailingComments[0]; + if (firstComment && firstComment.range[0] >= metadata.end.offset) { + trailingComments = entry.node.trailingComments; + delete entry.node.trailingComments; + } + } + return trailingComments; + }; + CommentHandler.prototype.findLeadingComments = function (metadata) { + var leadingComments = []; + var target; + while (this.stack.length > 0) { + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.start >= metadata.start.offset) { + target = entry.node; + this.stack.pop(); + } + else { + break; + } + } + if (target) { + var count = target.leadingComments ? target.leadingComments.length : 0; + for (var i = count - 1; i >= 0; --i) { + var comment = target.leadingComments[i]; + if (comment.range[1] <= metadata.start.offset) { + leadingComments.unshift(comment); + target.leadingComments.splice(i, 1); + } + } + if (target.leadingComments && target.leadingComments.length === 0) { + delete target.leadingComments; + } + return leadingComments; + } + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (entry.start <= metadata.start.offset) { + leadingComments.unshift(entry.comment); + this.leading.splice(i, 1); + } + } + return leadingComments; + }; + CommentHandler.prototype.visitNode = function (node, metadata) { + if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { + return; + } + this.insertInnerComments(node, metadata); + var trailingComments = this.findTrailingComments(metadata); + var leadingComments = this.findLeadingComments(metadata); + if (leadingComments.length > 0) { + node.leadingComments = leadingComments; + } + if (trailingComments.length > 0) { + node.trailingComments = trailingComments; + } + this.stack.push({ + node: node, + start: metadata.start.offset + }); + }; + CommentHandler.prototype.visitComment = function (node, metadata) { + var type = (node.type[0] === 'L') ? 'Line' : 'Block'; + var comment = { + type: type, + value: node.value + }; + if (node.range) { + comment.range = node.range; + } + if (node.loc) { + comment.loc = node.loc; + } + this.comments.push(comment); + if (this.attach) { + var entry = { + comment: { + type: type, + value: node.value, + range: [metadata.start.offset, metadata.end.offset] + }, + start: metadata.start.offset + }; + if (node.loc) { + entry.comment.loc = node.loc; + } + node.type = type; + this.leading.push(entry); + this.trailing.push(entry); + } + }; + CommentHandler.prototype.visit = function (node, metadata) { + if (node.type === 'LineComment') { + this.visitComment(node, metadata); + } + else if (node.type === 'BlockComment') { + this.visitComment(node, metadata); + } + else if (this.attach) { + this.visitNode(node, metadata); + } + }; + return CommentHandler; + }()); + exports.CommentHandler = CommentHandler; + + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; +/* istanbul ignore next */ + var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + var character_1 = __webpack_require__(4); + var JSXNode = __webpack_require__(5); + var jsx_syntax_1 = __webpack_require__(6); + var Node = __webpack_require__(7); + var parser_1 = __webpack_require__(8); + var token_1 = __webpack_require__(13); + var xhtml_entities_1 = __webpack_require__(14); + token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier'; + token_1.TokenName[101 /* Text */] = 'JSXText'; + // Fully qualified element name, e.g. returns "svg:path" + function getQualifiedElementName(elementName) { + var qualifiedName; + switch (elementName.type) { + case jsx_syntax_1.JSXSyntax.JSXIdentifier: + var id = elementName; + qualifiedName = id.name; + break; + case jsx_syntax_1.JSXSyntax.JSXNamespacedName: + var ns = elementName; + qualifiedName = getQualifiedElementName(ns.namespace) + ':' + + getQualifiedElementName(ns.name); + break; + case jsx_syntax_1.JSXSyntax.JSXMemberExpression: + var expr = elementName; + qualifiedName = getQualifiedElementName(expr.object) + '.' + + getQualifiedElementName(expr.property); + break; + /* istanbul ignore next */ + default: + break; + } + return qualifiedName; + } + var JSXParser = (function (_super) { + __extends(JSXParser, _super); + function JSXParser(code, options, delegate) { + return _super.call(this, code, options, delegate) || this; + } + JSXParser.prototype.parsePrimaryExpression = function () { + return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); + }; + JSXParser.prototype.startJSX = function () { + // Unwind the scanner before the lookahead token. + this.scanner.index = this.startMarker.index; + this.scanner.lineNumber = this.startMarker.line; + this.scanner.lineStart = this.startMarker.index - this.startMarker.column; + }; + JSXParser.prototype.finishJSX = function () { + // Prime the next lookahead. + this.nextToken(); + }; + JSXParser.prototype.reenterJSX = function () { + this.startJSX(); + this.expectJSX('}'); + // Pop the closing '}' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + }; + JSXParser.prototype.createJSXNode = function () { + this.collectComments(); + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.createJSXChildNode = function () { + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.scanXHTMLEntity = function (quote) { + var result = '&'; + var valid = true; + var terminated = false; + var numeric = false; + var hex = false; + while (!this.scanner.eof() && valid && !terminated) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === quote) { + break; + } + terminated = (ch === ';'); + result += ch; + ++this.scanner.index; + if (!terminated) { + switch (result.length) { + case 2: + // e.g. '{' + numeric = (ch === '#'); + break; + case 3: + if (numeric) { + // e.g. 'A' + hex = (ch === 'x'); + valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); + numeric = numeric && !hex; + } + break; + default: + valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); + valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); + break; + } + } + } + if (valid && terminated && result.length > 2) { + // e.g. 'A' becomes just '#x41' + var str = result.substr(1, result.length - 2); + if (numeric && str.length > 1) { + result = String.fromCharCode(parseInt(str.substr(1), 10)); + } + else if (hex && str.length > 2) { + result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); + } + else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { + result = xhtml_entities_1.XHTMLEntities[str]; + } + } + return result; + }; + // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. + JSXParser.prototype.lexJSX = function () { + var cp = this.scanner.source.charCodeAt(this.scanner.index); + // < > / : = { } + if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { + var value = this.scanner.source[this.scanner.index++]; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index - 1, + end: this.scanner.index + }; + } + // " ' + if (cp === 34 || cp === 39) { + var start = this.scanner.index; + var quote = this.scanner.source[this.scanner.index++]; + var str = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index++]; + if (ch === quote) { + break; + } + else if (ch === '&') { + str += this.scanXHTMLEntity(quote); + } + else { + str += ch; + } + } + return { + type: 8 /* StringLiteral */, + value: str, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ... or . + if (cp === 46) { + var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); + var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); + var value = (n1 === 46 && n2 === 46) ? '...' : '.'; + var start = this.scanner.index; + this.scanner.index += value.length; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ` + if (cp === 96) { + // Only placeholder, since it will be rescanned as a real assignment expression. + return { + type: 10 /* Template */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index, + end: this.scanner.index + }; + } + // Identifer can not contain backslash (char code 92). + if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) { + var start = this.scanner.index; + ++this.scanner.index; + while (!this.scanner.eof()) { + var ch = this.scanner.source.charCodeAt(this.scanner.index); + if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) { + ++this.scanner.index; + } + else if (ch === 45) { + // Hyphen (char code 45) can be part of an identifier. + ++this.scanner.index; + } + else { + break; + } + } + var id = this.scanner.source.slice(start, this.scanner.index); + return { + type: 100 /* Identifier */, + value: id, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + return this.scanner.lex(); + }; + JSXParser.prototype.nextJSXToken = function () { + this.collectComments(); + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var token = this.lexJSX(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + if (this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.nextJSXText = function () { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var start = this.scanner.index; + var text = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === '{' || ch === '<') { + break; + } + ++this.scanner.index; + text += ch; + if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { + ++this.scanner.lineNumber; + if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { + ++this.scanner.index; + } + this.scanner.lineStart = this.scanner.index; + } + } + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + var token = { + type: 101 /* Text */, + value: text, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + if ((text.length > 0) && this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.peekJSXToken = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.lexJSX(); + this.scanner.restoreState(state); + return next; + }; + // Expect the next JSX token to match the specified punctuator. + // If not, an exception will be thrown. + JSXParser.prototype.expectJSX = function (value) { + var token = this.nextJSXToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next JSX token matches the specified punctuator. + JSXParser.prototype.matchJSX = function (value) { + var next = this.peekJSXToken(); + return next.type === 7 /* Punctuator */ && next.value === value; + }; + JSXParser.prototype.parseJSXIdentifier = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 100 /* Identifier */) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); + }; + JSXParser.prototype.parseJSXElementName = function () { + var node = this.createJSXNode(); + var elementName = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = elementName; + this.expectJSX(':'); + var name_1 = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); + } + else if (this.matchJSX('.')) { + while (this.matchJSX('.')) { + var object = elementName; + this.expectJSX('.'); + var property = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); + } + } + return elementName; + }; + JSXParser.prototype.parseJSXAttributeName = function () { + var node = this.createJSXNode(); + var attributeName; + var identifier = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = identifier; + this.expectJSX(':'); + var name_2 = this.parseJSXIdentifier(); + attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); + } + else { + attributeName = identifier; + } + return attributeName; + }; + JSXParser.prototype.parseJSXStringLiteralAttribute = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 8 /* StringLiteral */) { + this.throwUnexpectedToken(token); + } + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + JSXParser.prototype.parseJSXExpressionAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.finishJSX(); + if (this.match('}')) { + this.tolerateError('JSX attributes must only be assigned a non-empty expression'); + } + var expression = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXAttributeValue = function () { + return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : + this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); + }; + JSXParser.prototype.parseJSXNameValueAttribute = function () { + var node = this.createJSXNode(); + var name = this.parseJSXAttributeName(); + var value = null; + if (this.matchJSX('=')) { + this.expectJSX('='); + value = this.parseJSXAttributeValue(); + } + return this.finalize(node, new JSXNode.JSXAttribute(name, value)); + }; + JSXParser.prototype.parseJSXSpreadAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.expectJSX('...'); + this.finishJSX(); + var argument = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); + }; + JSXParser.prototype.parseJSXAttributes = function () { + var attributes = []; + while (!this.matchJSX('/') && !this.matchJSX('>')) { + var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : + this.parseJSXNameValueAttribute(); + attributes.push(attribute); + } + return attributes; + }; + JSXParser.prototype.parseJSXOpeningElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXBoundaryElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + if (this.matchJSX('/')) { + this.expectJSX('/'); + var name_3 = this.parseJSXElementName(); + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); + } + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXEmptyExpression = function () { + var node = this.createJSXChildNode(); + this.collectComments(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + return this.finalize(node, new JSXNode.JSXEmptyExpression()); + }; + JSXParser.prototype.parseJSXExpressionContainer = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + var expression; + if (this.matchJSX('}')) { + expression = this.parseJSXEmptyExpression(); + this.expectJSX('}'); + } + else { + this.finishJSX(); + expression = this.parseAssignmentExpression(); + this.reenterJSX(); + } + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXChildren = function () { + var children = []; + while (!this.scanner.eof()) { + var node = this.createJSXChildNode(); + var token = this.nextJSXText(); + if (token.start < token.end) { + var raw = this.getTokenRaw(token); + var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); + children.push(child); + } + if (this.scanner.source[this.scanner.index] === '{') { + var container = this.parseJSXExpressionContainer(); + children.push(container); + } + else { + break; + } + } + return children; + }; + JSXParser.prototype.parseComplexJSXElement = function (el) { + var stack = []; + while (!this.scanner.eof()) { + el.children = el.children.concat(this.parseJSXChildren()); + var node = this.createJSXChildNode(); + var element = this.parseJSXBoundaryElement(); + if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { + var opening = element; + if (opening.selfClosing) { + var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); + el.children.push(child); + } + else { + stack.push(el); + el = { node: node, opening: opening, closing: null, children: [] }; + } + } + if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { + el.closing = element; + var open_1 = getQualifiedElementName(el.opening.name); + var close_1 = getQualifiedElementName(el.closing.name); + if (open_1 !== close_1) { + this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); + } + if (stack.length > 0) { + var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); + el = stack[stack.length - 1]; + el.children.push(child); + stack.pop(); + } + else { + break; + } + } + } + return el; + }; + JSXParser.prototype.parseJSXElement = function () { + var node = this.createJSXNode(); + var opening = this.parseJSXOpeningElement(); + var children = []; + var closing = null; + if (!opening.selfClosing) { + var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children }); + children = el.children; + closing = el.closing; + } + return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); + }; + JSXParser.prototype.parseJSXRoot = function () { + // Pop the opening '<' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + this.startJSX(); + var element = this.parseJSXElement(); + this.finishJSX(); + return element; + }; + JSXParser.prototype.isStartOfExpression = function () { + return _super.prototype.isStartOfExpression.call(this) || this.match('<'); + }; + return JSXParser; + }(parser_1.Parser)); + exports.JSXParser = JSXParser; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // See also tools/generate-unicode-regex.js. + var Regex = { + // Unicode v8.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, + // Unicode v8.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + exports.Character = { + /* tslint:disable:no-bitwise */ + fromCodePoint: function (cp) { + return (cp < 0x10000) ? String.fromCharCode(cp) : + String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + + String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); + }, + // https://tc39.github.io/ecma262/#sec-white-space + isWhiteSpace: function (cp) { + return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) || + (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0); + }, + // https://tc39.github.io/ecma262/#sec-line-terminators + isLineTerminator: function (cp) { + return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029); + }, + // https://tc39.github.io/ecma262/#sec-names-and-keywords + isIdentifierStart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp))); + }, + isIdentifierPart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp >= 0x30 && cp <= 0x39) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp))); + }, + // https://tc39.github.io/ecma262/#sec-literals-numeric-literals + isDecimalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39); // 0..9 + }, + isHexDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39) || + (cp >= 0x41 && cp <= 0x46) || + (cp >= 0x61 && cp <= 0x66); // a..f + }, + isOctalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x37); // 0..7 + } + }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var jsx_syntax_1 = __webpack_require__(6); + /* tslint:disable:max-classes-per-file */ + var JSXClosingElement = (function () { + function JSXClosingElement(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; + this.name = name; + } + return JSXClosingElement; + }()); + exports.JSXClosingElement = JSXClosingElement; + var JSXElement = (function () { + function JSXElement(openingElement, children, closingElement) { + this.type = jsx_syntax_1.JSXSyntax.JSXElement; + this.openingElement = openingElement; + this.children = children; + this.closingElement = closingElement; + } + return JSXElement; + }()); + exports.JSXElement = JSXElement; + var JSXEmptyExpression = (function () { + function JSXEmptyExpression() { + this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; + } + return JSXEmptyExpression; + }()); + exports.JSXEmptyExpression = JSXEmptyExpression; + var JSXExpressionContainer = (function () { + function JSXExpressionContainer(expression) { + this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; + this.expression = expression; + } + return JSXExpressionContainer; + }()); + exports.JSXExpressionContainer = JSXExpressionContainer; + var JSXIdentifier = (function () { + function JSXIdentifier(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; + this.name = name; + } + return JSXIdentifier; + }()); + exports.JSXIdentifier = JSXIdentifier; + var JSXMemberExpression = (function () { + function JSXMemberExpression(object, property) { + this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; + this.object = object; + this.property = property; + } + return JSXMemberExpression; + }()); + exports.JSXMemberExpression = JSXMemberExpression; + var JSXAttribute = (function () { + function JSXAttribute(name, value) { + this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; + this.name = name; + this.value = value; + } + return JSXAttribute; + }()); + exports.JSXAttribute = JSXAttribute; + var JSXNamespacedName = (function () { + function JSXNamespacedName(namespace, name) { + this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; + this.namespace = namespace; + this.name = name; + } + return JSXNamespacedName; + }()); + exports.JSXNamespacedName = JSXNamespacedName; + var JSXOpeningElement = (function () { + function JSXOpeningElement(name, selfClosing, attributes) { + this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; + this.name = name; + this.selfClosing = selfClosing; + this.attributes = attributes; + } + return JSXOpeningElement; + }()); + exports.JSXOpeningElement = JSXOpeningElement; + var JSXSpreadAttribute = (function () { + function JSXSpreadAttribute(argument) { + this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; + this.argument = argument; + } + return JSXSpreadAttribute; + }()); + exports.JSXSpreadAttribute = JSXSpreadAttribute; + var JSXText = (function () { + function JSXText(value, raw) { + this.type = jsx_syntax_1.JSXSyntax.JSXText; + this.value = value; + this.raw = raw; + } + return JSXText; + }()); + exports.JSXText = JSXText; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JSXSyntax = { + JSXAttribute: 'JSXAttribute', + JSXClosingElement: 'JSXClosingElement', + JSXElement: 'JSXElement', + JSXEmptyExpression: 'JSXEmptyExpression', + JSXExpressionContainer: 'JSXExpressionContainer', + JSXIdentifier: 'JSXIdentifier', + JSXMemberExpression: 'JSXMemberExpression', + JSXNamespacedName: 'JSXNamespacedName', + JSXOpeningElement: 'JSXOpeningElement', + JSXSpreadAttribute: 'JSXSpreadAttribute', + JSXText: 'JSXText' + }; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __webpack_require__(2); + /* tslint:disable:max-classes-per-file */ + var ArrayExpression = (function () { + function ArrayExpression(elements) { + this.type = syntax_1.Syntax.ArrayExpression; + this.elements = elements; + } + return ArrayExpression; + }()); + exports.ArrayExpression = ArrayExpression; + var ArrayPattern = (function () { + function ArrayPattern(elements) { + this.type = syntax_1.Syntax.ArrayPattern; + this.elements = elements; + } + return ArrayPattern; + }()); + exports.ArrayPattern = ArrayPattern; + var ArrowFunctionExpression = (function () { + function ArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = false; + } + return ArrowFunctionExpression; + }()); + exports.ArrowFunctionExpression = ArrowFunctionExpression; + var AssignmentExpression = (function () { + function AssignmentExpression(operator, left, right) { + this.type = syntax_1.Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return AssignmentExpression; + }()); + exports.AssignmentExpression = AssignmentExpression; + var AssignmentPattern = (function () { + function AssignmentPattern(left, right) { + this.type = syntax_1.Syntax.AssignmentPattern; + this.left = left; + this.right = right; + } + return AssignmentPattern; + }()); + exports.AssignmentPattern = AssignmentPattern; + var AsyncArrowFunctionExpression = (function () { + function AsyncArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = true; + } + return AsyncArrowFunctionExpression; + }()); + exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; + var AsyncFunctionDeclaration = (function () { + function AsyncFunctionDeclaration(id, params, body) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionDeclaration; + }()); + exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; + var AsyncFunctionExpression = (function () { + function AsyncFunctionExpression(id, params, body) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionExpression; + }()); + exports.AsyncFunctionExpression = AsyncFunctionExpression; + var AwaitExpression = (function () { + function AwaitExpression(argument) { + this.type = syntax_1.Syntax.AwaitExpression; + this.argument = argument; + } + return AwaitExpression; + }()); + exports.AwaitExpression = AwaitExpression; + var BinaryExpression = (function () { + function BinaryExpression(operator, left, right) { + var logical = (operator === '||' || operator === '&&'); + this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return BinaryExpression; + }()); + exports.BinaryExpression = BinaryExpression; + var BlockStatement = (function () { + function BlockStatement(body) { + this.type = syntax_1.Syntax.BlockStatement; + this.body = body; + } + return BlockStatement; + }()); + exports.BlockStatement = BlockStatement; + var BreakStatement = (function () { + function BreakStatement(label) { + this.type = syntax_1.Syntax.BreakStatement; + this.label = label; + } + return BreakStatement; + }()); + exports.BreakStatement = BreakStatement; + var CallExpression = (function () { + function CallExpression(callee, args) { + this.type = syntax_1.Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + } + return CallExpression; + }()); + exports.CallExpression = CallExpression; + var CatchClause = (function () { + function CatchClause(param, body) { + this.type = syntax_1.Syntax.CatchClause; + this.param = param; + this.body = body; + } + return CatchClause; + }()); + exports.CatchClause = CatchClause; + var ClassBody = (function () { + function ClassBody(body) { + this.type = syntax_1.Syntax.ClassBody; + this.body = body; + } + return ClassBody; + }()); + exports.ClassBody = ClassBody; + var ClassDeclaration = (function () { + function ClassDeclaration(id, superClass, body) { + this.type = syntax_1.Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassDeclaration; + }()); + exports.ClassDeclaration = ClassDeclaration; + var ClassExpression = (function () { + function ClassExpression(id, superClass, body) { + this.type = syntax_1.Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassExpression; + }()); + exports.ClassExpression = ClassExpression; + var ComputedMemberExpression = (function () { + function ComputedMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = true; + this.object = object; + this.property = property; + } + return ComputedMemberExpression; + }()); + exports.ComputedMemberExpression = ComputedMemberExpression; + var ConditionalExpression = (function () { + function ConditionalExpression(test, consequent, alternate) { + this.type = syntax_1.Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return ConditionalExpression; + }()); + exports.ConditionalExpression = ConditionalExpression; + var ContinueStatement = (function () { + function ContinueStatement(label) { + this.type = syntax_1.Syntax.ContinueStatement; + this.label = label; + } + return ContinueStatement; + }()); + exports.ContinueStatement = ContinueStatement; + var DebuggerStatement = (function () { + function DebuggerStatement() { + this.type = syntax_1.Syntax.DebuggerStatement; + } + return DebuggerStatement; + }()); + exports.DebuggerStatement = DebuggerStatement; + var Directive = (function () { + function Directive(expression, directive) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + this.directive = directive; + } + return Directive; + }()); + exports.Directive = Directive; + var DoWhileStatement = (function () { + function DoWhileStatement(body, test) { + this.type = syntax_1.Syntax.DoWhileStatement; + this.body = body; + this.test = test; + } + return DoWhileStatement; + }()); + exports.DoWhileStatement = DoWhileStatement; + var EmptyStatement = (function () { + function EmptyStatement() { + this.type = syntax_1.Syntax.EmptyStatement; + } + return EmptyStatement; + }()); + exports.EmptyStatement = EmptyStatement; + var ExportAllDeclaration = (function () { + function ExportAllDeclaration(source) { + this.type = syntax_1.Syntax.ExportAllDeclaration; + this.source = source; + } + return ExportAllDeclaration; + }()); + exports.ExportAllDeclaration = ExportAllDeclaration; + var ExportDefaultDeclaration = (function () { + function ExportDefaultDeclaration(declaration) { + this.type = syntax_1.Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + } + return ExportDefaultDeclaration; + }()); + exports.ExportDefaultDeclaration = ExportDefaultDeclaration; + var ExportNamedDeclaration = (function () { + function ExportNamedDeclaration(declaration, specifiers, source) { + this.type = syntax_1.Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = source; + } + return ExportNamedDeclaration; + }()); + exports.ExportNamedDeclaration = ExportNamedDeclaration; + var ExportSpecifier = (function () { + function ExportSpecifier(local, exported) { + this.type = syntax_1.Syntax.ExportSpecifier; + this.exported = exported; + this.local = local; + } + return ExportSpecifier; + }()); + exports.ExportSpecifier = ExportSpecifier; + var ExpressionStatement = (function () { + function ExpressionStatement(expression) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + } + return ExpressionStatement; + }()); + exports.ExpressionStatement = ExpressionStatement; + var ForInStatement = (function () { + function ForInStatement(left, right, body) { + this.type = syntax_1.Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + } + return ForInStatement; + }()); + exports.ForInStatement = ForInStatement; + var ForOfStatement = (function () { + function ForOfStatement(left, right, body) { + this.type = syntax_1.Syntax.ForOfStatement; + this.left = left; + this.right = right; + this.body = body; + } + return ForOfStatement; + }()); + exports.ForOfStatement = ForOfStatement; + var ForStatement = (function () { + function ForStatement(init, test, update, body) { + this.type = syntax_1.Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + } + return ForStatement; + }()); + exports.ForStatement = ForStatement; + var FunctionDeclaration = (function () { + function FunctionDeclaration(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionDeclaration; + }()); + exports.FunctionDeclaration = FunctionDeclaration; + var FunctionExpression = (function () { + function FunctionExpression(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionExpression; + }()); + exports.FunctionExpression = FunctionExpression; + var Identifier = (function () { + function Identifier(name) { + this.type = syntax_1.Syntax.Identifier; + this.name = name; + } + return Identifier; + }()); + exports.Identifier = Identifier; + var IfStatement = (function () { + function IfStatement(test, consequent, alternate) { + this.type = syntax_1.Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return IfStatement; + }()); + exports.IfStatement = IfStatement; + var ImportDeclaration = (function () { + function ImportDeclaration(specifiers, source) { + this.type = syntax_1.Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = source; + } + return ImportDeclaration; + }()); + exports.ImportDeclaration = ImportDeclaration; + var ImportDefaultSpecifier = (function () { + function ImportDefaultSpecifier(local) { + this.type = syntax_1.Syntax.ImportDefaultSpecifier; + this.local = local; + } + return ImportDefaultSpecifier; + }()); + exports.ImportDefaultSpecifier = ImportDefaultSpecifier; + var ImportNamespaceSpecifier = (function () { + function ImportNamespaceSpecifier(local) { + this.type = syntax_1.Syntax.ImportNamespaceSpecifier; + this.local = local; + } + return ImportNamespaceSpecifier; + }()); + exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; + var ImportSpecifier = (function () { + function ImportSpecifier(local, imported) { + this.type = syntax_1.Syntax.ImportSpecifier; + this.local = local; + this.imported = imported; + } + return ImportSpecifier; + }()); + exports.ImportSpecifier = ImportSpecifier; + var LabeledStatement = (function () { + function LabeledStatement(label, body) { + this.type = syntax_1.Syntax.LabeledStatement; + this.label = label; + this.body = body; + } + return LabeledStatement; + }()); + exports.LabeledStatement = LabeledStatement; + var Literal = (function () { + function Literal(value, raw) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + } + return Literal; + }()); + exports.Literal = Literal; + var MetaProperty = (function () { + function MetaProperty(meta, property) { + this.type = syntax_1.Syntax.MetaProperty; + this.meta = meta; + this.property = property; + } + return MetaProperty; + }()); + exports.MetaProperty = MetaProperty; + var MethodDefinition = (function () { + function MethodDefinition(key, computed, value, kind, isStatic) { + this.type = syntax_1.Syntax.MethodDefinition; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.static = isStatic; + } + return MethodDefinition; + }()); + exports.MethodDefinition = MethodDefinition; + var Module = (function () { + function Module(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'module'; + } + return Module; + }()); + exports.Module = Module; + var NewExpression = (function () { + function NewExpression(callee, args) { + this.type = syntax_1.Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + } + return NewExpression; + }()); + exports.NewExpression = NewExpression; + var ObjectExpression = (function () { + function ObjectExpression(properties) { + this.type = syntax_1.Syntax.ObjectExpression; + this.properties = properties; + } + return ObjectExpression; + }()); + exports.ObjectExpression = ObjectExpression; + var ObjectPattern = (function () { + function ObjectPattern(properties) { + this.type = syntax_1.Syntax.ObjectPattern; + this.properties = properties; + } + return ObjectPattern; + }()); + exports.ObjectPattern = ObjectPattern; + var Property = (function () { + function Property(kind, key, computed, value, method, shorthand) { + this.type = syntax_1.Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + } + return Property; + }()); + exports.Property = Property; + var RegexLiteral = (function () { + function RegexLiteral(value, raw, pattern, flags) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + this.regex = { pattern: pattern, flags: flags }; + } + return RegexLiteral; + }()); + exports.RegexLiteral = RegexLiteral; + var RestElement = (function () { + function RestElement(argument) { + this.type = syntax_1.Syntax.RestElement; + this.argument = argument; + } + return RestElement; + }()); + exports.RestElement = RestElement; + var ReturnStatement = (function () { + function ReturnStatement(argument) { + this.type = syntax_1.Syntax.ReturnStatement; + this.argument = argument; + } + return ReturnStatement; + }()); + exports.ReturnStatement = ReturnStatement; + var Script = (function () { + function Script(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'script'; + } + return Script; + }()); + exports.Script = Script; + var SequenceExpression = (function () { + function SequenceExpression(expressions) { + this.type = syntax_1.Syntax.SequenceExpression; + this.expressions = expressions; + } + return SequenceExpression; + }()); + exports.SequenceExpression = SequenceExpression; + var SpreadElement = (function () { + function SpreadElement(argument) { + this.type = syntax_1.Syntax.SpreadElement; + this.argument = argument; + } + return SpreadElement; + }()); + exports.SpreadElement = SpreadElement; + var StaticMemberExpression = (function () { + function StaticMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = false; + this.object = object; + this.property = property; + } + return StaticMemberExpression; + }()); + exports.StaticMemberExpression = StaticMemberExpression; + var Super = (function () { + function Super() { + this.type = syntax_1.Syntax.Super; + } + return Super; + }()); + exports.Super = Super; + var SwitchCase = (function () { + function SwitchCase(test, consequent) { + this.type = syntax_1.Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + } + return SwitchCase; + }()); + exports.SwitchCase = SwitchCase; + var SwitchStatement = (function () { + function SwitchStatement(discriminant, cases) { + this.type = syntax_1.Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + } + return SwitchStatement; + }()); + exports.SwitchStatement = SwitchStatement; + var TaggedTemplateExpression = (function () { + function TaggedTemplateExpression(tag, quasi) { + this.type = syntax_1.Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + } + return TaggedTemplateExpression; + }()); + exports.TaggedTemplateExpression = TaggedTemplateExpression; + var TemplateElement = (function () { + function TemplateElement(value, tail) { + this.type = syntax_1.Syntax.TemplateElement; + this.value = value; + this.tail = tail; + } + return TemplateElement; + }()); + exports.TemplateElement = TemplateElement; + var TemplateLiteral = (function () { + function TemplateLiteral(quasis, expressions) { + this.type = syntax_1.Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + } + return TemplateLiteral; + }()); + exports.TemplateLiteral = TemplateLiteral; + var ThisExpression = (function () { + function ThisExpression() { + this.type = syntax_1.Syntax.ThisExpression; + } + return ThisExpression; + }()); + exports.ThisExpression = ThisExpression; + var ThrowStatement = (function () { + function ThrowStatement(argument) { + this.type = syntax_1.Syntax.ThrowStatement; + this.argument = argument; + } + return ThrowStatement; + }()); + exports.ThrowStatement = ThrowStatement; + var TryStatement = (function () { + function TryStatement(block, handler, finalizer) { + this.type = syntax_1.Syntax.TryStatement; + this.block = block; + this.handler = handler; + this.finalizer = finalizer; + } + return TryStatement; + }()); + exports.TryStatement = TryStatement; + var UnaryExpression = (function () { + function UnaryExpression(operator, argument) { + this.type = syntax_1.Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + } + return UnaryExpression; + }()); + exports.UnaryExpression = UnaryExpression; + var UpdateExpression = (function () { + function UpdateExpression(operator, argument, prefix) { + this.type = syntax_1.Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = prefix; + } + return UpdateExpression; + }()); + exports.UpdateExpression = UpdateExpression; + var VariableDeclaration = (function () { + function VariableDeclaration(declarations, kind) { + this.type = syntax_1.Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + } + return VariableDeclaration; + }()); + exports.VariableDeclaration = VariableDeclaration; + var VariableDeclarator = (function () { + function VariableDeclarator(id, init) { + this.type = syntax_1.Syntax.VariableDeclarator; + this.id = id; + this.init = init; + } + return VariableDeclarator; + }()); + exports.VariableDeclarator = VariableDeclarator; + var WhileStatement = (function () { + function WhileStatement(test, body) { + this.type = syntax_1.Syntax.WhileStatement; + this.test = test; + this.body = body; + } + return WhileStatement; + }()); + exports.WhileStatement = WhileStatement; + var WithStatement = (function () { + function WithStatement(object, body) { + this.type = syntax_1.Syntax.WithStatement; + this.object = object; + this.body = body; + } + return WithStatement; + }()); + exports.WithStatement = WithStatement; + var YieldExpression = (function () { + function YieldExpression(argument, delegate) { + this.type = syntax_1.Syntax.YieldExpression; + this.argument = argument; + this.delegate = delegate; + } + return YieldExpression; + }()); + exports.YieldExpression = YieldExpression; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __webpack_require__(9); + var error_handler_1 = __webpack_require__(10); + var messages_1 = __webpack_require__(11); + var Node = __webpack_require__(7); + var scanner_1 = __webpack_require__(12); + var syntax_1 = __webpack_require__(2); + var token_1 = __webpack_require__(13); + var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; + var Parser = (function () { + function Parser(code, options, delegate) { + if (options === void 0) { options = {}; } + this.config = { + range: (typeof options.range === 'boolean') && options.range, + loc: (typeof options.loc === 'boolean') && options.loc, + source: null, + tokens: (typeof options.tokens === 'boolean') && options.tokens, + comment: (typeof options.comment === 'boolean') && options.comment, + tolerant: (typeof options.tolerant === 'boolean') && options.tolerant + }; + if (this.config.loc && options.source && options.source !== null) { + this.config.source = String(options.source); + } + this.delegate = delegate; + this.errorHandler = new error_handler_1.ErrorHandler(); + this.errorHandler.tolerant = this.config.tolerant; + this.scanner = new scanner_1.Scanner(code, this.errorHandler); + this.scanner.trackComment = this.config.comment; + this.operatorPrecedence = { + ')': 0, + ';': 0, + ',': 0, + '=': 0, + ']': 0, + '||': 1, + '&&': 2, + '|': 3, + '^': 4, + '&': 5, + '==': 6, + '!=': 6, + '===': 6, + '!==': 6, + '<': 7, + '>': 7, + '<=': 7, + '>=': 7, + '<<': 8, + '>>': 8, + '>>>': 8, + '+': 9, + '-': 9, + '*': 11, + '/': 11, + '%': 11 + }; + this.lookahead = { + type: 2 /* EOF */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: 0, + start: 0, + end: 0 + }; + this.hasLineTerminator = false; + this.context = { + isModule: false, + await: false, + allowIn: true, + allowStrictDirective: true, + allowYield: true, + firstCoverInitializedNameError: null, + isAssignmentTarget: false, + isBindingElement: false, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + labelSet: {}, + strict: false + }; + this.tokens = []; + this.startMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.lastMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.nextToken(); + this.lastMarker = { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + } + Parser.prototype.throwError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + throw this.errorHandler.createError(index, line, column, msg); + }; + Parser.prototype.tolerateError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.scanner.lineNumber; + var column = this.lastMarker.column + 1; + this.errorHandler.tolerateError(index, line, column, msg); + }; + // Throw an exception because of the token. + Parser.prototype.unexpectedTokenError = function (token, message) { + var msg = message || messages_1.Messages.UnexpectedToken; + var value; + if (token) { + if (!message) { + msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS : + (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier : + (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber : + (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString : + (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate : + messages_1.Messages.UnexpectedToken; + if (token.type === 4 /* Keyword */) { + if (this.scanner.isFutureReservedWord(token.value)) { + msg = messages_1.Messages.UnexpectedReserved; + } + else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { + msg = messages_1.Messages.StrictReservedWord; + } + } + } + value = token.value; + } + else { + value = 'ILLEGAL'; + } + msg = msg.replace('%0', value); + if (token && typeof token.lineNumber === 'number') { + var index = token.start; + var line = token.lineNumber; + var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; + var column = token.start - lastMarkerLineStart + 1; + return this.errorHandler.createError(index, line, column, msg); + } + else { + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + return this.errorHandler.createError(index, line, column, msg); + } + }; + Parser.prototype.throwUnexpectedToken = function (token, message) { + throw this.unexpectedTokenError(token, message); + }; + Parser.prototype.tolerateUnexpectedToken = function (token, message) { + this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); + }; + Parser.prototype.collectComments = function () { + if (!this.config.comment) { + this.scanner.scanComments(); + } + else { + var comments = this.scanner.scanComments(); + if (comments.length > 0 && this.delegate) { + for (var i = 0; i < comments.length; ++i) { + var e = comments[i]; + var node = void 0; + node = { + type: e.multiLine ? 'BlockComment' : 'LineComment', + value: this.scanner.source.slice(e.slice[0], e.slice[1]) + }; + if (this.config.range) { + node.range = e.range; + } + if (this.config.loc) { + node.loc = e.loc; + } + var metadata = { + start: { + line: e.loc.start.line, + column: e.loc.start.column, + offset: e.range[0] + }, + end: { + line: e.loc.end.line, + column: e.loc.end.column, + offset: e.range[1] + } + }; + this.delegate(node, metadata); + } + } + } + }; + // From internal representation to an external structure + Parser.prototype.getTokenRaw = function (token) { + return this.scanner.source.slice(token.start, token.end); + }; + Parser.prototype.convertToken = function (token) { + var t = { + type: token_1.TokenName[token.type], + value: this.getTokenRaw(token) + }; + if (this.config.range) { + t.range = [token.start, token.end]; + } + if (this.config.loc) { + t.loc = { + start: { + line: this.startMarker.line, + column: this.startMarker.column + }, + end: { + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + } + }; + } + if (token.type === 9 /* RegularExpression */) { + var pattern = token.pattern; + var flags = token.flags; + t.regex = { pattern: pattern, flags: flags }; + } + return t; + }; + Parser.prototype.nextToken = function () { + var token = this.lookahead; + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + this.collectComments(); + if (this.scanner.index !== this.startMarker.index) { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + } + var next = this.scanner.lex(); + this.hasLineTerminator = (token.lineNumber !== next.lineNumber); + if (next && this.context.strict && next.type === 3 /* Identifier */) { + if (this.scanner.isStrictModeReservedWord(next.value)) { + next.type = 4 /* Keyword */; + } + } + this.lookahead = next; + if (this.config.tokens && next.type !== 2 /* EOF */) { + this.tokens.push(this.convertToken(next)); + } + return token; + }; + Parser.prototype.nextRegexToken = function () { + this.collectComments(); + var token = this.scanner.scanRegExp(); + if (this.config.tokens) { + // Pop the previous token, '/' or '/=' + // This is added from the lookahead token. + this.tokens.pop(); + this.tokens.push(this.convertToken(token)); + } + // Prime the next lookahead. + this.lookahead = token; + this.nextToken(); + return token; + }; + Parser.prototype.createNode = function () { + return { + index: this.startMarker.index, + line: this.startMarker.line, + column: this.startMarker.column + }; + }; + Parser.prototype.startNode = function (token, lastLineStart) { + if (lastLineStart === void 0) { lastLineStart = 0; } + var column = token.start - token.lineStart; + var line = token.lineNumber; + if (column < 0) { + column += lastLineStart; + line--; + } + return { + index: token.start, + line: line, + column: column + }; + }; + Parser.prototype.finalize = function (marker, node) { + if (this.config.range) { + node.range = [marker.index, this.lastMarker.index]; + } + if (this.config.loc) { + node.loc = { + start: { + line: marker.line, + column: marker.column, + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column + } + }; + if (this.config.source) { + node.loc.source = this.config.source; + } + } + if (this.delegate) { + var metadata = { + start: { + line: marker.line, + column: marker.column, + offset: marker.index + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column, + offset: this.lastMarker.index + } + }; + this.delegate(node, metadata); + } + return node; + }; + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + Parser.prototype.expect = function (value) { + var token = this.nextToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). + Parser.prototype.expectCommaSeparator = function () { + if (this.config.tolerant) { + var token = this.lookahead; + if (token.type === 7 /* Punctuator */ && token.value === ',') { + this.nextToken(); + } + else if (token.type === 7 /* Punctuator */ && token.value === ';') { + this.nextToken(); + this.tolerateUnexpectedToken(token); + } + else { + this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); + } + } + else { + this.expect(','); + } + }; + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + Parser.prototype.expectKeyword = function (keyword) { + var token = this.nextToken(); + if (token.type !== 4 /* Keyword */ || token.value !== keyword) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next token matches the specified punctuator. + Parser.prototype.match = function (value) { + return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value; + }; + // Return true if the next token matches the specified keyword + Parser.prototype.matchKeyword = function (keyword) { + return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword; + }; + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) + Parser.prototype.matchContextualKeyword = function (keyword) { + return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword; + }; + // Return true if the next token is an assignment operator + Parser.prototype.matchAssign = function () { + if (this.lookahead.type !== 7 /* Punctuator */) { + return false; + } + var op = this.lookahead.value; + return op === '=' || + op === '*=' || + op === '**=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + }; + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + Parser.prototype.isolateCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + if (this.context.firstCoverInitializedNameError !== null) { + this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); + } + this.context.isBindingElement = previousIsBindingElement; + this.context.isAssignmentTarget = previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; + return result; + }; + Parser.prototype.inheritCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; + this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; + return result; + }; + Parser.prototype.consumeSemicolon = function () { + if (this.match(';')) { + this.nextToken(); + } + else if (!this.hasLineTerminator) { + if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) { + this.throwUnexpectedToken(this.lookahead); + } + this.lastMarker.index = this.startMarker.index; + this.lastMarker.line = this.startMarker.line; + this.lastMarker.column = this.startMarker.column; + } + }; + // https://tc39.github.io/ecma262/#sec-primary-expression + Parser.prototype.parsePrimaryExpression = function () { + var node = this.createNode(); + var expr; + var token, raw; + switch (this.lookahead.type) { + case 3 /* Identifier */: + if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { + this.tolerateUnexpectedToken(this.lookahead); + } + expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); + break; + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + if (this.context.strict && this.lookahead.octal) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 1 /* BooleanLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); + break; + case 5 /* NullLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(null, raw)); + break; + case 10 /* Template */: + expr = this.parseTemplateLiteral(); + break; + case 7 /* Punctuator */: + switch (this.lookahead.value) { + case '(': + this.context.isBindingElement = false; + expr = this.inheritCoverGrammar(this.parseGroupExpression); + break; + case '[': + expr = this.inheritCoverGrammar(this.parseArrayInitializer); + break; + case '{': + expr = this.inheritCoverGrammar(this.parseObjectInitializer); + break; + case '/': + case '/=': + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.scanner.index = this.startMarker.index; + token = this.nextRegexToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + break; + case 4 /* Keyword */: + if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseIdentifierName(); + } + else if (!this.context.strict && this.matchKeyword('let')) { + expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); + } + else { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + if (this.matchKeyword('function')) { + expr = this.parseFunctionExpression(); + } + else if (this.matchKeyword('this')) { + this.nextToken(); + expr = this.finalize(node, new Node.ThisExpression()); + } + else if (this.matchKeyword('class')) { + expr = this.parseClassExpression(); + } + else { + expr = this.throwUnexpectedToken(this.nextToken()); + } + } + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-array-initializer + Parser.prototype.parseSpreadElement = function () { + var node = this.createNode(); + this.expect('...'); + var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); + return this.finalize(node, new Node.SpreadElement(arg)); + }; + Parser.prototype.parseArrayInitializer = function () { + var node = this.createNode(); + var elements = []; + this.expect('['); + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else if (this.match('...')) { + var element = this.parseSpreadElement(); + if (!this.match(']')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.expect(','); + } + elements.push(element); + } + else { + elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayExpression(elements)); + }; + // https://tc39.github.io/ecma262/#sec-object-initializer + Parser.prototype.parsePropertyMethod = function (params) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = params.simple; + var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); + if (this.context.strict && params.firstRestricted) { + this.tolerateUnexpectedToken(params.firstRestricted, params.message); + } + if (this.context.strict && params.stricted) { + this.tolerateUnexpectedToken(params.stricted, params.message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + return body; + }; + Parser.prototype.parsePropertyMethodFunction = function () { + var isGenerator = false; + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + Parser.prototype.parsePropertyMethodAsyncFunction = function () { + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = false; + this.context.await = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); + }; + Parser.prototype.parseObjectPropertyKey = function () { + var node = this.createNode(); + var token = this.nextToken(); + var key; + switch (token.type) { + case 8 /* StringLiteral */: + case 6 /* NumericLiteral */: + if (this.context.strict && token.octal) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); + } + var raw = this.getTokenRaw(token); + key = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 3 /* Identifier */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 4 /* Keyword */: + key = this.finalize(node, new Node.Identifier(token.value)); + break; + case 7 /* Punctuator */: + if (token.value === '[') { + key = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.expect(']'); + } + else { + key = this.throwUnexpectedToken(token); + } + break; + default: + key = this.throwUnexpectedToken(token); + } + return key; + }; + Parser.prototype.isPropertyKey = function (key, value) { + return (key.type === syntax_1.Syntax.Identifier && key.name === value) || + (key.type === syntax_1.Syntax.Literal && key.value === value); + }; + Parser.prototype.parseObjectProperty = function (hasProto) { + var node = this.createNode(); + var token = this.lookahead; + var kind; + var key = null; + var value = null; + var computed = false; + var method = false; + var shorthand = false; + var isAsync = false; + if (token.type === 3 /* Identifier */) { + var id = token.value; + this.nextToken(); + computed = this.match('['); + isAsync = !this.hasLineTerminator && (id === 'async') && + !this.match(':') && !this.match('(') && !this.match('*') && !this.match(','); + key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); + } + else if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + else { + if (!key) { + this.throwUnexpectedToken(this.lookahead); + } + kind = 'init'; + if (this.match(':') && !isAsync) { + if (!computed && this.isPropertyKey(key, '__proto__')) { + if (hasProto.value) { + this.tolerateError(messages_1.Messages.DuplicateProtoProperty); + } + hasProto.value = true; + } + this.nextToken(); + value = this.inheritCoverGrammar(this.parseAssignmentExpression); + } + else if (this.match('(')) { + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + else if (token.type === 3 /* Identifier */) { + var id = this.finalize(node, new Node.Identifier(token.value)); + if (this.match('=')) { + this.context.firstCoverInitializedNameError = this.lookahead; + this.nextToken(); + shorthand = true; + var init = this.isolateCoverGrammar(this.parseAssignmentExpression); + value = this.finalize(node, new Node.AssignmentPattern(id, init)); + } + else { + shorthand = true; + value = id; + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectInitializer = function () { + var node = this.createNode(); + this.expect('{'); + var properties = []; + var hasProto = { value: false }; + while (!this.match('}')) { + properties.push(this.parseObjectProperty(hasProto)); + if (!this.match('}')) { + this.expectCommaSeparator(); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectExpression(properties)); + }; + // https://tc39.github.io/ecma262/#sec-template-literals + Parser.prototype.parseTemplateHead = function () { + assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateElement = function () { + if (this.lookahead.type !== 10 /* Template */) { + this.throwUnexpectedToken(); + } + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateLiteral = function () { + var node = this.createNode(); + var expressions = []; + var quasis = []; + var quasi = this.parseTemplateHead(); + quasis.push(quasi); + while (!quasi.tail) { + expressions.push(this.parseExpression()); + quasi = this.parseTemplateElement(); + quasis.push(quasi); + } + return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); + }; + // https://tc39.github.io/ecma262/#sec-grouping-operator + Parser.prototype.reinterpretExpressionAsPattern = function (expr) { + switch (expr.type) { + case syntax_1.Syntax.Identifier: + case syntax_1.Syntax.MemberExpression: + case syntax_1.Syntax.RestElement: + case syntax_1.Syntax.AssignmentPattern: + break; + case syntax_1.Syntax.SpreadElement: + expr.type = syntax_1.Syntax.RestElement; + this.reinterpretExpressionAsPattern(expr.argument); + break; + case syntax_1.Syntax.ArrayExpression: + expr.type = syntax_1.Syntax.ArrayPattern; + for (var i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + this.reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectExpression: + expr.type = syntax_1.Syntax.ObjectPattern; + for (var i = 0; i < expr.properties.length; i++) { + this.reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case syntax_1.Syntax.AssignmentExpression: + expr.type = syntax_1.Syntax.AssignmentPattern; + delete expr.operator; + this.reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } + }; + Parser.prototype.parseGroupExpression = function () { + var expr; + this.expect('('); + if (this.match(')')) { + this.nextToken(); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [], + async: false + }; + } + else { + var startToken = this.lookahead; + var params = []; + if (this.match('...')) { + expr = this.parseRestElement(params); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + else { + var arrow = false; + this.context.isBindingElement = true; + expr = this.inheritCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + this.context.isAssignmentTarget = false; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + if (this.match(')')) { + this.nextToken(); + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else if (this.match('...')) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + expressions.push(this.parseRestElement(params)); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + this.context.isBindingElement = false; + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else { + expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + } + if (arrow) { + break; + } + } + if (!arrow) { + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + } + if (!arrow) { + this.expect(')'); + if (this.match('=>')) { + if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + if (!arrow) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + if (expr.type === syntax_1.Syntax.SequenceExpression) { + for (var i = 0; i < expr.expressions.length; i++) { + this.reinterpretExpressionAsPattern(expr.expressions[i]); + } + } + else { + this.reinterpretExpressionAsPattern(expr); + } + var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); + expr = { + type: ArrowParameterPlaceHolder, + params: parameters, + async: false + }; + } + } + this.context.isBindingElement = false; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions + Parser.prototype.parseArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAssignmentExpression); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.isIdentifierName = function (token) { + return token.type === 3 /* Identifier */ || + token.type === 4 /* Keyword */ || + token.type === 1 /* BooleanLiteral */ || + token.type === 5 /* NullLiteral */; + }; + Parser.prototype.parseIdentifierName = function () { + var node = this.createNode(); + var token = this.nextToken(); + if (!this.isIdentifierName(token)) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseNewExpression = function () { + var node = this.createNode(); + var id = this.parseIdentifierName(); + assert_1.assert(id.name === 'new', 'New expression must start with `new`'); + var expr; + if (this.match('.')) { + this.nextToken(); + if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') { + var property = this.parseIdentifierName(); + expr = new Node.MetaProperty(id, property); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); + var args = this.match('(') ? this.parseArguments() : []; + expr = new Node.NewExpression(callee, args); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return this.finalize(node, expr); + }; + Parser.prototype.parseAsyncArgument = function () { + var arg = this.parseAssignmentExpression(); + this.context.firstCoverInitializedNameError = null; + return arg; + }; + Parser.prototype.parseAsyncArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAsyncArgument); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { + var startToken = this.lookahead; + var maybeAsync = this.matchContextualKeyword('async'); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var expr; + if (this.matchKeyword('super') && this.context.inFunctionBody) { + expr = this.createNode(); + this.nextToken(); + expr = this.finalize(expr, new Node.Super()); + if (!this.match('(') && !this.match('.') && !this.match('[')) { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + } + while (true) { + if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); + } + else if (this.match('(')) { + var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber); + this.context.isBindingElement = false; + this.context.isAssignmentTarget = false; + var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); + expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); + if (asyncArrow && this.match('=>')) { + for (var i = 0; i < args.length; ++i) { + this.reinterpretExpressionAsPattern(args[i]); + } + expr = { + type: ArrowParameterPlaceHolder, + params: args, + async: true + }; + } + } + else if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + this.context.allowIn = previousAllowIn; + return expr; + }; + Parser.prototype.parseSuper = function () { + var node = this.createNode(); + this.expectKeyword('super'); + if (!this.match('[') && !this.match('.')) { + this.throwUnexpectedToken(this.lookahead); + } + return this.finalize(node, new Node.Super()); + }; + Parser.prototype.parseLeftHandSideExpression = function () { + assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); + var node = this.startNode(this.lookahead); + var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : + this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + while (true) { + if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); + } + else if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-update-expressions + Parser.prototype.parseUpdateExpression = function () { + var expr; + var startToken = this.lookahead; + if (this.match('++') || this.match('--')) { + var node = this.startNode(startToken); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPrefix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + var prefix = true; + expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) { + if (this.match('++') || this.match('--')) { + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPostfix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var operator = this.nextToken().value; + var prefix = false; + expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-unary-operators + Parser.prototype.parseAwaitExpression = function () { + var node = this.createNode(); + this.nextToken(); + var argument = this.parseUnaryExpression(); + return this.finalize(node, new Node.AwaitExpression(argument)); + }; + Parser.prototype.parseUnaryExpression = function () { + var expr; + if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || + this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { + var node = this.startNode(this.lookahead); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); + if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { + this.tolerateError(messages_1.Messages.StrictDelete); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else if (this.context.await && this.matchContextualKeyword('await')) { + expr = this.parseAwaitExpression(); + } + else { + expr = this.parseUpdateExpression(); + } + return expr; + }; + Parser.prototype.parseExponentiationExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-exp-operator + // https://tc39.github.io/ecma262/#sec-multiplicative-operators + // https://tc39.github.io/ecma262/#sec-additive-operators + // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators + // https://tc39.github.io/ecma262/#sec-relational-operators + // https://tc39.github.io/ecma262/#sec-equality-operators + // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators + // https://tc39.github.io/ecma262/#sec-binary-logical-operators + Parser.prototype.binaryPrecedence = function (token) { + var op = token.value; + var precedence; + if (token.type === 7 /* Punctuator */) { + precedence = this.operatorPrecedence[op] || 0; + } + else if (token.type === 4 /* Keyword */) { + precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; + } + else { + precedence = 0; + } + return precedence; + }; + Parser.prototype.parseBinaryExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); + var token = this.lookahead; + var prec = this.binaryPrecedence(token); + if (prec > 0) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var markers = [startToken, this.lookahead]; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + var stack = [left, token.value, right]; + var precedences = [prec]; + while (true) { + prec = this.binaryPrecedence(this.lookahead); + if (prec <= 0) { + break; + } + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) { + right = stack.pop(); + var operator = stack.pop(); + precedences.pop(); + left = stack.pop(); + markers.pop(); + var node = this.startNode(markers[markers.length - 1]); + stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); + } + // Shift. + stack.push(this.nextToken().value); + precedences.push(prec); + markers.push(this.lookahead); + stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); + } + // Final reduce to clean-up the stack. + var i = stack.length - 1; + expr = stack[i]; + var lastMarker = markers.pop(); + while (i > 1) { + var marker = markers.pop(); + var lastLineStart = lastMarker && lastMarker.lineStart; + var node = this.startNode(marker, lastLineStart); + var operator = stack[i - 1]; + expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); + i -= 2; + lastMarker = marker; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-conditional-operator + Parser.prototype.parseConditionalExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseBinaryExpression); + if (this.match('?')) { + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + this.expect(':'); + var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-assignment-operators + Parser.prototype.checkPatternParam = function (options, param) { + switch (param.type) { + case syntax_1.Syntax.Identifier: + this.validateParam(options, param, param.name); + break; + case syntax_1.Syntax.RestElement: + this.checkPatternParam(options, param.argument); + break; + case syntax_1.Syntax.AssignmentPattern: + this.checkPatternParam(options, param.left); + break; + case syntax_1.Syntax.ArrayPattern: + for (var i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + this.checkPatternParam(options, param.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectPattern: + for (var i = 0; i < param.properties.length; i++) { + this.checkPatternParam(options, param.properties[i].value); + } + break; + default: + break; + } + options.simple = options.simple && (param instanceof Node.Identifier); + }; + Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { + var params = [expr]; + var options; + var asyncArrow = false; + switch (expr.type) { + case syntax_1.Syntax.Identifier: + break; + case ArrowParameterPlaceHolder: + params = expr.params; + asyncArrow = expr.async; + break; + default: + return null; + } + options = { + simple: true, + paramSet: {} + }; + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.AssignmentPattern) { + if (param.right.type === syntax_1.Syntax.YieldExpression) { + if (param.right.argument) { + this.throwUnexpectedToken(this.lookahead); + } + param.right.type = syntax_1.Syntax.Identifier; + param.right.name = 'yield'; + delete param.right.argument; + delete param.right.delegate; + } + } + else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { + this.throwUnexpectedToken(this.lookahead); + } + this.checkPatternParam(options, param); + params[i] = param; + } + if (this.context.strict || !this.context.allowYield) { + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.YieldExpression) { + this.throwUnexpectedToken(this.lookahead); + } + } + } + if (options.message === messages_1.Messages.StrictParamDupe) { + var token = this.context.strict ? options.stricted : options.firstRestricted; + this.throwUnexpectedToken(token, options.message); + } + return { + simple: options.simple, + params: params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.parseAssignmentExpression = function () { + var expr; + if (!this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseYieldExpression(); + } + else { + var startToken = this.lookahead; + var token = startToken; + expr = this.parseConditionalExpression(); + if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { + if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) { + var arg = this.parsePrimaryExpression(); + this.reinterpretExpressionAsPattern(arg); + expr = { + type: ArrowParameterPlaceHolder, + params: [arg], + async: true + }; + } + } + if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { + // https://tc39.github.io/ecma262/#sec-arrow-function-definitions + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var isAsync = expr.async; + var list = this.reinterpretAsCoverFormalsList(expr); + if (list) { + if (this.hasLineTerminator) { + this.tolerateUnexpectedToken(this.lookahead); + } + this.context.firstCoverInitializedNameError = null; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = list.simple; + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = true; + this.context.await = isAsync; + var node = this.startNode(startToken); + this.expect('=>'); + var body = void 0; + if (this.match('{')) { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + body = this.parseFunctionSourceElements(); + this.context.allowIn = previousAllowIn; + } + else { + body = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + var expression = body.type !== syntax_1.Syntax.BlockStatement; + if (this.context.strict && list.firstRestricted) { + this.throwUnexpectedToken(list.firstRestricted, list.message); + } + if (this.context.strict && list.stricted) { + this.tolerateUnexpectedToken(list.stricted, list.message); + } + expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : + this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + } + } + else { + if (this.matchAssign()) { + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { + var id = expr; + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); + } + if (this.scanner.isStrictModeReservedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + } + if (!this.match('=')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + this.reinterpretExpressionAsPattern(expr); + } + token = this.nextToken(); + var operator = token.value; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); + this.context.firstCoverInitializedNameError = null; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-comma-operator + Parser.prototype.parseExpression = function () { + var startToken = this.lookahead; + var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-block + Parser.prototype.parseStatementListItem = function () { + var statement; + this.context.isAssignmentTarget = true; + this.context.isBindingElement = true; + if (this.lookahead.type === 4 /* Keyword */) { + switch (this.lookahead.value) { + case 'export': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); + } + statement = this.parseExportDeclaration(); + break; + case 'import': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); + } + statement = this.parseImportDeclaration(); + break; + case 'const': + statement = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'class': + statement = this.parseClassDeclaration(); + break; + case 'let': + statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); + break; + default: + statement = this.parseStatement(); + break; + } + } + else { + statement = this.parseStatement(); + } + return statement; + }; + Parser.prototype.parseBlock = function () { + var node = this.createNode(); + this.expect('{'); + var block = []; + while (true) { + if (this.match('}')) { + break; + } + block.push(this.parseStatementListItem()); + } + this.expect('}'); + return this.finalize(node, new Node.BlockStatement(block)); + }; + // https://tc39.github.io/ecma262/#sec-let-and-const-declarations + Parser.prototype.parseLexicalBinding = function (kind, options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, kind); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (kind === 'const') { + if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else { + this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); + } + } + } + else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { + this.expect('='); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseBindingList = function (kind, options) { + var list = [this.parseLexicalBinding(kind, options)]; + while (this.match(',')) { + this.nextToken(); + list.push(this.parseLexicalBinding(kind, options)); + } + return list; + }; + Parser.prototype.isLexicalDeclaration = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + return (next.type === 3 /* Identifier */) || + (next.type === 7 /* Punctuator */ && next.value === '[') || + (next.type === 7 /* Punctuator */ && next.value === '{') || + (next.type === 4 /* Keyword */ && next.value === 'let') || + (next.type === 4 /* Keyword */ && next.value === 'yield'); + }; + Parser.prototype.parseLexicalDeclaration = function (options) { + var node = this.createNode(); + var kind = this.nextToken().value; + assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); + var declarations = this.parseBindingList(kind, options); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); + }; + // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns + Parser.prototype.parseBindingRestElement = function (params, kind) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params, kind); + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseArrayPattern = function (params, kind) { + var node = this.createNode(); + this.expect('['); + var elements = []; + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else { + if (this.match('...')) { + elements.push(this.parseBindingRestElement(params, kind)); + break; + } + else { + elements.push(this.parsePatternWithDefault(params, kind)); + } + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayPattern(elements)); + }; + Parser.prototype.parsePropertyPattern = function (params, kind) { + var node = this.createNode(); + var computed = false; + var shorthand = false; + var method = false; + var key; + var value; + if (this.lookahead.type === 3 /* Identifier */) { + var keyToken = this.lookahead; + key = this.parseVariableIdentifier(); + var init = this.finalize(node, new Node.Identifier(keyToken.value)); + if (this.match('=')) { + params.push(keyToken); + shorthand = true; + this.nextToken(); + var expr = this.parseAssignmentExpression(); + value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); + } + else if (!this.match(':')) { + params.push(keyToken); + shorthand = true; + value = init; + } + else { + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectPattern = function (params, kind) { + var node = this.createNode(); + var properties = []; + this.expect('{'); + while (!this.match('}')) { + properties.push(this.parsePropertyPattern(params, kind)); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectPattern(properties)); + }; + Parser.prototype.parsePattern = function (params, kind) { + var pattern; + if (this.match('[')) { + pattern = this.parseArrayPattern(params, kind); + } + else if (this.match('{')) { + pattern = this.parseObjectPattern(params, kind); + } + else { + if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); + } + params.push(this.lookahead); + pattern = this.parseVariableIdentifier(kind); + } + return pattern; + }; + Parser.prototype.parsePatternWithDefault = function (params, kind) { + var startToken = this.lookahead; + var pattern = this.parsePattern(params, kind); + if (this.match('=')) { + this.nextToken(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowYield = previousAllowYield; + pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); + } + return pattern; + }; + // https://tc39.github.io/ecma262/#sec-variable-statement + Parser.prototype.parseVariableIdentifier = function (kind) { + var node = this.createNode(); + var token = this.nextToken(); + if (token.type === 4 /* Keyword */ && token.value === 'yield') { + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else if (!this.context.allowYield) { + this.throwUnexpectedToken(token); + } + } + else if (token.type !== 3 /* Identifier */) { + if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else { + if (this.context.strict || token.value !== 'let' || kind !== 'var') { + this.throwUnexpectedToken(token); + } + } + } + else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') { + this.tolerateUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseVariableDeclaration = function (options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, 'var'); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { + this.expect('='); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseVariableDeclarationList = function (options) { + var opt = { inFor: options.inFor }; + var list = []; + list.push(this.parseVariableDeclaration(opt)); + while (this.match(',')) { + this.nextToken(); + list.push(this.parseVariableDeclaration(opt)); + } + return list; + }; + Parser.prototype.parseVariableStatement = function () { + var node = this.createNode(); + this.expectKeyword('var'); + var declarations = this.parseVariableDeclarationList({ inFor: false }); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); + }; + // https://tc39.github.io/ecma262/#sec-empty-statement + Parser.prototype.parseEmptyStatement = function () { + var node = this.createNode(); + this.expect(';'); + return this.finalize(node, new Node.EmptyStatement()); + }; + // https://tc39.github.io/ecma262/#sec-expression-statement + Parser.prototype.parseExpressionStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ExpressionStatement(expr)); + }; + // https://tc39.github.io/ecma262/#sec-if-statement + Parser.prototype.parseIfClause = function () { + if (this.context.strict && this.matchKeyword('function')) { + this.tolerateError(messages_1.Messages.StrictFunction); + } + return this.parseStatement(); + }; + Parser.prototype.parseIfStatement = function () { + var node = this.createNode(); + var consequent; + var alternate = null; + this.expectKeyword('if'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + consequent = this.parseIfClause(); + if (this.matchKeyword('else')) { + this.nextToken(); + alternate = this.parseIfClause(); + } + } + return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); + }; + // https://tc39.github.io/ecma262/#sec-do-while-statement + Parser.prototype.parseDoWhileStatement = function () { + var node = this.createNode(); + this.expectKeyword('do'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + var body = this.parseStatement(); + this.context.inIteration = previousInIteration; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + } + else { + this.expect(')'); + if (this.match(';')) { + this.nextToken(); + } + } + return this.finalize(node, new Node.DoWhileStatement(body, test)); + }; + // https://tc39.github.io/ecma262/#sec-while-statement + Parser.prototype.parseWhileStatement = function () { + var node = this.createNode(); + var body; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.parseStatement(); + this.context.inIteration = previousInIteration; + } + return this.finalize(node, new Node.WhileStatement(test, body)); + }; + // https://tc39.github.io/ecma262/#sec-for-statement + // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements + Parser.prototype.parseForStatement = function () { + var init = null; + var test = null; + var update = null; + var forIn = true; + var left, right; + var node = this.createNode(); + this.expectKeyword('for'); + this.expect('('); + if (this.match(';')) { + this.nextToken(); + } + else { + if (this.matchKeyword('var')) { + init = this.createNode(); + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseVariableDeclarationList({ inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && this.matchKeyword('in')) { + var decl = declarations[0]; + if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { + this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); + } + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.expect(';'); + } + } + else if (this.matchKeyword('const') || this.matchKeyword('let')) { + init = this.createNode(); + var kind = this.nextToken().value; + if (!this.context.strict && this.lookahead.value === 'in') { + init = this.finalize(init, new Node.Identifier(kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseBindingList(kind, { inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + this.consumeSemicolon(); + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + } + } + } + else { + var initStartToken = this.lookahead; + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + init = this.inheritCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + if (this.matchKeyword('in')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForIn); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseExpression(); + init = null; + } + else if (this.matchContextualKeyword('of')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + if (this.match(',')) { + var initSeq = [init]; + while (this.match(',')) { + this.nextToken(); + initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); + } + this.expect(';'); + } + } + } + if (typeof left === 'undefined') { + if (!this.match(';')) { + test = this.parseExpression(); + } + this.expect(';'); + if (!this.match(')')) { + update = this.parseExpression(); + } + } + var body; + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.isolateCoverGrammar(this.parseStatement); + this.context.inIteration = previousInIteration; + } + return (typeof left === 'undefined') ? + this.finalize(node, new Node.ForStatement(init, test, update, body)) : + forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : + this.finalize(node, new Node.ForOfStatement(left, right, body)); + }; + // https://tc39.github.io/ecma262/#sec-continue-statement + Parser.prototype.parseContinueStatement = function () { + var node = this.createNode(); + this.expectKeyword('continue'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + label = id; + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration) { + this.throwError(messages_1.Messages.IllegalContinue); + } + return this.finalize(node, new Node.ContinueStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-break-statement + Parser.prototype.parseBreakStatement = function () { + var node = this.createNode(); + this.expectKeyword('break'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + label = id; + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration && !this.context.inSwitch) { + this.throwError(messages_1.Messages.IllegalBreak); + } + return this.finalize(node, new Node.BreakStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-return-statement + Parser.prototype.parseReturnStatement = function () { + if (!this.context.inFunctionBody) { + this.tolerateError(messages_1.Messages.IllegalReturn); + } + var node = this.createNode(); + this.expectKeyword('return'); + var hasArgument = (!this.match(';') && !this.match('}') && + !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) || + this.lookahead.type === 8 /* StringLiteral */ || + this.lookahead.type === 10 /* Template */; + var argument = hasArgument ? this.parseExpression() : null; + this.consumeSemicolon(); + return this.finalize(node, new Node.ReturnStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-with-statement + Parser.prototype.parseWithStatement = function () { + if (this.context.strict) { + this.tolerateError(messages_1.Messages.StrictModeWith); + } + var node = this.createNode(); + var body; + this.expectKeyword('with'); + this.expect('('); + var object = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + body = this.parseStatement(); + } + return this.finalize(node, new Node.WithStatement(object, body)); + }; + // https://tc39.github.io/ecma262/#sec-switch-statement + Parser.prototype.parseSwitchCase = function () { + var node = this.createNode(); + var test; + if (this.matchKeyword('default')) { + this.nextToken(); + test = null; + } + else { + this.expectKeyword('case'); + test = this.parseExpression(); + } + this.expect(':'); + var consequent = []; + while (true) { + if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { + break; + } + consequent.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.SwitchCase(test, consequent)); + }; + Parser.prototype.parseSwitchStatement = function () { + var node = this.createNode(); + this.expectKeyword('switch'); + this.expect('('); + var discriminant = this.parseExpression(); + this.expect(')'); + var previousInSwitch = this.context.inSwitch; + this.context.inSwitch = true; + var cases = []; + var defaultFound = false; + this.expect('{'); + while (true) { + if (this.match('}')) { + break; + } + var clause = this.parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + this.expect('}'); + this.context.inSwitch = previousInSwitch; + return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); + }; + // https://tc39.github.io/ecma262/#sec-labelled-statements + Parser.prototype.parseLabelledStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + var statement; + if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { + this.nextToken(); + var id = expr; + var key = '$' + id.name; + if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); + } + this.context.labelSet[key] = true; + var body = void 0; + if (this.matchKeyword('class')) { + this.tolerateUnexpectedToken(this.lookahead); + body = this.parseClassDeclaration(); + } + else if (this.matchKeyword('function')) { + var token = this.lookahead; + var declaration = this.parseFunctionDeclaration(); + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); + } + else if (declaration.generator) { + this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); + } + body = declaration; + } + else { + body = this.parseStatement(); + } + delete this.context.labelSet[key]; + statement = new Node.LabeledStatement(id, body); + } + else { + this.consumeSemicolon(); + statement = new Node.ExpressionStatement(expr); + } + return this.finalize(node, statement); + }; + // https://tc39.github.io/ecma262/#sec-throw-statement + Parser.prototype.parseThrowStatement = function () { + var node = this.createNode(); + this.expectKeyword('throw'); + if (this.hasLineTerminator) { + this.throwError(messages_1.Messages.NewlineAfterThrow); + } + var argument = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ThrowStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-try-statement + Parser.prototype.parseCatchClause = function () { + var node = this.createNode(); + this.expectKeyword('catch'); + this.expect('('); + if (this.match(')')) { + this.throwUnexpectedToken(this.lookahead); + } + var params = []; + var param = this.parsePattern(params); + var paramMap = {}; + for (var i = 0; i < params.length; i++) { + var key = '$' + params[i].value; + if (Object.prototype.hasOwnProperty.call(paramMap, key)) { + this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); + } + paramMap[key] = true; + } + if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(param.name)) { + this.tolerateError(messages_1.Messages.StrictCatchVariable); + } + } + this.expect(')'); + var body = this.parseBlock(); + return this.finalize(node, new Node.CatchClause(param, body)); + }; + Parser.prototype.parseFinallyClause = function () { + this.expectKeyword('finally'); + return this.parseBlock(); + }; + Parser.prototype.parseTryStatement = function () { + var node = this.createNode(); + this.expectKeyword('try'); + var block = this.parseBlock(); + var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; + var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; + if (!handler && !finalizer) { + this.throwError(messages_1.Messages.NoCatchOrFinally); + } + return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); + }; + // https://tc39.github.io/ecma262/#sec-debugger-statement + Parser.prototype.parseDebuggerStatement = function () { + var node = this.createNode(); + this.expectKeyword('debugger'); + this.consumeSemicolon(); + return this.finalize(node, new Node.DebuggerStatement()); + }; + // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations + Parser.prototype.parseStatement = function () { + var statement; + switch (this.lookahead.type) { + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + case 10 /* Template */: + case 9 /* RegularExpression */: + statement = this.parseExpressionStatement(); + break; + case 7 /* Punctuator */: + var value = this.lookahead.value; + if (value === '{') { + statement = this.parseBlock(); + } + else if (value === '(') { + statement = this.parseExpressionStatement(); + } + else if (value === ';') { + statement = this.parseEmptyStatement(); + } + else { + statement = this.parseExpressionStatement(); + } + break; + case 3 /* Identifier */: + statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); + break; + case 4 /* Keyword */: + switch (this.lookahead.value) { + case 'break': + statement = this.parseBreakStatement(); + break; + case 'continue': + statement = this.parseContinueStatement(); + break; + case 'debugger': + statement = this.parseDebuggerStatement(); + break; + case 'do': + statement = this.parseDoWhileStatement(); + break; + case 'for': + statement = this.parseForStatement(); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'if': + statement = this.parseIfStatement(); + break; + case 'return': + statement = this.parseReturnStatement(); + break; + case 'switch': + statement = this.parseSwitchStatement(); + break; + case 'throw': + statement = this.parseThrowStatement(); + break; + case 'try': + statement = this.parseTryStatement(); + break; + case 'var': + statement = this.parseVariableStatement(); + break; + case 'while': + statement = this.parseWhileStatement(); + break; + case 'with': + statement = this.parseWithStatement(); + break; + default: + statement = this.parseExpressionStatement(); + break; + } + break; + default: + statement = this.throwUnexpectedToken(this.lookahead); + } + return statement; + }; + // https://tc39.github.io/ecma262/#sec-function-definitions + Parser.prototype.parseFunctionSourceElements = function () { + var node = this.createNode(); + this.expect('{'); + var body = this.parseDirectivePrologues(); + var previousLabelSet = this.context.labelSet; + var previousInIteration = this.context.inIteration; + var previousInSwitch = this.context.inSwitch; + var previousInFunctionBody = this.context.inFunctionBody; + this.context.labelSet = {}; + this.context.inIteration = false; + this.context.inSwitch = false; + this.context.inFunctionBody = true; + while (this.lookahead.type !== 2 /* EOF */) { + if (this.match('}')) { + break; + } + body.push(this.parseStatementListItem()); + } + this.expect('}'); + this.context.labelSet = previousLabelSet; + this.context.inIteration = previousInIteration; + this.context.inSwitch = previousInSwitch; + this.context.inFunctionBody = previousInFunctionBody; + return this.finalize(node, new Node.BlockStatement(body)); + }; + Parser.prototype.validateParam = function (options, param, name) { + var key = '$' + name; + if (this.context.strict) { + if (this.scanner.isRestrictedWord(name)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + else if (!options.firstRestricted) { + if (this.scanner.isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictParamName; + } + else if (this.scanner.isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictReservedWord; + } + else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + /* istanbul ignore next */ + if (typeof Object.defineProperty === 'function') { + Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); + } + else { + options.paramSet[key] = true; + } + }; + Parser.prototype.parseRestElement = function (params) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params); + if (this.match('=')) { + this.throwError(messages_1.Messages.DefaultRestParameter); + } + if (!this.match(')')) { + this.throwError(messages_1.Messages.ParameterAfterRestParameter); + } + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseFormalParameter = function (options) { + var params = []; + var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); + for (var i = 0; i < params.length; i++) { + this.validateParam(options, params[i], params[i].value); + } + options.simple = options.simple && (param instanceof Node.Identifier); + options.params.push(param); + }; + Parser.prototype.parseFormalParameters = function (firstRestricted) { + var options; + options = { + simple: true, + params: [], + firstRestricted: firstRestricted + }; + this.expect('('); + if (!this.match(')')) { + options.paramSet = {}; + while (this.lookahead.type !== 2 /* EOF */) { + this.parseFormalParameter(options); + if (this.match(')')) { + break; + } + this.expect(','); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return { + simple: options.simple, + params: options.params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.matchAsyncFunction = function () { + var match = this.matchContextualKeyword('async'); + if (match) { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function'); + } + return match; + }; + Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted = null; + if (!identifierIsOptional || !this.match('(')) { + var token = this.lookahead; + id = this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : + this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); + }; + Parser.prototype.parseFunctionExpression = function () { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted; + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + if (!this.match('(')) { + var token = this.lookahead; + id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : + this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive + Parser.prototype.parseDirective = function () { + var token = this.lookahead; + var node = this.createNode(); + var expr = this.parseExpression(); + var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null; + this.consumeSemicolon(); + return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); + }; + Parser.prototype.parseDirectivePrologues = function () { + var firstRestricted = null; + var body = []; + while (true) { + var token = this.lookahead; + if (token.type !== 8 /* StringLiteral */) { + break; + } + var statement = this.parseDirective(); + body.push(statement); + var directive = statement.directive; + if (typeof directive !== 'string') { + break; + } + if (directive === 'use strict') { + this.context.strict = true; + if (firstRestricted) { + this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); + } + if (!this.context.allowStrictDirective) { + this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); + } + } + else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + return body; + }; + // https://tc39.github.io/ecma262/#sec-method-definitions + Parser.prototype.qualifiedPropertyName = function (token) { + switch (token.type) { + case 3 /* Identifier */: + case 8 /* StringLiteral */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 4 /* Keyword */: + return true; + case 7 /* Punctuator */: + return token.value === '['; + default: + break; + } + return false; + }; + Parser.prototype.parseGetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length > 0) { + this.tolerateError(messages_1.Messages.BadGetterArity); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseSetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length !== 1) { + this.tolerateError(messages_1.Messages.BadSetterArity); + } + else if (formalParameters.params[0] instanceof Node.RestElement) { + this.tolerateError(messages_1.Messages.BadSetterRestParameter); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseGeneratorMethod = function () { + var node = this.createNode(); + var isGenerator = true; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + this.context.allowYield = false; + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-generator-function-definitions + Parser.prototype.isStartOfExpression = function () { + var start = true; + var value = this.lookahead.value; + switch (this.lookahead.type) { + case 7 /* Punctuator */: + start = (value === '[') || (value === '(') || (value === '{') || + (value === '+') || (value === '-') || + (value === '!') || (value === '~') || + (value === '++') || (value === '--') || + (value === '/') || (value === '/='); // regular expression literal + break; + case 4 /* Keyword */: + start = (value === 'class') || (value === 'delete') || + (value === 'function') || (value === 'let') || (value === 'new') || + (value === 'super') || (value === 'this') || (value === 'typeof') || + (value === 'void') || (value === 'yield'); + break; + default: + break; + } + return start; + }; + Parser.prototype.parseYieldExpression = function () { + var node = this.createNode(); + this.expectKeyword('yield'); + var argument = null; + var delegate = false; + if (!this.hasLineTerminator) { + var previousAllowYield = this.context.allowYield; + this.context.allowYield = false; + delegate = this.match('*'); + if (delegate) { + this.nextToken(); + argument = this.parseAssignmentExpression(); + } + else if (this.isStartOfExpression()) { + argument = this.parseAssignmentExpression(); + } + this.context.allowYield = previousAllowYield; + } + return this.finalize(node, new Node.YieldExpression(argument, delegate)); + }; + // https://tc39.github.io/ecma262/#sec-class-definitions + Parser.prototype.parseClassElement = function (hasConstructor) { + var token = this.lookahead; + var node = this.createNode(); + var kind = ''; + var key = null; + var value = null; + var computed = false; + var method = false; + var isStatic = false; + var isAsync = false; + if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + var id = key; + if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { + token = this.lookahead; + isStatic = true; + computed = this.match('['); + if (this.match('*')) { + this.nextToken(); + } + else { + key = this.parseObjectPropertyKey(); + } + } + if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) { + var punctuator = this.lookahead.value; + if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { + isAsync = true; + token = this.lookahead; + key = this.parseObjectPropertyKey(); + if (token.type === 3 /* Identifier */ && token.value === 'constructor') { + this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); + } + } + } + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */) { + if (token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + if (!kind && key && this.match('(')) { + kind = 'init'; + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + if (!kind) { + this.throwUnexpectedToken(this.lookahead); + } + if (kind === 'init') { + kind = 'method'; + } + if (!computed) { + if (isStatic && this.isPropertyKey(key, 'prototype')) { + this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); + } + if (!isStatic && this.isPropertyKey(key, 'constructor')) { + if (kind !== 'method' || !method || (value && value.generator)) { + this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); + } + if (hasConstructor.value) { + this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); + } + else { + hasConstructor.value = true; + } + kind = 'constructor'; + } + } + return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); + }; + Parser.prototype.parseClassElementList = function () { + var body = []; + var hasConstructor = { value: false }; + this.expect('{'); + while (!this.match('}')) { + if (this.match(';')) { + this.nextToken(); + } + else { + body.push(this.parseClassElement(hasConstructor)); + } + } + this.expect('}'); + return body; + }; + Parser.prototype.parseClassBody = function () { + var node = this.createNode(); + var elementList = this.parseClassElementList(); + return this.finalize(node, new Node.ClassBody(elementList)); + }; + Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier(); + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); + }; + Parser.prototype.parseClassExpression = function () { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null; + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); + }; + // https://tc39.github.io/ecma262/#sec-scripts + // https://tc39.github.io/ecma262/#sec-modules + Parser.prototype.parseModule = function () { + this.context.strict = true; + this.context.isModule = true; + this.scanner.isModule = true; + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Module(body)); + }; + Parser.prototype.parseScript = function () { + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Script(body)); + }; + // https://tc39.github.io/ecma262/#sec-imports + Parser.prototype.parseModuleSpecifier = function () { + var node = this.createNode(); + if (this.lookahead.type !== 8 /* StringLiteral */) { + this.throwError(messages_1.Messages.InvalidModuleSpecifier); + } + var token = this.nextToken(); + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + // import {} ...; + Parser.prototype.parseImportSpecifier = function () { + var node = this.createNode(); + var imported; + var local; + if (this.lookahead.type === 3 /* Identifier */) { + imported = this.parseVariableIdentifier(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + } + else { + imported = this.parseIdentifierName(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.ImportSpecifier(local, imported)); + }; + // {foo, bar as bas} + Parser.prototype.parseNamedImports = function () { + this.expect('{'); + var specifiers = []; + while (!this.match('}')) { + specifiers.push(this.parseImportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return specifiers; + }; + // import ...; + Parser.prototype.parseImportDefaultSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportDefaultSpecifier(local)); + }; + // import <* as foo> ...; + Parser.prototype.parseImportNamespaceSpecifier = function () { + var node = this.createNode(); + this.expect('*'); + if (!this.matchContextualKeyword('as')) { + this.throwError(messages_1.Messages.NoAsAfterImportNamespace); + } + this.nextToken(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); + }; + Parser.prototype.parseImportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalImportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('import'); + var src; + var specifiers = []; + if (this.lookahead.type === 8 /* StringLiteral */) { + // import 'foo'; + src = this.parseModuleSpecifier(); + } + else { + if (this.match('{')) { + // import {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else if (this.match('*')) { + // import * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { + // import foo + specifiers.push(this.parseImportDefaultSpecifier()); + if (this.match(',')) { + this.nextToken(); + if (this.match('*')) { + // import foo, * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.match('{')) { + // import foo, {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + src = this.parseModuleSpecifier(); + } + this.consumeSemicolon(); + return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); + }; + // https://tc39.github.io/ecma262/#sec-exports + Parser.prototype.parseExportSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + var exported = local; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + exported = this.parseIdentifierName(); + } + return this.finalize(node, new Node.ExportSpecifier(local, exported)); + }; + Parser.prototype.parseExportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalExportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('export'); + var exportDeclaration; + if (this.matchKeyword('default')) { + // export default ... + this.nextToken(); + if (this.matchKeyword('function')) { + // export default function foo () {} + // export default function () {} + var declaration = this.parseFunctionDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchKeyword('class')) { + // export default class foo {} + var declaration = this.parseClassDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchContextualKeyword('async')) { + // export default async function f () {} + // export default async function () {} + // export default async x => x + var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else { + if (this.matchContextualKeyword('from')) { + this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); + } + // export default {}; + // export default []; + // export default (1 + 2); + var declaration = this.match('{') ? this.parseObjectInitializer() : + this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + } + else if (this.match('*')) { + // export * from 'foo'; + this.nextToken(); + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + var src = this.parseModuleSpecifier(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); + } + else if (this.lookahead.type === 4 /* Keyword */) { + // export var f = 1; + var declaration = void 0; + switch (this.lookahead.value) { + case 'let': + case 'const': + declaration = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'var': + case 'class': + case 'function': + declaration = this.parseStatementListItem(); + break; + default: + this.throwUnexpectedToken(this.lookahead); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else if (this.matchAsyncFunction()) { + var declaration = this.parseFunctionDeclaration(); + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else { + var specifiers = []; + var source = null; + var isExportFromIdentifier = false; + this.expect('{'); + while (!this.match('}')) { + isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); + specifiers.push(this.parseExportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + if (this.matchContextualKeyword('from')) { + // export {default} from 'foo'; + // export {foo} from 'foo'; + this.nextToken(); + source = this.parseModuleSpecifier(); + this.consumeSemicolon(); + } + else if (isExportFromIdentifier) { + // export {default}; // missing fromClause + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + else { + // export {foo}; + this.consumeSemicolon(); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); + } + return exportDeclaration; + }; + return Parser; + }()); + exports.Parser = Parser; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + Object.defineProperty(exports, "__esModule", { value: true }); + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + exports.assert = assert; + + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + "use strict"; + /* tslint:disable:max-classes-per-file */ + Object.defineProperty(exports, "__esModule", { value: true }); + var ErrorHandler = (function () { + function ErrorHandler() { + this.errors = []; + this.tolerant = false; + } + ErrorHandler.prototype.recordError = function (error) { + this.errors.push(error); + }; + ErrorHandler.prototype.tolerate = function (error) { + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + ErrorHandler.prototype.constructError = function (msg, column) { + var error = new Error(msg); + try { + throw error; + } + catch (base) { + /* istanbul ignore else */ + if (Object.create && Object.defineProperty) { + error = Object.create(base); + Object.defineProperty(error, 'column', { value: column }); + } + } + /* istanbul ignore next */ + return error; + }; + ErrorHandler.prototype.createError = function (index, line, col, description) { + var msg = 'Line ' + line + ': ' + description; + var error = this.constructError(msg, col); + error.index = index; + error.lineNumber = line; + error.description = description; + return error; + }; + ErrorHandler.prototype.throwError = function (index, line, col, description) { + throw this.createError(index, line, col, description); + }; + ErrorHandler.prototype.tolerateError = function (index, line, col, description) { + var error = this.createError(index, line, col, description); + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + return ErrorHandler; + }()); + exports.ErrorHandler = ErrorHandler; + + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // Error messages should be identical to V8. + exports.Messages = { + BadGetterArity: 'Getter must not have any formal parameters', + BadSetterArity: 'Setter must have exactly one formal parameter', + BadSetterRestParameter: 'Setter function argument must not be a rest parameter', + ConstructorIsAsync: 'Class constructor may not be an async method', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DeclarationMissingInitializer: 'Missing initializer in %0 declaration', + DefaultRestParameter: 'Unexpected token =', + DuplicateBinding: 'Duplicate binding %0', + DuplicateConstructor: 'A class may only have one constructor', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', + GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', + IllegalBreak: 'Illegal break statement', + IllegalContinue: 'Illegal continue statement', + IllegalExportDeclaration: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', + IllegalReturn: 'Illegal return statement', + InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', + InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', + InvalidModuleSpecifier: 'Unexpected token', + InvalidRegExp: 'Invalid regular expression', + LetInLexicalBinding: 'let is disallowed as a lexically bound name', + MissingFromClause: 'Unexpected token', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NewlineAfterThrow: 'Illegal newline after throw', + NoAsAfterImportNamespace: 'Unexpected token', + NoCatchOrFinally: 'Missing catch or finally after try', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + Redeclaration: '%0 \'%1\' has already been declared', + StaticPrototype: 'Classes may not have static property named prototype', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + UnexpectedEOS: 'Unexpected end of input', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedNumber: 'Unexpected number', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedString: 'Unexpected string', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedToken: 'Unexpected token %0', + UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', + UnknownLabel: 'Undefined label \'%0\'', + UnterminatedRegExp: 'Invalid regular expression: missing /' + }; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __webpack_require__(9); + var character_1 = __webpack_require__(4); + var messages_1 = __webpack_require__(11); + function hexValue(ch) { + return '0123456789abcdef'.indexOf(ch.toLowerCase()); + } + function octalValue(ch) { + return '01234567'.indexOf(ch); + } + var Scanner = (function () { + function Scanner(code, handler) { + this.source = code; + this.errorHandler = handler; + this.trackComment = false; + this.isModule = false; + this.length = code.length; + this.index = 0; + this.lineNumber = (code.length > 0) ? 1 : 0; + this.lineStart = 0; + this.curlyStack = []; + } + Scanner.prototype.saveState = function () { + return { + index: this.index, + lineNumber: this.lineNumber, + lineStart: this.lineStart + }; + }; + Scanner.prototype.restoreState = function (state) { + this.index = state.index; + this.lineNumber = state.lineNumber; + this.lineStart = state.lineStart; + }; + Scanner.prototype.eof = function () { + return this.index >= this.length; + }; + Scanner.prototype.throwUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + Scanner.prototype.tolerateUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + // https://tc39.github.io/ecma262/#sec-comments + Scanner.prototype.skipSingleLineComment = function (offset) { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - offset; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - offset + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + ++this.index; + if (character_1.Character.isLineTerminator(ch)) { + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart - 1 + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index - 1], + range: [start, this.index - 1], + loc: loc + }; + comments.push(entry); + } + if (ch === 13 && this.source.charCodeAt(this.index) === 10) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + return comments; + } + } + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + }; + Scanner.prototype.skipMultiLineComment = function () { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - 2; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - 2 + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isLineTerminator(ch)) { + if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + ++this.index; + this.lineStart = this.index; + } + else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (this.source.charCodeAt(this.index + 1) === 0x2F) { + this.index += 2; + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index - 2], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + } + ++this.index; + } + else { + ++this.index; + } + } + // Ran off the end of the file - the whole thing is a comment + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + this.tolerateUnexpectedToken(); + return comments; + }; + Scanner.prototype.scanComments = function () { + var comments; + if (this.trackComment) { + comments = []; + } + var start = (this.index === 0); + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isWhiteSpace(ch)) { + ++this.index; + } + else if (character_1.Character.isLineTerminator(ch)) { + ++this.index; + if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + start = true; + } + else if (ch === 0x2F) { + ch = this.source.charCodeAt(this.index + 1); + if (ch === 0x2F) { + this.index += 2; + var comment = this.skipSingleLineComment(2); + if (this.trackComment) { + comments = comments.concat(comment); + } + start = true; + } + else if (ch === 0x2A) { + this.index += 2; + var comment = this.skipMultiLineComment(); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (start && ch === 0x2D) { + // U+003E is '>' + if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) { + // '-->' is a single-line comment + this.index += 3; + var comment = this.skipSingleLineComment(3); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (ch === 0x3C && !this.isModule) { + if (this.source.slice(this.index + 1, this.index + 4) === '!--') { + this.index += 4; // ` {a:{y:1,b:{x:2}}} + // use a filter to return the keys that have to be deleted. + Object.keys(out).filter(function (k, _, __) { + if (!out[k] || + typeof out[k] !== 'object' || + Array.isArray(out[k])) { + return false + } + // see if the parent section is also an object. + // if so, add it to that, and mark this one for deletion + var parts = dotSplit(k) + var p = out + var l = parts.pop() + var nl = l.replace(/\\\./g, '.') + parts.forEach(function (part, _, __) { + if (!p[part] || typeof p[part] !== 'object') p[part] = {} + p = p[part] + }) + if (p === out && nl === l) { + return false + } + p[nl] = out[k] + return true + }).forEach(function (del, _, __) { + delete out[del] + }) + + return out +} - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } +function isQuoted (val) { + return (val.charAt(0) === '"' && val.slice(-1) === '"') || + (val.charAt(0) === "'" && val.slice(-1) === "'") +} - if (!options) options = {}; - pattern = pattern.trim(); +function safe (val) { + return (typeof val !== 'string' || + val.match(/[=\r\n]/) || + val.match(/^\[/) || + (val.length > 1 && + isQuoted(val)) || + val !== val.trim()) + ? JSON.stringify(val) + : val.replace(/;/g, '\\;').replace(/#/g, '\\#') +} - // windows support: need to use /, not \ - if (path$2.sep !== '/') { - pattern = pattern.split(path$2.sep).join('/'); +function unsafe (val, doUnesc) { + val = (val || '').trim() + if (isQuoted(val)) { + // remove the single quotes before calling JSON.parse + if (val.charAt(0) === "'") { + val = val.substr(1, val.length - 2) + } + try { val = JSON.parse(val) } catch (_) {} + } else { + // walk the val to find the first not-escaped ; character + var esc = false + var unesc = '' + for (var i = 0, l = val.length; i < l; i++) { + var c = val.charAt(i) + if (esc) { + if ('\\;#'.indexOf(c) !== -1) { + unesc += c + } else { + unesc += '\\' + c + } + esc = false + } else if (';#'.indexOf(c) !== -1) { + break + } else if (c === '\\') { + esc = true + } else { + unesc += c + } + } + if (esc) { + unesc += '\\' + } + return unesc.trim() } - - this.options = options; - this.set = []; - this.pattern = pattern; - this.regexp = null; - this.negate = false; - this.comment = false; - this.empty = false; - - // make the set of regexps etc. - this.make(); + return val } -Minimatch.prototype.debug = function () {}; -Minimatch.prototype.make = make; -function make () { - // don't do it more than once. - if (this._made) return +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { - var pattern = this.pattern; - var options = this.options; +"use strict"; - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true; - return - } - if (!pattern) { - this.empty = true; - return - } +var singleComment = 1; +var multiComment = 2; - // step 1: figure out negation, etc. - this.parseNegate(); +function stripWithoutWhitespace() { + return ''; +} - // step 2: expand braces - var set = this.globSet = this.braceExpand(); +function stripWithWhitespace(str, start, end) { + return str.slice(start, end).replace(/\S/g, ' '); +} - if (options.debug) this.debug = console.error; +module.exports = function (str, opts) { + opts = opts || {}; - this.debug(this.pattern, set); + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var offset = 0; + var ret = ''; + var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }); + for (var i = 0; i < str.length; i++) { + currentChar = str[i]; + nextChar = str[i + 1]; - this.debug(this.pattern, set); + if (!insideComment && currentChar === '"') { + var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\'; + if (!escaped) { + insideString = !insideString; + } + } - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this); + if (insideString) { + continue; + } - this.debug(this.pattern, set); + if (!insideComment && currentChar + nextChar === '//') { + ret += str.slice(offset, i); + offset = i; + insideComment = singleComment; + i++; + } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') { + i++; + insideComment = false; + ret += strip(str, offset, i); + offset = i; + continue; + } else if (insideComment === singleComment && currentChar === '\n') { + insideComment = false; + ret += strip(str, offset, i); + offset = i; + } else if (!insideComment && currentChar + nextChar === '/*') { + ret += str.slice(offset, i); + offset = i; + insideComment = multiComment; + i++; + continue; + } else if (insideComment === multiComment && currentChar + nextChar === '*/') { + i++; + insideComment = false; + ret += strip(str, offset, i + 1); + offset = i + 1; + continue; + } + } - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }); + return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset)); +}; - this.debug(this.pattern, set); - this.set = set; -} +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { -Minimatch.prototype.parseNegate = parseNegate; -function parseNegate () { - var pattern = this.pattern; - var negate = false; - var options = this.options; - var negateOffset = 0; +"use strict"; +/*! + * @description Recursive object extending + * @author Viacheslav Lotsmanov + * @license MIT + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2018 Viacheslav Lotsmanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ - if (options.nonegate) return - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate; - negateOffset++; - } - if (negateOffset) this.pattern = pattern.substr(negateOffset); - this.negate = negate; +function isSpecificValue(val) { + return ( + val instanceof Buffer + || val instanceof Date + || val instanceof RegExp + ) ? true : false; } -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -}; - -Minimatch.prototype.braceExpand = braceExpand; +function cloneSpecificValue(val) { + if (val instanceof Buffer) { + var x = Buffer.alloc + ? Buffer.alloc(val.length) + : new Buffer(val.length); + val.copy(x); + return x; + } else if (val instanceof Date) { + return new Date(val.getTime()); + } else if (val instanceof RegExp) { + return new RegExp(val); + } else { + throw new Error('Unexpected situation'); + } +} -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options; - } else { - options = {}; - } - } +/** + * Recursive cloning array. + */ +function deepCloneArray(arr) { + var clone = []; + arr.forEach(function (item, index) { + if (typeof item === 'object' && item !== null) { + if (Array.isArray(item)) { + clone[index] = deepCloneArray(item); + } else if (isSpecificValue(item)) { + clone[index] = cloneSpecificValue(item); + } else { + clone[index] = deepExtend({}, item); + } + } else { + clone[index] = item; + } + }); + return clone; +} - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern; +function safeGetProperty(object, property) { + return property === '__proto__' ? undefined : object[property]; +} - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') - } +/** + * Extening object that entered in first argument. + * + * Returns extended object or false if have no target object or incorrect type. + * + * If you wish to clone source object (without modify it), just use empty new + * object as first argument, like this: + * deepExtend({}, yourObj_1, [yourObj_N]); + */ +var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) { + if (arguments.length < 1 || typeof arguments[0] !== 'object') { + return false; + } - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } + if (arguments.length < 2) { + return arguments[0]; + } - return braceExpansion(pattern) -} + var target = arguments[0]; -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse$2; -var SUBPARSE = {}; -function parse$2 (pattern, isSub) { - if (pattern.length > 1024 * 64) { - throw new TypeError('pattern is too long') - } + // convert arguments to array and cut off target object + var args = Array.prototype.slice.call(arguments, 1); - var options = this.options; + var val, src, clone; - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' + args.forEach(function (obj) { + // skip argument if isn't an object, is null, or is an array + if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) { + return; + } - var re = ''; - var hasMagic = !!options.nocase; - var escaping = false; - // ? => one single character - var patternListStack = []; - var negativeLists = []; - var stateChar; - var inClass = false; - var reClassStart = -1; - var classStart = -1; - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)'; - var self = this; + Object.keys(obj).forEach(function (key) { + src = safeGetProperty(target, key); // source value + val = safeGetProperty(obj, key); // new value - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star; - hasMagic = true; - break - case '?': - re += qmark; - hasMagic = true; - break - default: - re += '\\' + stateChar; - break - } - self.debug('clearStateChar %j %j', stateChar, re); - stateChar = false; - } - } + // recursion prevention + if (val === target) { + return; - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c); + /** + * if new value isn't object then just overwrite by new value + * instead of extending. + */ + } else if (typeof val !== 'object' || val === null) { + target[key] = val; + return; - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c; - escaping = false; - continue - } + // just clone arrays (and recursive clone objects inside) + } else if (Array.isArray(val)) { + target[key] = deepCloneArray(val); + return; - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false + // custom cloning and overwrite for specific objects + } else if (isSpecificValue(val)) { + target[key] = cloneSpecificValue(val); + return; - case '\\': - clearStateChar(); - escaping = true; - continue + // overwrite by new value if source isn't object or array + } else if (typeof src !== 'object' || src === null || Array.isArray(src)) { + target[key] = deepExtend({}, val); + return; - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c); + // source value and new value is objects both, extending... + } else { + target[key] = deepExtend(src, val); + return; + } + }); + }); - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class'); - if (c === '!' && i === classStart + 1) c = '^'; - re += c; - continue - } + return target; +}; - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar); - clearStateChar(); - stateChar = c; - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar(); - continue - case '(': - if (inClass) { - re += '('; - continue - } +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { - if (!stateChar) { - re += '\\('; - continue - } +"use strict"; - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }); - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:'; - this.debug('plType %j %j', stateChar, re); - stateChar = false; - continue +var osHomedir = __webpack_require__(139); +var home = osHomedir(); - case ')': - if (inClass || !patternListStack.length) { - re += '\\)'; - continue - } +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } - clearStateChar(); - hasMagic = true; - var pl = patternListStack.pop(); - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close; - if (pl.type === '!') { - negativeLists.push(pl); - } - pl.reEnd = re.length; - continue + return home ? str.replace(/^~($|\/|\\)/, home + '$1') : str; +}; - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|'; - escaping = false; - continue - } - clearStateChar(); - re += '|'; - continue +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar(); +"use strict"; - if (inClass) { - re += '\\' + c; - continue - } +var os = __webpack_require__(54); - inClass = true; - classStart = i; - reClassStart = re.length; - re += c; - continue +function homedir() { + var env = process.env; + var home = env.HOME; + var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c; - escaping = false; - continue - } + if (process.platform === 'win32') { + return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; + } - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i); - try { + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE); - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'; - hasMagic = hasMagic || sp[1]; - inClass = false; - continue - } - } + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); + } - // finish up the class. - hasMagic = true; - inClass = false; - re += c; - continue + return home || null; +} - default: - // swallow any state char that wasn't consumed - clearStateChar(); +module.exports = typeof os.homedir === 'function' ? os.homedir : homedir; - if (escaping) { - // no need - escaping = false; - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\'; - } - re += c; +/***/ }), +/* 140 */ +/***/ (function(module, exports) { - } // switch - } // for +module.exports = function (s, vars) { + return s.replace(/(\\*)(\$([_a-z0-9]+)|\${([_a-z0-9]+)})/ig, function (_, escape, varExpression, variable, bracedVariable) { + if (!(escape.length % 2)) { + return escape.substring(Math.ceil(escape.length / 2)) + (vars[variable || bracedVariable] || ''); + } else { + return escape.substring(1) + varExpression; + } + }); +}; - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1); - sp = this.parse(cs, SUBPARSE); - re = re.substr(0, reClassStart) + '\\[' + sp[0]; - hasMagic = hasMagic || sp[1]; - } - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length); - this.debug('setting tail', re, pl); - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\'; - } +/***/ }), +/* 141 */ +/***/ (function(module, exports) { - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }); +function webpackEmptyContext(req) { + try { return require(req) } +catch (e) { if (e.code !== 'MODULE_NOT_FOUND') throw e } +var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 141; - this.debug('tail=%j\n %s', tail, tail, pl, re); - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type; +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { + +// +// format - printf-like string formatting for JavaScript +// github.com/samsonjs/format +// @_sjs +// +// Copyright 2010 - 2013 Sami Samhuri +// +// MIT License +// http://sjs.mit-license.org +// - hasMagic = true; - re = re.slice(0, pl.reStart) + t + '\\(' + tail; - } +;(function() { - // handle trailing things that only matter at the very end. - clearStateChar(); - if (escaping) { - // trailing \\ - re += '\\\\'; - } + //// Export the API + var namespace; - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false; - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true; + // CommonJS / Node module + if (true) { + namespace = module.exports = format; } - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n]; - - var nlBefore = re.slice(0, nl.reStart); - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); - var nlAfter = re.slice(nl.reEnd); - - nlLast += nlAfter; + // Browsers and other environments + else {} - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1; - var cleanAfter = nlAfter; - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, ''); - } - nlAfter = cleanAfter; + namespace.format = format; + namespace.vsprintf = vsprintf; - var dollar = ''; - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$'; - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; - re = newRe; + if (typeof console !== 'undefined' && typeof console.log === 'function') { + namespace.printf = printf; } - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re; + function printf(/* ... */) { + console.log(format.apply(null, arguments)); } - if (addPatternStart) { - re = patternStart + re; + function vsprintf(fmt, replacements) { + return format.apply(null, [fmt].concat(replacements)); } - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] + function format(fmt) { + var argIndex = 1 // skip initial format argument + , args = [].slice.call(arguments) + , i = 0 + , n = fmt.length + , result = '' + , c + , escaped = false + , arg + , tmp + , leadingZero = false + , precision + , nextArg = function() { return args[argIndex++]; } + , slurpNumber = function() { + var digits = ''; + while (/\d/.test(fmt[i])) { + digits += fmt[i++]; + c = fmt[i]; + } + return digits.length > 0 ? parseInt(digits) : null; + } + ; + for (; i < n; ++i) { + c = fmt[i]; + if (escaped) { + escaped = false; + if (c == '.') { + leadingZero = false; + c = fmt[++i]; + } + else if (c == '0' && fmt[i + 1] == '.') { + leadingZero = true; + i += 2; + c = fmt[i]; + } + else { + leadingZero = true; + } + precision = slurpNumber(); + switch (c) { + case 'b': // number in binary + result += parseInt(nextArg(), 10).toString(2); + break; + case 'c': // character + arg = nextArg(); + if (typeof arg === 'string' || arg instanceof String) + result += arg; + else + result += String.fromCharCode(parseInt(arg, 10)); + break; + case 'd': // number in decimal + result += parseInt(nextArg(), 10); + break; + case 'f': // floating point number + tmp = String(parseFloat(nextArg()).toFixed(precision || 6)); + result += leadingZero ? tmp : tmp.replace(/^0/, ''); + break; + case 'j': // JSON + result += JSON.stringify(nextArg()); + break; + case 'o': // number in octal + result += '0' + parseInt(nextArg(), 10).toString(8); + break; + case 's': // string + result += nextArg(); + break; + case 'x': // lowercase hexadecimal + result += '0x' + parseInt(nextArg(), 10).toString(16); + break; + case 'X': // uppercase hexadecimal + result += '0x' + parseInt(nextArg(), 10).toString(16).toUpperCase(); + break; + default: + result += c; + break; + } + } else if (c === '%') { + escaped = true; + } else { + result += c; + } + } + return result; } - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } +}()); - var flags = options.nocase ? 'i' : ''; - try { - var regExp = new RegExp('^' + re + '$', flags); - } catch (er) { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } - regExp._glob = pattern; - regExp._src = re; +/***/ }), +/* 143 */ +/***/ (function(module, exports) { - return regExp +function webpackEmptyContext(req) { + try { return require(req) } +catch (e) { if (e.code !== 'MODULE_NOT_FOUND') throw e } +var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; } +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 143; -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -}; +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { -Minimatch.prototype.makeRe = makeRe; -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp +"use strict"; - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set; - if (!set.length) { - this.regexp = false; - return this.regexp +var Ignore = __webpack_require__(145); +var find = __webpack_require__(147); + +module.exports = fileSystem; + +/* Find files from the file-system. */ +function fileSystem(context, settings, next) { + var input = context.files; + var skip = settings.silentlyIgnore; + var ignore = new Ignore({ + cwd: settings.cwd, + detectIgnore: settings.detectIgnore, + ignoreName: settings.ignoreName, + ignorePath: settings.ignorePath + }); + + if (input.length === 0) { + return next(); } - var options = this.options; - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot; - var flags = options.nocase ? 'i' : ''; + find(input, { + cwd: settings.cwd, + extensions: settings.extensions, + silentlyIgnore: skip, + ignore: ignore + }, found); - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|'); + function found(err, result) { + var output = result.files; - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$'; + /* Sort alphabetically. Everything’s unique so we don’t care + * about cases where left and right are equal. */ + output.sort(function (left, right) { + return left.path < right.path ? -1 : 1; + }); - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$'; + /* Mark as given. This allows outputting files, + * which can be pretty dangerous, so it’s “hidden”. */ + output.forEach(function (file) { + file.data.unifiedEngineGiven = true; + }); - try { - this.regexp = new RegExp(re, flags); - } catch (ex) { - this.regexp = false; + context.files = output; + + /* If `out` wasn’t set, detect it based on + * whether one file was given. */ + if (settings.out === null || settings.out === undefined) { + settings.out = result.oneFileMode; + } + + next(err); } - return this.regexp } -minimatch.match = function (list, pattern, options) { - options = options || {}; - var mm = new Minimatch(pattern, options); - list = list.filter(function (f) { - return mm.match(f) - }); - if (mm.options.nonull && !list.length) { - list.push(pattern); - } - return list -}; -Minimatch.prototype.match = match; -function match (f, partial) { - this.debug('match', f, this.pattern); - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { - if (f === '/' && partial) return true +"use strict"; - var options = this.options; - // windows: need to use /, not \ - if (path$2.sep !== '/') { - f = f.split(path$2.sep).join('/'); - } +var path = __webpack_require__(4); +var gitignore = __webpack_require__(146); +var FindUp = __webpack_require__(57); - // treat the test path as a set of pathparts. - f = f.split(slashSplit); - this.debug(this.pattern, 'split', f); +module.exports = Ignore; - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. +Ignore.prototype.check = check; - var set = this.set; - this.debug(this.pattern, 'set', set); +var dirname = path.dirname; +var relative = path.relative; +var resolve = path.resolve; - // Find the basename of the path by looking for the last non-empty segment - var filename; - var i; - for (i = f.length - 1; i >= 0; i--) { - filename = f[i]; - if (filename) break - } +function Ignore(options) { + this.cwd = options.cwd; + + this.findUp = new FindUp({ + filePath: options.ignorePath, + cwd: options.cwd, + detect: options.detectIgnore, + names: options.ignoreName ? [options.ignoreName] : [], + create: create + }); +} + +function check(filePath, callback) { + var self = this; + + self.findUp.load(filePath, done); + + function done(err, ignore) { + var normal; - for (i = 0; i < set.length; i++) { - var pattern = set[i]; - var file = f; - if (options.matchBase && pattern.length === 1) { - file = [filename]; - } - var hit = this.matchOne(file, pattern, partial); - if (hit) { - if (options.flipNegate) return true - return !this.negate + if (err) { + callback(err); + } else if (ignore) { + normal = relative(ignore.filePath, resolve(self.cwd, filePath)); + callback(null, normal ? ignore.ignores(normal) : false); + } else { + callback(null, false); } } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate } -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options; +function create(buf, filePath) { + var ignore = gitignore().add(String(buf)); + ignore.filePath = dirname(filePath); + return ignore; +} - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }); - this.debug('matchOne', file.length, pattern.length); +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop'); - var p = pattern[pi]; - var f = file[fi]; +"use strict"; - this.debug(pattern, p, f); - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi; - var pr = pi + 1; - if (pr === pl) { - this.debug('** at the end'); - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } +module.exports = function () { + return new IgnoreBase(); +}; - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr]; +// A simple implementation of make-array +function make_array(subject) { + return Array.isArray(subject) ? subject : [subject]; +} - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); +var REGEX_BLANK_LINE = /^\s+$/; +var REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\\!/; +var REGEX_LEADING_EXCAPED_HASH = /^\\#/; +var SLASH = '/'; +var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore') +/* istanbul ignore next */ +: 'node-ignore'; - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee); - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr); - break - } +var IgnoreBase = function () { + function IgnoreBase() { + _classCallCheck(this, IgnoreBase); - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue'); - fr++; - } - } + this._rules = []; + this[KEY_IGNORE] = true; + this._initCache(); + } - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr); - if (fr === fl) return true - } - return false + _createClass(IgnoreBase, [{ + key: '_initCache', + value: function _initCache() { + this._cache = {}; } - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit; - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase(); - } else { - hit = f === p; - } - this.debug('string match', p, f, hit); - } else { - hit = f.match(p); - this.debug('pattern match', p, f, hit); - } + // @param {Array.|string|Ignore} pattern - if (!hit) return false - } + }, { + key: 'add', + value: function add(pattern) { + this._added = false; - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* + if (typeof pattern === 'string') { + pattern = pattern.split(/\r?\n/g); + } - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === ''); - return emptyFileEnd - } + make_array(pattern).forEach(this._addPattern, this); - // should be unreachable. - throw new Error('wtf?') -}; + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache(); + } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} + return this; + } -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} + // legacy -var inherits_browser = createCommonjsModule(function (module) { -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true + }, { + key: 'addPattern', + value: function addPattern(pattern) { + return this.add(pattern); + } + }, { + key: '_addPattern', + value: function _addPattern(pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules); + this._added = true; + return; } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - }; -} -}); - -var inherits = createCommonjsModule(function (module) { -try { - var util$$1 = util; - if (typeof util$$1.inherits !== 'function') throw ''; - module.exports = util$$1.inherits; -} catch (e) { - module.exports = inherits_browser; -} -}); - -function posix(path$$1) { - return path$$1.charAt(0) === '/'; -} -function win32(path$$1) { - // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path$$1); - var device = result[1] || ''; - var isUnc = Boolean(device && device.charAt(1) !== ':'); + if (this._checkPattern(pattern)) { + var rule = this._createRule(pattern); + this._added = true; + this._rules.push(rule); + } + } + }, { + key: '_checkPattern', + value: function _checkPattern(pattern) { + // > A blank line matches no files, so it can serve as a separator for readability. + return pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) - // UNC paths are always absolute - return Boolean(result[2] || isUnc); -} + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0; + } + }, { + key: 'filter', + value: function filter(paths) { + var _this = this; -var pathIsAbsolute = process.platform === 'win32' ? win32 : posix; -var posix_1 = posix; -var win32_1 = win32; + return make_array(paths).filter(function (path) { + return _this._filter(path); + }); + } + }, { + key: 'createFilter', + value: function createFilter() { + var _this2 = this; -pathIsAbsolute.posix = posix_1; -pathIsAbsolute.win32 = win32_1; + return function (path) { + return _this2._filter(path); + }; + } + }, { + key: 'ignores', + value: function ignores(path) { + return !this._filter(path); + } + }, { + key: '_createRule', + value: function _createRule(pattern) { + var origin = pattern; + var negative = false; -var alphasort_1 = alphasort; -var alphasorti_1 = alphasorti; -var setopts_1 = setopts; -var ownProp_1 = ownProp; -var makeAbs_1 = makeAbs; -var finish_1 = finish; -var mark_1 = mark$2; -var isIgnored_1 = isIgnored; -var childrenIgnored_1 = childrenIgnored; + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(1); + } -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) -} + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that begin with a hash. + .replace(REGEX_LEADING_EXCAPED_HASH, '#'); + var regex = make_regex(pattern, negative); + return { + origin: origin, + pattern: pattern, + negative: negative, + regex: regex + }; + } + // @returns `Boolean` true if the `path` is NOT ignored -var Minimatch$1 = minimatch_1.Minimatch; + }, { + key: '_filter', + value: function _filter(path, slices) { + if (!path) { + return false; + } -function alphasorti (a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()) -} + if (path in this._cache) { + return this._cache[path]; + } -function alphasort (a, b) { - return a.localeCompare(b) -} + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH); + } -function setupIgnores (self, options) { - self.ignore = options.ignore || []; + slices.pop(); - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore]; + return this._cache[path] = slices.length + // > It is not possible to re-include a file if a parent directory of that file is excluded. + // If the path contains a parent directory, check the parent first + ? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path) - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap); - } -} + // Or only test the path + : this._test(path); + } -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null; - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, ''); - gmatcher = new Minimatch$1(gpattern, { dot: true }); - } + // @returns {Boolean} true if a file is NOT ignored - return { - matcher: new Minimatch$1(pattern, { dot: true }), - gmatcher: gmatcher - } -} + }, { + key: '_test', + value: function _test(path) { + // Explicitly define variable type by setting matched to `0` + var matched = 0; -function setopts (self, pattern, options) { - if (!options) - options = {}; + this._rules.forEach(function (rule) { + // if matched = true, then we only test negative rules + // if matched = false, then we test non-negative rules + if (!(matched ^ rule.negative)) { + matched = rule.negative ^ rule.regex.test(path); + } + }); - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") + return !matched; } - pattern = "**/" + pattern; - } + }]); - self.silent = !!options.silent; - self.pattern = pattern; - self.strict = options.strict !== false; - self.realpath = !!options.realpath; - self.realpathCache = options.realpathCache || Object.create(null); - self.follow = !!options.follow; - self.dot = !!options.dot; - self.mark = !!options.mark; - self.nodir = !!options.nodir; - if (self.nodir) - self.mark = true; - self.sync = !!options.sync; - self.nounique = !!options.nounique; - self.nonull = !!options.nonull; - self.nosort = !!options.nosort; - self.nocase = !!options.nocase; - self.stat = !!options.stat; - self.noprocess = !!options.noprocess; - self.absolute = !!options.absolute; - - self.maxLength = options.maxLength || Infinity; - self.cache = options.cache || Object.create(null); - self.statCache = options.statCache || Object.create(null); - self.symlinks = options.symlinks || Object.create(null); - - setupIgnores(self, options); - - self.changedCwd = false; - var cwd = process.cwd(); - if (!ownProp(options, "cwd")) - self.cwd = cwd; - else { - self.cwd = path.resolve(options.cwd); - self.changedCwd = self.cwd !== cwd; - } + return IgnoreBase; +}(); - self.root = options.root || path.resolve(self.cwd, "/"); - self.root = path.resolve(self.root); - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/"); +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = pathIsAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd); - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/"); - self.nomount = !!options.nomount; +// '`foo/`' should not continue with the '`..`' - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true; - options.nocomment = true; - self.minimatch = new Minimatch$1(pattern, options); - self.options = self.minimatch.options; -} +var DEFAULT_REPLACER_PREFIX = [ -function finish (self) { - var nou = self.nounique; - var all = nou ? [] : Object.create(null); +// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[ +// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, function (match) { + return match.indexOf('\\') === 0 ? ' ' : ''; +}], - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i]; - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i]; - if (nou) - all.push(literal); - else - all[literal] = true; - } - } else { - // had matches - var m = Object.keys(matches); - if (nou) - all.push.apply(all, m); - else - m.forEach(function (m) { - all[m] = true; - }); - } - } +// replace (\ ) with ' ' +[/\\\s/g, function () { + return ' '; +}], - if (!nou) - all = Object.keys(all); +// Escape metacharacters +// which is written down by users but means special for regular expressions. - if (!self.nosort) - all = all.sort(self.nocase ? alphasorti : alphasort); +// > There are 12 characters with special meanings: +// > - the backslash \, +// > - the caret ^, +// > - the dollar sign $, +// > - the period or dot ., +// > - the vertical bar or pipe symbol |, +// > - the question mark ?, +// > - the asterisk or star *, +// > - the plus sign +, +// > - the opening parenthesis (, +// > - the closing parenthesis ), +// > - and the opening square bracket [, +// > - the opening curly brace {, +// > These special characters are often called "metacharacters". +[/[\\\^$.|?*+()\[{]/g, function (match) { + return '\\' + match; +}], - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]); - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)); - var c = self.cache[e] || self.cache[makeAbs(self, e)]; - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c); - return notDir - }); - } - } +// leading slash +[ - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }); +// > A leading slash matches the beginning of the pathname. +// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +// A leading slash matches the beginning of the pathname +/^\//, function () { + return '^'; +}], - self.found = all; -} +// replace special metacharacter slash after the leading slash +[/\//g, function () { + return '\\/'; +}], [ +// > A leading "**" followed by a slash means match in all directories. +// > For example, "**/foo" matches file or directory "foo" anywhere, +// > the same as pattern "foo". +// > "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". +// Notice that the '*'s have been replaced as '\\*' +/^\^*\\\*\\\*\\\//, -function mark$2 (self, p) { - var abs = makeAbs(self, p); - var c = self.cache[abs]; - var m = p; - if (c) { - var isDir = c === 'DIR' || Array.isArray(c); - var slash = p.slice(-1) === '/'; +// '**/foo' <-> 'foo' +function () { + return '^(?:.*\\/)?'; +}]]; - if (isDir && !slash) - m += '/'; - else if (!isDir && slash) - m = m.slice(0, -1); +var DEFAULT_REPLACER_SUFFIX = [ +// starting +[ +// there will be no leading '/' (which has been replaced by section "leading slash") +// If starts with '**', adding a '^' to the regular expression also works +/^(?=[^\^])/, function () { + return !/\/(?!$)/.test(this) + // > If the pattern does not contain a slash /, Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, git also treats it as a shell glob pattern + ? '(?:^|\\/)' - if (m !== p) { - var mabs = makeAbs(self, m); - self.statCache[mabs] = self.statCache[abs]; - self.cache[mabs] = self.cache[abs]; - } - } + // > Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) + : '^'; +}], - return m -} +// two globstars +[ +// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, -// lotta situps... -function makeAbs (self, f) { - var abs = f; - if (f.charAt(0) === '/') { - abs = path.join(self.root, f); - } else if (pathIsAbsolute(f) || f === '') { - abs = f; - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f); - } else { - abs = path.resolve(f); - } +// Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/'); +// Check if it is not the last `'/**'` +function (match, index, str) { + return index + 6 < str.length - return abs -} + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' + // case: /** + // > A trailing `"/**"` matches everything inside. -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path$$1) { - if (!self.ignore.length) - return false + // #21: everything inside but it should not include the current folder + : '\\/.+'; +}], - return self.ignore.some(function(item) { - return item.matcher.match(path$$1) || !!(item.gmatcher && item.gmatcher.match(path$$1)) - }) -} +// intermediate wildcards +[ +// Never replace escaped '*' +// ignore rule '\*' will match the path '*' + +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, -function childrenIgnored (self, path$$1) { - if (!self.ignore.length) - return false +// '*.js' matches '.js' +// '*.js' doesn't match 'abc' +function (match, p1) { + return p1 + '[^\\/]*'; +}], - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path$$1)) - }) -} +// trailing wildcard +[/(\^|\\\/)?\\\*$/, function (match, p1) { + return (p1 + // '\^': + // '/*' does not match '' + // '/*' does not match everything -var common$5 = { - alphasort: alphasort_1, - alphasorti: alphasorti_1, - setopts: setopts_1, - ownProp: ownProp_1, - makeAbs: makeAbs_1, - finish: finish_1, - mark: mark_1, - isIgnored: isIgnored_1, - childrenIgnored: childrenIgnored_1 -}; + // '\\\/': + // 'abc/*' does not match 'abc/' + ? p1 + '[^/]+' -var sync = globSync; -globSync.GlobSync = GlobSync; + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*') + '(?=$|\\/$)'; +}], [ +// unescape +/\\\\\\/g, function () { + return '\\'; +}]]; +var POSITIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [ +// 'f' +// matches +// - /f(end) +// - /f/ +// - (start)f(end) +// - (start)f/ +// doesn't match +// - oof +// - foo +// pseudo: +// -> (^|/)f(/|$) +// ending +[ +// 'js' will not match 'js.' +// 'ab' will not match 'abc' +/(?:[^*\/])$/, -var setopts$1 = common$5.setopts; -var ownProp$1 = common$5.ownProp; -var childrenIgnored$1 = common$5.childrenIgnored; -var isIgnored$1 = common$5.isIgnored; +// 'js*' will not match 'a.js' +// 'js/' will not match 'a.js' +// 'js' will match 'a.js' and 'a.js/' +function (match) { + return match + '(?=$|\\/)'; +}]], DEFAULT_REPLACER_SUFFIX); -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') +var NEGATIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [ - return new GlobSync(pattern, options).found -} +// #24, #38 +// The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore) +// A negative pattern without a trailing wildcard should not +// re-include the things inside that directory. -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') +// eg: +// ['node_modules/*', '!node_modules'] +// should ignore `node_modules/a.js` +[/(?:[^*])$/, function (match) { + return match + '(?=$|\\/$)'; +}]], DEFAULT_REPLACER_SUFFIX); - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') +// A simple cache, because an ignore rule only has only one certain meaning +var cache = {}; - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) +// @param {pattern} +function make_regex(pattern, negative) { + var r = cache[pattern]; + if (r) { + return r; + } - setopts$1(this, pattern, options); + var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS; - if (this.noprocess) - return this + var source = replacers.reduce(function (prev, current) { + return prev.replace(current[0], current[1].bind(pattern)); + }, pattern); - var n = this.minimatch.set.length; - this.matches = new Array(n); - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false); - } - this._finish(); + return cache[pattern] = new RegExp(source, 'i'); } -GlobSync.prototype._finish = function () { - assert(this instanceof GlobSync); - if (this.realpath) { - var self = this; - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null); - for (var p in matchset) { - try { - p = self._makeAbs(p); - var real = fs_realpath.realpathSync(p, self.realpathCache); - set[real] = true; - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true; - else - throw er - } - } - }); - } - common$5.finish(this); -}; - +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( +// Detect `process` so that it can run in browsers. +typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) { -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert(this instanceof GlobSync); + var filter = IgnoreBase.prototype._filter; + var make_posix = function make_posix(str) { + return (/^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/') + ); + }; - // Get the first [n] parts of pattern that are all strings. - var n = 0; - while (typeof pattern[n] === 'string') { - n ++; - } - // now n is the index of the first one that is *not* a string. + IgnoreBase.prototype._filter = function (path, slices) { + path = make_posix(path); + return filter.call(this, path, slices); + }; +} - // See if there's anything else - var prefix; - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index); - return - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null; - break +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/'); - break - } +"use strict"; - var remain = pattern.slice(n); - // get the list of entries. - var read; - if (prefix === null) - read = '.'; - else if (pathIsAbsolute(prefix) || pathIsAbsolute(pattern.join('/'))) { - if (!prefix || !pathIsAbsolute(prefix)) - prefix = '/' + prefix; - read = prefix; - } else - read = prefix; +var path = __webpack_require__(4); +var fs = __webpack_require__(6); +var glob = __webpack_require__(58); +var vfile = __webpack_require__(39); +var xtend = __webpack_require__(7); +var hidden = __webpack_require__(159); +var string = __webpack_require__(17); - var abs = this._makeAbs(read); +var readdir = fs.readdir; +var stat = fs.stat; +var join = path.join; +var relative = path.relative; +var resolve = path.resolve; +var basename = path.basename; +var extname = path.extname; +var magic = glob.hasMagic; - //if ignored, skip processing - if (childrenIgnored$1(this, read)) - return +module.exports = find; - var isGlobStar = remain[0] === minimatch_1.GLOBSTAR; - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar); - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar); -}; +/* Search `patterns`, a mix of globs, paths, and files. */ +function find(input, options, callback) { + expand(input, options, done); + function done(err, result) { + /* istanbul ignore if - glob errors are unusual. + * other errors are on the vfile results. */ + if (err) { + callback(err); + } else { + callback(null, {oneFileMode: oneFileMode(result), files: result.output}); + } + } +} -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar); +/* Expand the given glob patterns, search given and found + * directories, and map to vfiles. */ +function expand(input, options, next) { + var cwd = options.cwd; + var paths = []; + var actual = 0; + var expected = 0; + var failed; - // if the abs isn't a dir, then nothing can match! - if (!entries) - return + input.forEach(each); - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0]; - var negate = !!this.minimatch.negate; - var rawGlob = pn._glob; - var dotOk = this.dot || rawGlob.charAt(0) === '.'; + if (!expected) { + search(paths, options, done); + } - var matchedEntries = []; - for (var i = 0; i < entries.length; i++) { - var e = entries[i]; - if (e.charAt(0) !== '.' || dotOk) { - var m; - if (negate && !prefix) { - m = !e.match(pn); + function each(file) { + if (string(file)) { + if (magic(file)) { + expected++; + glob(file, {cwd: cwd}, one); } else { - m = e.match(pn); + /* `relative` to make the paths canonical. */ + file = relative(cwd, resolve(cwd, file)) || '.'; + paths.push(file); } - if (m) - matchedEntries.push(e); + } else { + file.cwd = cwd; + file.path = relative(cwd, file.path); + file.history = [file.path]; + paths.push(file); } } - var len = matchedEntries.length; - // If there are no matched entries, then nothing matches. - if (len === 0) - return - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. + function one(err, files) { + /* istanbul ignore if - glob errors are unusual. */ + if (failed) { + return; + } - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null); + /* istanbul ignore if - glob errors are unusual. */ + if (err) { + failed = true; + done(err); + } else { + actual++; + paths = paths.concat(files); - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i]; - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e; - else - e = prefix + e; + if (actual === expected) { + search(paths, options, done); } + } + } - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e); - } - this._emitMatch(index, e); + function done(err, files) { + /* istanbul ignore if - `search` currently does not give errors. */ + if (err) { + next(err); + } else { + next(null, {input: paths, output: files}); } - // This was the last one, and no stats were needed - return } +} - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift(); - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i]; - var newPattern; - if (prefix) - newPattern = [prefix, e]; - else - newPattern = [e]; - this._process(newPattern.concat(remain), index, inGlobStar); +/* Search `paths`. */ +function search(input, options, next) { + var cwd = options.cwd; + var silent = options.silentlyIgnore; + var nested = options.nested; + var extensions = options.extensions; + var files = []; + var expected = 0; + var actual = 0; + + input.forEach(each); + + if (!expected) { + next(null, files); } -}; + return each; -GlobSync.prototype._emitMatch = function (index, e) { - if (isIgnored$1(this, e)) - return + function each(file) { + var part = base(file); - var abs = this._makeAbs(e); + if (nested && (hidden(part) || part === 'node_modules')) { + return; + } - if (this.mark) - e = this._mark(e); + expected++; - if (this.absolute) { - e = abs; - } + statAndIgnore(file, options, handle); - if (this.matches[index][e]) - return + function handle(err, result) { + var ignored = result && result.ignored; + var dir = result && result.stats && result.stats.isDirectory(); - if (this.nodir) { - var c = this.cache[abs]; - if (c === 'DIR' || Array.isArray(c)) - return - } + if (ignored && (nested || silent)) { + return one(null, []); + } - this.matches[index][e] = true; + if (!ignored && dir) { + return readdir(resolve(cwd, filePath(file)), directory); + } - if (this.stat) - this._stat(e); -}; + if (nested && !dir && extensions.length !== 0 && extensions.indexOf(extname(file)) === -1) { + return one(null, []); + } + file = vfile(file); + file.cwd = cwd; -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) + if (ignored) { + try { + file.fail('Cannot process specified file: it’s ignored'); + } catch (err) {} + } - var entries; - var lstat; - try { - lstat = fs.lstatSync(abs); - } catch (er) { - if (er.code === 'ENOENT') { - // lstat failed, doesn't exist - return null + if (err && err.code === 'ENOENT') { + try { + file.fail(err.syscall === 'stat' ? 'No such file or directory' : err); + } catch (err) {} + } + + one(null, [file]); } - } - var isSym = lstat && lstat.isSymbolicLink(); - this.symlinks[abs] = isSym; + function directory(err, basenames) { + var file; - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) - this.cache[abs] = 'FILE'; - else - entries = this._readdir(abs, false); + /* istanbul ignore if - Should not happen often: the directory + * is `stat`ed first, which was ok, but reading it is not. */ + if (err) { + file = vfile(filePath(file)); + file.cwd = cwd; - return entries -}; + try { + file.fail('Cannot read directory'); + } catch (err) {} -GlobSync.prototype._readdir = function (abs, inGlobStar) { - if (inGlobStar && !ownProp$1(this.symlinks, abs)) - return this._readdirInGlobStar(abs) + one(null, [file]); + } else { + search(basenames.map(concat), xtend(options, {nested: true}), one); + } + } - if (ownProp$1(this.cache, abs)) { - var c = this.cache[abs]; - if (!c || c === 'FILE') - return null + /* Error is never given. Always given `results`. */ + function one(_, results) { + /* istanbul ignore else - always given. */ + if (results) { + files = files.concat(results); + } - if (Array.isArray(c)) - return c - } + actual++; - try { - return this._readdirEntries(abs, fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er); - return null - } -}; + if (actual === expected) { + next(null, files); + } + } -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i]; - if (abs === '/') - e = abs + e; - else - e = abs + '/' + e; - this.cache[e] = true; + function concat(value) { + return join(filePath(file), value); } } +} - this.cache[abs] = entries; +function statAndIgnore(file, options, callback) { + var ignore = options.ignore; + var fp = resolve(options.cwd, filePath(file)); + var expected = 1; + var actual = 0; + var stats; + var ignored; - // mark and cache dir-ness - return entries -}; + if (!file.contents) { + expected++; + stat(fp, handleStat); + } -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f); - this.cache[abs] = 'FILE'; - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd); - error.path = this.cwd; - error.code = er.code; - throw error - } - break + ignore.check(fp, handleIgnore); - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false; - break + function handleStat(err, value) { + stats = value; + one(err); + } - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false; - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er); - break + function handleIgnore(err, value) { + ignored = value; + one(err); } -}; -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + function one(err) { + actual++; - var entries = this._readdir(abs, inGlobStar); + if (err) { + callback(err); + actual = -1; + } else if (actual === expected) { + callback(null, {stats: stats, ignored: ignored}); + } + } +} - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return +function base(file) { + return string(file) ? basename(file) : file.basename; +} - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1); - var gspref = prefix ? [ prefix ] : []; - var noGlobStar = gspref.concat(remainWithoutGlobStar); +function filePath(file) { + return string(file) ? file : file.path; +} - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false); +function oneFileMode(result) { + return result.output.length === 1 && + result.input.length === 1 && + result.output[0].path === result.input[0]; +} - var len = entries.length; - var isSym = this.symlinks[abs]; - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { - for (var i = 0; i < len; i++) { - var e = entries[i]; - if (e.charAt(0) === '.' && !this.dot) - continue +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar); - this._process(instead, index, true); +var pathModule = __webpack_require__(4); +var isWindows = process.platform === 'win32'; +var fs = __webpack_require__(6); - var below = gspref.concat(entries[i], remain); - this._process(below, index, true); - } -}; +// JavaScript implementation of realpath, ported from node pre-v6 -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix); +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - if (!this.matches[index]) - this.matches[index] = Object.create(null); +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; - // If it doesn't exist, then just mark the lack of results - if (!exists) - return + return callback; - if (prefix && pathIsAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix); - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix); - } else { - prefix = path.resolve(this.root, prefix); - if (trail) - prefix += '/'; + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } } } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/'); +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} - // Mark this as a match - this._emitMatch(index, prefix); -}; +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f); - var needDir = f.slice(-1) === '/'; +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); - if (f.length > this.maxLength) - return false + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } - if (!this.stat && ownProp$1(this.cache, abs)) { - var c = this.cache[abs]; + var original = p, + seenLinks = {}, + knownHard = {}; - if (Array.isArray(c)) - c = 'DIR'; + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c + start(); - if (needDir && c === 'FILE') - return false + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } } - var stat = this.statCache[abs]; - if (!stat) { - var lstat; - try { - lstat = fs.lstatSync(abs); - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false; - return false - } + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; } - if (lstat && lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs); - } catch (er) { - stat = lstat; - } + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; } else { - stat = lstat; + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; } - } - this.statCache[abs] = stat; + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } - var c = true; - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE'; + if (cache) cache[original] = p; - this.cache[abs] = this.cache[abs] || c; + return p; +}; - if (needDir && c === 'FILE') - return false - return c -}; +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } -GlobSync.prototype._mark = function (p) { - return common$5.mark(this, p) -}; + // make p is absolute + p = pathModule.resolve(p); -GlobSync.prototype._makeAbs = function (f) { - return common$5.makeAbs(this, f) -}; + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -var wrappy_1 = wrappy; -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) + var original = p, + seenLinks = {}, + knownHard = {}; - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k]; - }); + start(); - return wrapper + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; - function wrapper() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - var ret = fn.apply(this, args); - var cb = args[args.length-1]; - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k]; + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); }); + } else { + process.nextTick(LOOP); } - return ret } -} -var once_1 = wrappy_1(once); -var strict = wrappy_1(onceStrict); + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }); + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }); -}); + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true; - return f.value = fn.apply(this, arguments) - }; - f.called = false; - return f -} + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true; - return f.value = fn.apply(this, arguments) - }; - var name = fn.name || 'Function wrapped with `once`'; - f.onceError = name + " shouldn't be called more than once"; - f.called = false; - return f -} + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } -once_1.strict = strict; + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); -var reqs = Object.create(null); + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + function gotTarget(err, target, base) { + if (err) return cb(err); -var inflight_1 = wrappy_1(inflight); + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } -function inflight (key, cb) { - if (reqs[key]) { - reqs[key].push(cb); - return null - } else { - reqs[key] = [cb]; - return makeres(key) + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); } -} +}; -function makeres (key) { - return once_1(function RES () { - var cbs = reqs[key]; - var len = cbs.length; - var args = slice$2(arguments); - // XXX It's somewhat ambiguous whether a new callback added in this - // pass should be queued for later execution if something in the - // list of callbacks throws, or if it should just be discarded. - // However, it's such an edge case that it hardly matters, and either - // choice is likely as surprising as the other. - // As it happens, we do go ahead and schedule it for later execution. - try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args); - } - } finally { - if (cbs.length > len) { - // added more in the interim. - // de-zalgo, just in case, but don't call again. - cbs.splice(0, len); - process.nextTick(function () { - RES.apply(null, args); - }); - } else { - delete reqs[key]; - } - } - }) -} +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { -function slice$2 (args) { - var length = args.length; - var array = []; +var concatMap = __webpack_require__(150); +var balanced = __webpack_require__(151); - for (var i = 0; i < length; i++) array[i] = args[i]; - return array -} +module.exports = expandTop; -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; -var glob_1 = glob; +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} -var EE = events.EventEmitter; +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + var parts = []; + var m = balanced('{', '}', str); + if (!m) + return str.split(','); + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } -var setopts$2 = common$5.setopts; -var ownProp$2 = common$5.ownProp; + parts.push.apply(parts, p); + return parts; +} -var childrenIgnored$2 = common$5.childrenIgnored; -var isIgnored$2 = common$5.isIgnored; +function expandTop(str) { + if (!str) + return []; + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + return expand(escapeBraces(str), true).map(unescapeBraces); +} -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {}; - if (!options) options = {}; +function identity(e) { + return e; +} - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return sync(pattern, options) - } +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} - return new Glob$1(pattern, options, cb) +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; } -glob.sync = sync; -var GlobSync$1 = glob.GlobSync = sync.GlobSync; +function expand(str, isTop) { + var expansions = []; -// old api surface -glob.glob = glob; + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; -function extend$2 (origin, add) { - if (add === null || typeof add !== 'object') { - return origin + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; } - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } } - return origin -} -glob.hasMagic = function (pattern, options_) { - var options = extend$2({}, options_); - options.noprocess = true; + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. - var g = new Glob$1(pattern, options); - var set = g.minimatch.set; + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; - if (!pattern) - return false + var N; - if (set.length > 1) - return true + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true - } + N = []; - return false -}; + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } -glob.Glob = Glob$1; -inherits(Glob$1, EE); -function Glob$1 (pattern, options, cb) { - if (typeof options === 'function') { - cb = options; - options = null; + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } } - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync$1(pattern, options) - } + return expansions; +} - if (!(this instanceof Glob$1)) - return new Glob$1(pattern, options, cb) - setopts$2(this, pattern, options); - this._didRealPath = false; - // process each pattern in the minimatch set - var n = this.minimatch.set.length; +/***/ }), +/* 150 */ +/***/ (function(module, exports) { - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n); +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; - if (typeof cb === 'function') { - cb = once_1(cb); - this.on('error', cb); - this.on('end', function (matches) { - cb(null, matches); - }); - } +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; - var self = this; - this._processing = 0; - this._emitQueue = []; - this._processQueue = []; - this.paused = false; +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.noprocess) - return this +"use strict"; - if (n === 0) - return done() +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); - var sync$$1 = true; - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done); - } - sync$$1 = false; + var r = range(a, b, str); - function done () { - --self._processing; - if (self._processing <= 0) { - if (sync$$1) { - process.nextTick(function () { - self._finish(); - }); - } else { - self._finish(); - } - } - } + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; } -Glob$1.prototype._finish = function () { - assert(this instanceof Glob$1); - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} - common$5.finish(this); - this.emit('end', this.found); -}; +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; -Glob$1.prototype._realpath = function () { - if (this._didRealpath) - return + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; - this._didRealpath = true; + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } - var n = this.matches.length; - if (n === 0) - return this._finish() + bi = str.indexOf(b, i + 1); + } - var self = this; - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next); + i = ai < bi && ai >= 0 ? ai : bi; + } - function next () { - if (--n === 0) - self._finish(); + if (begs.length) { + result = [ left, right ]; + } } -}; - -Glob$1.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index]; - if (!matchset) - return cb() - var found = Object.keys(matchset); - var self = this; - var n = found.length; + return result; +} - if (n === 0) - return cb() - var set = this.matches[index] = Object.create(null); - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p); - fs_realpath.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true; - else if (er.syscall === 'stat') - set[p] = true; - else - self.emit('error', er); // srsly wtf right here +/***/ }), +/* 152 */ +/***/ (function(module, exports) { - if (--n === 0) { - self.matches[index] = set; - cb(); +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true } }); - }); -}; + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = __webpack_require__(6) +var rp = __webpack_require__(59) +var minimatch = __webpack_require__(36) +var Minimatch = minimatch.Minimatch +var Glob = __webpack_require__(58).Glob +var util = __webpack_require__(11) +var path = __webpack_require__(4) +var assert = __webpack_require__(60) +var isAbsolute = __webpack_require__(38) +var common = __webpack_require__(61) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored -Glob$1.prototype._mark = function (p) { - return common$5.mark(this, p) -}; +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') -Glob$1.prototype._makeAbs = function (f) { - return common$5.makeAbs(this, f) -}; + return new GlobSync(pattern, options).found +} -Glob$1.prototype.abort = function () { - this.aborted = true; - this.emit('abort'); -}; +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') -Glob$1.prototype.pause = function () { - if (!this.paused) { - this.paused = true; - this.emit('pause'); - } -}; + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') -Glob$1.prototype.resume = function () { - if (this.paused) { - this.emit('resume'); - this.paused = false; - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0); - this._emitQueue.length = 0; - for (var i = 0; i < eq.length; i ++) { - var e = eq[i]; - this._emitMatch(e[0], e[1]); - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0); - this._processQueue.length = 0; - for (var i = 0; i < pq.length; i ++) { - var p = pq[i]; - this._processing--; - this._process(p[0], p[1], p[2], p[3]); - } - } - } -}; + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) -Glob$1.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob$1); - assert(typeof cb === 'function'); + setopts(this, pattern, options) - if (this.aborted) - return + if (this.noprocess) + return this - this._processing++; - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]); - return + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) } + this._finish() +} - //console.error('PROCESS %d', this._processing, pattern) +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) // Get the first [n] parts of pattern that are all strings. - var n = 0; + var n = 0 while (typeof pattern[n] === 'string') { - n ++; + n ++ } // now n is the index of the first one that is *not* a string. - // see if there's anything else - var prefix; + // See if there's anything else + var prefix switch (n) { // if not, then this is rather simple case pattern.length: - this._processSimple(pattern.join('/'), index, cb); + this._processSimple(pattern.join('/'), index) return case 0: // pattern *starts* with some non-trivial item. // going to readdir(cwd), but not include the prefix in matches. - prefix = null; + prefix = null break default: // pattern has some string bits in the front. // whatever it starts with, whether that's 'absolute' like /foo/bar, // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/'); + prefix = pattern.slice(0, n).join('/') break } - var remain = pattern.slice(n); + var remain = pattern.slice(n) // get the list of entries. - var read; + var read if (prefix === null) - read = '.'; - else if (pathIsAbsolute(prefix) || pathIsAbsolute(pattern.join('/'))) { - if (!prefix || !pathIsAbsolute(prefix)) - prefix = '/' + prefix; - read = prefix; + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix } else - read = prefix; + read = prefix - var abs = this._makeAbs(read); + var abs = this._makeAbs(read) - //if ignored, skip _processing - if (childrenIgnored$2(this, read)) - return cb() + //if ignored, skip processing + if (childrenIgnored(this, read)) + return - var isGlobStar = remain[0] === minimatch_1.GLOBSTAR; + var isGlobStar = remain[0] === minimatch.GLOBSTAR if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb); + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb); -}; + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} -Glob$1.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this; - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }); -}; -Glob$1.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) // if the abs isn't a dir, then nothing can match! if (!entries) - return cb() + return // It will only match dot entries if it starts with a dot, or if // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0]; - var negate = !!this.minimatch.negate; - var rawGlob = pn._glob; - var dotOk = this.dot || rawGlob.charAt(0) === '.'; + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' - var matchedEntries = []; + var matchedEntries = [] for (var i = 0; i < entries.length; i++) { - var e = entries[i]; + var e = entries[i] if (e.charAt(0) !== '.' || dotOk) { - var m; + var m if (negate && !prefix) { - m = !e.match(pn); + m = !e.match(pn) } else { - m = e.match(pn); + m = e.match(pn) } if (m) - matchedEntries.push(e); + matchedEntries.push(e) } } - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length; + var len = matchedEntries.length // If there are no matched entries, then nothing matches. if (len === 0) - return cb() + return // if this is the last remaining pattern bit, then no need for // an additional stat *unless* the user has specified mark or @@ -10112,184 +22958,157 @@ Glob$1.prototype._processReaddir2 = function (prefix, read, abs, remain, index, if (remain.length === 1 && !this.mark && !this.stat) { if (!this.matches[index]) - this.matches[index] = Object.create(null); + this.matches[index] = Object.create(null) for (var i = 0; i < len; i ++) { - var e = matchedEntries[i]; + var e = matchedEntries[i] if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e; + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e else - e = prefix + e; + e = prefix + e } if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e); + e = path.join(this.root, e) } - this._emitMatch(index, e); + this._emitMatch(index, e) } // This was the last one, and no stats were needed - return cb() + return } // now test all matched entries as stand-ins for that part // of the pattern. - remain.shift(); + remain.shift() for (var i = 0; i < len; i ++) { - var e = matchedEntries[i]; - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e; - else - e = prefix + e; - } - this._process([e].concat(remain), index, inGlobStar, cb); + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) } - cb(); -}; - -Glob$1.prototype._emitMatch = function (index, e) { - if (this.aborted) - return +} - if (isIgnored$2(this, e)) - return - if (this.paused) { - this._emitQueue.push([index, e]); +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) return - } - var abs = pathIsAbsolute(e) ? e : this._makeAbs(e); + var abs = this._makeAbs(e) if (this.mark) - e = this._mark(e); + e = this._mark(e) - if (this.absolute) - e = abs; + if (this.absolute) { + e = abs + } if (this.matches[index][e]) return if (this.nodir) { - var c = this.cache[abs]; + var c = this.cache[abs] if (c === 'DIR' || Array.isArray(c)) return } - this.matches[index][e] = true; - - var st = this.statCache[abs]; - if (st) - this.emit('stat', e, st); + this.matches[index][e] = true - this.emit('match', e); -}; + if (this.stat) + this._stat(e) +} -Glob$1.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return +GlobSync.prototype._readdirInGlobStar = function (abs) { // follow all symlinked directories forever // just proceed as if this is a non-globstar situation if (this.follow) - return this._readdir(abs, false, cb) - - var lstatkey = 'lstat\0' + abs; - var self = this; - var lstatcb = inflight_1(lstatkey, lstatcb_); - - if (lstatcb) - fs.lstat(abs, lstatcb); + return this._readdir(abs, false) - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } - var isSym = lstat && lstat.isSymbolicLink(); - self.symlinks[abs] = isSym; + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE'; - cb(); - } else - self._readdir(abs, false, cb); - } -}; + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) -Glob$1.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return + return entries +} - cb = inflight_1('readdir\0'+abs+'\0'+inGlobStar, cb); - if (!cb) - return +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp$2(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) - if (ownProp$2(this.cache, abs)) { - var c = this.cache[abs]; + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] if (!c || c === 'FILE') - return cb() + return null if (Array.isArray(c)) - return cb(null, c) + return c } - fs.readdir(abs, readdirCb(this, abs, cb)); -}; - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb); - else - self._readdirEntries(abs, entries, cb); + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null } } -Glob$1.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - +GlobSync.prototype._readdirEntries = function (abs, entries) { // if we haven't asked to stat everything, then just // assume that everything in there exists, so we can avoid // having to stat it a second time. if (!this.mark && !this.stat) { for (var i = 0; i < entries.length; i ++) { - var e = entries[i]; + var e = entries[i] if (abs === '/') - e = abs + e; + e = abs + e else - e = abs + '/' + e; - this.cache[e] = true; + e = abs + '/' + e + this.cache[e] = true } } - this.cache[abs] = entries; - return cb(null, entries) -}; + this.cache[abs] = entries -Glob$1.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return + // mark and cache dir-ness + return entries +} +GlobSync.prototype._readdirError = function (f, er) { // handle errors, and cache the information switch (er.code) { case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f); - this.cache[abs] = 'FILE'; + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd); - error.path = this.cwd; - error.code = er.code; - this.emit('error', error); - this.abort(); + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error } break @@ -10297,376 +23116,419 @@ Glob$1.prototype._readdirError = function (f, er, cb) { case 'ELOOP': case 'ENAMETOOLONG': case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false; + this.cache[this._makeAbs(f)] = false break default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false; - if (this.strict) { - this.emit('error', er); - // If the error is handled, then we abort - // if not, we threw out of here - this.abort(); - } + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er if (!this.silent) - console.error('glob error', er); + console.error('glob error', er) break } +} - return cb() -}; - -Glob$1.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this; - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb); - }); -}; - +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { -Glob$1.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) + var entries = this._readdir(abs, inGlobStar) // no entries means not a dir, so it can never have matches // foo.txt/** doesn't match foo.txt if (!entries) - return cb() + return // test without the globstar, and with every child both below // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1); - var gspref = prefix ? [ prefix ] : []; - var noGlobStar = gspref.concat(remainWithoutGlobStar); + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb); + this._process(noGlobStar, index, false) - var isSym = this.symlinks[abs]; - var len = entries.length; + var len = entries.length + var isSym = this.symlinks[abs] // If it's a symlink, and we're in a globstar, then stop if (isSym && inGlobStar) - return cb() + return for (var i = 0; i < len; i++) { - var e = entries[i]; + var e = entries[i] if (e.charAt(0) === '.' && !this.dot) continue // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar); - this._process(instead, index, true, cb); + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) - var below = gspref.concat(entries[i], remain); - this._process(below, index, true, cb); + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) } +} - cb(); -}; - -Glob$1.prototype._processSimple = function (prefix, index, cb) { +GlobSync.prototype._processSimple = function (prefix, index) { // XXX review this. Shouldn't it be doing the mounting etc // before doing stat? kinda weird? - var self = this; - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb); - }); -}; -Glob$1.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - - //console.error('ps2', prefix, exists) + var exists = this._stat(prefix) if (!this.matches[index]) - this.matches[index] = Object.create(null); + this.matches[index] = Object.create(null) // If it doesn't exist, then just mark the lack of results if (!exists) - return cb() + return - if (prefix && pathIsAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix); + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix); + prefix = path.join(this.root, prefix) } else { - prefix = path.resolve(this.root, prefix); + prefix = path.resolve(this.root, prefix) if (trail) - prefix += '/'; + prefix += '/' } } if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/'); + prefix = prefix.replace(/\\/g, '/') // Mark this as a match - this._emitMatch(index, prefix); - cb(); -}; + this._emitMatch(index, prefix) +} // Returns either 'DIR', 'FILE', or false -Glob$1.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f); - var needDir = f.slice(-1) === '/'; +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' if (f.length > this.maxLength) - return cb() + return false - if (!this.stat && ownProp$2(this.cache, abs)) { - var c = this.cache[abs]; + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] if (Array.isArray(c)) - c = 'DIR'; + c = 'DIR' // It exists, but maybe not how we need it if (!needDir || c === 'DIR') - return cb(null, c) + return c if (needDir && c === 'FILE') - return cb() + return false // otherwise we have to stat, because maybe c=true // if we know it exists, but not what it is. } - var stat = this.statCache[abs]; - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE'; - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } } - } - var self = this; - var statcb = inflight_1('stat\0' + abs, lstatcb_); - if (statcb) - fs.lstat(abs, statcb); - - function lstatcb_ (er, lstat) { if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb); - else - self._stat2(f, abs, er, stat, cb); - }) + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } } else { - self._stat2(f, abs, er, lstat, cb); + stat = lstat } } -}; -Glob$1.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false; - return cb() + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +var wrappy = __webpack_require__(62) +var reqs = Object.create(null) +var once = __webpack_require__(63) + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) } +} - var needDir = f.slice(-1) === '/'; - this.statCache[abs] = stat; +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} - var c = true; - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE'; - this.cache[abs] = this.cache[abs] || c; +function slice (args) { + var length = args.length + var array = [] - if (needDir && c === 'FILE') - return cb() + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} - return cb(null, c, stat) -}; -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -var isBuffer_1 = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -}; +"use strict"; -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) + +var fs = __webpack_require__(6); +var func = __webpack_require__(26); +var vfile = __webpack_require__(156); + +module.exports = vfile; + +vfile.read = read; +vfile.readSync = readSync; +vfile.write = write; +vfile.writeSync = writeSync; + +/* Create a virtual file and read it in, asynchronously. */ +function read(description, options, callback) { + var file = vfile(description); + + if (!callback && func(options)) { + callback = options; + options = null; + } + + if (!callback) { + return new Promise(executor); + } + + executor(null, callback); + + function executor(resolve, reject) { + fs.readFile(file.path, options, done); + + function done(err, res) { + if (err) { + reject(err); + } else { + file.contents = res; + + if (resolve) { + resolve(file); + } else { + callback(null, file); + } + } + } + } +} + +/* Create a virtual file and read it in, synchronously. */ +function readSync(description, options) { + var file = vfile(description); + file.contents = fs.readFileSync(file.path, options); + return file; +} + +/* Create a virtual file and write it out, asynchronously. */ +function write(description, options, callback) { + var file = vfile(description); + + /* Weird, right? Otherwise `fs` doesn’t accept it. */ + if (!callback && func(options)) { + callback = options; + options = undefined; + } + + if (!callback) { + return new Promise(executor); + } + + executor(null, callback); + + function executor(resolve, reject) { + fs.writeFile(file.path, file.contents || '', options, done); + + function done(err) { + if (err) { + reject(err); + } else if (resolve) { + resolve(); + } else { + callback(); + } + } + } } -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +/* Create a virtual file and write it out, synchronously. */ +function writeSync(description, options) { + var file = vfile(description); + fs.writeFileSync(file.path, file.contents || '', options); } -var own = {}.hasOwnProperty; -var unistUtilStringifyPosition = stringify; +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { -function stringify(value) { - /* Nothing. */ - if (!value || typeof value !== 'object') { - return null - } +"use strict"; - /* Node. */ - if (own.call(value, 'position') || own.call(value, 'type')) { - return position(value.position) - } - /* Position. */ - if (own.call(value, 'start') || own.call(value, 'end')) { - return position(value) - } +var buffer = __webpack_require__(64); +var vfile = __webpack_require__(157); - /* Point. */ - if (own.call(value, 'line') || own.call(value, 'column')) { - return point(value) +module.exports = toVFile; + +/* Create a virtual file from a description. + * If `options` is a string or a buffer, it’s used as the + * path. In all other cases, the options are passed through + * to `vfile()`. */ +function toVFile(options) { + if (typeof options === 'string' || buffer(options)) { + options = {path: String(options)}; } - /* ? */ - return null + return vfile(options); } -function point(point) { - if (!point || typeof point !== 'object') { - point = {}; - } - return index(point.line) + ':' + index(point.column) -} +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { -function position(pos) { - if (!pos || typeof pos !== 'object') { - pos = {}; - } +"use strict"; - return point(pos.start) + '-' + point(pos.end) -} -function index(value) { - return value && typeof value === 'number' ? value : 1 -} +var VMessage = __webpack_require__(65); +var VFile = __webpack_require__(158); -var vfileMessage = VMessage; +module.exports = VFile; -/* Inherit from `Error#`. */ -function VMessagePrototype() {} -VMessagePrototype.prototype = Error.prototype; -VMessage.prototype = new VMessagePrototype(); +var proto = VFile.prototype; -/* Message properties. */ -var proto = VMessage.prototype; +proto.message = message; +proto.info = info; +proto.fail = fail; -proto.file = ''; -proto.name = ''; -proto.reason = ''; -proto.message = ''; -proto.stack = ''; -proto.fatal = null; -proto.column = null; -proto.line = null; +/* Slight backwards compatibility. Remove in the future. */ +proto.warn = message; -/* Construct a new VMessage. - * - * Note: We cannot invoke `Error` on the created context, - * as that adds readonly `line` and `column` attributes on - * Safari 9, thus throwing and failing the data. */ -function VMessage(reason, position, origin) { - var parts; - var range; - var location; +/* Create a message with `reason` at `position`. + * When an error is passed in as `reason`, copies the stack. */ +function message(reason, position, origin) { + var filePath = this.path; + var message = new VMessage(reason, position, origin); - if (typeof position === 'string') { - origin = position; - position = null; + if (filePath) { + message.name = filePath + ':' + message.name; + message.file = filePath; } - parts = parseOrigin(origin); - range = unistUtilStringifyPosition(position) || '1:1'; + message.fatal = false; - location = { - start: {line: null, column: null}, - end: {line: null, column: null} - }; + this.messages.push(message); - /* Node. */ - if (position && position.position) { - position = position.position; - } + return message; +} - if (position) { - /* Position. */ - if (position.start) { - location = position; - position = position.start; - } else { - /* Point. */ - location.start = position; - } - } +/* Fail. Creates a vmessage, associates it with the file, + * and throws it. */ +function fail() { + var message = this.message.apply(this, arguments); - if (reason.stack) { - this.stack = reason.stack; - reason = reason.message; - } + message.fatal = true; - this.message = reason; - this.name = range; - this.reason = reason; - this.line = position ? position.line : null; - this.column = position ? position.column : null; - this.location = location; - this.source = parts[0]; - this.ruleId = parts[1]; + throw message; } -function parseOrigin(origin) { - var result = [null, null]; - var index; - - if (typeof origin === 'string') { - index = origin.indexOf(':'); +/* Info. Creates a vmessage, associates it with the file, + * and marks the fatality as null. */ +function info() { + var message = this.message.apply(this, arguments); - if (index === -1) { - result[1] = origin; - } else { - result[0] = origin.slice(0, index); - result[1] = origin.slice(index + 1); - } - } + message.fatal = null; - return result + return message; } -function replaceExt(npath, ext) { - if (typeof npath !== 'string') { - return npath; - } - if (npath.length === 0) { - return npath; - } +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { - var nFileName = path.basename(npath, path.extname(npath)) + ext; - return path.join(path.dirname(npath), nFileName); -} +"use strict"; -var replaceExt_1 = replaceExt; -var core$2 = VFile; +var path = __webpack_require__(4); +var replace = __webpack_require__(66); +var buffer = __webpack_require__(64); -var own$1 = {}.hasOwnProperty; -var proto$1 = VFile.prototype; +module.exports = VFile; -proto$1.toString = toString$1; +var own = {}.hasOwnProperty; +var proto = VFile.prototype; + +proto.toString = toString; /* Order of setting (least specific to most), we need this because * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path @@ -10688,7 +23550,7 @@ function VFile(options) { if (!options) { options = {}; - } else if (typeof options === 'string' || isBuffer_1(options)) { + } else if (typeof options === 'string' || buffer(options)) { options = {contents: options}; } else if ('message' in options && 'messages' in options) { return options; @@ -10710,7 +23572,7 @@ function VFile(options) { while (++index < length) { prop = order[index]; - if (own$1.call(options, prop)) { + if (own.call(options, prop)) { this[prop] = options[prop]; } } @@ -10724,21 +23586,21 @@ function VFile(options) { } /* Access full path (`~/index.min.js`). */ -Object.defineProperty(proto$1, 'path', { +Object.defineProperty(proto, 'path', { get: function () { return this.history[this.history.length - 1]; }, - set: function (path$$1) { - assertNonEmpty(path$$1, 'path'); + set: function (path) { + assertNonEmpty(path, 'path'); - if (path$$1 !== this.path) { - this.history.push(path$$1); + if (path !== this.path) { + this.history.push(path); } } }); /* Access parent path (`~`). */ -Object.defineProperty(proto$1, 'dirname', { +Object.defineProperty(proto, 'dirname', { get: function () { return typeof this.path === 'string' ? path.dirname(this.path) : undefined; }, @@ -10749,7 +23611,7 @@ Object.defineProperty(proto$1, 'dirname', { }); /* Access basename (`index.min.js`). */ -Object.defineProperty(proto$1, 'basename', { +Object.defineProperty(proto, 'basename', { get: function () { return typeof this.path === 'string' ? path.basename(this.path) : undefined; }, @@ -10761,7 +23623,7 @@ Object.defineProperty(proto$1, 'basename', { }); /* Access extname (`.js`). */ -Object.defineProperty(proto$1, 'extname', { +Object.defineProperty(proto, 'extname', { get: function () { return typeof this.path === 'string' ? path.extname(this.path) : undefined; }, @@ -10781,12 +23643,12 @@ Object.defineProperty(proto$1, 'extname', { } } - this.path = replaceExt_1(this.path, ext); + this.path = replace(this.path, ext); } }); /* Access stem (`index.min`). */ -Object.defineProperty(proto$1, 'stem', { +Object.defineProperty(proto, 'stem', { get: function () { return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; }, @@ -10798,9 +23660,9 @@ Object.defineProperty(proto$1, 'stem', { }); /* Get the value of the file. */ -function toString$1(encoding) { +function toString(encoding) { var value = this.contents || ''; - return isBuffer_1(value) ? value.toString(encoding) : String(value); + return buffer(value) ? value.toString(encoding) : String(value); } /* Assert that `part` is not a path (i.e., does @@ -10811,172 +23673,30 @@ function assertPart(part, name) { } } -/* Assert that `part` is not empty. */ -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty'); - } -} - -/* Assert `path` exists. */ -function assertPath(path$$1, name) { - if (!path$$1) { - throw new Error('Setting `' + name + '` requires `path` to be set too'); - } -} - -var vfile = core$2; - -var proto$2 = core$2.prototype; - -proto$2.message = message; -proto$2.info = info; -proto$2.fail = fail; - -/* Slight backwards compatibility. Remove in the future. */ -proto$2.warn = message; - -/* Create a message with `reason` at `position`. - * When an error is passed in as `reason`, copies the stack. */ -function message(reason, position, origin) { - var filePath = this.path; - var message = new vfileMessage(reason, position, origin); - - if (filePath) { - message.name = filePath + ':' + message.name; - message.file = filePath; - } - - message.fatal = false; - - this.messages.push(message); - - return message; -} - -/* Fail. Creates a vmessage, associates it with the file, - * and throws it. */ -function fail() { - var message = this.message.apply(this, arguments); - - message.fatal = true; - - throw message; -} - -/* Info. Creates a vmessage, associates it with the file, - * and marks the fatality as null. */ -function info() { - var message = this.message.apply(this, arguments); - - message.fatal = null; - - return message; -} - -var core$4 = toVFile; - -/* Create a virtual file from a description. - * If `options` is a string or a buffer, it’s used as the - * path. In all other cases, the options are passed through - * to `vfile()`. */ -function toVFile(options) { - if (typeof options === 'string' || isBuffer_1(options)) { - options = {path: String(options)}; - } - - return vfile(options); -} - -var fs_1 = core$4; - -core$4.read = read$1; -core$4.readSync = readSync; -core$4.write = write; -core$4.writeSync = writeSync; - -/* Create a virtual file and read it in, asynchronously. */ -function read$1(description, options, callback) { - var file = core$4(description); - - if (!callback && xIsFunction(options)) { - callback = options; - options = null; - } - - if (!callback) { - return new Promise(executor); - } - - executor(null, callback); - - function executor(resolve, reject) { - fs.readFile(file.path, options, done); - - function done(err, res) { - if (err) { - reject(err); - } else { - file.contents = res; - - if (resolve) { - resolve(file); - } else { - callback(null, file); - } - } - } - } -} - -/* Create a virtual file and read it in, synchronously. */ -function readSync(description, options) { - var file = core$4(description); - file.contents = fs.readFileSync(file.path, options); - return file; -} - -/* Create a virtual file and write it out, asynchronously. */ -function write(description, options, callback) { - var file = core$4(description); - - /* Weird, right? Otherwise `fs` doesn’t accept it. */ - if (!callback && xIsFunction(options)) { - callback = options; - options = undefined; - } - - if (!callback) { - return new Promise(executor); - } - - executor(null, callback); - - function executor(resolve, reject) { - fs.writeFile(file.path, file.contents || '', options, done); - - function done(err) { - if (err) { - reject(err); - } else if (resolve) { - resolve(); - } else { - callback(); - } - } - } -} - -/* Create a virtual file and write it out, synchronously. */ -function writeSync(description, options) { - var file = core$4(description); - fs.writeFileSync(file.path, file.contents || '', options); +/* Assert that `part` is not empty. */ +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty'); + } } -var toVfile = fs_1; +/* Assert `path` exists. */ +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too'); + } +} + + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + /* Expose. */ -var isHidden = hidden; +module.exports = hidden; /* Check if `filename` is hidden (starts with a dot). */ function hidden(filename) { @@ -10987,324 +23707,435 @@ function hidden(filename) { return filename.charAt(0) === '.'; } -var readdir = fs.readdir; -var stat = fs.stat; -var join$2 = path.join; -var relative$2 = path.relative; -var resolve$3 = path.resolve; -var basename = path.basename; -var extname = path.extname; -var magic = glob_1.hasMagic; -var finder = find; +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { -/* Search `patterns`, a mix of globs, paths, and files. */ -function find(input, options, callback) { - expand$2(input, options, done); +"use strict"; - function done(err, result) { - /* istanbul ignore if - glob errors are unusual. - * other errors are on the vfile results. */ - if (err) { - callback(err); - } else { - callback(null, {oneFileMode: oneFileMode(result), files: result.output}); - } - } -} -/* Expand the given glob patterns, search given and found - * directories, and map to vfiles. */ -function expand$2(input, options, next) { - var cwd = options.cwd; - var paths = []; - var actual = 0; - var expected = 0; - var failed; +var debug = __webpack_require__(9)('unified-engine:file-set-pipeline:stdin'); +var vfile = __webpack_require__(39); +var concat = __webpack_require__(161); - input.forEach(each); +module.exports = stdin; - if (!expected) { - search(paths, options, done); - } +function stdin(context, settings, next) { + var streamIn = settings.streamIn; + var err; - function each(file) { - if (xIsString(file)) { - if (magic(file)) { - expected++; - glob_1(file, {cwd: cwd}, one); - } else { - /* `relative` to make the paths canonical. */ - file = relative$2(cwd, resolve$3(cwd, file)) || '.'; - paths.push(file); - } - } else { - file.cwd = cwd; - file.path = relative$2(cwd, file.path); - file.history = [file.path]; - paths.push(file); - } - } + if (settings.files && settings.files.length !== 0) { + debug('Ignoring `streamIn`'); - function one(err, files) { - /* istanbul ignore if - glob errors are unusual. */ - if (failed) { - return; + if (settings.filePath) { + err = new Error( + 'Do not pass both `--file-path` and real files.\n' + + 'Did you mean to pass stdin instead of files?' + ); } - /* istanbul ignore if - glob errors are unusual. */ - if (err) { - failed = true; - done(err); - } else { - actual++; - paths = paths.concat(files); + next(err); - if (actual === expected) { - search(paths, options, done); - } - } + return; } - function done(err, files) { - /* istanbul ignore if - `search` currently does not give errors. */ - if (err) { - next(err); - } else { - next(null, {input: paths, output: files}); - } + if (streamIn.isTTY) { + debug('Cannot read from `tty` stream'); + next(new Error('No input')); + + return; } -} -/* Search `paths`. */ -function search(input, options, next) { - var cwd = options.cwd; - var silent = options.silentlyIgnore; - var nested = options.nested; - var extensions = options.extensions; - var files = []; - var expected = 0; - var actual = 0; + debug('Reading from `streamIn`'); - input.forEach(each); + streamIn.pipe(concat({encoding: 'string'}, read)); - if (!expected) { - next(null, files); + function read(value) { + var file = vfile(settings.filePath || undefined); + + debug('Read from `streamIn`'); + + file.cwd = settings.cwd; + file.contents = value; + file.data.unifiedEngineGiven = true; + file.data.unifiedEngineStreamIn = true; + + context.files = [file]; + + /* If `out` wasn’t set, set `out`. */ + settings.out = settings.out === null || settings.out === undefined ? true : settings.out; + + next(); } +} - return each; - function each(file) { - var part = base(file); +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { - if (nested && (isHidden(part) || part === 'node_modules')) { - return; +var Writable = __webpack_require__(162).Writable +var inherits = __webpack_require__(13) +var bufferFrom = __webpack_require__(167) + +if (typeof Uint8Array === 'undefined') { + var U8 = __webpack_require__(168).Uint8Array +} else { + var U8 = Uint8Array +} + +function ConcatStream(opts, cb) { + if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb) + + if (typeof opts === 'function') { + cb = opts + opts = {} + } + if (!opts) opts = {} + + var encoding = opts.encoding + var shouldInferEncoding = false + + if (!encoding) { + shouldInferEncoding = true + } else { + encoding = String(encoding).toLowerCase() + if (encoding === 'u8' || encoding === 'uint8') { + encoding = 'uint8array' } + } - expected++; + Writable.call(this, { objectMode: true }) - statAndIgnore(file, options, handle); + this.encoding = encoding + this.shouldInferEncoding = shouldInferEncoding - function handle(err, result) { - var ignored = result && result.ignored; - var dir = result && result.stats && result.stats.isDirectory(); + if (cb) this.on('finish', function () { cb(this.getBody()) }) + this.body = [] +} - if (ignored && (nested || silent)) { - return one(null, []); - } +module.exports = ConcatStream +inherits(ConcatStream, Writable) - if (!ignored && dir) { - return readdir(resolve$3(cwd, filePath(file)), directory); - } +ConcatStream.prototype._write = function(chunk, enc, next) { + this.body.push(chunk) + next() +} - if (nested && !dir && extensions.length !== 0 && extensions.indexOf(extname(file)) === -1) { - return one(null, []); - } +ConcatStream.prototype.inferEncoding = function (buff) { + var firstBuffer = buff === undefined ? this.body[0] : buff; + if (Buffer.isBuffer(firstBuffer)) return 'buffer' + if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array' + if (Array.isArray(firstBuffer)) return 'array' + if (typeof firstBuffer === 'string') return 'string' + if (Object.prototype.toString.call(firstBuffer) === "[object Object]") return 'object' + return 'buffer' +} - file = toVfile(file); - file.cwd = cwd; +ConcatStream.prototype.getBody = function () { + if (!this.encoding && this.body.length === 0) return [] + if (this.shouldInferEncoding) this.encoding = this.inferEncoding() + if (this.encoding === 'array') return arrayConcat(this.body) + if (this.encoding === 'string') return stringConcat(this.body) + if (this.encoding === 'buffer') return bufferConcat(this.body) + if (this.encoding === 'uint8array') return u8Concat(this.body) + return this.body +} - if (ignored) { - try { - file.fail('Cannot process specified file: it’s ignored'); - } catch (err) {} - } +var isArray = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]' +} - if (err && err.code === 'ENOENT') { - try { - file.fail(err.syscall === 'stat' ? 'No such file or directory' : err); - } catch (err) {} - } +function isArrayish (arr) { + return /Array\]$/.test(Object.prototype.toString.call(arr)) +} - one(null, [file]); - } +function isBufferish (p) { + return typeof p === 'string' || isArrayish(p) || (p && typeof p.subarray === 'function') +} - function directory(err, basenames) { - var file; +function stringConcat (parts) { + var strings = [] + var needsToString = false + for (var i = 0; i < parts.length; i++) { + var p = parts[i] + if (typeof p === 'string') { + strings.push(p) + } else if (Buffer.isBuffer(p)) { + strings.push(p) + } else if (isBufferish(p)) { + strings.push(bufferFrom(p)) + } else { + strings.push(bufferFrom(String(p))) + } + } + if (Buffer.isBuffer(parts[0])) { + strings = Buffer.concat(strings) + strings = strings.toString('utf8') + } else { + strings = strings.join('') + } + return strings +} - /* istanbul ignore if - Should not happen often: the directory - * is `stat`ed first, which was ok, but reading it is not. */ - if (err) { - file = toVfile(filePath(file)); - file.cwd = cwd; +function bufferConcat (parts) { + var bufs = [] + for (var i = 0; i < parts.length; i++) { + var p = parts[i] + if (Buffer.isBuffer(p)) { + bufs.push(p) + } else if (isBufferish(p)) { + bufs.push(bufferFrom(p)) + } else { + bufs.push(bufferFrom(String(p))) + } + } + return Buffer.concat(bufs) +} - try { - file.fail('Cannot read directory'); - } catch (err) {} +function arrayConcat (parts) { + var res = [] + for (var i = 0; i < parts.length; i++) { + res.push.apply(res, parts[i]) + } + return res +} - one(null, [file]); - } else { - search(basenames.map(concat), immutable(options, {nested: true}), one); - } +function u8Concat (parts) { + var len = 0 + for (var i = 0; i < parts.length; i++) { + if (typeof parts[i] === 'string') { + parts[i] = bufferFrom(parts[i]) + } + len += parts[i].length + } + var u8 = new U8(len) + for (var i = 0, offset = 0; i < parts.length; i++) { + var part = parts[i] + for (var j = 0; j < part.length; j++) { + u8[offset++] = part[j] } + } + return u8 +} - /* Error is never given. Always given `results`. */ - function one(_, results) { - /* istanbul ignore else - always given. */ - if (results) { - files = files.concat(results); - } - actual++; +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { + +var Stream = __webpack_require__(32); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; + exports = module.exports = Stream.Readable; + exports.Readable = Stream.Readable; + exports.Writable = Stream.Writable; + exports.Duplex = Stream.Duplex; + exports.Transform = Stream.Transform; + exports.PassThrough = Stream.PassThrough; + exports.Stream = Stream; +} else { + exports = module.exports = __webpack_require__(67); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = __webpack_require__(70); + exports.Duplex = __webpack_require__(18); + exports.Transform = __webpack_require__(72); + exports.PassThrough = __webpack_require__(166); +} + + +/***/ }), +/* 163 */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + - if (actual === expected) { - next(null, files); - } - } +/***/ }), +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { - function concat(value) { - return join$2(filePath(file), value); - } - } +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = __webpack_require__(29).Buffer; +var util = __webpack_require__(11); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); } -function statAndIgnore(file, options, callback) { - var ignore = options.ignore; - var fp = resolve$3(options.cwd, filePath(file)); - var expected = 1; - var actual = 0; - var stats; - var ignored; +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); - if (!file.contents) { - expected++; - stat(fp, handleStat); + this.head = null; + this.tail = null; + this.length = 0; } - ignore.check(fp, handleIgnore); + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; - function handleStat(err, value) { - stats = value; - one(err); - } + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; - function handleIgnore(err, value) { - ignored = value; - one(err); - } + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; - function one(err) { - actual++; + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; - if (err) { - callback(err); - actual = -1; - } else if (actual === expected) { - callback(null, {stats: stats, ignored: ignored}); + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; } - } -} + return ret; + }; -function base(file) { - return xIsString(file) ? basename(file) : file.basename; -} + return BufferList; +}(); -function filePath(file) { - return xIsString(file) ? file : file.path; +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; } -function oneFileMode(result) { - return result.output.length === 1 && - result.input.length === 1 && - result.output[0].path === result.input[0]; -} +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { -var fileSystem_1 = fileSystem; -/* Find files from the file-system. */ -function fileSystem(context, settings, next) { - var input = context.files; - var skip = settings.silentlyIgnore; - var ignore = new ignore$2({ - cwd: settings.cwd, - detectIgnore: settings.detectIgnore, - ignoreName: settings.ignoreName, - ignorePath: settings.ignorePath - }); +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ - if (input.length === 0) { - return next(); - } +module.exports = __webpack_require__(11).deprecate; - finder(input, { - cwd: settings.cwd, - extensions: settings.extensions, - silentlyIgnore: skip, - ignore: ignore - }, found); - function found(err, result) { - var output = result.files; +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { - /* Sort alphabetically. Everything’s unique so we don’t care - * about cases where left and right are equal. */ - output.sort(function (left, right) { - return left.path < right.path ? -1 : 1; - }); +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - /* Mark as given. This allows outputting files, - * which can be pretty dangerous, so it’s “hidden”. */ - output.forEach(function (file) { - file.data.unifiedEngineGiven = true; - }); +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. - context.files = output; - /* If `out` wasn’t set, detect it based on - * whether one file was given. */ - if (settings.out === null || settings.out === undefined) { - settings.out = result.oneFileMode; - } - next(err); - } +module.exports = PassThrough; + +var Transform = __webpack_require__(72); + +/**/ +var util = __webpack_require__(22); +util.inherits = __webpack_require__(13); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); } -var toString$2 = Object.prototype.toString; +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), +/* 167 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString var isModern = ( typeof Buffer.alloc === 'function' && typeof Buffer.allocUnsafe === 'function' && typeof Buffer.from === 'function' -); +) function isArrayBuffer (input) { - return toString$2.call(input).slice(8, -1) === 'ArrayBuffer' + return toString.call(input).slice(8, -1) === 'ArrayBuffer' } function fromArrayBuffer (obj, byteOffset, length) { - byteOffset >>>= 0; + byteOffset >>>= 0 - var maxLength = obj.byteLength - byteOffset; + var maxLength = obj.byteLength - byteOffset if (maxLength < 0) { throw new RangeError("'offset' is out of bounds") } if (length === undefined) { - length = maxLength; + length = maxLength } else { - length >>>= 0; + length >>>= 0 if (length > maxLength) { throw new RangeError("'length' is out of bounds") @@ -11318,7 +24149,7 @@ function fromArrayBuffer (obj, byteOffset, length) { function fromString (string, encoding) { if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8'; + encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { @@ -11348,9 +24179,13 @@ function bufferFrom (value, encodingOrOffset, length) { : new Buffer(value) } -var bufferFrom_1 = bufferFrom; +module.exports = bufferFrom + + +/***/ }), +/* 168 */ +/***/ (function(module, exports) { -var typedarray = createCommonjsModule(function (module, exports) { var undefined = (void 0); // Paranoia // Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to @@ -11402,7 +24237,7 @@ function configureProperties(obj) { // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) -var defineProp; +var defineProp if (Object.defineProperty && (function() { try { Object.defineProperty({}, 'x', {}); @@ -11981,221 +24816,81 @@ function packF32(v) { return packIEEE754(v, 8, 23); } exports.DataView = exports.DataView || DataView; }()); -}); -var typedarray_1 = typedarray.ArrayBuffer; -var typedarray_2 = typedarray.Int8Array; -var typedarray_3 = typedarray.Uint8Array; -var typedarray_4 = typedarray.Uint8ClampedArray; -var typedarray_5 = typedarray.Int16Array; -var typedarray_6 = typedarray.Uint16Array; -var typedarray_7 = typedarray.Int32Array; -var typedarray_8 = typedarray.Uint32Array; -var typedarray_9 = typedarray.Float32Array; -var typedarray_10 = typedarray.Float64Array; -var typedarray_11 = typedarray.DataView; -var Writable = stream.Writable; +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -if (typeof Uint8Array === 'undefined') { - var U8 = typedarray.Uint8Array; -} else { - var U8 = Uint8Array; -} - -function ConcatStream(opts, cb) { - if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb) - - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - if (!opts) opts = {}; - - var encoding = opts.encoding; - var shouldInferEncoding = false; - - if (!encoding) { - shouldInferEncoding = true; - } else { - encoding = String(encoding).toLowerCase(); - if (encoding === 'u8' || encoding === 'uint8') { - encoding = 'uint8array'; - } - } - - Writable.call(this, { objectMode: true }); - - this.encoding = encoding; - this.shouldInferEncoding = shouldInferEncoding; - - if (cb) this.on('finish', function () { cb(this.getBody()); }); - this.body = []; -} - -var concatStream = ConcatStream; -inherits(ConcatStream, Writable); - -ConcatStream.prototype._write = function(chunk, enc, next) { - this.body.push(chunk); - next(); -}; - -ConcatStream.prototype.inferEncoding = function (buff) { - var firstBuffer = buff === undefined ? this.body[0] : buff; - if (Buffer.isBuffer(firstBuffer)) return 'buffer' - if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array' - if (Array.isArray(firstBuffer)) return 'array' - if (typeof firstBuffer === 'string') return 'string' - if (Object.prototype.toString.call(firstBuffer) === "[object Object]") return 'object' - return 'buffer' -}; - -ConcatStream.prototype.getBody = function () { - if (!this.encoding && this.body.length === 0) return [] - if (this.shouldInferEncoding) this.encoding = this.inferEncoding(); - if (this.encoding === 'array') return arrayConcat(this.body) - if (this.encoding === 'string') return stringConcat(this.body) - if (this.encoding === 'buffer') return bufferConcat(this.body) - if (this.encoding === 'uint8array') return u8Concat(this.body) - return this.body -}; - -function isArrayish$3 (arr) { - return /Array\]$/.test(Object.prototype.toString.call(arr)) -} - -function isBufferish (p) { - return typeof p === 'string' || isArrayish$3(p) || (p && typeof p.subarray === 'function') -} - -function stringConcat (parts) { - var strings = []; - for (var i = 0; i < parts.length; i++) { - var p = parts[i]; - if (typeof p === 'string') { - strings.push(p); - } else if (Buffer.isBuffer(p)) { - strings.push(p); - } else if (isBufferish(p)) { - strings.push(bufferFrom_1(p)); - } else { - strings.push(bufferFrom_1(String(p))); - } - } - if (Buffer.isBuffer(parts[0])) { - strings = Buffer.concat(strings); - strings = strings.toString('utf8'); - } else { - strings = strings.join(''); - } - return strings -} +var FileSet = __webpack_require__(170); +var filePipeline = __webpack_require__(171); -function bufferConcat (parts) { - var bufs = []; - for (var i = 0; i < parts.length; i++) { - var p = parts[i]; - if (Buffer.isBuffer(p)) { - bufs.push(p); - } else if (isBufferish(p)) { - bufs.push(bufferFrom_1(p)); - } else { - bufs.push(bufferFrom_1(String(p))); - } - } - return Buffer.concat(bufs) -} - -function arrayConcat (parts) { - var res = []; - for (var i = 0; i < parts.length; i++) { - res.push.apply(res, parts[i]); - } - return res -} - -function u8Concat (parts) { - var len = 0; - for (var i = 0; i < parts.length; i++) { - if (typeof parts[i] === 'string') { - parts[i] = bufferFrom_1(parts[i]); - } - len += parts[i].length; - } - var u8 = new U8(len); - for (var i = 0, offset = 0; i < parts.length; i++) { - var part = parts[i]; - for (var j = 0; j < part.length; j++) { - u8[offset++] = part[j]; - } - } - return u8 -} - -var debug$1 = src('unified-engine:file-set-pipeline:stdin'); - - - -var stdin_1 = stdin; - -function stdin(context, settings, next) { - var streamIn = settings.streamIn; - var err; - - if (settings.files && settings.files.length !== 0) { - debug$1('Ignoring `streamIn`'); - - if (settings.filePath) { - err = new Error( - 'Do not pass both `--file-path` and real files.\n' + - 'Did you mean to pass stdin instead of files?' - ); - } - - next(err); - - return; - } - - if (streamIn.isTTY) { - debug$1('Cannot read from `tty` stream'); - next(new Error('No input')); - - return; - } - - debug$1('Reading from `streamIn`'); +module.exports = transform; - streamIn.pipe(concatStream({encoding: 'string'}, read)); - - function read(value) { - var file = toVfile(settings.filePath || undefined); - - debug$1('Read from `streamIn`'); - - file.cwd = settings.cwd; - file.contents = value; - file.data.unifiedEngineGiven = true; - file.data.unifiedEngineStreamIn = true; +/* Transform all files. */ +function transform(context, settings, next) { + var fileSet = new FileSet(); - context.files = [file]; + context.fileSet = fileSet; - /* If `out` wasn’t set, set `out`. */ - settings.out = settings.out === null || settings.out === undefined ? true : settings.out; + fileSet.on('add', add).on('done', next); + if (context.files.length === 0) { next(); + } else { + context.files.forEach(fileSet.add, fileSet); + } + + function add(file) { + filePipeline.run({ + configuration: context.configuration, + processor: settings.processor(), + cwd: settings.cwd, + extensions: settings.extensions, + pluginPrefix: settings.pluginPrefix, + treeIn: settings.treeIn, + treeOut: settings.treeOut, + inspect: settings.inspect, + color: settings.color, + out: settings.out, + output: settings.output, + streamOut: settings.streamOut, + alwaysStringify: settings.alwaysStringify + }, file, fileSet, done); + + function done(err) { + /* istanbul ignore next - doesn’t occur as all + * failures in `filePipeLine` are failed on each + * file. Still, just to ensure things work in + * the future, we add an extra check. */ + if (err) { + err = file.message(err); + err.fatal = true; + } + + fileSet.emit('one', file); + } } } -var inherits$3 = util.inherits; +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +var events = __webpack_require__(37); +var inherits = __webpack_require__(11).inherits; +var trough = __webpack_require__(24); +var vfile = __webpack_require__(39); +var string = __webpack_require__(17); -var fileSet = FileSet; +module.exports = FileSet; /* FileSet constructor. */ function FileSet() { @@ -12207,7 +24902,7 @@ function FileSet() { self.expected = 0; self.actual = 0; - self.pipeline = trough_1(); + self.pipeline = trough(); self.plugins = []; events.init.call(self); @@ -12216,7 +24911,7 @@ function FileSet() { } /* Events. */ -inherits$3(FileSet, events.EventEmitter); +inherits(FileSet, events.EventEmitter); /* Expose methods. */ FileSet.prototype.valueOf = valueOf; @@ -12263,8 +24958,8 @@ function add(file) { var self = this; var origin; - if (xIsString(file)) { - file = toVfile(file); + if (string(file)) { + file = vfile(file); } /* Prevent files from being added multiple times. */ @@ -12304,140 +24999,128 @@ function one() { } } -var debug$2 = src('unified-engine:file-pipeline:read'); +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { -var read_1 = read$2; - -var resolve$4 = path.resolve; -var readFile = fs.readFile; - -/* Fill a file with its contents when not already filled. */ -function read$2(context, file, fileSet, next) { - var filePath = file.path; +"use strict"; - if (file.contents || file.data.unifiedEngineStreamIn) { - debug$2('Not reading file `%s` with contents', filePath); - next(); - } else if (vfileStatistics(file).fatal) { - debug$2('Not reading failed file `%s`', filePath); - next(); - } else { - filePath = resolve$4(context.cwd, filePath); - debug$2('Reading `%s` in `%s`', filePath, 'utf8'); +var trough = __webpack_require__(24); +var read = __webpack_require__(172); +var configure = __webpack_require__(173); +var parse = __webpack_require__(175); +var transform = __webpack_require__(176); +var queue = __webpack_require__(177); +var stringify = __webpack_require__(178); +var copy = __webpack_require__(180); +var stdout = __webpack_require__(181); +var fileSystem = __webpack_require__(182); - readFile(filePath, 'utf8', function (err, contents) { - debug$2('Read `%s` (err: %s)', filePath, err); +/* Expose: This pipeline ensures each of the pipes + * always runs: even if the read pipe fails, + * queue and write trigger. */ +module.exports = trough() + .use(chunk(trough().use(read).use(configure).use(parse).use(transform))) + .use(chunk(trough().use(queue))) + .use(chunk(trough().use(stringify).use(copy).use(stdout).use(fileSystem))); - file.contents = contents || ''; +/* Factory to run a pipe. Wraps a pipe to trigger an + * error on the `file` in `context`, but still call + * `next`. */ +function chunk(pipe) { + return run; - next(err); - }); - } -} + /* Run the bound bound pipe and handles any errors. */ + function run(context, file, fileSet, next) { + pipe.run(context, file, fileSet, one); -var fnName = function (fn) { - if (typeof fn !== 'function') { - throw new TypeError('Expected a function'); - } + function one(err) { + var messages = file.messages; + var index; - return fn.displayName || fn.name || (/function ([^\(]+)?\(/.exec(fn.toString()) || [])[1] || null; -}; + if (err) { + index = messages.indexOf(err); -/** - * Has own property. - * - * @type {Function} - */ + if (index === -1) { + err = file.message(err); + index = messages.length - 1; + } -var has = Object.prototype.hasOwnProperty; + messages[index].fatal = true; + } -/** - * To string. - * - * @type {Function} - */ + next(); + } + } +} -var toString$3 = Object.prototype.toString; -/** - * Test whether a value is "empty". - * - * @param {Mixed} val - * @return {Boolean} - */ +/***/ }), +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { -function isEmpty(val) { - // Null and Undefined... - if (val == null) return true +"use strict"; - // Booleans... - if ('boolean' == typeof val) return false - // Numbers... - if ('number' == typeof val) return val === 0 +var fs = __webpack_require__(6); +var path = __webpack_require__(4); +var debug = __webpack_require__(9)('unified-engine:file-pipeline:read'); +var stats = __webpack_require__(12); - // Strings... - if ('string' == typeof val) return val.length === 0 +module.exports = read; - // Functions... - if ('function' == typeof val) return val.length === 0 +var resolve = path.resolve; +var readFile = fs.readFile; - // Arrays... - if (Array.isArray(val)) return val.length === 0 +/* Fill a file with its contents when not already filled. */ +function read(context, file, fileSet, next) { + var filePath = file.path; - // Errors... - if (val instanceof Error) return val.message === '' + if (file.contents || file.data.unifiedEngineStreamIn) { + debug('Not reading file `%s` with contents', filePath); + next(); + } else if (stats(file).fatal) { + debug('Not reading failed file `%s`', filePath); + next(); + } else { + filePath = resolve(context.cwd, filePath); - // Objects... - if (val.toString == toString$3) { - switch (val.toString()) { + debug('Reading `%s` in `%s`', filePath, 'utf8'); - // Maps, Sets, Files and Errors... - case '[object File]': - case '[object Map]': - case '[object Set]': { - return val.size === 0 - } + readFile(filePath, 'utf8', function (err, contents) { + debug('Read `%s` (err: %s)', filePath, err); - // Plain objects... - case '[object Object]': { - for (var key in val) { - if (has.call(val, key)) return false - } + file.contents = contents || ''; - return true - } - } + next(err); + }); } - - // Anything else... - return false } -/** - * Export `isEmpty`. - * - * @type {Function} - */ - -var lib = isEmpty; - -var debug$3 = src('unified-engine:file-pipeline:configure'); +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +var debug = __webpack_require__(9)('unified-engine:file-pipeline:configure'); +var stats = __webpack_require__(12); +var fnName = __webpack_require__(174); +var object = __webpack_require__(35); +var empty = __webpack_require__(73); -var configure_1$2 = configure$1; +module.exports = configure; /* Collect configuration for a file based on the context. */ -function configure$1(context, file, fileSet, next) { +function configure(context, file, fileSet, next) { var config = context.configuration; var processor = context.processor; - if (vfileStatistics(file).fatal) { + if (stats(file).fatal) { return next(); } @@ -12456,14 +25139,14 @@ function configure$1(context, file, fileSet, next) { } /* Store configuration on the context object. */ - debug$3('Using settings `%j`', configuration.settings); + debug('Using settings `%j`', configuration.settings); processor.data('settings', configuration.settings); plugins = configuration.plugins; length = plugins.length; index = -1; - debug$3('Using `%d` plugins', length); + debug('Using `%d` plugins', length); while (++index < length) { plugin = plugins[index][0]; @@ -12474,12 +25157,12 @@ function configure$1(context, file, fileSet, next) { } /* Allow for default arguments in es2020. */ - if (options === null || (isObject$1(options) && lib(options))) { + if (options === null || (object(options) && empty(options))) { options = undefined; } name = fnName(plugin) || 'function'; - debug$3('Using plug-in `%s`, with options `%j`', name, options); + debug('Using plug-in `%s`, with options `%j`', name, options); try { processor.use(plugin, options, fileSet); @@ -12493,25 +25176,48 @@ function configure$1(context, file, fileSet, next) { } } -var debug$4 = src('unified-engine:file-pipeline:parse'); +/***/ }), +/* 174 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function (fn) { + if (typeof fn !== 'function') { + throw new TypeError('Expected a function'); + } + + return fn.displayName || fn.name || (/function ([^\(]+)?\(/.exec(fn.toString()) || [])[1] || null; +}; + + +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -var parse_1 = parse$3; + +var debug = __webpack_require__(9)('unified-engine:file-pipeline:parse'); +var stats = __webpack_require__(12); +var json = __webpack_require__(51); + +module.exports = parse; /* Fill a file with a tree. */ -function parse$3(context, file) { +function parse(context, file) { var message; - if (vfileStatistics(file).fatal) { + if (stats(file).fatal) { return; } if (context.treeIn) { - debug$4('Not parsing already parsed document'); + debug('Not parsing already parsed document'); try { - context.tree = parseJson$1(file.toString()); + context.tree = json(file.toString()); } catch (err) { message = file.message(new Error('Cannot read file as JSON\n' + err.message)); message.fatal = true; @@ -12529,40 +25235,56 @@ function parse$3(context, file) { return; } - debug$4('Parsing `%s`', file.path); + debug('Parsing `%s`', file.path); context.tree = context.processor.parse(file); - debug$4('Parsed document'); + debug('Parsed document'); } -var debug$5 = src('unified-engine:file-pipeline:transform'); + +/***/ }), +/* 176 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var transform_1 = transform; +var debug = __webpack_require__(9)('unified-engine:file-pipeline:transform'); +var stats = __webpack_require__(12); + +module.exports = transform; /* Transform the tree associated with a file with * configured plug-ins. */ function transform(context, file, fileSet, next) { - if (vfileStatistics(file).fatal) { + if (stats(file).fatal) { next(); return; } - debug$5('Transforming document `%s`', file.path); + debug('Transforming document `%s`', file.path); context.processor.run(context.tree, file, function (err, node) { - debug$5('Transformed document (error: %s)', err); + debug('Transformed document (error: %s)', err); context.tree = node; next(err); }); } -var debug$6 = src('unified-engine:file-pipeline:queue'); +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var queue_1 = queue; +var debug = __webpack_require__(9)('unified-engine:file-pipeline:queue'); +var stats = __webpack_require__(12); +var func = __webpack_require__(26); + +module.exports = queue; /* Queue all files which came this far. * When the last file gets here, run the file-set pipeline @@ -12577,14 +25299,14 @@ function queue(context, file, fileSet, next) { fileSet.complete = map; } - debug$6('Queueing `%s`', origin); + debug('Queueing `%s`', origin); map[origin] = next; fileSet.valueOf().forEach(each); if (!complete) { - debug$6('Not flushing: some files cannot be flushed'); + debug('Not flushing: some files cannot be flushed'); return; } @@ -12595,20 +25317,20 @@ function queue(context, file, fileSet, next) { function each(file) { var key = file.history[0]; - if (vfileStatistics(file).fatal) { + if (stats(file).fatal) { return; } - if (xIsFunction(map[key])) { - debug$6('`%s` can be flushed', key); + if (func(map[key])) { + debug('`%s` can be flushed', key); } else { - debug$6('Interupting flush: `%s` is not finished', key); + debug('Interupting flush: `%s` is not finished', key); complete = false; } } function done(err) { - debug$6('Flushing: all files can be flushed'); + debug('Flushing: all files can be flushed'); /* Flush. */ for (origin in map) { @@ -12617,27 +25339,94 @@ function queue(context, file, fileSet, next) { } } + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var debug = __webpack_require__(9)('unified-engine:file-pipeline:stringify'); +var stats = __webpack_require__(12); +var inspect = __webpack_require__(179); + +module.exports = stringify; + +/* Stringify a tree. */ +function stringify(context, file) { + var processor = context.processor; + var tree = context.tree; + var value; + + if (stats(file).fatal) { + debug('Not compiling failed document'); + return; + } + + if (!context.output && !context.out && !context.alwaysStringify) { + debug('Not compiling document without output settings'); + return; + } + + debug('Compiling `%s`', file.path); + + if (context.inspect) { + /* Add a `txt` extension if there’s a path. */ + if (file.path) { + file.extname = '.txt'; + } + + value = inspect[context.color ? 'color' : 'noColor'](tree) + '\n'; + } else if (context.treeOut) { + /* Add a `json` extension to ensure the file is correctly seen as JSON. + * Only add it if there’s a path — not if the file is for example stdin. */ + if (file.path) { + file.extname = '.json'; + } + + /* Add the line break to create a valid UNIX file. */ + value = JSON.stringify(tree, null, 2) + '\n'; + } else { + value = processor.stringify(tree, file); + } + + file.contents = value; + + debug('Compiled document'); +} + + +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isEmpty = __webpack_require__(73) + /* Detect color support. */ -var color = true; +var color = true try { - color = 'inspect' in util; + color = 'inspect' in __webpack_require__(11) } catch (err) { /* istanbul ignore next - browser */ - color = false; + color = false } -var unistUtilInspect = color ? inspect : /* istanbul ignore next */ noColor; +module.exports = color ? inspect : /* istanbul ignore next */ noColor -inspect.color = inspect; -noColor.color = inspect; -inspect.noColor = noColor; -noColor.noColor = noColor; +inspect.color = inspect +noColor.color = inspect +inspect.noColor = noColor +noColor.noColor = noColor -var dim = ansiColor(2, 22); -var yellow = ansiColor(33, 39); -var green = ansiColor(32, 39); +var dim = ansiColor(2, 22) +var yellow = ansiColor(33, 39) +var green = ansiColor(32, 39) /* Define ANSII color removal functionality. */ var COLOR_EXPRESSION = new RegExp( @@ -12650,12 +25439,12 @@ var COLOR_EXPRESSION = new RegExp( ')|' + '\\u001b[A-M]', 'g' -); +) /* Standard keys defined by unist: * https://github.com/syntax-tree/unist. * We don’t ignore `data` though. */ -var ignore$4 = ['type', 'value', 'children', 'position']; +var ignore = ['type', 'value', 'children', 'position'] /* Inspects a node, without using color. */ function noColor(node, pad) { @@ -12664,18 +25453,18 @@ function noColor(node, pad) { /* Inspects a node. */ function inspect(node, pad) { - var result; - var children; - var index; - var length; + var result + var children + var index + var length if (node && Boolean(node.length) && typeof node !== 'string') { - length = node.length; - index = -1; - result = []; + length = node.length + index = -1 + result = [] while (++index < length) { - result[index] = inspect(node[index]); + result[index] = inspect(node[index]) } return result.join('\n') @@ -12685,26 +25474,26 @@ function inspect(node, pad) { return String(node) } - result = [formatNode(node)]; - children = node.children; - length = children && children.length; - index = -1; + result = [formatNode(node)] + children = node.children + length = children && children.length + index = -1 if (!length) { return result[0] } if (!pad || typeof pad === 'number') { - pad = ''; + pad = '' } while (++index < length) { - node = children[index]; + node = children[index] if (index === length - 1) { - result.push(formatNesting(pad + '└─ ') + inspect(node, pad + ' ')); + result.push(formatNesting(pad + '└─ ') + inspect(node, pad + ' ')) } else { - result.push(formatNesting(pad + '├─ ') + inspect(node, pad + '│ ')); + result.push(formatNesting(pad + '├─ ') + inspect(node, pad + '│ ')) } } @@ -12718,49 +25507,49 @@ function formatNesting(value) { /* Compile a single position. */ function compile(pos) { - var values = []; + var values = [] if (!pos) { return null } - values = [[pos.line || 1, pos.column || 1].join(':')]; + values = [[pos.line || 1, pos.column || 1].join(':')] if ('offset' in pos) { - values.push(String(pos.offset || 0)); + values.push(String(pos.offset || 0)) } return values } /* Compile a location. */ -function stringify$2(start, end) { - var values = []; - var positions = []; - var offsets = []; +function stringify(start, end) { + var values = [] + var positions = [] + var offsets = [] - add(start); - add(end); + add(start) + add(end) if (positions.length !== 0) { - values.push(positions.join('-')); + values.push(positions.join('-')) } if (offsets.length !== 0) { - values.push(offsets.join('-')); + values.push(offsets.join('-')) } return values.join(', ') /* Add a position. */ function add(position) { - var tuple = compile(position); + var tuple = compile(position) if (tuple) { - positions.push(tuple[0]); + positions.push(tuple[0]) if (tuple[1]) { - offsets.push(tuple[1]); + offsets.push(tuple[1]) } } } @@ -12768,40 +25557,40 @@ function stringify$2(start, end) { /* Colored node formatter. */ function formatNode(node) { - var log = node.type; - var location = node.position || {}; - var position = stringify$2(location.start, location.end); - var key; - var values = []; - var value; + var log = node.type + var location = node.position || {} + var position = stringify(location.start, location.end) + var key + var values = [] + var value if (node.children) { - log += dim('[') + yellow(node.children.length) + dim(']'); + log += dim('[') + yellow(node.children.length) + dim(']') } else if (typeof node.value === 'string') { - log += dim(': ') + green(JSON.stringify(node.value)); + log += dim(': ') + green(JSON.stringify(node.value)) } if (position) { - log += ' (' + position + ')'; + log += ' (' + position + ')' } for (key in node) { - value = node[key]; + value = node[key] if ( - ignore$4.indexOf(key) !== -1 || + ignore.indexOf(key) !== -1 || value === null || value === undefined || - (typeof value === 'object' && lib(value)) + (typeof value === 'object' && isEmpty(value)) ) { continue } - values.push('[' + key + '=' + JSON.stringify(value) + ']'); + values.push('[' + key + '=' + JSON.stringify(value) + ']') } if (values.length !== 0) { - log += ' ' + values.join(''); + log += ' ' + values.join('') } return log @@ -12821,64 +25610,25 @@ function ansiColor(open, close) { } } -var debug$7 = src('unified-engine:file-pipeline:stringify'); - - - -var stringify_1 = stringify$3; - -/* Stringify a tree. */ -function stringify$3(context, file) { - var processor = context.processor; - var tree = context.tree; - var value; - - if (vfileStatistics(file).fatal) { - debug$7('Not compiling failed document'); - return; - } - - if (!context.output && !context.out && !context.alwaysStringify) { - debug$7('Not compiling document without output settings'); - return; - } - - debug$7('Compiling `%s`', file.path); - - if (context.inspect) { - /* Add a `txt` extension if there’s a path. */ - if (file.path) { - file.extname = '.txt'; - } - - value = unistUtilInspect[context.color ? 'color' : 'noColor'](tree) + '\n'; - } else if (context.treeOut) { - /* Add a `json` extension to ensure the file is correctly seen as JSON. - * Only add it if there’s a path — not if the file is for example stdin. */ - if (file.path) { - file.extname = '.json'; - } - - /* Add the line break to create a valid UNIX file. */ - value = JSON.stringify(tree, null, 2) + '\n'; - } else { - value = processor.stringify(tree, file); - } - file.contents = value; +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { - debug$7('Compiled document'); -} +"use strict"; -var debug$8 = src('unified-engine:file-pipeline:copy'); +var fs = __webpack_require__(6); +var path = __webpack_require__(4); +var debug = __webpack_require__(9)('unified-engine:file-pipeline:copy'); +var string = __webpack_require__(17); -var copy_1 = copy; +module.exports = copy; -var stat$1 = fs.stat; -var dirname$2 = path.dirname; -var resolve$5 = path.resolve; -var relative$3 = path.relative; +var stat = fs.stat; +var dirname = path.dirname; +var resolve = path.resolve; +var relative = path.relative; /* Move a file. */ function copy(context, file, fileSet, next) { @@ -12887,16 +25637,16 @@ function copy(context, file, fileSet, next) { var outpath = output; var currentPath = file.path; - if (!xIsString(outpath)) { - debug$8('Not copying'); + if (!string(outpath)) { + debug('Not copying'); return next(); } - outpath = resolve$5(context.cwd, outpath); + outpath = resolve(context.cwd, outpath); - debug$8('Copying `%s`', currentPath); + debug('Copying `%s`', currentPath); - stat$1(outpath, onstatfile); + stat(outpath, onstatfile); function onstatfile(err, stats) { if (err) { @@ -12904,7 +25654,7 @@ function copy(context, file, fileSet, next) { return next(new Error('Cannot read output directory. Error:\n' + err.message)); } - stat$1(dirname$2(outpath), onstatparent); + stat(dirname(outpath), onstatparent); } else { done(stats.isDirectory()); } @@ -12926,363 +25676,162 @@ function copy(context, file, fileSet, next) { return next(new Error('Cannot write multiple files to single output: ' + outpath)); } - file[directory ? 'dirname' : 'path'] = relative$3(file.cwd, outpath); + file[directory ? 'dirname' : 'path'] = relative(file.cwd, outpath); - debug$8('Copying document from %s to %s', currentPath, file.path); + debug('Copying document from %s to %s', currentPath, file.path); next(); } } -var debug$9 = src('unified-engine:file-pipeline:stdout'); +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var stdout_1 = stdout; + +var debug = __webpack_require__(9)('unified-engine:file-pipeline:stdout'); +var stats = __webpack_require__(12); + +module.exports = stdout; /* Write a virtual file to `streamOut`. * Ignored when `output` is given, more than one file * was processed, or `out` is false. */ function stdout(context, file, fileSet, next) { if (!file.data.unifiedEngineGiven) { - debug$9('Ignoring programmatically added file'); + debug('Ignoring programmatically added file'); next(); - } else if (vfileStatistics(file).fatal || context.output || !context.out) { - debug$9('Ignoring writing to `streamOut`'); + } else if (stats(file).fatal || context.output || !context.out) { + debug('Ignoring writing to `streamOut`'); next(); } else { - debug$9('Writing document to `streamOut`'); + debug('Writing document to `streamOut`'); context.streamOut.write(file.toString(), next); } } -var debug$10 = src('unified-engine:file-pipeline:file-system'); -var fileSystem_1$2 = fileSystem$1; +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var fs = __webpack_require__(6); +var path = __webpack_require__(4); +var debug = __webpack_require__(9)('unified-engine:file-pipeline:file-system'); + +module.exports = fileSystem; var writeFile = fs.writeFile; -var resolve$6 = path.resolve; +var resolve = path.resolve; /* Write a virtual file to the file-system. * Ignored when `output` is not given. */ -function fileSystem$1(context, file, fileSet, next) { +function fileSystem(context, file, fileSet, next) { var destinationPath; if (!context.output) { - debug$10('Ignoring writing to file-system'); + debug('Ignoring writing to file-system'); return next(); } if (!file.data.unifiedEngineGiven) { - debug$10('Ignoring programmatically added file'); + debug('Ignoring programmatically added file'); return next(); } destinationPath = file.path; if (!destinationPath) { - debug$10('Cannot write file without a `destinationPath`'); + debug('Cannot write file without a `destinationPath`'); return next(new Error('Cannot write file without an output path ')); } - destinationPath = resolve$6(context.cwd, destinationPath); - debug$10('Writing document to `%s`', destinationPath); + destinationPath = resolve(context.cwd, destinationPath); + debug('Writing document to `%s`', destinationPath); file.stored = true; writeFile(destinationPath, file.toString(), next); } -/* Expose: This pipeline ensures each of the pipes - * always runs: even if the read pipe fails, - * queue and write trigger. */ -var filePipeline = trough_1() - .use(chunk(trough_1().use(read_1).use(configure_1$2).use(parse_1).use(transform_1))) - .use(chunk(trough_1().use(queue_1))) - .use(chunk(trough_1().use(stringify_1).use(copy_1).use(stdout_1).use(fileSystem_1$2))); - -/* Factory to run a pipe. Wraps a pipe to trigger an - * error on the `file` in `context`, but still call - * `next`. */ -function chunk(pipe) { - return run; - - /* Run the bound bound pipe and handles any errors. */ - function run(context, file, fileSet, next) { - pipe.run(context, file, fileSet, one); - - function one(err) { - var messages = file.messages; - var index; - - if (err) { - index = messages.indexOf(err); - - if (index === -1) { - err = file.message(err); - index = messages.length - 1; - } - - messages[index].fatal = true; - } - - next(); - } - } -} -var transform_1$2 = transform$2; +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { -/* Transform all files. */ -function transform$2(context, settings, next) { - var fileSet$$1 = new fileSet(); +"use strict"; - context.fileSet = fileSet$$1; - fileSet$$1.on('add', add).on('done', next); +var xtend = __webpack_require__(7); +var load = __webpack_require__(55); +var report = __webpack_require__(184); +var string = __webpack_require__(17); - if (context.files.length === 0) { - next(); - } else { - context.files.forEach(fileSet$$1.add, fileSet$$1); - } +module.exports = log; - function add(file) { - filePipeline.run({ - configuration: context.configuration, - processor: settings.processor(), - cwd: settings.cwd, - extensions: settings.extensions, - pluginPrefix: settings.pluginPrefix, - treeIn: settings.treeIn, - treeOut: settings.treeOut, - inspect: settings.inspect, - color: settings.color, - out: settings.out, - output: settings.output, - streamOut: settings.streamOut, - alwaysStringify: settings.alwaysStringify - }, file, fileSet$$1, done); +var prefix = 'vfile-reporter'; - function done(err) { - /* istanbul ignore next - doesn’t occur as all - * failures in `filePipeLine` are failed on each - * file. Still, just to ensure things work in - * the future, we add an extra check. */ - if (err) { - err = file.message(err); - err.fatal = true; - } +function log(context, settings, next) { + var reporter = settings.reporter || report; + var diagnostics; - fileSet$$1.emit('one', file); + if (string(reporter)) { + try { + reporter = load(reporter, {cwd: settings.cwd, prefix: prefix}); + } catch (err) { + next(new Error('Could not find reporter `' + reporter + '`')); + return; } } -} - -var ansiRegex = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; - -var ansiRegex$2 = ansiRegex(); - -var stripAnsi = function (str) { - return typeof str === 'string' ? str.replace(ansiRegex$2, '') : str; -}; - -/* eslint-disable babel/new-cap, xo/throw-new-error */ -var codePointAt = function (str, pos) { - if (str === null || str === undefined) { - throw TypeError(); - } - - str = String(str); - - var size = str.length; - var i = pos ? Number(pos) : 0; - - if (Number.isNaN(i)) { - i = 0; - } - - if (i < 0 || i >= size) { - return undefined; - } - - var first = str.charCodeAt(i); - - if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { - var second = str.charCodeAt(i + 1); - - if (second >= 0xDC00 && second <= 0xDFFF) { - return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000; - } - } - - return first; -}; - -var numberIsNan = Number.isNaN || function (x) { - return x !== x; -}; - -var isFullwidthCodePoint = function (x) { - if (numberIsNan(x)) { - return false; - } - - // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369 - - // code points are derived from: - // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt - if (x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - 0x2329 === x || // LEFT-POINTING ANGLE BRACKET - 0x232a === x || // RIGHT-POINTING ANGLE BRACKET - // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || - // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - 0x3250 <= x && x <= 0x4dbf || - // CJK Unified Ideographs .. Yi Radicals - 0x4e00 <= x && x <= 0xa4c6 || - // Hangul Jamo Extended-A - 0xa960 <= x && x <= 0xa97c || - // Hangul Syllables - 0xac00 <= x && x <= 0xd7a3 || - // CJK Compatibility Ideographs - 0xf900 <= x && x <= 0xfaff || - // Vertical Forms - 0xfe10 <= x && x <= 0xfe19 || - // CJK Compatibility Forms .. Small Form Variants - 0xfe30 <= x && x <= 0xfe6b || - // Halfwidth and Fullwidth Forms - 0xff01 <= x && x <= 0xff60 || - 0xffe0 <= x && x <= 0xffe6 || - // Kana Supplement - 0x1b000 <= x && x <= 0x1b001 || - // Enclosed Ideographic Supplement - 0x1f200 <= x && x <= 0x1f251 || - // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - 0x20000 <= x && x <= 0x3fffd)) { - return true; - } - - return false; -}; - -// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345 -var stringWidth = function (str) { - if (typeof str !== 'string' || str.length === 0) { - return 0; - } - - var width = 0; - - str = stripAnsi(str); - - for (var i = 0; i < str.length; i++) { - var code = codePointAt(str, i); - - // ignore control characters - if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) { - continue; - } - - // surrogates - if (code >= 0x10000) { - i++; - } - - if (isFullwidthCodePoint(code)) { - width += 2; - } else { - width++; - } - } - - return width; -}; - -/*! - * repeat-string - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -/** - * Results cache - */ - -var res = ''; -var cache$1; - -/** - * Expose `repeat` - */ - -var repeatString = repeat$1; - -/** - * Repeat the given `string` the specified `number` - * of times. - * - * **Example:** - * - * ```js - * var repeat = require('repeat-string'); - * repeat('A', 5); - * //=> AAAAA - * ``` - * - * @param {String} `string` The string to repeat - * @param {Number} `number` The number of times to repeat the string - * @return {String} Repeated string - * @api public - */ - -function repeat$1(str, num) { - if (typeof str !== 'string') { - throw new TypeError('expected a string'); - } - - // cover common, quick use cases - if (num === 1) return str; - if (num === 2) return str + str; - var max = str.length * num; - if (cache$1 !== str || typeof cache$1 === 'undefined') { - cache$1 = str; - res = ''; - } else if (res.length >= max) { - return res.substr(0, max); - } + diagnostics = reporter(context.files.filter(given), xtend(settings.reporterOptions, { + quiet: settings.quiet, + silent: settings.silent, + color: settings.color + })); - while (max > res.length && num > 1) { - if (num & 1) { - res += str; + if (diagnostics) { + if (diagnostics.charAt(diagnostics.length - 1) !== '\n') { + diagnostics += '\n'; } - - num >>= 1; - str += str; + + settings.streamError.write(diagnostics, next); + } else { + next(); } +} - res += str; - res = res.substr(0, max); - return res; +function given(file) { + return file.data.unifiedEngineGiven; } -var supported = supportsColor.hasBasic; +/***/ }), +/* 184 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; +var supported = __webpack_require__(53).hasBasic; +var width = __webpack_require__(185); +var stringify = __webpack_require__(27); +var repeat = __webpack_require__(10); +var statistics = __webpack_require__(12); -var vfileReporter = reporter; +module.exports = reporter; /* Check which characters should be used. */ -var windows$1 = process.platform === 'win32'; +var windows = process.platform === 'win32'; /* `log-symbols` without chalk: */ /* istanbul ignore next - Windows. */ -var chars = windows$1 ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}; +var chars = windows ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}; /* Match trailing white-space. */ var trailing = /\s*$/; @@ -13333,10 +25882,10 @@ function reporter(files, options) { files = [files]; } - return compile$1(parse$5(filter$2(files, settings), settings), one, settings); + return compile(parse(filter(files, settings), settings), one, settings); } -function filter$2(files, options) { +function filter(files, options) { var result = []; var length = files.length; var index = -1; @@ -13357,7 +25906,7 @@ function filter$2(files, options) { return result; } -function parse$5(files, options) { +function parse(files, options) { var length = files.length; var index = -1; var rows = []; @@ -13395,7 +25944,7 @@ function parse$5(files, options) { name: origin || options.defaultName || DEFAULT, stored: Boolean(file.stored), moved: Boolean(file.stored && destination !== origin), - stats: vfileStatistics(messages) + stats: statistics(messages) }); offset = -1; @@ -13406,7 +25955,7 @@ function parse$5(files, options) { id = message.ruleId || ''; reason = message.stack || message.message; loc = message.location; - loc = unistUtilStringifyPosition(loc.end.line && loc.end.column ? loc : loc.start); + loc = stringify(loc.end.line && loc.end.column ? loc : loc.start); if (options.verbose && message.note) { reason += '\n' + message.note; @@ -13433,7 +25982,7 @@ function parse$5(files, options) { return { rows: rows, - statistics: vfileStatistics(all), + statistics: statistics(all), location: locationSize, label: labelSize, reason: reasonSize, @@ -13441,7 +25990,7 @@ function parse$5(files, options) { }; } -function compile$1(map, one, options) { +function compile(map, one, options) { var enabled = options.color; var all = map.statistics; var rows = map.rows; @@ -13507,7 +26056,7 @@ function compile$1(map, one, options) { line.push([ style.red.open + chars.error + style.red.close, all.fatal, - plural$1(labels.true, all.fatal) + plural(labels.true, all.fatal) ].join(' ')); } @@ -13515,7 +26064,7 @@ function compile$1(map, one, options) { line.push([ style.yellow.open + chars.warning + style.yellow.close, all.warn, - plural$1(labels.false, all.warn) + plural(labels.false, all.warn) ].join(' ')); } @@ -13553,26 +26102,26 @@ function applicable(file, options) { /* Get the length of `value`, ignoring ANSI sequences. */ function realLength(value) { var length = value.indexOf('\n'); - return stringWidth(length === -1 ? value : value.slice(0, length)); + return width(length === -1 ? value : value.slice(0, length)); } /* Pad `value` on the left. */ function padLeft(value, minimum) { - return repeatString(' ', minimum - realLength(value)) + value; + return repeat(' ', minimum - realLength(value)) + value; } /* Pad `value` on the Right. */ function padRight(value, minimum) { - return value + repeatString(' ', minimum - realLength(value)); + return value + repeat(' ', minimum - realLength(value)); } /* Comparator. */ function comparator(a, b) { - return check$1(a, b, 'line') || check$1(a, b, 'column') || -1; + return check(a, b, 'line') || check(a, b, 'column') || -1; } /* Compare a single property. */ -function check$1(a, b, property) { +function check(a, b, property) { return (a[property] || 0) - (b[property] || 0); } @@ -13580,547 +26129,202 @@ function current(file) { /* istanbul ignore if - Previous `vfile` version. */ if (file.filePath) { return file.filePath(); - } - - return file.path; -} - -function plural$1(value, count) { - return count === 1 ? value : value + 's'; -} - -var log_1 = log; - -var prefix$1 = 'vfile-reporter'; - -function log(context, settings, next) { - var reporter = settings.reporter || vfileReporter; - var diagnostics; - - if (xIsString(reporter)) { - try { - reporter = loadPlugin_1(reporter, {cwd: settings.cwd, prefix: prefix$1}); - } catch (err) { - next(new Error('Could not find reporter `' + reporter + '`')); - return; - } - } - - diagnostics = reporter(context.files.filter(given), immutable(settings.reporterOptions, { - quiet: settings.quiet, - silent: settings.silent, - color: settings.color - })); - - if (diagnostics) { - if (diagnostics.charAt(diagnostics.length - 1) !== '\n') { - diagnostics += '\n'; - } - - settings.streamError.write(diagnostics, next); - } else { - next(); - } -} - -function given(file) { - return file.data.unifiedEngineGiven; -} - -var fileSetPipeline = trough_1() - .use(configure_1) - .use(fileSystem_1) - .use(stdin_1) - .use(transform_1$2) - .use(log_1); - -var PassThrough = stream.PassThrough; - - - -var lib$2 = run; - -/* Run the file set pipeline once. - * `callback` is invoked with a fatal error, - * or with a status code (`0` on success, `1` on failure). */ -function run(options, callback) { - var settings = {}; - var stdin = new PassThrough(); - var tree; - var detectConfig; - var hasConfig; - var detectIgnore; - var hasIgnore; - - try { - stdin = process.stdin; - } catch (err) { - /* Obscure bug in Node (seen on windows): - * - https://github.com/nodejs/node/blob/f856234/lib/internal/ - * process/stdio.js#L82; - * - https://github.com/AtomLinter/linter-markdown/pull/85. - */ - } - - if (!callback) { - throw new Error('Missing `callback`'); - } - - if (!options || !options.processor) { - return next(new Error('Missing `processor`')); - } - - /* Processor. */ - settings.processor = options.processor; - - /* Path to run as. */ - settings.cwd = options.cwd || process.cwd(); - - /* Input. */ - settings.files = options.files || []; - settings.extensions = (options.extensions || []).map(function (extension) { - return extension.charAt(0) === '.' ? extension : '.' + extension; - }); - - settings.filePath = options.filePath || null; - settings.streamIn = options.streamIn || stdin; - - /* Output. */ - settings.streamOut = options.streamOut || process.stdout; - settings.streamError = options.streamError || process.stderr; - settings.alwaysStringify = options.alwaysStringify; - settings.output = options.output; - settings.out = options.out; - - /* Null overwrites config settings, `undefined` doesn’t. */ - if (settings.output === null || settings.output === undefined) { - settings.output = undefined; - } - - if (settings.output && settings.out) { - return next(new Error('Cannot accept both `output` and `out`')); - } - - /* Process phase management. */ - tree = options.tree || false; - - settings.treeIn = options.treeIn; - settings.treeOut = options.treeOut; - settings.inspect = options.inspect; - - if (settings.treeIn === null || settings.treeIn === undefined) { - settings.treeIn = tree; - } - - if (settings.treeOut === null || settings.treeOut === undefined) { - settings.treeOut = tree; - } - - /* Configuration. */ - detectConfig = options.detectConfig; - hasConfig = Boolean(options.rcName || options.packageField); - - if (detectConfig && !hasConfig) { - return next(new Error( - 'Missing `rcName` or `packageField` with `detectConfig`' - )); - } - - settings.detectConfig = detectConfig === null || detectConfig === undefined ? hasConfig : detectConfig; - settings.rcName = options.rcName || null; - settings.rcPath = options.rcPath || null; - settings.packageField = options.packageField || null; - settings.settings = options.settings || {}; - settings.configTransform = options.configTransform; - settings.defaultConfig = options.defaultConfig; - - /* Ignore. */ - detectIgnore = options.detectIgnore; - hasIgnore = Boolean(options.ignoreName); - - settings.detectIgnore = detectIgnore === null || detectIgnore === undefined ? hasIgnore : detectIgnore; - settings.ignoreName = options.ignoreName || null; - settings.ignorePath = options.ignorePath || null; - settings.silentlyIgnore = Boolean(options.silentlyIgnore); - - if (detectIgnore && !hasIgnore) { - return next(new Error('Missing `ignoreName` with `detectIgnore`')); - } - - /* Plug-ins. */ - settings.pluginPrefix = options.pluginPrefix || null; - settings.plugins = options.plugins || {}; - - /* Reporting. */ - settings.reporter = options.reporter || null; - settings.reporterOptions = options.reporterOptions || null; - settings.color = options.color || false; - settings.silent = options.silent || false; - settings.quiet = options.quiet || false; - settings.frail = options.frail || false; - - /* Process. */ - fileSetPipeline.run({files: options.files || []}, settings, next); - - function next(err, context) { - var stats = vfileStatistics((context || {}).files); - var failed = Boolean(settings.frail ? stats.fatal || stats.warn : stats.fatal); - - if (err) { - callback(err); - } else { - callback(null, failed ? 1 : 0, context); - } - } -} - -var textTable = function (rows_, opts) { - if (!opts) opts = {}; - var hsep = opts.hsep === undefined ? ' ' : opts.hsep; - var align = opts.align || []; - var stringLength = opts.stringLength - || function (s) { return String(s).length; }; - - var dotsizes = reduce(rows_, function (acc, row) { - forEach(row, function (c, ix) { - var n = dotindex(c); - if (!acc[ix] || n > acc[ix]) acc[ix] = n; - }); - return acc; - }, []); - - var rows = map$2(rows_, function (row) { - return map$2(row, function (c_, ix) { - var c = String(c_); - if (align[ix] === '.') { - var index = dotindex(c); - var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) - - (stringLength(c) - index); - return c + Array(size).join(' '); - } - else return c; - }); - }); - - var sizes = reduce(rows, function (acc, row) { - forEach(row, function (c, ix) { - var n = stringLength(c); - if (!acc[ix] || n > acc[ix]) acc[ix] = n; - }); - return acc; - }, []); - - return map$2(rows, function (row) { - return map$2(row, function (c, ix) { - var n = (sizes[ix] - stringLength(c)) || 0; - var s = Array(Math.max(n + 1, 1)).join(' '); - if (align[ix] === 'r' || align[ix] === '.') { - return s + c; - } - if (align[ix] === 'c') { - return Array(Math.ceil(n / 2 + 1)).join(' ') - + c + Array(Math.floor(n / 2 + 1)).join(' ') - ; - } - - return c + s; - }).join(hsep).replace(/\s+$/, ''); - }).join('\n'); -}; - -function dotindex (c) { - var m = /\.[^.]*$/.exec(c); - return m ? m.index + 1 : c.length; -} - -function reduce (xs, f, init) { - if (xs.reduce) return xs.reduce(f, init); - var i = 0; - var acc = arguments.length >= 3 ? init : xs[i++]; - for (; i < xs.length; i++) { - f(acc, xs[i], i); - } - return acc; -} - -function forEach (xs, f) { - if (xs.forEach) return xs.forEach(f); - for (var i = 0; i < xs.length; i++) { - f.call(xs, xs[i], i); - } + } + + return file.path; } -function map$2 (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f.call(xs, xs[i], i)); - } - return res; +function plural(value, count) { + return count === 1 ? value : value + 's'; } -var camelcase = createCommonjsModule(function (module) { -const preserveCamelCase = input => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - for (let i = 0; i < input.length; i++) { - const c = input[i]; +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { - if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { - input = input.slice(0, i) + '-' + input.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; +"use strict"; + +var stripAnsi = __webpack_require__(186); +var codePointAt = __webpack_require__(188); +var isFullwidthCodePoint = __webpack_require__(189); + +// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345 +module.exports = function (str) { + if (typeof str !== 'string' || str.length === 0) { + return 0; + } + + var width = 0; + + str = stripAnsi(str); + + for (var i = 0; i < str.length; i++) { + var code = codePointAt(str, i); + + // ignore control characters + if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) { + continue; + } + + // surrogates + if (code >= 0x10000) { i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { - input = input.slice(0, i - 1) + '-' + input.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; + } + + if (isFullwidthCodePoint(code)) { + width += 2; } else { - isLastCharLower = c.toLowerCase() === c; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = c.toUpperCase() === c; + width++; } } - return input; + return width; }; -module.exports = (input, options) => { - options = Object.assign({ - pascalCase: false - }, options); - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; +/***/ }), +/* 186 */ +/***/ (function(module, exports, __webpack_require__) { - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } +"use strict"; - if (input.length === 0) { - return ''; +var ansiRegex = __webpack_require__(187)(); + +module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; +}; + + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; + + +/***/ }), +/* 188 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* eslint-disable babel/new-cap, xo/throw-new-error */ + +module.exports = function (str, pos) { + if (str === null || str === undefined) { + throw TypeError(); } - if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); + str = String(str); + + var size = str.length; + var i = pos ? Number(pos) : 0; + + if (Number.isNaN(i)) { + i = 0; } - if (/^[a-z\d]+$/.test(input)) { - return postProcess(input); + if (i < 0 || i >= size) { + return undefined; } - const hasUpperCase = input !== input.toLowerCase(); + var first = str.charCodeAt(i); - if (hasUpperCase) { - input = preserveCamelCase(input); - } + if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { + var second = str.charCodeAt(i + 1); - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); + if (second >= 0xDC00 && second <= 0xDFFF) { + return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000; + } + } - return postProcess(input); + return first; }; -}); -var unicode = createCommonjsModule(function (module, exports) { -Object.defineProperty(exports,"__esModule",{value:true});var Space_Separator=exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;var ID_Start=exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/;var ID_Continue=exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/; -}); -unwrapExports(unicode); -var unicode_1 = unicode.Space_Separator; -var unicode_2 = unicode.ID_Start; -var unicode_3 = unicode.ID_Continue; +/***/ }), +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { -var util$1 = createCommonjsModule(function (module, exports) { -Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var unicode$$1=_interopRequireWildcard(unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode$$1.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode$$1.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode$$1.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)} -}); +"use strict"; -unwrapExports(util$1); -var util_1 = util$1.isSpaceSeparator; -var util_2 = util$1.isIdStartChar; -var util_3 = util$1.isIdContinueChar; -var util_4 = util$1.isDigit; -var util_5 = util$1.isHexDigit; +var numberIsNan = __webpack_require__(190); -var parse_1$2 = createCommonjsModule(function (module, exports) { -Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=parse;var util$$1=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}var source=void 0;var parseState=void 0;var stack=void 0;var pos=void 0;var line=void 0;var column=void 0;var token=void 0;var key=void 0;var root=void 0;function parse(text,reviver){source=String(text);parseState='start';stack=[];pos=0;line=1;column=0;token=undefined;key=undefined;root=undefined;do{token=lex();parseStates[parseState]();}while(token.type!=='eof');if(typeof reviver==='function'){return internalize({'':root},'',reviver)}return root}function internalize(holder,name,reviver){var value=holder[name];if(value!=null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){for(var _key in value){var replacement=internalize(value,_key,reviver);if(replacement===undefined){delete value[_key];}else{value[_key]=replacement;}}}return reviver.call(holder,name,value)}var lexState=void 0;var buffer=void 0;var doubleQuote=void 0;var _sign=void 0;var c=void 0;function lex(){lexState='default';buffer='';doubleQuote=false;_sign=1;for(;;){c=peek();var _token=lexStates[lexState]();if(_token){return _token}}}function peek(){if(source[pos]){return String.fromCodePoint(source.codePointAt(pos))}}function read(){var c=peek();if(c==='\n'){line++;column=0;}else if(c){column+=c.length;}else{column++;}if(c){pos+=c.length;}return c}var lexStates={default:function _default(){switch(c){case'\t':case'\x0B':case'\f':case' ':case'\xA0':case'\uFEFF':case'\n':case'\r':case'\u2028':case'\u2029':read();return;case'/':read();lexState='comment';return;case undefined:read();return newToken('eof');}if(util$$1.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment:function comment(){switch(c){case'*':read();lexState='multiLineComment';return;case'/':read();lexState='singleLineComment';return;}throw invalidChar(read())},multiLineComment:function multiLineComment(){switch(c){case'*':read();lexState='multiLineCommentAsterisk';return;case undefined:throw invalidChar(read());}read();},multiLineCommentAsterisk:function multiLineCommentAsterisk(){switch(c){case'*':read();return;case'/':read();lexState='default';return;case undefined:throw invalidChar(read());}read();lexState='multiLineComment';},singleLineComment:function singleLineComment(){switch(c){case'\n':case'\r':case'\u2028':case'\u2029':read();lexState='default';return;case undefined:read();return newToken('eof');}read();},value:function value(){switch(c){case'{':case'[':return newToken('punctuator',read());case'n':read();literal('ull');return newToken('null',null);case't':read();literal('rue');return newToken('boolean',true);case'f':read();literal('alse');return newToken('boolean',false);case'-':case'+':if(read()==='-'){_sign=-1;}lexState='sign';return;case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);case'"':case'\'':doubleQuote=read()==='"';buffer='';lexState='string';return;}throw invalidChar(read())},identifierNameStartEscape:function identifierNameStartEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':break;default:if(!util$$1.isIdStartChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},identifierName:function identifierName(){switch(c){case'$':case'_':case'\u200C':case'\u200D':buffer+=read();return;case'\\':read();lexState='identifierNameEscape';return;}if(util$$1.isIdContinueChar(c)){buffer+=read();return}return newToken('identifier',buffer)},identifierNameEscape:function identifierNameEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':case'\u200C':case'\u200D':break;default:if(!util$$1.isIdContinueChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},sign:function sign(){switch(c){case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',_sign*Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);}throw invalidChar(read())},zero:function zero(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;case'x':case'X':buffer+=read();lexState='hexadecimal';return;}return newToken('numeric',_sign*0)},decimalInteger:function decimalInteger(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util$$1.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalPointLeading:function decimalPointLeading(){if(util$$1.isDigit(c)){buffer+=read();lexState='decimalFraction';return}throw invalidChar(read())},decimalPoint:function decimalPoint(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util$$1.isDigit(c)){buffer+=read();lexState='decimalFraction';return}return newToken('numeric',_sign*Number(buffer))},decimalFraction:function decimalFraction(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util$$1.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalExponent:function decimalExponent(){switch(c){case'+':case'-':buffer+=read();lexState='decimalExponentSign';return;}if(util$$1.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentSign:function decimalExponentSign(){if(util$$1.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentInteger:function decimalExponentInteger(){if(util$$1.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},hexadecimal:function hexadecimal(){if(util$$1.isHexDigit(c)){buffer+=read();lexState='hexadecimalInteger';return}throw invalidChar(read())},hexadecimalInteger:function hexadecimalInteger(){if(util$$1.isHexDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},string:function string(){switch(c){case'\\':read();buffer+=escape();return;case'"':if(doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\'':if(!doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\n':case'\r':throw invalidChar(read());case'\u2028':case'\u2029':separatorChar(c);break;case undefined:throw invalidChar(read());}buffer+=read();},start:function start(){switch(c){case'{':case'[':return newToken('punctuator',read());}lexState='value';},beforePropertyName:function beforePropertyName(){switch(c){case'$':case'_':buffer=read();lexState='identifierName';return;case'\\':read();lexState='identifierNameStartEscape';return;case'}':return newToken('punctuator',read());case'"':case'\'':doubleQuote=read()==='"';lexState='string';return;}if(util$$1.isIdStartChar(c)){buffer+=read();lexState='identifierName';return}throw invalidChar(read())},afterPropertyName:function afterPropertyName(){if(c===':'){return newToken('punctuator',read())}throw invalidChar(read())},beforePropertyValue:function beforePropertyValue(){lexState='value';},afterPropertyValue:function afterPropertyValue(){switch(c){case',':case'}':return newToken('punctuator',read());}throw invalidChar(read())},beforeArrayValue:function beforeArrayValue(){if(c===']'){return newToken('punctuator',read())}lexState='value';},afterArrayValue:function afterArrayValue(){switch(c){case',':case']':return newToken('punctuator',read());}throw invalidChar(read())},end:function end(){throw invalidChar(read())}};function newToken(type,value){return{type:type,value:value,line:line,column:column}}function literal(s){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _c=_step.value;var p=peek();if(p!==_c){throw invalidChar(read())}read();}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}function escape(){var c=peek();switch(c){case'b':read();return'\b';case'f':read();return'\f';case'n':read();return'\n';case'r':read();return'\r';case't':read();return'\t';case'v':read();return'\x0B';case'0':read();if(util$$1.isDigit(peek())){throw invalidChar(read())}return'\0';case'x':read();return hexEscape();case'u':read();return unicodeEscape();case'\n':case'\u2028':case'\u2029':read();return'';case'\r':read();if(peek()==='\n'){read();}return'';case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':throw invalidChar(read());case undefined:throw invalidChar(read());}return read()}function hexEscape(){var buffer='';var c=peek();if(!util$$1.isHexDigit(c)){throw invalidChar(read())}buffer+=read();c=peek();if(!util$$1.isHexDigit(c)){throw invalidChar(read())}buffer+=read();return String.fromCodePoint(parseInt(buffer,16))}function unicodeEscape(){var buffer='';var count=4;while(count-->0){var _c2=peek();if(!util$$1.isHexDigit(_c2)){throw invalidChar(read())}buffer+=read();}return String.fromCodePoint(parseInt(buffer,16))}var parseStates={start:function start(){if(token.type==='eof'){throw invalidEOF()}push();},beforePropertyName:function beforePropertyName(){switch(token.type){case'identifier':case'string':key=token.value;parseState='afterPropertyName';return;case'punctuator':pop();return;case'eof':throw invalidEOF();}},afterPropertyName:function afterPropertyName(){if(token.type==='eof'){throw invalidEOF()}parseState='beforePropertyValue';},beforePropertyValue:function beforePropertyValue(){if(token.type==='eof'){throw invalidEOF()}push();},beforeArrayValue:function beforeArrayValue(){if(token.type==='eof'){throw invalidEOF()}if(token.type==='punctuator'&&token.value===']'){pop();return}push();},afterPropertyValue:function afterPropertyValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforePropertyName';return;case'}':pop();}},afterArrayValue:function afterArrayValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforeArrayValue';return;case']':pop();}},end:function end(){}};function push(){var value=void 0;switch(token.type){case'punctuator':switch(token.value){case'{':value={};break;case'[':value=[];break;}break;case'null':case'boolean':case'numeric':case'string':value=token.value;break;}if(root===undefined){root=value;}else{var parent=stack[stack.length-1];if(Array.isArray(parent)){parent.push(value);}else{parent[key]=value;}}if(value!==null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){stack.push(value);if(Array.isArray(value)){parseState='beforeArrayValue';}else{parseState='beforePropertyName';}}else{var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else{parseState='afterPropertyValue';}}}function pop(){stack.pop();var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else{parseState='afterPropertyValue';}}function invalidChar(c){if(c===undefined){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}return syntaxError('JSON5: invalid character \''+formatChar(c)+'\' at '+line+':'+column)}function invalidEOF(){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}function invalidIdentifier(){column-=5;return syntaxError('JSON5: invalid identifier character at '+line+':'+column)}function separatorChar(c){console.warn('JSON5: \''+c+'\' is not valid ECMAScript; consider escaping');}function formatChar(c){var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};if(replacements[c]){return replacements[c]}if(c<' '){var hexString=c.charCodeAt(0).toString(16);return'\\x'+('00'+hexString).substring(hexString.length)}return c}function syntaxError(message){var err=new SyntaxError(message);err.lineNumber=line;err.columnNumber=column;return err}module.exports=exports['default']; -}); +module.exports = function (x) { + if (numberIsNan(x)) { + return false; + } -unwrapExports(parse_1$2); + // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369 -var stringify_1$2 = createCommonjsModule(function (module, exports) { -Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=stringify;var util$$1=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function stringify(value,replacer,space){var stack=[];var indent='';var propertyList=void 0;var replacerFunc=void 0;var gap='';var quote=void 0;if(replacer!=null&&(typeof replacer==='undefined'?'undefined':_typeof(replacer))==='object'&&!Array.isArray(replacer)){space=replacer.space;quote=replacer.quote;replacer=replacer.replacer;}if(typeof replacer==='function'){replacerFunc=replacer;}else if(Array.isArray(replacer)){propertyList=[];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=replacer[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;var item=void 0;if(typeof v==='string'){item=v;}else if(typeof v==='number'||v instanceof String||v instanceof Number){item=String(v);}if(item!==undefined&&propertyList.indexOf(item)<0){propertyList.push(item);}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}if(space instanceof Number){space=Number(space);}else if(space instanceof String){space=String(space);}if(typeof space==='number'){if(space>0){space=Math.min(10,Math.floor(space));gap=' '.substr(0,space);}}else if(typeof space==='string'){gap=space.substr(0,10);}return serializeProperty('',{'':value});function serializeProperty(key,holder){var value=holder[key];if(value!=null){if(typeof value.toJSON5==='function'){value=value.toJSON5(key);}else if(typeof value.toJSON==='function'){value=value.toJSON(key);}}if(replacerFunc){value=replacerFunc.call(holder,key,value);}if(value instanceof Number){value=Number(value);}else if(value instanceof String){value=String(value);}else if(value instanceof Boolean){value=value.valueOf();}switch(value){case null:return'null';case true:return'true';case false:return'false';}if(typeof value==='string'){return quoteString(value,false)}if(typeof value==='number'){return String(value)}if((typeof value==='undefined'?'undefined':_typeof(value))==='object'){return Array.isArray(value)?serializeArray(value):serializeObject(value)}return undefined}function quoteString(value){var quotes={'\'':0.1,'"':0.2};var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};var product='';var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=value[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var c=_step2.value;switch(c){case'\'':case'"':quotes[c]++;product+=c;continue;}if(replacements[c]){product+=replacements[c];continue}if(c<' '){var hexString=c.charCodeAt(0).toString(16);product+='\\x'+('00'+hexString).substring(hexString.length);continue}product+=c;}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2}}}var quoteChar=quote||Object.keys(quotes).reduce(function(a,b){return quotes[a]=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var keys=propertyList||Object.keys(value);var partial=[];var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=keys[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var key=_step3.value;var propertyString=serializeProperty(key,value);if(propertyString!==undefined){var member=serializeKey(key)+':';if(gap!==''){member+=' ';}member+=propertyString;partial.push(member);}}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3}}}var final=void 0;if(partial.length===0){final='{}';}else{var properties=void 0;if(gap===''){properties=partial.join(',');final='{'+properties+'}';}else{var separator=',\n'+indent;properties=partial.join(separator);final='{\n'+indent+properties+',\n'+stepback+'}';}}stack.pop();indent=stepback;return final}function serializeKey(key){if(key.length===0){return quoteString(key,true)}var firstChar=String.fromCodePoint(key.codePointAt(0));if(!util$$1.isIdStartChar(firstChar)){return quoteString(key,true)}for(var i=firstChar.length;i=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var partial=[];for(var i=0;i= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + 0x2329 === x || // LEFT-POINTING ANGLE BRACKET + 0x232a === x || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + 0x3250 <= x && x <= 0x4dbf || + // CJK Unified Ideographs .. Yi Radicals + 0x4e00 <= x && x <= 0xa4c6 || + // Hangul Jamo Extended-A + 0xa960 <= x && x <= 0xa97c || + // Hangul Syllables + 0xac00 <= x && x <= 0xd7a3 || + // CJK Compatibility Ideographs + 0xf900 <= x && x <= 0xfaff || + // Vertical Forms + 0xfe10 <= x && x <= 0xfe19 || + // CJK Compatibility Forms .. Small Form Variants + 0xfe30 <= x && x <= 0xfe6b || + // Halfwidth and Fullwidth Forms + 0xff01 <= x && x <= 0xff60 || + 0xffe0 <= x && x <= 0xffe6 || + // Kana Supplement + 0x1b000 <= x && x <= 0x1b001 || + // Enclosed Ideographic Supplement + 0x1f200 <= x && x <= 0x1f251 || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + 0x20000 <= x && x <= 0x3fffd)) { + return true; + } + + return false; +} -unwrapExports(stringify_1$2); -var lib$4 = createCommonjsModule(function (module, exports) { -Object.defineProperty(exports,'__esModule',{value:true});var _parse2=_interopRequireDefault(parse_1$2);var _stringify2=_interopRequireDefault(stringify_1$2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default']; -}); +/***/ }), +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { -unwrapExports(lib$4); +"use strict"; -var schema$2 = [ - { - "long": "help", - "description": "output usage information", - "short": "h", - "type": "boolean", - "default": false - }, - { - "long": "version", - "description": "output version number", - "short": "v", - "type": "boolean", - "default": false - }, - { - "long": "output", - "description": "specify output location", - "short": "o", - "value": "[path]" - }, - { - "long": "rc-path", - "description": "specify configuration file", - "short": "r", - "type": "string", - "value": "" - }, - { - "long": "ignore-path", - "description": "specify ignore file", - "short": "i", - "type": "string", - "value": "" - }, - { - "long": "setting", - "description": "specify settings", - "short": "s", - "type": "string", - "value": "" - }, - { - "long": "ext", - "description": "specify extensions", - "short": "e", - "type": "string", - "value": "" - }, - { - "long": "use", - "description": "use plugins", - "short": "u", - "type": "string", - "value": "" - }, - { - "long": "watch", - "description": "watch for changes and reprocess", - "short": "w", - "type": "boolean", - "default": false - }, - { - "long": "quiet", - "description": "output only warnings and errors", - "short": "q", - "type": "boolean", - "default": false - }, - { - "long": "silent", - "description": "output only errors", - "short": "S", - "type": "boolean", - "default": false - }, - { - "long": "frail", - "description": "exit with 1 on warnings", - "short": "f", - "type": "boolean", - "default": false - }, - { - "long": "tree", - "description": "specify input and output as syntax tree", - "short": "t", - "type": "boolean", - "default": false - }, - { - "long": "report", - "description": "specify reporter", - "type": "string", - "value": "" - }, - { - "long": "file-path", - "description": "specify path to process as", - "type": "string", - "value": "" - }, - { - "long": "tree-in", - "description": "specify input as syntax tree", - "type": "boolean" - }, - { - "long": "tree-out", - "description": "output syntax tree", - "type": "boolean" - }, - { - "long": "inspect", - "description": "output formatted syntax tree", - "type": "boolean" - }, - { - "long": "stdout", - "description": "specify writing to stdout", - "type": "boolean", - "truelike": true - }, - { - "long": "color", - "description": "specify color in report", - "type": "boolean", - "default": true - }, - { - "long": "config", - "description": "search for configuration files", - "type": "boolean", - "default": true - }, - { - "long": "ignore", - "description": "search for ignore files", - "type": "boolean", - "default": true - } -] -; +module.exports = Number.isNaN || function (x) { + return x !== x; +}; -var schema$3 = Object.freeze({ - default: schema$2 -}); -var schema$4 = ( schema$3 && schema$2 ) || schema$3; +/***/ }), +/* 191 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + -var options_1 = options; +var table = __webpack_require__(192) +var camelcase = __webpack_require__(193) +var minimist = __webpack_require__(56) +var json5 = __webpack_require__(194) +var fault = __webpack_require__(34) +var schema = __webpack_require__(198) + +module.exports = options /* Schema for `minimist`. */ var minischema = { @@ -14129,30 +26333,30 @@ var minischema = { alias: {}, string: [], boolean: [] -}; +} -schema$4.forEach(addEach); +schema.forEach(addEach) /* Parse CLI options. */ function options(flags, configuration) { - var extension = configuration.extensions[0]; - var name = configuration.name; - var config = toCamelCase(minimist(flags, minischema)); - var help; - var ext; - var report; - - schema$4.forEach(function(option) { + var extension = configuration.extensions[0] + var name = configuration.name + var config = toCamelCase(minimist(flags, minischema)) + var help + var ext + var report + + schema.forEach(function(option) { if (option.type === 'string' && config[option.long] === '') { - throw fault_1('Missing value:%s', inspect$2(option).join(' ')) + throw fault('Missing value:%s', inspect(option).join(' ')) } - }); + }) - ext = extensions(config.ext); - report = reporter$1(config.report); + ext = extensions(config.ext) + report = reporter(config.report) help = [ - inspectAll(schema$4), + inspectAll(schema), '', 'Examples:', '', @@ -14164,7 +26368,7 @@ function options(flags, configuration) { '', ' # Rewrite all applicable files', ' $ ' + name + ' . -o' - ].join('\n'); + ].join('\n') return { helpMessage: help, @@ -14202,75 +26406,75 @@ function options(flags, configuration) { } function addEach(option) { - var value = option.default; + var value = option.default - minischema.default[option.long] = value === undefined ? null : value; + minischema.default[option.long] = value === undefined ? null : value if (option.type in minischema) { - minischema[option.type].push(option.long); + minischema[option.type].push(option.long) } if (option.short) { - minischema.alias[option.short] = option.long; + minischema.alias[option.short] = option.long } } /* Parse `extensions`. */ function extensions(value) { - return flatten(normalize$1(value).map(splitList)) + return flatten(normalize(value).map(splitList)) } /* Parse `plugins`. */ function plugins(value) { - var result = {}; + var result = {} - normalize$1(value) + normalize(value) .map(splitOptions) .forEach(function(value) { - result[value[0]] = value[1] ? parseConfig(value[1], {}) : null; - }); + result[value[0]] = value[1] ? parseConfig(value[1], {}) : null + }) return result } /* Parse `reporter`: only one is accepted. */ -function reporter$1(value) { - var all = normalize$1(value) +function reporter(value) { + var all = normalize(value) .map(splitOptions) .map(function(value) { return [value[0], value[1] ? parseConfig(value[1], {}) : null] - }); + }) return all[all.length - 1] || [] } /* Parse `settings`. */ function settings(value) { - var cache = {}; + var cache = {} - normalize$1(value).forEach(function(value) { - parseConfig(value, cache); - }); + normalize(value).forEach(function(value) { + parseConfig(value, cache) + }) return cache } /* Parse configuration. */ function parseConfig(flags, cache) { - var flag; - var message; + var flag + var message try { - flags = toCamelCase(parseJSON(flags)); + flags = toCamelCase(parseJSON(flags)) } catch (err) { /* Fix position */ - message = err.message.replace(/at(?= position)/, 'around'); + message = err.message.replace(/at(?= position)/, 'around') - throw fault_1('Cannot parse `%s` as JSON: %s', flags, message) + throw fault('Cannot parse `%s` as JSON: %s', flags, message) } for (flag in flags) { - cache[flag] = flags[flag]; + cache[flag] = flags[flag] } return cache @@ -14285,32 +26489,32 @@ function handleUnknownArgument(flag) { /* Long options. Always unknown. */ if (flag.charAt(1) === '-') { - throw fault_1('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema$4)) + throw fault('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema)) } /* Short options. Can be grouped. */ flag .slice(1) .split('') - .forEach(each); + .forEach(each) function each(key) { - var length = schema$4.length; - var index = -1; - var option; + var length = schema.length + var index = -1 + var option while (++index < length) { - option = schema$4[index]; + option = schema[index] if (option.short === key) { return } } - throw fault_1( + throw fault( 'Unknown short option `-%s`, expected:\n%s', key, - inspectAll(schema$4.filter(short)) + inspectAll(schema.filter(short)) ) } @@ -14321,17 +26525,17 @@ function handleUnknownArgument(flag) { /* Inspect all `options`. */ function inspectAll(options) { - return textTable(options.map(inspect$2)) + return table(options.map(inspect)) } /* Inspect one `option`. */ -function inspect$2(option) { - var description = option.description; - var long = option.long; +function inspect(option) { + var description = option.description + var long = option.long if (option.default === true || option.truelike) { - description += ' (on by default)'; - long = '[no-]' + long; + description += ' (on by default)' + long = '[no-]' + long } return [ @@ -14343,7 +26547,7 @@ function inspect$2(option) { } /* Normalize `value`. */ -function normalize$1(value) { +function normalize(value) { if (!value) { return [] } @@ -14352,7 +26556,7 @@ function normalize$1(value) { return [value] } - return flatten(value.map(normalize$1)) + return flatten(value.map(normalize)) } /* Flatten `values`. */ @@ -14371,473 +26575,353 @@ function splitList(value) { /* Transform the keys on an object to camel-case, * recursivly. */ function toCamelCase(object) { - var result = {}; - var value; - var key; - - for (key in object) { - value = object[key]; - - if (value && typeof value === 'object' && !('length' in value)) { - value = toCamelCase(value); - } - - result[camelcase(key)] = value; - } - - return result -} - -/* Parse a (lazy?) JSON config. */ -function parseJSON(value) { - return lib$4.parse('{' + value + '}') -} - -var markdownExtensions = [ - "md", - "markdown", - "mdown", - "mkdn", - "mkd", - "mdwn", - "mkdown", - "ron" -] -; - -var markdownExtensions$1 = Object.freeze({ - default: markdownExtensions -}); - -var require$$0$14 = ( markdownExtensions$1 && markdownExtensions ) || markdownExtensions$1; - -var markdownExtensions$2 = require$$0$14; - -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; -var defineProperty = Object.defineProperty; -var gOPD = Object.getOwnPropertyDescriptor; - -var isArray$2 = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; -}; - -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) { /**/ } + var result = {} + var value + var key - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; + for (key in object) { + value = object[key] -// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target -var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } -}; + if (value && typeof value === 'object' && !('length' in value)) { + value = toCamelCase(value) + } -// Return undefined instead of __proto__ if '__proto__' is not an own property -var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - // In early versions of node, obj['__proto__'] is buggy when obj has - // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. - return gOPD(obj, name).value; - } - } + result[camelcase(key)] = value + } - return obj[name]; -}; + return result +} -var extend$3 = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; +/* Parse a (lazy?) JSON config. */ +function parseJSON(value) { + return json5.parse('{' + value + '}') +} - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { - target = {}; - } - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); +/***/ }), +/* 192 */ +/***/ (function(module, exports) { - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray$2(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray$2(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } +module.exports = function (rows_, opts) { + if (!opts) opts = {}; + var hsep = opts.hsep === undefined ? ' ' : opts.hsep; + var align = opts.align || []; + var stringLength = opts.stringLength + || function (s) { return String(s).length; } + ; - // Never move original objects, clone them - setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); + var dotsizes = reduce(rows_, function (acc, row) { + forEach(row, function (c, ix) { + var n = dotindex(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } - } - } - } + var rows = map(rows_, function (row) { + return map(row, function (c_, ix) { + var c = String(c_); + if (align[ix] === '.') { + var index = dotindex(c); + var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) + - (stringLength(c) - index) + ; + return c + Array(size).join(' '); + } + else return c; + }); + }); - // Return the modified object - return target; + var sizes = reduce(rows, function (acc, row) { + forEach(row, function (c, ix) { + var n = stringLength(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + return map(rows, function (row) { + return map(row, function (c, ix) { + var n = (sizes[ix] - stringLength(c)) || 0; + var s = Array(Math.max(n + 1, 1)).join(' '); + if (align[ix] === 'r' || align[ix] === '.') { + return s + c; + } + if (align[ix] === 'c') { + return Array(Math.ceil(n / 2 + 1)).join(' ') + + c + Array(Math.floor(n / 2 + 1)).join(' ') + ; + } + + return c + s; + }).join(hsep).replace(/\s+$/, ''); + }).join('\n'); }; -var bail_1 = bail; +function dotindex (c) { + var m = /\.[^.]*$/.exec(c); + return m ? m.index + 1 : c.length; +} -function bail(err) { - if (err) { - throw err - } +function reduce (xs, f, init) { + if (xs.reduce) return xs.reduce(f, init); + var i = 0; + var acc = arguments.length >= 3 ? init : xs[i++]; + for (; i < xs.length; i++) { + f(acc, xs[i], i); + } + return acc; } -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ +function forEach (xs, f) { + if (xs.forEach) return xs.forEach(f); + for (var i = 0; i < xs.length; i++) { + f.call(xs, xs[i], i); + } +} -var isBuffer$1 = function isBuffer (obj) { - return obj != null && obj.constructor != null && - typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -}; +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f.call(xs, xs[i], i)); + } + return res; +} -var core$6 = VFile$2; -var own$2 = {}.hasOwnProperty; -var proto$3 = VFile$2.prototype; +/***/ }), +/* 193 */ +/***/ (function(module, exports, __webpack_require__) { -proto$3.toString = toString$4; +"use strict"; -// Order of setting (least specific to most), we need this because otherwise -// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a -// stem can be set. -var order$1 = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; -// Construct a new file. -function VFile$2(options) { - var prop; - var index; - var length; +const preserveCamelCase = input => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; - if (!options) { - options = {}; - } else if (typeof options === 'string' || isBuffer$1(options)) { - options = {contents: options}; - } else if ('message' in options && 'messages' in options) { - return options - } + for (let i = 0; i < input.length; i++) { + const c = input[i]; - if (!(this instanceof VFile$2)) { - return new VFile$2(options) - } + if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { + input = input.slice(0, i) + '-' + input.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { + input = input.slice(0, i - 1) + '-' + input.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = c.toLowerCase() === c; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = c.toUpperCase() === c; + } + } - this.data = {}; - this.messages = []; - this.history = []; - this.cwd = process.cwd(); + return input; +}; - // Set path related properties in the correct order. - index = -1; - length = order$1.length; +module.exports = (input, options) => { + options = Object.assign({ + pascalCase: false + }, options); - while (++index < length) { - prop = order$1[index]; + const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; - if (own$2.call(options, prop)) { - this[prop] = options[prop]; - } - } + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } - // Set non-path related properties. - for (prop in options) { - if (order$1.indexOf(prop) === -1) { - this[prop] = options[prop]; - } - } -} + if (input.length === 0) { + return ''; + } -// Access full path (`~/index.min.js`). -Object.defineProperty(proto$3, 'path', { - get: function() { - return this.history[this.history.length - 1] - }, - set: function(path$$1) { - assertNonEmpty$1(path$$1, 'path'); + if (input.length === 1) { + return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); + } - if (path$$1 !== this.path) { - this.history.push(path$$1); - } - } -}); + if (/^[a-z\d]+$/.test(input)) { + return postProcess(input); + } -// Access parent path (`~`). -Object.defineProperty(proto$3, 'dirname', { - get: function() { - return typeof this.path === 'string' ? path.dirname(this.path) : undefined - }, - set: function(dirname) { - assertPath$1(this.path, 'dirname'); - this.path = path.join(dirname || '', this.basename); - } -}); + const hasUpperCase = input !== input.toLowerCase(); + + if (hasUpperCase) { + input = preserveCamelCase(input); + } -// Access basename (`index.min.js`). -Object.defineProperty(proto$3, 'basename', { - get: function() { - return typeof this.path === 'string' ? path.basename(this.path) : undefined - }, - set: function(basename) { - assertNonEmpty$1(basename, 'basename'); - assertPart$1(basename, 'basename'); - this.path = path.join(this.dirname || '', basename); - } -}); + input = input + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); -// Access extname (`.js`). -Object.defineProperty(proto$3, 'extname', { - get: function() { - return typeof this.path === 'string' ? path.extname(this.path) : undefined - }, - set: function(extname) { - var ext = extname || ''; + return postProcess(input); +}; - assertPart$1(ext, 'extname'); - assertPath$1(this.path, 'extname'); - if (ext) { - if (ext.charAt(0) !== '.') { - throw new Error('`extname` must start with `.`') - } +/***/ }), +/* 194 */ +/***/ (function(module, exports, __webpack_require__) { - if (ext.indexOf('.', 1) !== -1) { - throw new Error('`extname` cannot contain multiple dots') - } - } +"use strict"; +Object.defineProperty(exports,'__esModule',{value:true});var _parse=__webpack_require__(195);var _parse2=_interopRequireDefault(_parse);var _stringify=__webpack_require__(197);var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default']; - this.path = replaceExt_1(this.path, ext); - } -}); +/***/ }), +/* 195 */ +/***/ (function(module, exports, __webpack_require__) { -// Access stem (`index.min`). -Object.defineProperty(proto$3, 'stem', { - get: function() { - return typeof this.path === 'string' - ? path.basename(this.path, this.extname) - : undefined - }, - set: function(stem) { - assertNonEmpty$1(stem, 'stem'); - assertPart$1(stem, 'stem'); - this.path = path.join(this.dirname || '', stem + (this.extname || '')); - } -}); +"use strict"; +Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=parse;var _util=__webpack_require__(74);var util=_interopRequireWildcard(_util);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}var source=void 0;var parseState=void 0;var stack=void 0;var pos=void 0;var line=void 0;var column=void 0;var token=void 0;var key=void 0;var root=void 0;function parse(text,reviver){source=String(text);parseState='start';stack=[];pos=0;line=1;column=0;token=undefined;key=undefined;root=undefined;do{token=lex();parseStates[parseState]()}while(token.type!=='eof');if(typeof reviver==='function'){return internalize({'':root},'',reviver)}return root}function internalize(holder,name,reviver){var value=holder[name];if(value!=null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){for(var _key in value){var replacement=internalize(value,_key,reviver);if(replacement===undefined){delete value[_key]}else{value[_key]=replacement}}}return reviver.call(holder,name,value)}var lexState=void 0;var buffer=void 0;var doubleQuote=void 0;var _sign=void 0;var c=void 0;function lex(){lexState='default';buffer='';doubleQuote=false;_sign=1;for(;;){c=peek();var _token=lexStates[lexState]();if(_token){return _token}}}function peek(){if(source[pos]){return String.fromCodePoint(source.codePointAt(pos))}}function read(){var c=peek();if(c==='\n'){line++;column=0}else if(c){column+=c.length}else{column++}if(c){pos+=c.length}return c}var lexStates={default:function _default(){switch(c){case'\t':case'\x0B':case'\f':case' ':case'\xA0':case'\uFEFF':case'\n':case'\r':case'\u2028':case'\u2029':read();return;case'/':read();lexState='comment';return;case undefined:read();return newToken('eof');}if(util.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment:function comment(){switch(c){case'*':read();lexState='multiLineComment';return;case'/':read();lexState='singleLineComment';return;}throw invalidChar(read())},multiLineComment:function multiLineComment(){switch(c){case'*':read();lexState='multiLineCommentAsterisk';return;case undefined:throw invalidChar(read());}read()},multiLineCommentAsterisk:function multiLineCommentAsterisk(){switch(c){case'*':read();return;case'/':read();lexState='default';return;case undefined:throw invalidChar(read());}read();lexState='multiLineComment'},singleLineComment:function singleLineComment(){switch(c){case'\n':case'\r':case'\u2028':case'\u2029':read();lexState='default';return;case undefined:read();return newToken('eof');}read()},value:function value(){switch(c){case'{':case'[':return newToken('punctuator',read());case'n':read();literal('ull');return newToken('null',null);case't':read();literal('rue');return newToken('boolean',true);case'f':read();literal('alse');return newToken('boolean',false);case'-':case'+':if(read()==='-'){_sign=-1}lexState='sign';return;case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);case'"':case'\'':doubleQuote=read()==='"';buffer='';lexState='string';return;}throw invalidChar(read())},identifierNameStartEscape:function identifierNameStartEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':break;default:if(!util.isIdStartChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName'},identifierName:function identifierName(){switch(c){case'$':case'_':case'\u200C':case'\u200D':buffer+=read();return;case'\\':read();lexState='identifierNameEscape';return;}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken('identifier',buffer)},identifierNameEscape:function identifierNameEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':case'\u200C':case'\u200D':break;default:if(!util.isIdContinueChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName'},sign:function sign(){switch(c){case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',_sign*Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);}throw invalidChar(read())},zero:function zero(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;case'x':case'X':buffer+=read();lexState='hexadecimal';return;}return newToken('numeric',_sign*0)},decimalInteger:function decimalInteger(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalPointLeading:function decimalPointLeading(){if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}throw invalidChar(read())},decimalPoint:function decimalPoint(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}return newToken('numeric',_sign*Number(buffer))},decimalFraction:function decimalFraction(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalExponent:function decimalExponent(){switch(c){case'+':case'-':buffer+=read();lexState='decimalExponentSign';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentSign:function decimalExponentSign(){if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentInteger:function decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},hexadecimal:function hexadecimal(){if(util.isHexDigit(c)){buffer+=read();lexState='hexadecimalInteger';return}throw invalidChar(read())},hexadecimalInteger:function hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},string:function string(){switch(c){case'\\':read();buffer+=escape();return;case'"':if(doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\'':if(!doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\n':case'\r':throw invalidChar(read());case'\u2028':case'\u2029':separatorChar(c);break;case undefined:throw invalidChar(read());}buffer+=read()},start:function start(){switch(c){case'{':case'[':return newToken('punctuator',read());}lexState='value'},beforePropertyName:function beforePropertyName(){switch(c){case'$':case'_':buffer=read();lexState='identifierName';return;case'\\':read();lexState='identifierNameStartEscape';return;case'}':return newToken('punctuator',read());case'"':case'\'':doubleQuote=read()==='"';lexState='string';return;}if(util.isIdStartChar(c)){buffer+=read();lexState='identifierName';return}throw invalidChar(read())},afterPropertyName:function afterPropertyName(){if(c===':'){return newToken('punctuator',read())}throw invalidChar(read())},beforePropertyValue:function beforePropertyValue(){lexState='value'},afterPropertyValue:function afterPropertyValue(){switch(c){case',':case'}':return newToken('punctuator',read());}throw invalidChar(read())},beforeArrayValue:function beforeArrayValue(){if(c===']'){return newToken('punctuator',read())}lexState='value'},afterArrayValue:function afterArrayValue(){switch(c){case',':case']':return newToken('punctuator',read());}throw invalidChar(read())},end:function end(){throw invalidChar(read())}};function newToken(type,value){return{type:type,value:value,line:line,column:column}}function literal(s){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _c=_step.value;var p=peek();if(p!==_c){throw invalidChar(read())}read()}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}function escape(){var c=peek();switch(c){case'b':read();return'\b';case'f':read();return'\f';case'n':read();return'\n';case'r':read();return'\r';case't':read();return'\t';case'v':read();return'\x0B';case'0':read();if(util.isDigit(peek())){throw invalidChar(read())}return'\0';case'x':read();return hexEscape();case'u':read();return unicodeEscape();case'\n':case'\u2028':case'\u2029':read();return'';case'\r':read();if(peek()==='\n'){read()}return'';case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':throw invalidChar(read());case undefined:throw invalidChar(read());}return read()}function hexEscape(){var buffer='';var c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();return String.fromCodePoint(parseInt(buffer,16))}function unicodeEscape(){var buffer='';var count=4;while(count-->0){var _c2=peek();if(!util.isHexDigit(_c2)){throw invalidChar(read())}buffer+=read()}return String.fromCodePoint(parseInt(buffer,16))}var parseStates={start:function start(){if(token.type==='eof'){throw invalidEOF()}push()},beforePropertyName:function beforePropertyName(){switch(token.type){case'identifier':case'string':key=token.value;parseState='afterPropertyName';return;case'punctuator':pop();return;case'eof':throw invalidEOF();}},afterPropertyName:function afterPropertyName(){if(token.type==='eof'){throw invalidEOF()}parseState='beforePropertyValue'},beforePropertyValue:function beforePropertyValue(){if(token.type==='eof'){throw invalidEOF()}push()},beforeArrayValue:function beforeArrayValue(){if(token.type==='eof'){throw invalidEOF()}if(token.type==='punctuator'&&token.value===']'){pop();return}push()},afterPropertyValue:function afterPropertyValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforePropertyName';return;case'}':pop();}},afterArrayValue:function afterArrayValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforeArrayValue';return;case']':pop();}},end:function end(){}};function push(){var value=void 0;switch(token.type){case'punctuator':switch(token.value){case'{':value={};break;case'[':value=[];break;}break;case'null':case'boolean':case'numeric':case'string':value=token.value;break;}if(root===undefined){root=value}else{var parent=stack[stack.length-1];if(Array.isArray(parent)){parent.push(value)}else{parent[key]=value}}if(value!==null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){stack.push(value);if(Array.isArray(value)){parseState='beforeArrayValue'}else{parseState='beforePropertyName'}}else{var current=stack[stack.length-1];if(current==null){parseState='end'}else if(Array.isArray(current)){parseState='afterArrayValue'}else{parseState='afterPropertyValue'}}}function pop(){stack.pop();var current=stack[stack.length-1];if(current==null){parseState='end'}else if(Array.isArray(current)){parseState='afterArrayValue'}else{parseState='afterPropertyValue'}}function invalidChar(c){if(c===undefined){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}return syntaxError('JSON5: invalid character \''+formatChar(c)+'\' at '+line+':'+column)}function invalidEOF(){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}function invalidIdentifier(){column-=5;return syntaxError('JSON5: invalid identifier character at '+line+':'+column)}function separatorChar(c){console.warn('JSON5: \''+c+'\' is not valid ECMAScript; consider escaping')}function formatChar(c){var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};if(replacements[c]){return replacements[c]}if(c<' '){var hexString=c.charCodeAt(0).toString(16);return'\\x'+('00'+hexString).substring(hexString.length)}return c}function syntaxError(message){var err=new SyntaxError(message);err.lineNumber=line;err.columnNumber=column;return err}module.exports=exports['default']; -// Get the value of the file. -function toString$4(encoding) { - var value = this.contents || ''; - return isBuffer$1(value) ? value.toString(encoding) : String(value) -} +/***/ }), +/* 196 */ +/***/ (function(module, exports, __webpack_require__) { -// Assert that `part` is not a path (i.e., does not contain `path.sep`). -function assertPart$1(part, name) { - if (part.indexOf(path.sep) !== -1) { - throw new Error( - '`' + name + '` cannot be a path: did not expect `' + path.sep + '`' - ) - } -} +"use strict"; +Object.defineProperty(exports,"__esModule",{value:true});var Space_Separator=exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;var ID_Start=exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/;var ID_Continue=exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/; -// Assert that `part` is not empty. -function assertNonEmpty$1(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty') - } -} +/***/ }), +/* 197 */ +/***/ (function(module, exports, __webpack_require__) { -// Assert `path` exists. -function assertPath$1(path$$1, name) { - if (!path$$1) { - throw new Error('Setting `' + name + '` requires `path` to be set too') - } -} +"use strict"; +Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=stringify;var _util=__webpack_require__(74);var util=_interopRequireWildcard(_util);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function stringify(value,replacer,space){var stack=[];var indent='';var propertyList=void 0;var replacerFunc=void 0;var gap='';var quote=void 0;if(replacer!=null&&(typeof replacer==='undefined'?'undefined':_typeof(replacer))==='object'&&!Array.isArray(replacer)){space=replacer.space;quote=replacer.quote;replacer=replacer.replacer}if(typeof replacer==='function'){replacerFunc=replacer}else if(Array.isArray(replacer)){propertyList=[];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=replacer[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;var item=void 0;if(typeof v==='string'){item=v}else if(typeof v==='number'||v instanceof String||v instanceof Number){item=String(v)}if(item!==undefined&&propertyList.indexOf(item)<0){propertyList.push(item)}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}if(space instanceof Number){space=Number(space)}else if(space instanceof String){space=String(space)}if(typeof space==='number'){if(space>0){space=Math.min(10,Math.floor(space));gap=' '.substr(0,space)}}else if(typeof space==='string'){gap=space.substr(0,10)}return serializeProperty('',{'':value});function serializeProperty(key,holder){var value=holder[key];if(value!=null){if(typeof value.toJSON5==='function'){value=value.toJSON5(key)}else if(typeof value.toJSON==='function'){value=value.toJSON(key)}}if(replacerFunc){value=replacerFunc.call(holder,key,value)}if(value instanceof Number){value=Number(value)}else if(value instanceof String){value=String(value)}else if(value instanceof Boolean){value=value.valueOf()}switch(value){case null:return'null';case true:return'true';case false:return'false';}if(typeof value==='string'){return quoteString(value,false)}if(typeof value==='number'){return String(value)}if((typeof value==='undefined'?'undefined':_typeof(value))==='object'){return Array.isArray(value)?serializeArray(value):serializeObject(value)}return undefined}function quoteString(value){var quotes={'\'':0.1,'"':0.2};var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};var product='';var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=value[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var c=_step2.value;switch(c){case'\'':case'"':quotes[c]++;product+=c;continue;}if(replacements[c]){product+=replacements[c];continue}if(c<' '){var hexString=c.charCodeAt(0).toString(16);product+='\\x'+('00'+hexString).substring(hexString.length);continue}product+=c}}catch(err){_didIteratorError2=true;_iteratorError2=err}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return()}}finally{if(_didIteratorError2){throw _iteratorError2}}}var quoteChar=quote||Object.keys(quotes).reduce(function(a,b){return quotes[a]=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var keys=propertyList||Object.keys(value);var partial=[];var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=keys[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var key=_step3.value;var propertyString=serializeProperty(key,value);if(propertyString!==undefined){var member=serializeKey(key)+':';if(gap!==''){member+=' '}member+=propertyString;partial.push(member)}}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var final=void 0;if(partial.length===0){final='{}'}else{var properties=void 0;if(gap===''){properties=partial.join(',');final='{'+properties+'}'}else{var separator=',\n'+indent;properties=partial.join(separator);final='{\n'+indent+properties+',\n'+stepback+'}'}}stack.pop();indent=stepback;return final}function serializeKey(key){if(key.length===0){return quoteString(key,true)}var firstChar=String.fromCodePoint(key.codePointAt(0));if(!util.isIdStartChar(firstChar)){return quoteString(key,true)}for(var i=firstChar.length;i=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var partial=[];for(var i=0;i"},{"long":"ignore-path","description":"specify ignore file","short":"i","type":"string","value":""},{"long":"setting","description":"specify settings","short":"s","type":"string","value":""},{"long":"ext","description":"specify extensions","short":"e","type":"string","value":""},{"long":"use","description":"use plugins","short":"u","type":"string","value":""},{"long":"watch","description":"watch for changes and reprocess","short":"w","type":"boolean","default":false},{"long":"quiet","description":"output only warnings and errors","short":"q","type":"boolean","default":false},{"long":"silent","description":"output only errors","short":"S","type":"boolean","default":false},{"long":"frail","description":"exit with 1 on warnings","short":"f","type":"boolean","default":false},{"long":"tree","description":"specify input and output as syntax tree","short":"t","type":"boolean","default":false},{"long":"report","description":"specify reporter","type":"string","value":""},{"long":"file-path","description":"specify path to process as","type":"string","value":""},{"long":"tree-in","description":"specify input as syntax tree","type":"boolean"},{"long":"tree-out","description":"output syntax tree","type":"boolean"},{"long":"inspect","description":"output formatted syntax tree","type":"boolean"},{"long":"stdout","description":"specify writing to stdout","type":"boolean","truelike":true},{"long":"color","description":"specify color in report","type":"boolean","default":true},{"long":"config","description":"search for configuration files","type":"boolean","default":true},{"long":"ignore","description":"search for ignore files","type":"boolean","default":true}]; -proto$4.message = message$1; -proto$4.info = info$1; -proto$4.fail = fail$1; +/***/ }), +/* 199 */ +/***/ (function(module, exports, __webpack_require__) { -// Slight backwards compatibility. Remove in the future. -proto$4.warn = message$1; +"use strict"; -// Create a message with `reason` at `position`. When an error is passed in as -// `reason`, copies the stack. -function message$1(reason, position, origin) { - var filePath = this.path; - var message = new vfileMessage(reason, position, origin); +module.exports = __webpack_require__(200); - if (filePath) { - message.name = filePath + ':' + message.name; - message.file = filePath; - } - message.fatal = false; +/***/ }), +/* 200 */ +/***/ (function(module) { - this.messages.push(message); +module.exports = ["md","markdown","mdown","mkdn","mkd","mdwn","mkdown","ron"]; - return message -} +/***/ }), +/* 201 */ +/***/ (function(module, exports, __webpack_require__) { -// Fail. Creates a vmessage, associates it with the file, and throws it. -function fail$1() { - var message = this.message.apply(this, arguments); +"use strict"; - message.fatal = true; - throw message -} +var unified = __webpack_require__(202) +var parse = __webpack_require__(209) +var stringify = __webpack_require__(258) -// Info. Creates a vmessage, associates it with the file, and marks the -// fatality as null. -function info$1() { - var message = this.message.apply(this, arguments); +module.exports = unified() + .use(parse) + .use(stringify) + .freeze() - message.fatal = null; - return message -} +/***/ }), +/* 202 */ +/***/ (function(module, exports, __webpack_require__) { -var toString$5 = Object.prototype.toString; +"use strict"; -var isPlainObj = function (x) { - var prototype; - return toString$5.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); -}; + +var extend = __webpack_require__(203) +var bail = __webpack_require__(204) +var vfile = __webpack_require__(205) +var trough = __webpack_require__(24) +var string = __webpack_require__(17) +var plain = __webpack_require__(208) // Expose a frozen processor. -var unified_1 = unified().freeze(); +module.exports = unified().freeze() -var slice$3 = [].slice; -var own$3 = {}.hasOwnProperty; +var slice = [].slice +var own = {}.hasOwnProperty // Process pipeline. -var pipeline = trough_1() +var pipeline = trough() .use(pipelineParse) .use(pipelineRun) - .use(pipelineStringify); + .use(pipelineStringify) function pipelineParse(p, ctx) { - ctx.tree = p.parse(ctx.file); + ctx.tree = p.parse(ctx.file) } function pipelineRun(p, ctx, next) { - p.run(ctx.tree, ctx.file, done); + p.run(ctx.tree, ctx.file, done) function done(err, tree, file) { if (err) { - next(err); + next(err) } else { - ctx.tree = tree; - ctx.file = file; - next(); + ctx.tree = tree + ctx.file = file + next() } } } function pipelineStringify(p, ctx) { - ctx.file.contents = p.stringify(ctx.tree, ctx.file); + ctx.file.contents = p.stringify(ctx.tree, ctx.file) } // Function to create the first processor. function unified() { - var attachers = []; - var transformers = trough_1(); - var namespace = {}; - var frozen = false; - var freezeIndex = -1; + var attachers = [] + var transformers = trough() + var namespace = {} + var frozen = false + var freezeIndex = -1 // Data management. - processor.data = data; + processor.data = data // Lock. - processor.freeze = freeze; + processor.freeze = freeze // Plugins. - processor.attachers = attachers; - processor.use = use; + processor.attachers = attachers + processor.use = use // API. - processor.parse = parse; - processor.stringify = stringify; - processor.run = run; - processor.runSync = runSync; - processor.process = process; - processor.processSync = processSync; + processor.parse = parse + processor.stringify = stringify + processor.run = run + processor.runSync = runSync + processor.process = process + processor.processSync = processSync // Expose. return processor // Create a new processor based on the processor in the current scope. function processor() { - var destination = unified(); - var length = attachers.length; - var index = -1; + var destination = unified() + var length = attachers.length + var index = -1 while (++index < length) { - destination.use.apply(null, attachers[index]); + destination.use.apply(null, attachers[index]) } - destination.data(extend$3(true, {}, namespace)); + destination.data(extend(true, {}, namespace)) return destination } @@ -14850,62 +26934,62 @@ function unified() { // // In essence, always invoke this when exporting a processor. function freeze() { - var values; - var plugin; - var options; - var transformer; + var values + var plugin + var options + var transformer if (frozen) { return processor } while (++freezeIndex < attachers.length) { - values = attachers[freezeIndex]; - plugin = values[0]; - options = values[1]; - transformer = null; + values = attachers[freezeIndex] + plugin = values[0] + options = values[1] + transformer = null if (options === false) { continue } if (options === true) { - values[1] = undefined; + values[1] = undefined } - transformer = plugin.apply(processor, values.slice(1)); + transformer = plugin.apply(processor, values.slice(1)) if (typeof transformer === 'function') { - transformers.use(transformer); + transformers.use(transformer) } } - frozen = true; - freezeIndex = Infinity; + frozen = true + freezeIndex = Infinity return processor } // Data management. Getter / setter for processor-specific informtion. function data(key, value) { - if (xIsString(key)) { + if (string(key)) { // Set `key`. if (arguments.length === 2) { - assertUnfrozen('data', frozen); + assertUnfrozen('data', frozen) - namespace[key] = value; + namespace[key] = value return processor } // Get `key`. - return (own$3.call(namespace, key) && namespace[key]) || null + return (own.call(namespace, key) && namespace[key]) || null } // Set space. if (key) { - assertUnfrozen('data', frozen); - namespace = key; + assertUnfrozen('data', frozen) + namespace = key return processor } @@ -14921,46 +27005,46 @@ function unified() { // * a list of presets, attachers, and arguments (list of attachers and // options). function use(value) { - var settings; + var settings - assertUnfrozen('use', frozen); + assertUnfrozen('use', frozen) if (value === null || value === undefined) { // Empty. } else if (typeof value === 'function') { - addPlugin.apply(null, arguments); + addPlugin.apply(null, arguments) } else if (typeof value === 'object') { if ('length' in value) { - addList(value); + addList(value) } else { - addPreset(value); + addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') } if (settings) { - namespace.settings = extend$3(namespace.settings || {}, settings); + namespace.settings = extend(namespace.settings || {}, settings) } return processor function addPreset(result) { - addList(result.plugins); + addList(result.plugins) if (result.settings) { - settings = extend$3(settings || {}, result.settings); + settings = extend(settings || {}, result.settings) } } function add(value) { if (typeof value === 'function') { - addPlugin(value); + addPlugin(value) } else if (typeof value === 'object') { if ('length' in value) { - addPlugin.apply(null, value); + addPlugin.apply(null, value) } else { - addPreset(value); + addPreset(value) } } else { throw new Error('Expected usable value, not `' + value + '`') @@ -14968,17 +27052,17 @@ function unified() { } function addList(plugins) { - var length; - var index; + var length + var index if (plugins === null || plugins === undefined) { // Empty. } else if (typeof plugins === 'object' && 'length' in plugins) { - length = plugins.length; - index = -1; + length = plugins.length + index = -1 while (++index < length) { - add(plugins[index]); + add(plugins[index]) } } else { throw new Error('Expected a list of plugins, not `' + plugins + '`') @@ -14986,27 +27070,27 @@ function unified() { } function addPlugin(plugin, value) { - var entry = find(plugin); + var entry = find(plugin) if (entry) { - if (isPlainObj(entry[1]) && isPlainObj(value)) { - value = extend$3(entry[1], value); + if (plain(entry[1]) && plain(value)) { + value = extend(entry[1], value) } - entry[1] = value; + entry[1] = value } else { - attachers.push(slice$3.call(arguments)); + attachers.push(slice.call(arguments)) } } } function find(plugin) { - var length = attachers.length; - var index = -1; - var entry; + var length = attachers.length + var index = -1 + var entry while (++index < length) { - entry = attachers[index]; + entry = attachers[index] if (entry[0] === plugin) { return entry @@ -15017,12 +27101,12 @@ function unified() { // Parse a file (in string or vfile representation) into a unist node using // the `Parser` on the processor. function parse(doc) { - var file = vfile$5(doc); - var Parser; + var file = vfile(doc) + var Parser - freeze(); - Parser = processor.Parser; - assertParser('parse', Parser); + freeze() + Parser = processor.Parser + assertParser('parse', Parser) if (newable(Parser)) { return new Parser(String(file), file).parse() @@ -15034,31 +27118,31 @@ function unified() { // Run transforms on a unist node representation of a file (in string or // vfile representation), async. function run(node, file, cb) { - assertNode(node); - freeze(); + assertNode(node) + freeze() if (!cb && typeof file === 'function') { - cb = file; - file = null; + cb = file + file = null } if (!cb) { return new Promise(executor) } - executor(null, cb); + executor(null, cb) function executor(resolve, reject) { - transformers.run(node, vfile$5(file), done); + transformers.run(node, vfile(file), done) function done(err, tree, file) { - tree = tree || node; + tree = tree || node if (err) { - reject(err); + reject(err) } else if (resolve) { - resolve(tree); + resolve(tree) } else { - cb(null, tree, file); + cb(null, tree, file) } } } @@ -15067,32 +27151,32 @@ function unified() { // Run transforms on a unist node representation of a file (in string or // vfile representation), sync. function runSync(node, file) { - var complete = false; - var result; + var complete = false + var result - run(node, file, done); + run(node, file, done) - assertDone('runSync', 'run', complete); + assertDone('runSync', 'run', complete) return result function done(err, tree) { - complete = true; - bail_1(err); - result = tree; + complete = true + bail(err) + result = tree } } // Stringify a unist node representation of a file (in string or vfile // representation) into a string using the `Compiler` on the processor. function stringify(node, doc) { - var file = vfile$5(doc); - var Compiler; + var file = vfile(doc) + var Compiler - freeze(); - Compiler = processor.Compiler; - assertCompiler('stringify', Compiler); - assertNode(node); + freeze() + Compiler = processor.Compiler + assertCompiler('stringify', Compiler) + assertNode(node) if (newable(Compiler)) { return new Compiler(node, file).compile() @@ -15106,28 +27190,28 @@ function unified() { // compile the resulting node using the `Compiler` on the processor, and // store that result on the vfile. function process(doc, cb) { - freeze(); - assertParser('process', processor.Parser); - assertCompiler('process', processor.Compiler); + freeze() + assertParser('process', processor.Parser) + assertCompiler('process', processor.Compiler) if (!cb) { return new Promise(executor) } - executor(null, cb); + executor(null, cb) function executor(resolve, reject) { - var file = vfile$5(doc); + var file = vfile(doc) - pipeline.run(processor, {file: file}, done); + pipeline.run(processor, {file: file}, done) function done(err) { if (err) { - reject(err); + reject(err) } else if (resolve) { - resolve(file); + resolve(file) } else { - cb(null, file); + cb(null, file) } } } @@ -15135,23 +27219,23 @@ function unified() { // Process the given document (in string or vfile representation), sync. function processSync(doc) { - var complete = false; - var file; + var complete = false + var file - freeze(); - assertParser('processSync', processor.Parser); - assertCompiler('processSync', processor.Compiler); - file = vfile$5(doc); + freeze() + assertParser('processSync', processor.Parser) + assertCompiler('processSync', processor.Compiler) + file = vfile(doc) - process(file, done); + process(file, done) - assertDone('processSync', 'process', complete); + assertDone('processSync', 'process', complete) return file function done(err) { - complete = true; - bail_1(err); + complete = true + bail(err) } } } @@ -15163,7 +27247,7 @@ function newable(value) { // Check if `value` is an object with keys. function keys(value) { - var key; + var key for (key in value) { return true } @@ -15197,7 +27281,7 @@ function assertUnfrozen(name, frozen) { // Assert `node` is a unist node. function assertNode(node) { - if (!node || !xIsString(node.type)) { + if (!node || !string(node.type)) { throw new Error('Expected node, got `' + node + '`') } } @@ -15211,7729 +27295,662 @@ function assertDone(name, asyncName, complete) { } } -var unherit_1 = unherit; -/* Create a custom constructor which can be modified - * without affecting the original class. */ -function unherit(Super) { - var result; - var key; - var value; - - inherits(Of, Super); - inherits(From, Of); - - /* Clone values. */ - result = Of.prototype; - - for (key in result) { - value = result[key]; +/***/ }), +/* 203 */ +/***/ (function(module, exports, __webpack_require__) { - if (value && typeof value === 'object') { - result[key] = 'concat' in value ? value.concat() : immutable(value); - } - } +"use strict"; - return Of - /* Constructor accepting a single argument, - * which itself is an `arguments` object. */ - function From(parameters) { - return Super.apply(this, parameters) - } +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; +var defineProperty = Object.defineProperty; +var gOPD = Object.getOwnPropertyDescriptor; - /* Constructor accepting variadic arguments. */ - function Of() { - if (!(this instanceof Of)) { - return new From(arguments) - } +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } - return Super.apply(this, arguments) - } -} + return toStr.call(arr) === '[object Array]'; +}; -var stateToggle = factory; +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } -/* Construct a state `toggler`: a function which inverses - * `property` in context based on its current value. - * The by `toggler` returned function restores that value. */ -function factory(key, state, ctx) { - return enter + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } - function enter() { - var context = ctx || this; - var current = context[key]; + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } - context[key] = !state; + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; - return exit +// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target +var setProperty = function setProperty(target, options) { + if (defineProperty && options.name === '__proto__') { + defineProperty(target, options.name, { + enumerable: true, + configurable: true, + value: options.newValue, + writable: true + }); + } else { + target[options.name] = options.newValue; + } +}; - function exit() { - context[key] = current; - } - } -} +// Return undefined instead of __proto__ if '__proto__' is not an own property +var getProperty = function getProperty(obj, name) { + if (name === '__proto__') { + if (!hasOwn.call(obj, name)) { + return void 0; + } else if (gOPD) { + // In early versions of node, obj['__proto__'] is buggy when obj has + // __proto__ as an own property. Object.getOwnPropertyDescriptor() works. + return gOPD(obj, name).value; + } + } -/* Expose. */ -var vfileLocation = factory$1; + return obj[name]; +}; -/* Factory. */ -function factory$1(file) { - var contents = indices(String(file)); +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; - return { - toPosition: offsetToPositionFactory(contents), - toOffset: positionToOffsetFactory(contents) - } -} + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } -/* Factory to get the line and column-based `position` for - * `offset` in the bound indices. */ -function offsetToPositionFactory(indices) { - return offsetToPosition + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = getProperty(target, name); + copy = getProperty(options, name); - /* Get the line and column-based `position` for - * `offset` in the bound indices. */ - function offsetToPosition(offset) { - var index = -1; - var length = indices.length; + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } - if (offset < 0) { - return {} - } + // Never move original objects, clone them + setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); - while (++index < length) { - if (indices[index] > offset) { - return { - line: index + 1, - column: offset - (indices[index - 1] || 0) + 1, - offset: offset - } - } - } + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + setProperty(target, { name: name, newValue: copy }); + } + } + } + } + } - return {} - } -} + // Return the modified object + return target; +}; -/* Factory to get the `offset` for a line and column-based - * `position` in the bound indices. */ -function positionToOffsetFactory(indices) { - return positionToOffset - /* Get the `offset` for a line and column-based - * `position` in the bound indices. */ - function positionToOffset(position) { - var line = position && position.line; - var column = position && position.column; +/***/ }), +/* 204 */ +/***/ (function(module, exports, __webpack_require__) { - if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { - return (indices[line - 2] || 0) + column - 1 || 0 - } +"use strict"; - return -1 - } -} -/* Get indices of line-breaks in `value`. */ -function indices(value) { - var result = []; - var index = value.indexOf('\n'); +module.exports = bail - while (index !== -1) { - result.push(index + 1); - index = value.indexOf('\n', index + 1); +function bail(err) { + if (err) { + throw err } +} - result.push(value.length + 1); - return result -} +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { -var _unescape = factory$2; +"use strict"; -var backslash = '\\'; -// Factory to de-escape a value, based on a list at `key` in `ctx`. -function factory$2(ctx, key) { - return unescape +var VMessage = __webpack_require__(65) +var VFile = __webpack_require__(206) - // De-escape a string using the expression at `key` in `ctx`. - function unescape(value) { - var prev = 0; - var index = value.indexOf(backslash); - var escape = ctx[key]; - var queue = []; - var character; +module.exports = VFile - while (index !== -1) { - queue.push(value.slice(prev, index)); - prev = index + 1; - character = value.charAt(prev); +var proto = VFile.prototype - // If the following character is not a valid escape, add the slash. - if (!character || escape.indexOf(character) === -1) { - queue.push(backslash); - } +proto.message = message +proto.info = info +proto.fail = fail - index = value.indexOf(backslash, prev + 1); - } +// Slight backwards compatibility. Remove in the future. +proto.warn = message - queue.push(value.slice(prev)); +// Create a message with `reason` at `position`. When an error is passed in as +// `reason`, copies the stack. +function message(reason, position, origin) { + var filePath = this.path + var message = new VMessage(reason, position, origin) - return queue.join('') + if (filePath) { + message.name = filePath + ':' + message.name + message.file = filePath } -} - -const AElig = "Æ"; -const AMP = "&"; -const Aacute = "Á"; -const Acirc = "Â"; -const Agrave = "À"; -const Aring = "Å"; -const Atilde = "Ã"; -const Auml = "Ä"; -const COPY = "©"; -const Ccedil = "Ç"; -const ETH = "Ð"; -const Eacute = "É"; -const Ecirc = "Ê"; -const Egrave = "È"; -const Euml = "Ë"; -const GT = ">"; -const Iacute = "Í"; -const Icirc = "Î"; -const Igrave = "Ì"; -const Iuml = "Ï"; -const LT = "<"; -const Ntilde = "Ñ"; -const Oacute = "Ó"; -const Ocirc = "Ô"; -const Ograve = "Ò"; -const Oslash = "Ø"; -const Otilde = "Õ"; -const Ouml = "Ö"; -const QUOT = "\""; -const REG = "®"; -const THORN = "Þ"; -const Uacute = "Ú"; -const Ucirc = "Û"; -const Ugrave = "Ù"; -const Uuml = "Ü"; -const Yacute = "Ý"; -const aacute = "á"; -const acirc = "â"; -const acute = "´"; -const aelig = "æ"; -const agrave = "à"; -const amp = "&"; -const aring = "å"; -const atilde = "ã"; -const auml = "ä"; -const brvbar = "¦"; -const ccedil = "ç"; -const cedil = "¸"; -const cent = "¢"; -const copy$2 = "©"; -const curren = "¤"; -const deg = "°"; -const divide = "÷"; -const eacute = "é"; -const ecirc = "ê"; -const egrave = "è"; -const eth = "ð"; -const euml = "ë"; -const frac12 = "½"; -const frac14 = "¼"; -const frac34 = "¾"; -const gt = ">"; -const iacute = "í"; -const icirc = "î"; -const iexcl = "¡"; -const igrave = "ì"; -const iquest = "¿"; -const iuml = "ï"; -const laquo = "«"; -const lt = "<"; -const macr = "¯"; -const micro = "µ"; -const middot = "·"; -const nbsp = " "; -const not = "¬"; -const ntilde = "ñ"; -const oacute = "ó"; -const ocirc = "ô"; -const ograve = "ò"; -const ordf = "ª"; -const ordm = "º"; -const oslash = "ø"; -const otilde = "õ"; -const ouml = "ö"; -const para = "¶"; -const plusmn = "±"; -const pound = "£"; -const quot = "\""; -const raquo = "»"; -const reg = "®"; -const sect = "§"; -const shy = "­"; -const sup1 = "¹"; -const sup2 = "²"; -const sup3 = "³"; -const szlig = "ß"; -const thorn = "þ"; -const times = "×"; -const uacute = "ú"; -const ucirc = "û"; -const ugrave = "ù"; -const uml = "¨"; -const uuml = "ü"; -const yacute = "ý"; -const yen = "¥"; -const yuml = "ÿ"; -var index$2 = { - AElig: AElig, - AMP: AMP, - Aacute: Aacute, - Acirc: Acirc, - Agrave: Agrave, - Aring: Aring, - Atilde: Atilde, - Auml: Auml, - COPY: COPY, - Ccedil: Ccedil, - ETH: ETH, - Eacute: Eacute, - Ecirc: Ecirc, - Egrave: Egrave, - Euml: Euml, - GT: GT, - Iacute: Iacute, - Icirc: Icirc, - Igrave: Igrave, - Iuml: Iuml, - LT: LT, - Ntilde: Ntilde, - Oacute: Oacute, - Ocirc: Ocirc, - Ograve: Ograve, - Oslash: Oslash, - Otilde: Otilde, - Ouml: Ouml, - QUOT: QUOT, - REG: REG, - THORN: THORN, - Uacute: Uacute, - Ucirc: Ucirc, - Ugrave: Ugrave, - Uuml: Uuml, - Yacute: Yacute, - aacute: aacute, - acirc: acirc, - acute: acute, - aelig: aelig, - agrave: agrave, - amp: amp, - aring: aring, - atilde: atilde, - auml: auml, - brvbar: brvbar, - ccedil: ccedil, - cedil: cedil, - cent: cent, - copy: copy$2, - curren: curren, - deg: deg, - divide: divide, - eacute: eacute, - ecirc: ecirc, - egrave: egrave, - eth: eth, - euml: euml, - frac12: frac12, - frac14: frac14, - frac34: frac34, - gt: gt, - iacute: iacute, - icirc: icirc, - iexcl: iexcl, - igrave: igrave, - iquest: iquest, - iuml: iuml, - laquo: laquo, - lt: lt, - macr: macr, - micro: micro, - middot: middot, - nbsp: nbsp, - not: not, - ntilde: ntilde, - oacute: oacute, - ocirc: ocirc, - ograve: ograve, - ordf: ordf, - ordm: ordm, - oslash: oslash, - otilde: otilde, - ouml: ouml, - para: para, - plusmn: plusmn, - pound: pound, - quot: quot, - raquo: raquo, - reg: reg, - sect: sect, - shy: shy, - sup1: sup1, - sup2: sup2, - sup3: sup3, - szlig: szlig, - thorn: thorn, - times: times, - uacute: uacute, - ucirc: ucirc, - ugrave: ugrave, - uml: uml, - uuml: uuml, - yacute: yacute, - yen: yen, - yuml: yuml -}; -var characterEntitiesLegacy = Object.freeze({ - AElig: AElig, - AMP: AMP, - Aacute: Aacute, - Acirc: Acirc, - Agrave: Agrave, - Aring: Aring, - Atilde: Atilde, - Auml: Auml, - COPY: COPY, - Ccedil: Ccedil, - ETH: ETH, - Eacute: Eacute, - Ecirc: Ecirc, - Egrave: Egrave, - Euml: Euml, - GT: GT, - Iacute: Iacute, - Icirc: Icirc, - Igrave: Igrave, - Iuml: Iuml, - LT: LT, - Ntilde: Ntilde, - Oacute: Oacute, - Ocirc: Ocirc, - Ograve: Ograve, - Oslash: Oslash, - Otilde: Otilde, - Ouml: Ouml, - QUOT: QUOT, - REG: REG, - THORN: THORN, - Uacute: Uacute, - Ucirc: Ucirc, - Ugrave: Ugrave, - Uuml: Uuml, - Yacute: Yacute, - aacute: aacute, - acirc: acirc, - acute: acute, - aelig: aelig, - agrave: agrave, - amp: amp, - aring: aring, - atilde: atilde, - auml: auml, - brvbar: brvbar, - ccedil: ccedil, - cedil: cedil, - cent: cent, - copy: copy$2, - curren: curren, - deg: deg, - divide: divide, - eacute: eacute, - ecirc: ecirc, - egrave: egrave, - eth: eth, - euml: euml, - frac12: frac12, - frac14: frac14, - frac34: frac34, - gt: gt, - iacute: iacute, - icirc: icirc, - iexcl: iexcl, - igrave: igrave, - iquest: iquest, - iuml: iuml, - laquo: laquo, - lt: lt, - macr: macr, - micro: micro, - middot: middot, - nbsp: nbsp, - not: not, - ntilde: ntilde, - oacute: oacute, - ocirc: ocirc, - ograve: ograve, - ordf: ordf, - ordm: ordm, - oslash: oslash, - otilde: otilde, - ouml: ouml, - para: para, - plusmn: plusmn, - pound: pound, - quot: quot, - raquo: raquo, - reg: reg, - sect: sect, - shy: shy, - sup1: sup1, - sup2: sup2, - sup3: sup3, - szlig: szlig, - thorn: thorn, - times: times, - uacute: uacute, - ucirc: ucirc, - ugrave: ugrave, - uml: uml, - uuml: uuml, - yacute: yacute, - yen: yen, - yuml: yuml, - default: index$2 -}); + message.fatal = false -var index$3 = { - "0": "�", - "128": "€", - "130": "‚", - "131": "ƒ", - "132": "„", - "133": "…", - "134": "†", - "135": "‡", - "136": "ˆ", - "137": "‰", - "138": "Š", - "139": "‹", - "140": "Œ", - "142": "Ž", - "145": "‘", - "146": "’", - "147": "“", - "148": "”", - "149": "•", - "150": "–", - "151": "—", - "152": "˜", - "153": "™", - "154": "š", - "155": "›", - "156": "œ", - "158": "ž", - "159": "Ÿ" -}; + this.messages.push(message) -var characterReferenceInvalid = Object.freeze({ - default: index$3 -}); + return message +} -var isDecimal = decimal; +// Fail. Creates a vmessage, associates it with the file, and throws it. +function fail() { + var message = this.message.apply(this, arguments) -/* Check if the given character code, or the character - * code at the first character, is decimal. */ -function decimal(character) { - var code = typeof character === 'string' ? character.charCodeAt(0) : character; + message.fatal = true - return code >= 48 && code <= 57 /* 0-9 */ + throw message } -var isHexadecimal = hexadecimal; +// Info. Creates a vmessage, associates it with the file, and marks the +// fatality as null. +function info() { + var message = this.message.apply(this, arguments) -/* Check if the given character code, or the character - * code at the first character, is hexadecimal. */ -function hexadecimal(character) { - var code = typeof character === 'string' ? character.charCodeAt(0) : character; + message.fatal = null - return ( - (code >= 97 /* a */ && code <= 102) /* z */ || - (code >= 65 /* A */ && code <= 70) /* Z */ || - (code >= 48 /* A */ && code <= 57) /* Z */ - ) + return message } -var isAlphabetical = alphabetical; -/* Check if the given character code, or the character - * code at the first character, is alphabetical. */ -function alphabetical(character) { - var code = typeof character === 'string' ? character.charCodeAt(0) : character; +/***/ }), +/* 206 */ +/***/ (function(module, exports, __webpack_require__) { - return ( - (code >= 97 && code <= 122) /* a-z */ || - (code >= 65 && code <= 90) /* A-Z */ - ) -} +"use strict"; -var isAlphanumerical = alphanumerical; -/* Check if the given character code, or the character - * code at the first character, is alphanumerical. */ -function alphanumerical(character) { - return isAlphabetical(character) || isDecimal(character) -} - -const AEli = "Æ"; -const AElig$1 = "Æ"; -const AM = "&"; -const AMP$1 = "&"; -const Aacut = "Á"; -const Aacute$1 = "Á"; -const Abreve = "Ă"; -const Acir = "Â"; -const Acirc$1 = "Â"; -const Acy = "А"; -const Afr = "𝔄"; -const Agrav = "À"; -const Agrave$1 = "À"; -const Alpha = "Α"; -const Amacr = "Ā"; -const And = "⩓"; -const Aogon = "Ą"; -const Aopf = "𝔸"; -const ApplyFunction = "⁡"; -const Arin = "Å"; -const Aring$1 = "Å"; -const Ascr = "𝒜"; -const Assign = "≔"; -const Atild = "Ã"; -const Atilde$1 = "Ã"; -const Aum = "Ä"; -const Auml$1 = "Ä"; -const Backslash = "∖"; -const Barv = "⫧"; -const Barwed = "⌆"; -const Bcy = "Б"; -const Because = "∵"; -const Bernoullis = "ℬ"; -const Beta = "Β"; -const Bfr = "𝔅"; -const Bopf = "𝔹"; -const Breve = "˘"; -const Bscr = "ℬ"; -const Bumpeq = "≎"; -const CHcy = "Ч"; -const COP = "©"; -const COPY$1 = "©"; -const Cacute = "Ć"; -const Cap = "⋒"; -const CapitalDifferentialD = "ⅅ"; -const Cayleys = "ℭ"; -const Ccaron = "Č"; -const Ccedi = "Ç"; -const Ccedil$1 = "Ç"; -const Ccirc = "Ĉ"; -const Cconint = "∰"; -const Cdot = "Ċ"; -const Cedilla = "¸"; -const CenterDot = "·"; -const Cfr = "ℭ"; -const Chi = "Χ"; -const CircleDot = "⊙"; -const CircleMinus = "⊖"; -const CirclePlus = "⊕"; -const CircleTimes = "⊗"; -const ClockwiseContourIntegral = "∲"; -const CloseCurlyDoubleQuote = "”"; -const CloseCurlyQuote = "’"; -const Colon = "∷"; -const Colone = "⩴"; -const Congruent = "≡"; -const Conint = "∯"; -const ContourIntegral = "∮"; -const Copf = "ℂ"; -const Coproduct = "∐"; -const CounterClockwiseContourIntegral = "∳"; -const Cross = "⨯"; -const Cscr = "𝒞"; -const Cup = "⋓"; -const CupCap = "≍"; -const DD = "ⅅ"; -const DDotrahd = "⤑"; -const DJcy = "Ђ"; -const DScy = "Ѕ"; -const DZcy = "Џ"; -const Dagger = "‡"; -const Darr = "↡"; -const Dashv = "⫤"; -const Dcaron = "Ď"; -const Dcy = "Д"; -const Del = "∇"; -const Delta = "Δ"; -const Dfr = "𝔇"; -const DiacriticalAcute = "´"; -const DiacriticalDot = "˙"; -const DiacriticalDoubleAcute = "˝"; -const DiacriticalGrave = "`"; -const DiacriticalTilde = "˜"; -const Diamond = "⋄"; -const DifferentialD = "ⅆ"; -const Dopf = "𝔻"; -const Dot = "¨"; -const DotDot = "⃜"; -const DotEqual = "≐"; -const DoubleContourIntegral = "∯"; -const DoubleDot = "¨"; -const DoubleDownArrow = "⇓"; -const DoubleLeftArrow = "⇐"; -const DoubleLeftRightArrow = "⇔"; -const DoubleLeftTee = "⫤"; -const DoubleLongLeftArrow = "⟸"; -const DoubleLongLeftRightArrow = "⟺"; -const DoubleLongRightArrow = "⟹"; -const DoubleRightArrow = "⇒"; -const DoubleRightTee = "⊨"; -const DoubleUpArrow = "⇑"; -const DoubleUpDownArrow = "⇕"; -const DoubleVerticalBar = "∥"; -const DownArrow = "↓"; -const DownArrowBar = "⤓"; -const DownArrowUpArrow = "⇵"; -const DownBreve = "̑"; -const DownLeftRightVector = "⥐"; -const DownLeftTeeVector = "⥞"; -const DownLeftVector = "↽"; -const DownLeftVectorBar = "⥖"; -const DownRightTeeVector = "⥟"; -const DownRightVector = "⇁"; -const DownRightVectorBar = "⥗"; -const DownTee = "⊤"; -const DownTeeArrow = "↧"; -const Downarrow = "⇓"; -const Dscr = "𝒟"; -const Dstrok = "Đ"; -const ENG = "Ŋ"; -const ET = "Ð"; -const ETH$1 = "Ð"; -const Eacut = "É"; -const Eacute$1 = "É"; -const Ecaron = "Ě"; -const Ecir = "Ê"; -const Ecirc$1 = "Ê"; -const Ecy = "Э"; -const Edot = "Ė"; -const Efr = "𝔈"; -const Egrav = "È"; -const Egrave$1 = "È"; -const Element = "∈"; -const Emacr = "Ē"; -const EmptySmallSquare = "◻"; -const EmptyVerySmallSquare = "▫"; -const Eogon = "Ę"; -const Eopf = "𝔼"; -const Epsilon = "Ε"; -const Equal = "⩵"; -const EqualTilde = "≂"; -const Equilibrium = "⇌"; -const Escr = "ℰ"; -const Esim = "⩳"; -const Eta = "Η"; -const Eum = "Ë"; -const Euml$1 = "Ë"; -const Exists = "∃"; -const ExponentialE = "ⅇ"; -const Fcy = "Ф"; -const Ffr = "𝔉"; -const FilledSmallSquare = "◼"; -const FilledVerySmallSquare = "▪"; -const Fopf = "𝔽"; -const ForAll = "∀"; -const Fouriertrf = "ℱ"; -const Fscr = "ℱ"; -const GJcy = "Ѓ"; -const G = ">"; -const GT$1 = ">"; -const Gamma = "Γ"; -const Gammad = "Ϝ"; -const Gbreve = "Ğ"; -const Gcedil = "Ģ"; -const Gcirc = "Ĝ"; -const Gcy = "Г"; -const Gdot = "Ġ"; -const Gfr = "𝔊"; -const Gg = "⋙"; -const Gopf = "𝔾"; -const GreaterEqual = "≥"; -const GreaterEqualLess = "⋛"; -const GreaterFullEqual = "≧"; -const GreaterGreater = "⪢"; -const GreaterLess = "≷"; -const GreaterSlantEqual = "⩾"; -const GreaterTilde = "≳"; -const Gscr = "𝒢"; -const Gt = "≫"; -const HARDcy = "Ъ"; -const Hacek = "ˇ"; -const Hat = "^"; -const Hcirc = "Ĥ"; -const Hfr = "ℌ"; -const HilbertSpace = "ℋ"; -const Hopf = "ℍ"; -const HorizontalLine = "─"; -const Hscr = "ℋ"; -const Hstrok = "Ħ"; -const HumpDownHump = "≎"; -const HumpEqual = "≏"; -const IEcy = "Е"; -const IJlig = "IJ"; -const IOcy = "Ё"; -const Iacut = "Í"; -const Iacute$1 = "Í"; -const Icir = "Î"; -const Icirc$1 = "Î"; -const Icy = "И"; -const Idot = "İ"; -const Ifr = "ℑ"; -const Igrav = "Ì"; -const Igrave$1 = "Ì"; -const Im = "ℑ"; -const Imacr = "Ī"; -const ImaginaryI = "ⅈ"; -const Implies = "⇒"; -const Int = "∬"; -const Integral = "∫"; -const Intersection = "⋂"; -const InvisibleComma = "⁣"; -const InvisibleTimes = "⁢"; -const Iogon = "Į"; -const Iopf = "𝕀"; -const Iota = "Ι"; -const Iscr = "ℐ"; -const Itilde = "Ĩ"; -const Iukcy = "І"; -const Ium = "Ï"; -const Iuml$1 = "Ï"; -const Jcirc = "Ĵ"; -const Jcy = "Й"; -const Jfr = "𝔍"; -const Jopf = "𝕁"; -const Jscr = "𝒥"; -const Jsercy = "Ј"; -const Jukcy = "Є"; -const KHcy = "Х"; -const KJcy = "Ќ"; -const Kappa = "Κ"; -const Kcedil = "Ķ"; -const Kcy = "К"; -const Kfr = "𝔎"; -const Kopf = "𝕂"; -const Kscr = "𝒦"; -const LJcy = "Љ"; -const L = "<"; -const LT$1 = "<"; -const Lacute = "Ĺ"; -const Lambda = "Λ"; -const Lang = "⟪"; -const Laplacetrf = "ℒ"; -const Larr = "↞"; -const Lcaron = "Ľ"; -const Lcedil = "Ļ"; -const Lcy = "Л"; -const LeftAngleBracket = "⟨"; -const LeftArrow = "←"; -const LeftArrowBar = "⇤"; -const LeftArrowRightArrow = "⇆"; -const LeftCeiling = "⌈"; -const LeftDoubleBracket = "⟦"; -const LeftDownTeeVector = "⥡"; -const LeftDownVector = "⇃"; -const LeftDownVectorBar = "⥙"; -const LeftFloor = "⌊"; -const LeftRightArrow = "↔"; -const LeftRightVector = "⥎"; -const LeftTee = "⊣"; -const LeftTeeArrow = "↤"; -const LeftTeeVector = "⥚"; -const LeftTriangle = "⊲"; -const LeftTriangleBar = "⧏"; -const LeftTriangleEqual = "⊴"; -const LeftUpDownVector = "⥑"; -const LeftUpTeeVector = "⥠"; -const LeftUpVector = "↿"; -const LeftUpVectorBar = "⥘"; -const LeftVector = "↼"; -const LeftVectorBar = "⥒"; -const Leftarrow = "⇐"; -const Leftrightarrow = "⇔"; -const LessEqualGreater = "⋚"; -const LessFullEqual = "≦"; -const LessGreater = "≶"; -const LessLess = "⪡"; -const LessSlantEqual = "⩽"; -const LessTilde = "≲"; -const Lfr = "𝔏"; -const Ll = "⋘"; -const Lleftarrow = "⇚"; -const Lmidot = "Ŀ"; -const LongLeftArrow = "⟵"; -const LongLeftRightArrow = "⟷"; -const LongRightArrow = "⟶"; -const Longleftarrow = "⟸"; -const Longleftrightarrow = "⟺"; -const Longrightarrow = "⟹"; -const Lopf = "𝕃"; -const LowerLeftArrow = "↙"; -const LowerRightArrow = "↘"; -const Lscr = "ℒ"; -const Lsh = "↰"; -const Lstrok = "Ł"; -const Lt = "≪"; -const Mcy = "М"; -const MediumSpace = " "; -const Mellintrf = "ℳ"; -const Mfr = "𝔐"; -const MinusPlus = "∓"; -const Mopf = "𝕄"; -const Mscr = "ℳ"; -const Mu = "Μ"; -const NJcy = "Њ"; -const Nacute = "Ń"; -const Ncaron = "Ň"; -const Ncedil = "Ņ"; -const Ncy = "Н"; -const NegativeMediumSpace = "​"; -const NegativeThickSpace = "​"; -const NegativeThinSpace = "​"; -const NegativeVeryThinSpace = "​"; -const NestedGreaterGreater = "≫"; -const NestedLessLess = "≪"; -const NewLine = "\n"; -const Nfr = "𝔑"; -const NoBreak = "⁠"; -const NonBreakingSpace = " "; -const Nopf = "ℕ"; -const Not = "⫬"; -const NotCongruent = "≢"; -const NotCupCap = "≭"; -const NotDoubleVerticalBar = "∦"; -const NotElement = "∉"; -const NotEqual = "≠"; -const NotEqualTilde = "≂̸"; -const NotExists = "∄"; -const NotGreater = "≯"; -const NotGreaterEqual = "≱"; -const NotGreaterFullEqual = "≧̸"; -const NotGreaterGreater = "≫̸"; -const NotGreaterLess = "≹"; -const NotGreaterSlantEqual = "⩾̸"; -const NotGreaterTilde = "≵"; -const NotHumpDownHump = "≎̸"; -const NotHumpEqual = "≏̸"; -const NotLeftTriangle = "⋪"; -const NotLeftTriangleBar = "⧏̸"; -const NotLeftTriangleEqual = "⋬"; -const NotLess = "≮"; -const NotLessEqual = "≰"; -const NotLessGreater = "≸"; -const NotLessLess = "≪̸"; -const NotLessSlantEqual = "⩽̸"; -const NotLessTilde = "≴"; -const NotNestedGreaterGreater = "⪢̸"; -const NotNestedLessLess = "⪡̸"; -const NotPrecedes = "⊀"; -const NotPrecedesEqual = "⪯̸"; -const NotPrecedesSlantEqual = "⋠"; -const NotReverseElement = "∌"; -const NotRightTriangle = "⋫"; -const NotRightTriangleBar = "⧐̸"; -const NotRightTriangleEqual = "⋭"; -const NotSquareSubset = "⊏̸"; -const NotSquareSubsetEqual = "⋢"; -const NotSquareSuperset = "⊐̸"; -const NotSquareSupersetEqual = "⋣"; -const NotSubset = "⊂⃒"; -const NotSubsetEqual = "⊈"; -const NotSucceeds = "⊁"; -const NotSucceedsEqual = "⪰̸"; -const NotSucceedsSlantEqual = "⋡"; -const NotSucceedsTilde = "≿̸"; -const NotSuperset = "⊃⃒"; -const NotSupersetEqual = "⊉"; -const NotTilde = "≁"; -const NotTildeEqual = "≄"; -const NotTildeFullEqual = "≇"; -const NotTildeTilde = "≉"; -const NotVerticalBar = "∤"; -const Nscr = "𝒩"; -const Ntild = "Ñ"; -const Ntilde$1 = "Ñ"; -const Nu = "Ν"; -const OElig = "Œ"; -const Oacut = "Ó"; -const Oacute$1 = "Ó"; -const Ocir = "Ô"; -const Ocirc$1 = "Ô"; -const Ocy = "О"; -const Odblac = "Ő"; -const Ofr = "𝔒"; -const Ograv = "Ò"; -const Ograve$1 = "Ò"; -const Omacr = "Ō"; -const Omega = "Ω"; -const Omicron = "Ο"; -const Oopf = "𝕆"; -const OpenCurlyDoubleQuote = "“"; -const OpenCurlyQuote = "‘"; -const Or = "⩔"; -const Oscr = "𝒪"; -const Oslas = "Ø"; -const Oslash$1 = "Ø"; -const Otild = "Õ"; -const Otilde$1 = "Õ"; -const Otimes = "⨷"; -const Oum = "Ö"; -const Ouml$1 = "Ö"; -const OverBar = "‾"; -const OverBrace = "⏞"; -const OverBracket = "⎴"; -const OverParenthesis = "⏜"; -const PartialD = "∂"; -const Pcy = "П"; -const Pfr = "𝔓"; -const Phi = "Φ"; -const Pi = "Π"; -const PlusMinus = "±"; -const Poincareplane = "ℌ"; -const Popf = "ℙ"; -const Pr = "⪻"; -const Precedes = "≺"; -const PrecedesEqual = "⪯"; -const PrecedesSlantEqual = "≼"; -const PrecedesTilde = "≾"; -const Prime = "″"; -const Product = "∏"; -const Proportion = "∷"; -const Proportional = "∝"; -const Pscr = "𝒫"; -const Psi = "Ψ"; -const QUO = "\""; -const QUOT$1 = "\""; -const Qfr = "𝔔"; -const Qopf = "ℚ"; -const Qscr = "𝒬"; -const RBarr = "⤐"; -const RE = "®"; -const REG$1 = "®"; -const Racute = "Ŕ"; -const Rang = "⟫"; -const Rarr = "↠"; -const Rarrtl = "⤖"; -const Rcaron = "Ř"; -const Rcedil = "Ŗ"; -const Rcy = "Р"; -const Re = "ℜ"; -const ReverseElement = "∋"; -const ReverseEquilibrium = "⇋"; -const ReverseUpEquilibrium = "⥯"; -const Rfr = "ℜ"; -const Rho = "Ρ"; -const RightAngleBracket = "⟩"; -const RightArrow = "→"; -const RightArrowBar = "⇥"; -const RightArrowLeftArrow = "⇄"; -const RightCeiling = "⌉"; -const RightDoubleBracket = "⟧"; -const RightDownTeeVector = "⥝"; -const RightDownVector = "⇂"; -const RightDownVectorBar = "⥕"; -const RightFloor = "⌋"; -const RightTee = "⊢"; -const RightTeeArrow = "↦"; -const RightTeeVector = "⥛"; -const RightTriangle = "⊳"; -const RightTriangleBar = "⧐"; -const RightTriangleEqual = "⊵"; -const RightUpDownVector = "⥏"; -const RightUpTeeVector = "⥜"; -const RightUpVector = "↾"; -const RightUpVectorBar = "⥔"; -const RightVector = "⇀"; -const RightVectorBar = "⥓"; -const Rightarrow = "⇒"; -const Ropf = "ℝ"; -const RoundImplies = "⥰"; -const Rrightarrow = "⇛"; -const Rscr = "ℛ"; -const Rsh = "↱"; -const RuleDelayed = "⧴"; -const SHCHcy = "Щ"; -const SHcy = "Ш"; -const SOFTcy = "Ь"; -const Sacute = "Ś"; -const Sc = "⪼"; -const Scaron = "Š"; -const Scedil = "Ş"; -const Scirc = "Ŝ"; -const Scy = "С"; -const Sfr = "𝔖"; -const ShortDownArrow = "↓"; -const ShortLeftArrow = "←"; -const ShortRightArrow = "→"; -const ShortUpArrow = "↑"; -const Sigma = "Σ"; -const SmallCircle = "∘"; -const Sopf = "𝕊"; -const Sqrt = "√"; -const Square = "□"; -const SquareIntersection = "⊓"; -const SquareSubset = "⊏"; -const SquareSubsetEqual = "⊑"; -const SquareSuperset = "⊐"; -const SquareSupersetEqual = "⊒"; -const SquareUnion = "⊔"; -const Sscr = "𝒮"; -const Star = "⋆"; -const Sub = "⋐"; -const Subset = "⋐"; -const SubsetEqual = "⊆"; -const Succeeds = "≻"; -const SucceedsEqual = "⪰"; -const SucceedsSlantEqual = "≽"; -const SucceedsTilde = "≿"; -const SuchThat = "∋"; -const Sum = "∑"; -const Sup = "⋑"; -const Superset = "⊃"; -const SupersetEqual = "⊇"; -const Supset = "⋑"; -const THOR = "Þ"; -const THORN$1 = "Þ"; -const TRADE = "™"; -const TSHcy = "Ћ"; -const TScy = "Ц"; -const Tab = "\t"; -const Tau = "Τ"; -const Tcaron = "Ť"; -const Tcedil = "Ţ"; -const Tcy = "Т"; -const Tfr = "𝔗"; -const Therefore = "∴"; -const Theta = "Θ"; -const ThickSpace = "  "; -const ThinSpace = " "; -const Tilde = "∼"; -const TildeEqual = "≃"; -const TildeFullEqual = "≅"; -const TildeTilde = "≈"; -const Topf = "𝕋"; -const TripleDot = "⃛"; -const Tscr = "𝒯"; -const Tstrok = "Ŧ"; -const Uacut = "Ú"; -const Uacute$1 = "Ú"; -const Uarr = "↟"; -const Uarrocir = "⥉"; -const Ubrcy = "Ў"; -const Ubreve = "Ŭ"; -const Ucir = "Û"; -const Ucirc$1 = "Û"; -const Ucy = "У"; -const Udblac = "Ű"; -const Ufr = "𝔘"; -const Ugrav = "Ù"; -const Ugrave$1 = "Ù"; -const Umacr = "Ū"; -const UnderBar = "_"; -const UnderBrace = "⏟"; -const UnderBracket = "⎵"; -const UnderParenthesis = "⏝"; -const Union = "⋃"; -const UnionPlus = "⊎"; -const Uogon = "Ų"; -const Uopf = "𝕌"; -const UpArrow = "↑"; -const UpArrowBar = "⤒"; -const UpArrowDownArrow = "⇅"; -const UpDownArrow = "↕"; -const UpEquilibrium = "⥮"; -const UpTee = "⊥"; -const UpTeeArrow = "↥"; -const Uparrow = "⇑"; -const Updownarrow = "⇕"; -const UpperLeftArrow = "↖"; -const UpperRightArrow = "↗"; -const Upsi = "ϒ"; -const Upsilon = "Υ"; -const Uring = "Ů"; -const Uscr = "𝒰"; -const Utilde = "Ũ"; -const Uum = "Ü"; -const Uuml$1 = "Ü"; -const VDash = "⊫"; -const Vbar = "⫫"; -const Vcy = "В"; -const Vdash = "⊩"; -const Vdashl = "⫦"; -const Vee = "⋁"; -const Verbar = "‖"; -const Vert = "‖"; -const VerticalBar = "∣"; -const VerticalLine = "|"; -const VerticalSeparator = "❘"; -const VerticalTilde = "≀"; -const VeryThinSpace = " "; -const Vfr = "𝔙"; -const Vopf = "𝕍"; -const Vscr = "𝒱"; -const Vvdash = "⊪"; -const Wcirc = "Ŵ"; -const Wedge = "⋀"; -const Wfr = "𝔚"; -const Wopf = "𝕎"; -const Wscr = "𝒲"; -const Xfr = "𝔛"; -const Xi = "Ξ"; -const Xopf = "𝕏"; -const Xscr = "𝒳"; -const YAcy = "Я"; -const YIcy = "Ї"; -const YUcy = "Ю"; -const Yacut = "Ý"; -const Yacute$1 = "Ý"; -const Ycirc = "Ŷ"; -const Ycy = "Ы"; -const Yfr = "𝔜"; -const Yopf = "𝕐"; -const Yscr = "𝒴"; -const Yuml = "Ÿ"; -const ZHcy = "Ж"; -const Zacute = "Ź"; -const Zcaron = "Ž"; -const Zcy = "З"; -const Zdot = "Ż"; -const ZeroWidthSpace = "​"; -const Zeta = "Ζ"; -const Zfr = "ℨ"; -const Zopf = "ℤ"; -const Zscr = "𝒵"; -const aacut = "á"; -const aacute$1 = "á"; -const abreve = "ă"; -const ac = "∾"; -const acE = "∾̳"; -const acd = "∿"; -const acir = "â"; -const acirc$1 = "â"; -const acut = "´"; -const acute$1 = "´"; -const acy = "а"; -const aeli = "æ"; -const aelig$1 = "æ"; -const af = "⁡"; -const afr = "𝔞"; -const agrav = "à"; -const agrave$1 = "à"; -const alefsym = "ℵ"; -const aleph = "ℵ"; -const alpha = "α"; -const amacr = "ā"; -const amalg = "⨿"; -const am = "&"; -const amp$1 = "&"; -const and = "∧"; -const andand = "⩕"; -const andd = "⩜"; -const andslope = "⩘"; -const andv = "⩚"; -const ang = "∠"; -const ange = "⦤"; -const angle = "∠"; -const angmsd = "∡"; -const angmsdaa = "⦨"; -const angmsdab = "⦩"; -const angmsdac = "⦪"; -const angmsdad = "⦫"; -const angmsdae = "⦬"; -const angmsdaf = "⦭"; -const angmsdag = "⦮"; -const angmsdah = "⦯"; -const angrt = "∟"; -const angrtvb = "⊾"; -const angrtvbd = "⦝"; -const angsph = "∢"; -const angst = "Å"; -const angzarr = "⍼"; -const aogon = "ą"; -const aopf = "𝕒"; -const ap = "≈"; -const apE = "⩰"; -const apacir = "⩯"; -const ape = "≊"; -const apid = "≋"; -const apos = "'"; -const approx = "≈"; -const approxeq = "≊"; -const arin = "å"; -const aring$1 = "å"; -const ascr = "𝒶"; -const ast = "*"; -const asymp = "≈"; -const asympeq = "≍"; -const atild = "ã"; -const atilde$1 = "ã"; -const aum = "ä"; -const auml$1 = "ä"; -const awconint = "∳"; -const awint = "⨑"; -const bNot = "⫭"; -const backcong = "≌"; -const backepsilon = "϶"; -const backprime = "‵"; -const backsim = "∽"; -const backsimeq = "⋍"; -const barvee = "⊽"; -const barwed = "⌅"; -const barwedge = "⌅"; -const bbrk = "⎵"; -const bbrktbrk = "⎶"; -const bcong = "≌"; -const bcy = "б"; -const bdquo = "„"; -const becaus = "∵"; -const because = "∵"; -const bemptyv = "⦰"; -const bepsi = "϶"; -const bernou = "ℬ"; -const beta = "β"; -const beth = "ℶ"; -const between = "≬"; -const bfr = "𝔟"; -const bigcap = "⋂"; -const bigcirc = "◯"; -const bigcup = "⋃"; -const bigodot = "⨀"; -const bigoplus = "⨁"; -const bigotimes = "⨂"; -const bigsqcup = "⨆"; -const bigstar = "★"; -const bigtriangledown = "▽"; -const bigtriangleup = "△"; -const biguplus = "⨄"; -const bigvee = "⋁"; -const bigwedge = "⋀"; -const bkarow = "⤍"; -const blacklozenge = "⧫"; -const blacksquare = "▪"; -const blacktriangle = "▴"; -const blacktriangledown = "▾"; -const blacktriangleleft = "◂"; -const blacktriangleright = "▸"; -const blank = "␣"; -const blk12 = "▒"; -const blk14 = "░"; -const blk34 = "▓"; -const block = "█"; -const bne = "=⃥"; -const bnequiv = "≡⃥"; -const bnot = "⌐"; -const bopf = "𝕓"; -const bot = "⊥"; -const bottom = "⊥"; -const bowtie = "⋈"; -const boxDL = "╗"; -const boxDR = "╔"; -const boxDl = "╖"; -const boxDr = "╓"; -const boxH = "═"; -const boxHD = "╦"; -const boxHU = "╩"; -const boxHd = "╤"; -const boxHu = "╧"; -const boxUL = "╝"; -const boxUR = "╚"; -const boxUl = "╜"; -const boxUr = "╙"; -const boxV = "║"; -const boxVH = "╬"; -const boxVL = "╣"; -const boxVR = "╠"; -const boxVh = "╫"; -const boxVl = "╢"; -const boxVr = "╟"; -const boxbox = "⧉"; -const boxdL = "╕"; -const boxdR = "╒"; -const boxdl = "┐"; -const boxdr = "┌"; -const boxh = "─"; -const boxhD = "╥"; -const boxhU = "╨"; -const boxhd = "┬"; -const boxhu = "┴"; -const boxminus = "⊟"; -const boxplus = "⊞"; -const boxtimes = "⊠"; -const boxuL = "╛"; -const boxuR = "╘"; -const boxul = "┘"; -const boxur = "└"; -const boxv = "│"; -const boxvH = "╪"; -const boxvL = "╡"; -const boxvR = "╞"; -const boxvh = "┼"; -const boxvl = "┤"; -const boxvr = "├"; -const bprime = "‵"; -const breve = "˘"; -const brvba = "¦"; -const brvbar$1 = "¦"; -const bscr = "𝒷"; -const bsemi = "⁏"; -const bsim = "∽"; -const bsime = "⋍"; -const bsol = "\\"; -const bsolb = "⧅"; -const bsolhsub = "⟈"; -const bull = "•"; -const bullet = "•"; -const bump = "≎"; -const bumpE = "⪮"; -const bumpe = "≏"; -const bumpeq = "≏"; -const cacute = "ć"; -const cap = "∩"; -const capand = "⩄"; -const capbrcup = "⩉"; -const capcap = "⩋"; -const capcup = "⩇"; -const capdot = "⩀"; -const caps = "∩︀"; -const caret = "⁁"; -const caron = "ˇ"; -const ccaps = "⩍"; -const ccaron = "č"; -const ccedi = "ç"; -const ccedil$1 = "ç"; -const ccirc = "ĉ"; -const ccups = "⩌"; -const ccupssm = "⩐"; -const cdot = "ċ"; -const cedi = "¸"; -const cedil$1 = "¸"; -const cemptyv = "⦲"; -const cen = "¢"; -const cent$1 = "¢"; -const centerdot = "·"; -const cfr = "𝔠"; -const chcy = "ч"; -const check$2 = "✓"; -const checkmark = "✓"; -const chi = "χ"; -const cir = "○"; -const cirE = "⧃"; -const circ = "ˆ"; -const circeq = "≗"; -const circlearrowleft = "↺"; -const circlearrowright = "↻"; -const circledR = "®"; -const circledS = "Ⓢ"; -const circledast = "⊛"; -const circledcirc = "⊚"; -const circleddash = "⊝"; -const cire = "≗"; -const cirfnint = "⨐"; -const cirmid = "⫯"; -const cirscir = "⧂"; -const clubs = "♣"; -const clubsuit = "♣"; -const colon = ":"; -const colone = "≔"; -const coloneq = "≔"; -const comma = ","; -const commat = "@"; -const comp = "∁"; -const compfn = "∘"; -const complement = "∁"; -const complexes = "ℂ"; -const cong = "≅"; -const congdot = "⩭"; -const conint = "∮"; -const copf = "𝕔"; -const coprod = "∐"; -const cop = "©"; -const copy$3 = "©"; -const copysr = "℗"; -const crarr = "↵"; -const cross = "✗"; -const cscr = "𝒸"; -const csub = "⫏"; -const csube = "⫑"; -const csup = "⫐"; -const csupe = "⫒"; -const ctdot = "⋯"; -const cudarrl = "⤸"; -const cudarrr = "⤵"; -const cuepr = "⋞"; -const cuesc = "⋟"; -const cularr = "↶"; -const cularrp = "⤽"; -const cup = "∪"; -const cupbrcap = "⩈"; -const cupcap = "⩆"; -const cupcup = "⩊"; -const cupdot = "⊍"; -const cupor = "⩅"; -const cups = "∪︀"; -const curarr = "↷"; -const curarrm = "⤼"; -const curlyeqprec = "⋞"; -const curlyeqsucc = "⋟"; -const curlyvee = "⋎"; -const curlywedge = "⋏"; -const curre = "¤"; -const curren$1 = "¤"; -const curvearrowleft = "↶"; -const curvearrowright = "↷"; -const cuvee = "⋎"; -const cuwed = "⋏"; -const cwconint = "∲"; -const cwint = "∱"; -const cylcty = "⌭"; -const dArr = "⇓"; -const dHar = "⥥"; -const dagger = "†"; -const daleth = "ℸ"; -const darr = "↓"; -const dash = "‐"; -const dashv = "⊣"; -const dbkarow = "⤏"; -const dblac = "˝"; -const dcaron = "ď"; -const dcy = "д"; -const dd = "ⅆ"; -const ddagger = "‡"; -const ddarr = "⇊"; -const ddotseq = "⩷"; -const de = "°"; -const deg$1 = "°"; -const delta = "δ"; -const demptyv = "⦱"; -const dfisht = "⥿"; -const dfr = "𝔡"; -const dharl = "⇃"; -const dharr = "⇂"; -const diam = "⋄"; -const diamond = "⋄"; -const diamondsuit = "♦"; -const diams = "♦"; -const die = "¨"; -const digamma = "ϝ"; -const disin = "⋲"; -const div = "÷"; -const divid = "÷"; -const divide$1 = "÷"; -const divideontimes = "⋇"; -const divonx = "⋇"; -const djcy = "ђ"; -const dlcorn = "⌞"; -const dlcrop = "⌍"; -const dollar = "$"; -const dopf = "𝕕"; -const dot = "˙"; -const doteq = "≐"; -const doteqdot = "≑"; -const dotminus = "∸"; -const dotplus = "∔"; -const dotsquare = "⊡"; -const doublebarwedge = "⌆"; -const downarrow = "↓"; -const downdownarrows = "⇊"; -const downharpoonleft = "⇃"; -const downharpoonright = "⇂"; -const drbkarow = "⤐"; -const drcorn = "⌟"; -const drcrop = "⌌"; -const dscr = "𝒹"; -const dscy = "ѕ"; -const dsol = "⧶"; -const dstrok = "đ"; -const dtdot = "⋱"; -const dtri = "▿"; -const dtrif = "▾"; -const duarr = "⇵"; -const duhar = "⥯"; -const dwangle = "⦦"; -const dzcy = "џ"; -const dzigrarr = "⟿"; -const eDDot = "⩷"; -const eDot = "≑"; -const eacut = "é"; -const eacute$1 = "é"; -const easter = "⩮"; -const ecaron = "ě"; -const ecir = "ê"; -const ecirc$1 = "ê"; -const ecolon = "≕"; -const ecy = "э"; -const edot = "ė"; -const ee = "ⅇ"; -const efDot = "≒"; -const efr = "𝔢"; -const eg = "⪚"; -const egrav = "è"; -const egrave$1 = "è"; -const egs = "⪖"; -const egsdot = "⪘"; -const el = "⪙"; -const elinters = "⏧"; -const ell = "ℓ"; -const els = "⪕"; -const elsdot = "⪗"; -const emacr = "ē"; -const empty = "∅"; -const emptyset = "∅"; -const emptyv = "∅"; -const emsp13 = " "; -const emsp14 = " "; -const emsp = " "; -const eng = "ŋ"; -const ensp = " "; -const eogon = "ę"; -const eopf = "𝕖"; -const epar = "⋕"; -const eparsl = "⧣"; -const eplus = "⩱"; -const epsi = "ε"; -const epsilon = "ε"; -const epsiv = "ϵ"; -const eqcirc = "≖"; -const eqcolon = "≕"; -const eqsim = "≂"; -const eqslantgtr = "⪖"; -const eqslantless = "⪕"; -const equals = "="; -const equest = "≟"; -const equiv = "≡"; -const equivDD = "⩸"; -const eqvparsl = "⧥"; -const erDot = "≓"; -const erarr = "⥱"; -const escr = "ℯ"; -const esdot = "≐"; -const esim = "≂"; -const eta = "η"; -const et = "ð"; -const eth$1 = "ð"; -const eum = "ë"; -const euml$1 = "ë"; -const euro = "€"; -const excl = "!"; -const exist = "∃"; -const expectation = "ℰ"; -const exponentiale = "ⅇ"; -const fallingdotseq = "≒"; -const fcy = "ф"; -const female = "♀"; -const ffilig = "ffi"; -const fflig = "ff"; -const ffllig = "ffl"; -const ffr = "𝔣"; -const filig = "fi"; -const fjlig = "fj"; -const flat = "♭"; -const fllig = "fl"; -const fltns = "▱"; -const fnof = "ƒ"; -const fopf = "𝕗"; -const forall = "∀"; -const fork = "⋔"; -const forkv = "⫙"; -const fpartint = "⨍"; -const frac1 = "¼"; -const frac12$1 = "½"; -const frac13 = "⅓"; -const frac14$1 = "¼"; -const frac15 = "⅕"; -const frac16 = "⅙"; -const frac18 = "⅛"; -const frac23 = "⅔"; -const frac25 = "⅖"; -const frac3 = "¾"; -const frac34$1 = "¾"; -const frac35 = "⅗"; -const frac38 = "⅜"; -const frac45 = "⅘"; -const frac56 = "⅚"; -const frac58 = "⅝"; -const frac78 = "⅞"; -const frasl = "⁄"; -const frown = "⌢"; -const fscr = "𝒻"; -const gE = "≧"; -const gEl = "⪌"; -const gacute = "ǵ"; -const gamma = "γ"; -const gammad = "ϝ"; -const gap = "⪆"; -const gbreve = "ğ"; -const gcirc = "ĝ"; -const gcy = "г"; -const gdot = "ġ"; -const ge = "≥"; -const gel = "⋛"; -const geq = "≥"; -const geqq = "≧"; -const geqslant = "⩾"; -const ges = "⩾"; -const gescc = "⪩"; -const gesdot = "⪀"; -const gesdoto = "⪂"; -const gesdotol = "⪄"; -const gesl = "⋛︀"; -const gesles = "⪔"; -const gfr = "𝔤"; -const gg = "≫"; -const ggg = "⋙"; -const gimel = "ℷ"; -const gjcy = "ѓ"; -const gl = "≷"; -const glE = "⪒"; -const gla = "⪥"; -const glj = "⪤"; -const gnE = "≩"; -const gnap = "⪊"; -const gnapprox = "⪊"; -const gne = "⪈"; -const gneq = "⪈"; -const gneqq = "≩"; -const gnsim = "⋧"; -const gopf = "𝕘"; -const grave = "`"; -const gscr = "ℊ"; -const gsim = "≳"; -const gsime = "⪎"; -const gsiml = "⪐"; -const g = ">"; -const gt$1 = ">"; -const gtcc = "⪧"; -const gtcir = "⩺"; -const gtdot = "⋗"; -const gtlPar = "⦕"; -const gtquest = "⩼"; -const gtrapprox = "⪆"; -const gtrarr = "⥸"; -const gtrdot = "⋗"; -const gtreqless = "⋛"; -const gtreqqless = "⪌"; -const gtrless = "≷"; -const gtrsim = "≳"; -const gvertneqq = "≩︀"; -const gvnE = "≩︀"; -const hArr = "⇔"; -const hairsp = " "; -const half = "½"; -const hamilt = "ℋ"; -const hardcy = "ъ"; -const harr = "↔"; -const harrcir = "⥈"; -const harrw = "↭"; -const hbar = "ℏ"; -const hcirc = "ĥ"; -const hearts = "♥"; -const heartsuit = "♥"; -const hellip = "…"; -const hercon = "⊹"; -const hfr = "𝔥"; -const hksearow = "⤥"; -const hkswarow = "⤦"; -const hoarr = "⇿"; -const homtht = "∻"; -const hookleftarrow = "↩"; -const hookrightarrow = "↪"; -const hopf = "𝕙"; -const horbar = "―"; -const hscr = "𝒽"; -const hslash = "ℏ"; -const hstrok = "ħ"; -const hybull = "⁃"; -const hyphen = "‐"; -const iacut = "í"; -const iacute$1 = "í"; -const ic = "⁣"; -const icir = "î"; -const icirc$1 = "î"; -const icy = "и"; -const iecy = "е"; -const iexc = "¡"; -const iexcl$1 = "¡"; -const iff = "⇔"; -const ifr = "𝔦"; -const igrav = "ì"; -const igrave$1 = "ì"; -const ii = "ⅈ"; -const iiiint = "⨌"; -const iiint = "∭"; -const iinfin = "⧜"; -const iiota = "℩"; -const ijlig = "ij"; -const imacr = "ī"; -const image = "ℑ"; -const imagline = "ℐ"; -const imagpart = "ℑ"; -const imath = "ı"; -const imof = "⊷"; -const imped = "Ƶ"; -const incare = "℅"; -const infin = "∞"; -const infintie = "⧝"; -const inodot = "ı"; -const int = "∫"; -const intcal = "⊺"; -const integers = "ℤ"; -const intercal = "⊺"; -const intlarhk = "⨗"; -const intprod = "⨼"; -const iocy = "ё"; -const iogon = "į"; -const iopf = "𝕚"; -const iota = "ι"; -const iprod = "⨼"; -const iques = "¿"; -const iquest$1 = "¿"; -const iscr = "𝒾"; -const isin = "∈"; -const isinE = "⋹"; -const isindot = "⋵"; -const isins = "⋴"; -const isinsv = "⋳"; -const isinv = "∈"; -const it = "⁢"; -const itilde = "ĩ"; -const iukcy = "і"; -const ium = "ï"; -const iuml$1 = "ï"; -const jcirc = "ĵ"; -const jcy = "й"; -const jfr = "𝔧"; -const jmath = "ȷ"; -const jopf = "𝕛"; -const jscr = "𝒿"; -const jsercy = "ј"; -const jukcy = "є"; -const kappa = "κ"; -const kappav = "ϰ"; -const kcedil = "ķ"; -const kcy = "к"; -const kfr = "𝔨"; -const kgreen = "ĸ"; -const khcy = "х"; -const kjcy = "ќ"; -const kopf = "𝕜"; -const kscr = "𝓀"; -const lAarr = "⇚"; -const lArr = "⇐"; -const lAtail = "⤛"; -const lBarr = "⤎"; -const lE = "≦"; -const lEg = "⪋"; -const lHar = "⥢"; -const lacute = "ĺ"; -const laemptyv = "⦴"; -const lagran = "ℒ"; -const lambda = "λ"; -const lang = "⟨"; -const langd = "⦑"; -const langle = "⟨"; -const lap = "⪅"; -const laqu = "«"; -const laquo$1 = "«"; -const larr = "←"; -const larrb = "⇤"; -const larrbfs = "⤟"; -const larrfs = "⤝"; -const larrhk = "↩"; -const larrlp = "↫"; -const larrpl = "⤹"; -const larrsim = "⥳"; -const larrtl = "↢"; -const lat = "⪫"; -const latail = "⤙"; -const late = "⪭"; -const lates = "⪭︀"; -const lbarr = "⤌"; -const lbbrk = "❲"; -const lbrace = "{"; -const lbrack = "["; -const lbrke = "⦋"; -const lbrksld = "⦏"; -const lbrkslu = "⦍"; -const lcaron = "ľ"; -const lcedil = "ļ"; -const lceil = "⌈"; -const lcub = "{"; -const lcy = "л"; -const ldca = "⤶"; -const ldquo = "“"; -const ldquor = "„"; -const ldrdhar = "⥧"; -const ldrushar = "⥋"; -const ldsh = "↲"; -const le = "≤"; -const leftarrow = "←"; -const leftarrowtail = "↢"; -const leftharpoondown = "↽"; -const leftharpoonup = "↼"; -const leftleftarrows = "⇇"; -const leftrightarrow = "↔"; -const leftrightarrows = "⇆"; -const leftrightharpoons = "⇋"; -const leftrightsquigarrow = "↭"; -const leftthreetimes = "⋋"; -const leg = "⋚"; -const leq = "≤"; -const leqq = "≦"; -const leqslant = "⩽"; -const les = "⩽"; -const lescc = "⪨"; -const lesdot = "⩿"; -const lesdoto = "⪁"; -const lesdotor = "⪃"; -const lesg = "⋚︀"; -const lesges = "⪓"; -const lessapprox = "⪅"; -const lessdot = "⋖"; -const lesseqgtr = "⋚"; -const lesseqqgtr = "⪋"; -const lessgtr = "≶"; -const lesssim = "≲"; -const lfisht = "⥼"; -const lfloor = "⌊"; -const lfr = "𝔩"; -const lg = "≶"; -const lgE = "⪑"; -const lhard = "↽"; -const lharu = "↼"; -const lharul = "⥪"; -const lhblk = "▄"; -const ljcy = "љ"; -const ll = "≪"; -const llarr = "⇇"; -const llcorner = "⌞"; -const llhard = "⥫"; -const lltri = "◺"; -const lmidot = "ŀ"; -const lmoust = "⎰"; -const lmoustache = "⎰"; -const lnE = "≨"; -const lnap = "⪉"; -const lnapprox = "⪉"; -const lne = "⪇"; -const lneq = "⪇"; -const lneqq = "≨"; -const lnsim = "⋦"; -const loang = "⟬"; -const loarr = "⇽"; -const lobrk = "⟦"; -const longleftarrow = "⟵"; -const longleftrightarrow = "⟷"; -const longmapsto = "⟼"; -const longrightarrow = "⟶"; -const looparrowleft = "↫"; -const looparrowright = "↬"; -const lopar = "⦅"; -const lopf = "𝕝"; -const loplus = "⨭"; -const lotimes = "⨴"; -const lowast = "∗"; -const lowbar = "_"; -const loz = "◊"; -const lozenge = "◊"; -const lozf = "⧫"; -const lpar = "("; -const lparlt = "⦓"; -const lrarr = "⇆"; -const lrcorner = "⌟"; -const lrhar = "⇋"; -const lrhard = "⥭"; -const lrm = "‎"; -const lrtri = "⊿"; -const lsaquo = "‹"; -const lscr = "𝓁"; -const lsh = "↰"; -const lsim = "≲"; -const lsime = "⪍"; -const lsimg = "⪏"; -const lsqb = "["; -const lsquo = "‘"; -const lsquor = "‚"; -const lstrok = "ł"; -const l = "<"; -const lt$1 = "<"; -const ltcc = "⪦"; -const ltcir = "⩹"; -const ltdot = "⋖"; -const lthree = "⋋"; -const ltimes = "⋉"; -const ltlarr = "⥶"; -const ltquest = "⩻"; -const ltrPar = "⦖"; -const ltri = "◃"; -const ltrie = "⊴"; -const ltrif = "◂"; -const lurdshar = "⥊"; -const luruhar = "⥦"; -const lvertneqq = "≨︀"; -const lvnE = "≨︀"; -const mDDot = "∺"; -const mac = "¯"; -const macr$1 = "¯"; -const male = "♂"; -const malt = "✠"; -const maltese = "✠"; -const map$3 = "↦"; -const mapsto = "↦"; -const mapstodown = "↧"; -const mapstoleft = "↤"; -const mapstoup = "↥"; -const marker = "▮"; -const mcomma = "⨩"; -const mcy = "м"; -const mdash = "—"; -const measuredangle = "∡"; -const mfr = "𝔪"; -const mho = "℧"; -const micr = "µ"; -const micro$1 = "µ"; -const mid = "∣"; -const midast = "*"; -const midcir = "⫰"; -const middo = "·"; -const middot$1 = "·"; -const minus = "−"; -const minusb = "⊟"; -const minusd = "∸"; -const minusdu = "⨪"; -const mlcp = "⫛"; -const mldr = "…"; -const mnplus = "∓"; -const models = "⊧"; -const mopf = "𝕞"; -const mp = "∓"; -const mscr = "𝓂"; -const mstpos = "∾"; -const mu = "μ"; -const multimap = "⊸"; -const mumap = "⊸"; -const nGg = "⋙̸"; -const nGt = "≫⃒"; -const nGtv = "≫̸"; -const nLeftarrow = "⇍"; -const nLeftrightarrow = "⇎"; -const nLl = "⋘̸"; -const nLt = "≪⃒"; -const nLtv = "≪̸"; -const nRightarrow = "⇏"; -const nVDash = "⊯"; -const nVdash = "⊮"; -const nabla = "∇"; -const nacute = "ń"; -const nang = "∠⃒"; -const nap = "≉"; -const napE = "⩰̸"; -const napid = "≋̸"; -const napos = "ʼn"; -const napprox = "≉"; -const natur = "♮"; -const natural = "♮"; -const naturals = "ℕ"; -const nbs = " "; -const nbsp$1 = " "; -const nbump = "≎̸"; -const nbumpe = "≏̸"; -const ncap = "⩃"; -const ncaron = "ň"; -const ncedil = "ņ"; -const ncong = "≇"; -const ncongdot = "⩭̸"; -const ncup = "⩂"; -const ncy = "н"; -const ndash = "–"; -const ne = "≠"; -const neArr = "⇗"; -const nearhk = "⤤"; -const nearr = "↗"; -const nearrow = "↗"; -const nedot = "≐̸"; -const nequiv = "≢"; -const nesear = "⤨"; -const nesim = "≂̸"; -const nexist = "∄"; -const nexists = "∄"; -const nfr = "𝔫"; -const ngE = "≧̸"; -const nge = "≱"; -const ngeq = "≱"; -const ngeqq = "≧̸"; -const ngeqslant = "⩾̸"; -const nges = "⩾̸"; -const ngsim = "≵"; -const ngt = "≯"; -const ngtr = "≯"; -const nhArr = "⇎"; -const nharr = "↮"; -const nhpar = "⫲"; -const ni = "∋"; -const nis = "⋼"; -const nisd = "⋺"; -const niv = "∋"; -const njcy = "њ"; -const nlArr = "⇍"; -const nlE = "≦̸"; -const nlarr = "↚"; -const nldr = "‥"; -const nle = "≰"; -const nleftarrow = "↚"; -const nleftrightarrow = "↮"; -const nleq = "≰"; -const nleqq = "≦̸"; -const nleqslant = "⩽̸"; -const nles = "⩽̸"; -const nless = "≮"; -const nlsim = "≴"; -const nlt = "≮"; -const nltri = "⋪"; -const nltrie = "⋬"; -const nmid = "∤"; -const nopf = "𝕟"; -const no = "¬"; -const not$1 = "¬"; -const notin = "∉"; -const notinE = "⋹̸"; -const notindot = "⋵̸"; -const notinva = "∉"; -const notinvb = "⋷"; -const notinvc = "⋶"; -const notni = "∌"; -const notniva = "∌"; -const notnivb = "⋾"; -const notnivc = "⋽"; -const npar = "∦"; -const nparallel = "∦"; -const nparsl = "⫽⃥"; -const npart = "∂̸"; -const npolint = "⨔"; -const npr = "⊀"; -const nprcue = "⋠"; -const npre = "⪯̸"; -const nprec = "⊀"; -const npreceq = "⪯̸"; -const nrArr = "⇏"; -const nrarr = "↛"; -const nrarrc = "⤳̸"; -const nrarrw = "↝̸"; -const nrightarrow = "↛"; -const nrtri = "⋫"; -const nrtrie = "⋭"; -const nsc = "⊁"; -const nsccue = "⋡"; -const nsce = "⪰̸"; -const nscr = "𝓃"; -const nshortmid = "∤"; -const nshortparallel = "∦"; -const nsim = "≁"; -const nsime = "≄"; -const nsimeq = "≄"; -const nsmid = "∤"; -const nspar = "∦"; -const nsqsube = "⋢"; -const nsqsupe = "⋣"; -const nsub = "⊄"; -const nsubE = "⫅̸"; -const nsube = "⊈"; -const nsubset = "⊂⃒"; -const nsubseteq = "⊈"; -const nsubseteqq = "⫅̸"; -const nsucc = "⊁"; -const nsucceq = "⪰̸"; -const nsup = "⊅"; -const nsupE = "⫆̸"; -const nsupe = "⊉"; -const nsupset = "⊃⃒"; -const nsupseteq = "⊉"; -const nsupseteqq = "⫆̸"; -const ntgl = "≹"; -const ntild = "ñ"; -const ntilde$1 = "ñ"; -const ntlg = "≸"; -const ntriangleleft = "⋪"; -const ntrianglelefteq = "⋬"; -const ntriangleright = "⋫"; -const ntrianglerighteq = "⋭"; -const nu = "ν"; -const num = "#"; -const numero = "№"; -const numsp = " "; -const nvDash = "⊭"; -const nvHarr = "⤄"; -const nvap = "≍⃒"; -const nvdash = "⊬"; -const nvge = "≥⃒"; -const nvgt = ">⃒"; -const nvinfin = "⧞"; -const nvlArr = "⤂"; -const nvle = "≤⃒"; -const nvlt = "<⃒"; -const nvltrie = "⊴⃒"; -const nvrArr = "⤃"; -const nvrtrie = "⊵⃒"; -const nvsim = "∼⃒"; -const nwArr = "⇖"; -const nwarhk = "⤣"; -const nwarr = "↖"; -const nwarrow = "↖"; -const nwnear = "⤧"; -const oS = "Ⓢ"; -const oacut = "ó"; -const oacute$1 = "ó"; -const oast = "⊛"; -const ocir = "ô"; -const ocirc$1 = "ô"; -const ocy = "о"; -const odash = "⊝"; -const odblac = "ő"; -const odiv = "⨸"; -const odot = "⊙"; -const odsold = "⦼"; -const oelig = "œ"; -const ofcir = "⦿"; -const ofr = "𝔬"; -const ogon = "˛"; -const ograv = "ò"; -const ograve$1 = "ò"; -const ogt = "⧁"; -const ohbar = "⦵"; -const ohm = "Ω"; -const oint = "∮"; -const olarr = "↺"; -const olcir = "⦾"; -const olcross = "⦻"; -const oline = "‾"; -const olt = "⧀"; -const omacr = "ō"; -const omega = "ω"; -const omicron = "ο"; -const omid = "⦶"; -const ominus = "⊖"; -const oopf = "𝕠"; -const opar = "⦷"; -const operp = "⦹"; -const oplus = "⊕"; -const or = "∨"; -const orarr = "↻"; -const ord = "º"; -const order$2 = "ℴ"; -const orderof = "ℴ"; -const ordf$1 = "ª"; -const ordm$1 = "º"; -const origof = "⊶"; -const oror = "⩖"; -const orslope = "⩗"; -const orv = "⩛"; -const oscr = "ℴ"; -const oslas = "ø"; -const oslash$1 = "ø"; -const osol = "⊘"; -const otild = "õ"; -const otilde$1 = "õ"; -const otimes = "⊗"; -const otimesas = "⨶"; -const oum = "ö"; -const ouml$1 = "ö"; -const ovbar = "⌽"; -const par = "¶"; -const para$1 = "¶"; -const parallel = "∥"; -const parsim = "⫳"; -const parsl = "⫽"; -const part = "∂"; -const pcy = "п"; -const percnt = "%"; -const period = "."; -const permil = "‰"; -const perp = "⊥"; -const pertenk = "‱"; -const pfr = "𝔭"; -const phi = "φ"; -const phiv = "ϕ"; -const phmmat = "ℳ"; -const phone = "☎"; -const pi = "π"; -const pitchfork = "⋔"; -const piv = "ϖ"; -const planck = "ℏ"; -const planckh = "ℎ"; -const plankv = "ℏ"; -const plus = "+"; -const plusacir = "⨣"; -const plusb = "⊞"; -const pluscir = "⨢"; -const plusdo = "∔"; -const plusdu = "⨥"; -const pluse = "⩲"; -const plusm = "±"; -const plusmn$1 = "±"; -const plussim = "⨦"; -const plustwo = "⨧"; -const pm = "±"; -const pointint = "⨕"; -const popf = "𝕡"; -const poun = "£"; -const pound$1 = "£"; -const pr = "≺"; -const prE = "⪳"; -const prap = "⪷"; -const prcue = "≼"; -const pre = "⪯"; -const prec = "≺"; -const precapprox = "⪷"; -const preccurlyeq = "≼"; -const preceq = "⪯"; -const precnapprox = "⪹"; -const precneqq = "⪵"; -const precnsim = "⋨"; -const precsim = "≾"; -const prime = "′"; -const primes = "ℙ"; -const prnE = "⪵"; -const prnap = "⪹"; -const prnsim = "⋨"; -const prod = "∏"; -const profalar = "⌮"; -const profline = "⌒"; -const profsurf = "⌓"; -const prop = "∝"; -const propto = "∝"; -const prsim = "≾"; -const prurel = "⊰"; -const pscr = "𝓅"; -const psi = "ψ"; -const puncsp = " "; -const qfr = "𝔮"; -const qint = "⨌"; -const qopf = "𝕢"; -const qprime = "⁗"; -const qscr = "𝓆"; -const quaternions = "ℍ"; -const quatint = "⨖"; -const quest = "?"; -const questeq = "≟"; -const quo = "\""; -const quot$1 = "\""; -const rAarr = "⇛"; -const rArr = "⇒"; -const rAtail = "⤜"; -const rBarr = "⤏"; -const rHar = "⥤"; -const race = "∽̱"; -const racute = "ŕ"; -const radic = "√"; -const raemptyv = "⦳"; -const rang = "⟩"; -const rangd = "⦒"; -const range$1 = "⦥"; -const rangle = "⟩"; -const raqu = "»"; -const raquo$1 = "»"; -const rarr = "→"; -const rarrap = "⥵"; -const rarrb = "⇥"; -const rarrbfs = "⤠"; -const rarrc = "⤳"; -const rarrfs = "⤞"; -const rarrhk = "↪"; -const rarrlp = "↬"; -const rarrpl = "⥅"; -const rarrsim = "⥴"; -const rarrtl = "↣"; -const rarrw = "↝"; -const ratail = "⤚"; -const ratio = "∶"; -const rationals = "ℚ"; -const rbarr = "⤍"; -const rbbrk = "❳"; -const rbrace = "}"; -const rbrack = "]"; -const rbrke = "⦌"; -const rbrksld = "⦎"; -const rbrkslu = "⦐"; -const rcaron = "ř"; -const rcedil = "ŗ"; -const rceil = "⌉"; -const rcub = "}"; -const rcy = "р"; -const rdca = "⤷"; -const rdldhar = "⥩"; -const rdquo = "”"; -const rdquor = "”"; -const rdsh = "↳"; -const real = "ℜ"; -const realine = "ℛ"; -const realpart = "ℜ"; -const reals = "ℝ"; -const rect = "▭"; -const re = "®"; -const reg$1 = "®"; -const rfisht = "⥽"; -const rfloor = "⌋"; -const rfr = "𝔯"; -const rhard = "⇁"; -const rharu = "⇀"; -const rharul = "⥬"; -const rho = "ρ"; -const rhov = "ϱ"; -const rightarrow = "→"; -const rightarrowtail = "↣"; -const rightharpoondown = "⇁"; -const rightharpoonup = "⇀"; -const rightleftarrows = "⇄"; -const rightleftharpoons = "⇌"; -const rightrightarrows = "⇉"; -const rightsquigarrow = "↝"; -const rightthreetimes = "⋌"; -const ring = "˚"; -const risingdotseq = "≓"; -const rlarr = "⇄"; -const rlhar = "⇌"; -const rlm = "‏"; -const rmoust = "⎱"; -const rmoustache = "⎱"; -const rnmid = "⫮"; -const roang = "⟭"; -const roarr = "⇾"; -const robrk = "⟧"; -const ropar = "⦆"; -const ropf = "𝕣"; -const roplus = "⨮"; -const rotimes = "⨵"; -const rpar = ")"; -const rpargt = "⦔"; -const rppolint = "⨒"; -const rrarr = "⇉"; -const rsaquo = "›"; -const rscr = "𝓇"; -const rsh = "↱"; -const rsqb = "]"; -const rsquo = "’"; -const rsquor = "’"; -const rthree = "⋌"; -const rtimes = "⋊"; -const rtri = "▹"; -const rtrie = "⊵"; -const rtrif = "▸"; -const rtriltri = "⧎"; -const ruluhar = "⥨"; -const rx = "℞"; -const sacute = "ś"; -const sbquo = "‚"; -const sc = "≻"; -const scE = "⪴"; -const scap = "⪸"; -const scaron = "š"; -const sccue = "≽"; -const sce = "⪰"; -const scedil = "ş"; -const scirc = "ŝ"; -const scnE = "⪶"; -const scnap = "⪺"; -const scnsim = "⋩"; -const scpolint = "⨓"; -const scsim = "≿"; -const scy = "с"; -const sdot = "⋅"; -const sdotb = "⊡"; -const sdote = "⩦"; -const seArr = "⇘"; -const searhk = "⤥"; -const searr = "↘"; -const searrow = "↘"; -const sec = "§"; -const sect$1 = "§"; -const semi = ";"; -const seswar = "⤩"; -const setminus = "∖"; -const setmn = "∖"; -const sext = "✶"; -const sfr = "𝔰"; -const sfrown = "⌢"; -const sharp = "♯"; -const shchcy = "щ"; -const shcy = "ш"; -const shortmid = "∣"; -const shortparallel = "∥"; -const sh = "­"; -const shy$1 = "­"; -const sigma = "σ"; -const sigmaf = "ς"; -const sigmav = "ς"; -const sim = "∼"; -const simdot = "⩪"; -const sime = "≃"; -const simeq = "≃"; -const simg = "⪞"; -const simgE = "⪠"; -const siml = "⪝"; -const simlE = "⪟"; -const simne = "≆"; -const simplus = "⨤"; -const simrarr = "⥲"; -const slarr = "←"; -const smallsetminus = "∖"; -const smashp = "⨳"; -const smeparsl = "⧤"; -const smid = "∣"; -const smile = "⌣"; -const smt = "⪪"; -const smte = "⪬"; -const smtes = "⪬︀"; -const softcy = "ь"; -const sol = "/"; -const solb = "⧄"; -const solbar = "⌿"; -const sopf = "𝕤"; -const spades = "♠"; -const spadesuit = "♠"; -const spar = "∥"; -const sqcap = "⊓"; -const sqcaps = "⊓︀"; -const sqcup = "⊔"; -const sqcups = "⊔︀"; -const sqsub = "⊏"; -const sqsube = "⊑"; -const sqsubset = "⊏"; -const sqsubseteq = "⊑"; -const sqsup = "⊐"; -const sqsupe = "⊒"; -const sqsupset = "⊐"; -const sqsupseteq = "⊒"; -const squ = "□"; -const square = "□"; -const squarf = "▪"; -const squf = "▪"; -const srarr = "→"; -const sscr = "𝓈"; -const ssetmn = "∖"; -const ssmile = "⌣"; -const sstarf = "⋆"; -const star$1 = "☆"; -const starf = "★"; -const straightepsilon = "ϵ"; -const straightphi = "ϕ"; -const strns = "¯"; -const sub = "⊂"; -const subE = "⫅"; -const subdot = "⪽"; -const sube = "⊆"; -const subedot = "⫃"; -const submult = "⫁"; -const subnE = "⫋"; -const subne = "⊊"; -const subplus = "⪿"; -const subrarr = "⥹"; -const subset = "⊂"; -const subseteq = "⊆"; -const subseteqq = "⫅"; -const subsetneq = "⊊"; -const subsetneqq = "⫋"; -const subsim = "⫇"; -const subsub = "⫕"; -const subsup = "⫓"; -const succ = "≻"; -const succapprox = "⪸"; -const succcurlyeq = "≽"; -const succeq = "⪰"; -const succnapprox = "⪺"; -const succneqq = "⪶"; -const succnsim = "⋩"; -const succsim = "≿"; -const sum = "∑"; -const sung = "♪"; -const sup = "⊃"; -const sup1$1 = "¹"; -const sup2$1 = "²"; -const sup3$1 = "³"; -const supE = "⫆"; -const supdot = "⪾"; -const supdsub = "⫘"; -const supe = "⊇"; -const supedot = "⫄"; -const suphsol = "⟉"; -const suphsub = "⫗"; -const suplarr = "⥻"; -const supmult = "⫂"; -const supnE = "⫌"; -const supne = "⊋"; -const supplus = "⫀"; -const supset = "⊃"; -const supseteq = "⊇"; -const supseteqq = "⫆"; -const supsetneq = "⊋"; -const supsetneqq = "⫌"; -const supsim = "⫈"; -const supsub = "⫔"; -const supsup = "⫖"; -const swArr = "⇙"; -const swarhk = "⤦"; -const swarr = "↙"; -const swarrow = "↙"; -const swnwar = "⤪"; -const szli = "ß"; -const szlig$1 = "ß"; -const target = "⌖"; -const tau = "τ"; -const tbrk = "⎴"; -const tcaron = "ť"; -const tcedil = "ţ"; -const tcy = "т"; -const tdot = "⃛"; -const telrec = "⌕"; -const tfr = "𝔱"; -const there4 = "∴"; -const therefore = "∴"; -const theta = "θ"; -const thetasym = "ϑ"; -const thetav = "ϑ"; -const thickapprox = "≈"; -const thicksim = "∼"; -const thinsp = " "; -const thkap = "≈"; -const thksim = "∼"; -const thor = "þ"; -const thorn$1 = "þ"; -const tilde = "˜"; -const time = "×"; -const times$1 = "×"; -const timesb = "⊠"; -const timesbar = "⨱"; -const timesd = "⨰"; -const tint = "∭"; -const toea = "⤨"; -const top = "⊤"; -const topbot = "⌶"; -const topcir = "⫱"; -const topf = "𝕥"; -const topfork = "⫚"; -const tosa = "⤩"; -const tprime = "‴"; -const trade = "™"; -const triangle = "▵"; -const triangledown = "▿"; -const triangleleft = "◃"; -const trianglelefteq = "⊴"; -const triangleq = "≜"; -const triangleright = "▹"; -const trianglerighteq = "⊵"; -const tridot = "◬"; -const trie = "≜"; -const triminus = "⨺"; -const triplus = "⨹"; -const trisb = "⧍"; -const tritime = "⨻"; -const trpezium = "⏢"; -const tscr = "𝓉"; -const tscy = "ц"; -const tshcy = "ћ"; -const tstrok = "ŧ"; -const twixt = "≬"; -const twoheadleftarrow = "↞"; -const twoheadrightarrow = "↠"; -const uArr = "⇑"; -const uHar = "⥣"; -const uacut = "ú"; -const uacute$1 = "ú"; -const uarr = "↑"; -const ubrcy = "ў"; -const ubreve = "ŭ"; -const ucir = "û"; -const ucirc$1 = "û"; -const ucy = "у"; -const udarr = "⇅"; -const udblac = "ű"; -const udhar = "⥮"; -const ufisht = "⥾"; -const ufr = "𝔲"; -const ugrav = "ù"; -const ugrave$1 = "ù"; -const uharl = "↿"; -const uharr = "↾"; -const uhblk = "▀"; -const ulcorn = "⌜"; -const ulcorner = "⌜"; -const ulcrop = "⌏"; -const ultri = "◸"; -const umacr = "ū"; -const um = "¨"; -const uml$1 = "¨"; -const uogon = "ų"; -const uopf = "𝕦"; -const uparrow = "↑"; -const updownarrow = "↕"; -const upharpoonleft = "↿"; -const upharpoonright = "↾"; -const uplus = "⊎"; -const upsi = "υ"; -const upsih = "ϒ"; -const upsilon = "υ"; -const upuparrows = "⇈"; -const urcorn = "⌝"; -const urcorner = "⌝"; -const urcrop = "⌎"; -const uring = "ů"; -const urtri = "◹"; -const uscr = "𝓊"; -const utdot = "⋰"; -const utilde = "ũ"; -const utri = "▵"; -const utrif = "▴"; -const uuarr = "⇈"; -const uum = "ü"; -const uuml$1 = "ü"; -const uwangle = "⦧"; -const vArr = "⇕"; -const vBar = "⫨"; -const vBarv = "⫩"; -const vDash = "⊨"; -const vangrt = "⦜"; -const varepsilon = "ϵ"; -const varkappa = "ϰ"; -const varnothing = "∅"; -const varphi = "ϕ"; -const varpi = "ϖ"; -const varpropto = "∝"; -const varr = "↕"; -const varrho = "ϱ"; -const varsigma = "ς"; -const varsubsetneq = "⊊︀"; -const varsubsetneqq = "⫋︀"; -const varsupsetneq = "⊋︀"; -const varsupsetneqq = "⫌︀"; -const vartheta = "ϑ"; -const vartriangleleft = "⊲"; -const vartriangleright = "⊳"; -const vcy = "в"; -const vdash = "⊢"; -const vee = "∨"; -const veebar = "⊻"; -const veeeq = "≚"; -const vellip = "⋮"; -const verbar = "|"; -const vert = "|"; -const vfr = "𝔳"; -const vltri = "⊲"; -const vnsub = "⊂⃒"; -const vnsup = "⊃⃒"; -const vopf = "𝕧"; -const vprop = "∝"; -const vrtri = "⊳"; -const vscr = "𝓋"; -const vsubnE = "⫋︀"; -const vsubne = "⊊︀"; -const vsupnE = "⫌︀"; -const vsupne = "⊋︀"; -const vzigzag = "⦚"; -const wcirc = "ŵ"; -const wedbar = "⩟"; -const wedge = "∧"; -const wedgeq = "≙"; -const weierp = "℘"; -const wfr = "𝔴"; -const wopf = "𝕨"; -const wp = "℘"; -const wr = "≀"; -const wreath = "≀"; -const wscr = "𝓌"; -const xcap = "⋂"; -const xcirc = "◯"; -const xcup = "⋃"; -const xdtri = "▽"; -const xfr = "𝔵"; -const xhArr = "⟺"; -const xharr = "⟷"; -const xi = "ξ"; -const xlArr = "⟸"; -const xlarr = "⟵"; -const xmap = "⟼"; -const xnis = "⋻"; -const xodot = "⨀"; -const xopf = "𝕩"; -const xoplus = "⨁"; -const xotime = "⨂"; -const xrArr = "⟹"; -const xrarr = "⟶"; -const xscr = "𝓍"; -const xsqcup = "⨆"; -const xuplus = "⨄"; -const xutri = "△"; -const xvee = "⋁"; -const xwedge = "⋀"; -const yacut = "ý"; -const yacute$1 = "ý"; -const yacy = "я"; -const ycirc = "ŷ"; -const ycy = "ы"; -const ye = "¥"; -const yen$1 = "¥"; -const yfr = "𝔶"; -const yicy = "ї"; -const yopf = "𝕪"; -const yscr = "𝓎"; -const yucy = "ю"; -const yum = "ÿ"; -const yuml$1 = "ÿ"; -const zacute = "ź"; -const zcaron = "ž"; -const zcy = "з"; -const zdot = "ż"; -const zeetrf = "ℨ"; -const zeta = "ζ"; -const zfr = "𝔷"; -const zhcy = "ж"; -const zigrarr = "⇝"; -const zopf = "𝕫"; -const zscr = "𝓏"; -const zwj = "‍"; -const zwnj = "‌"; -var index$4 = { - AEli: AEli, - AElig: AElig$1, - AM: AM, - AMP: AMP$1, - Aacut: Aacut, - Aacute: Aacute$1, - Abreve: Abreve, - Acir: Acir, - Acirc: Acirc$1, - Acy: Acy, - Afr: Afr, - Agrav: Agrav, - Agrave: Agrave$1, - Alpha: Alpha, - Amacr: Amacr, - And: And, - Aogon: Aogon, - Aopf: Aopf, - ApplyFunction: ApplyFunction, - Arin: Arin, - Aring: Aring$1, - Ascr: Ascr, - Assign: Assign, - Atild: Atild, - Atilde: Atilde$1, - Aum: Aum, - Auml: Auml$1, - Backslash: Backslash, - Barv: Barv, - Barwed: Barwed, - Bcy: Bcy, - Because: Because, - Bernoullis: Bernoullis, - Beta: Beta, - Bfr: Bfr, - Bopf: Bopf, - Breve: Breve, - Bscr: Bscr, - Bumpeq: Bumpeq, - CHcy: CHcy, - COP: COP, - COPY: COPY$1, - Cacute: Cacute, - Cap: Cap, - CapitalDifferentialD: CapitalDifferentialD, - Cayleys: Cayleys, - Ccaron: Ccaron, - Ccedi: Ccedi, - Ccedil: Ccedil$1, - Ccirc: Ccirc, - Cconint: Cconint, - Cdot: Cdot, - Cedilla: Cedilla, - CenterDot: CenterDot, - Cfr: Cfr, - Chi: Chi, - CircleDot: CircleDot, - CircleMinus: CircleMinus, - CirclePlus: CirclePlus, - CircleTimes: CircleTimes, - ClockwiseContourIntegral: ClockwiseContourIntegral, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, - CloseCurlyQuote: CloseCurlyQuote, - Colon: Colon, - Colone: Colone, - Congruent: Congruent, - Conint: Conint, - ContourIntegral: ContourIntegral, - Copf: Copf, - Coproduct: Coproduct, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, - Cross: Cross, - Cscr: Cscr, - Cup: Cup, - CupCap: CupCap, - DD: DD, - DDotrahd: DDotrahd, - DJcy: DJcy, - DScy: DScy, - DZcy: DZcy, - Dagger: Dagger, - Darr: Darr, - Dashv: Dashv, - Dcaron: Dcaron, - Dcy: Dcy, - Del: Del, - Delta: Delta, - Dfr: Dfr, - DiacriticalAcute: DiacriticalAcute, - DiacriticalDot: DiacriticalDot, - DiacriticalDoubleAcute: DiacriticalDoubleAcute, - DiacriticalGrave: DiacriticalGrave, - DiacriticalTilde: DiacriticalTilde, - Diamond: Diamond, - DifferentialD: DifferentialD, - Dopf: Dopf, - Dot: Dot, - DotDot: DotDot, - DotEqual: DotEqual, - DoubleContourIntegral: DoubleContourIntegral, - DoubleDot: DoubleDot, - DoubleDownArrow: DoubleDownArrow, - DoubleLeftArrow: DoubleLeftArrow, - DoubleLeftRightArrow: DoubleLeftRightArrow, - DoubleLeftTee: DoubleLeftTee, - DoubleLongLeftArrow: DoubleLongLeftArrow, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, - DoubleLongRightArrow: DoubleLongRightArrow, - DoubleRightArrow: DoubleRightArrow, - DoubleRightTee: DoubleRightTee, - DoubleUpArrow: DoubleUpArrow, - DoubleUpDownArrow: DoubleUpDownArrow, - DoubleVerticalBar: DoubleVerticalBar, - DownArrow: DownArrow, - DownArrowBar: DownArrowBar, - DownArrowUpArrow: DownArrowUpArrow, - DownBreve: DownBreve, - DownLeftRightVector: DownLeftRightVector, - DownLeftTeeVector: DownLeftTeeVector, - DownLeftVector: DownLeftVector, - DownLeftVectorBar: DownLeftVectorBar, - DownRightTeeVector: DownRightTeeVector, - DownRightVector: DownRightVector, - DownRightVectorBar: DownRightVectorBar, - DownTee: DownTee, - DownTeeArrow: DownTeeArrow, - Downarrow: Downarrow, - Dscr: Dscr, - Dstrok: Dstrok, - ENG: ENG, - ET: ET, - ETH: ETH$1, - Eacut: Eacut, - Eacute: Eacute$1, - Ecaron: Ecaron, - Ecir: Ecir, - Ecirc: Ecirc$1, - Ecy: Ecy, - Edot: Edot, - Efr: Efr, - Egrav: Egrav, - Egrave: Egrave$1, - Element: Element, - Emacr: Emacr, - EmptySmallSquare: EmptySmallSquare, - EmptyVerySmallSquare: EmptyVerySmallSquare, - Eogon: Eogon, - Eopf: Eopf, - Epsilon: Epsilon, - Equal: Equal, - EqualTilde: EqualTilde, - Equilibrium: Equilibrium, - Escr: Escr, - Esim: Esim, - Eta: Eta, - Eum: Eum, - Euml: Euml$1, - Exists: Exists, - ExponentialE: ExponentialE, - Fcy: Fcy, - Ffr: Ffr, - FilledSmallSquare: FilledSmallSquare, - FilledVerySmallSquare: FilledVerySmallSquare, - Fopf: Fopf, - ForAll: ForAll, - Fouriertrf: Fouriertrf, - Fscr: Fscr, - GJcy: GJcy, - G: G, - GT: GT$1, - Gamma: Gamma, - Gammad: Gammad, - Gbreve: Gbreve, - Gcedil: Gcedil, - Gcirc: Gcirc, - Gcy: Gcy, - Gdot: Gdot, - Gfr: Gfr, - Gg: Gg, - Gopf: Gopf, - GreaterEqual: GreaterEqual, - GreaterEqualLess: GreaterEqualLess, - GreaterFullEqual: GreaterFullEqual, - GreaterGreater: GreaterGreater, - GreaterLess: GreaterLess, - GreaterSlantEqual: GreaterSlantEqual, - GreaterTilde: GreaterTilde, - Gscr: Gscr, - Gt: Gt, - HARDcy: HARDcy, - Hacek: Hacek, - Hat: Hat, - Hcirc: Hcirc, - Hfr: Hfr, - HilbertSpace: HilbertSpace, - Hopf: Hopf, - HorizontalLine: HorizontalLine, - Hscr: Hscr, - Hstrok: Hstrok, - HumpDownHump: HumpDownHump, - HumpEqual: HumpEqual, - IEcy: IEcy, - IJlig: IJlig, - IOcy: IOcy, - Iacut: Iacut, - Iacute: Iacute$1, - Icir: Icir, - Icirc: Icirc$1, - Icy: Icy, - Idot: Idot, - Ifr: Ifr, - Igrav: Igrav, - Igrave: Igrave$1, - Im: Im, - Imacr: Imacr, - ImaginaryI: ImaginaryI, - Implies: Implies, - Int: Int, - Integral: Integral, - Intersection: Intersection, - InvisibleComma: InvisibleComma, - InvisibleTimes: InvisibleTimes, - Iogon: Iogon, - Iopf: Iopf, - Iota: Iota, - Iscr: Iscr, - Itilde: Itilde, - Iukcy: Iukcy, - Ium: Ium, - Iuml: Iuml$1, - Jcirc: Jcirc, - Jcy: Jcy, - Jfr: Jfr, - Jopf: Jopf, - Jscr: Jscr, - Jsercy: Jsercy, - Jukcy: Jukcy, - KHcy: KHcy, - KJcy: KJcy, - Kappa: Kappa, - Kcedil: Kcedil, - Kcy: Kcy, - Kfr: Kfr, - Kopf: Kopf, - Kscr: Kscr, - LJcy: LJcy, - L: L, - LT: LT$1, - Lacute: Lacute, - Lambda: Lambda, - Lang: Lang, - Laplacetrf: Laplacetrf, - Larr: Larr, - Lcaron: Lcaron, - Lcedil: Lcedil, - Lcy: Lcy, - LeftAngleBracket: LeftAngleBracket, - LeftArrow: LeftArrow, - LeftArrowBar: LeftArrowBar, - LeftArrowRightArrow: LeftArrowRightArrow, - LeftCeiling: LeftCeiling, - LeftDoubleBracket: LeftDoubleBracket, - LeftDownTeeVector: LeftDownTeeVector, - LeftDownVector: LeftDownVector, - LeftDownVectorBar: LeftDownVectorBar, - LeftFloor: LeftFloor, - LeftRightArrow: LeftRightArrow, - LeftRightVector: LeftRightVector, - LeftTee: LeftTee, - LeftTeeArrow: LeftTeeArrow, - LeftTeeVector: LeftTeeVector, - LeftTriangle: LeftTriangle, - LeftTriangleBar: LeftTriangleBar, - LeftTriangleEqual: LeftTriangleEqual, - LeftUpDownVector: LeftUpDownVector, - LeftUpTeeVector: LeftUpTeeVector, - LeftUpVector: LeftUpVector, - LeftUpVectorBar: LeftUpVectorBar, - LeftVector: LeftVector, - LeftVectorBar: LeftVectorBar, - Leftarrow: Leftarrow, - Leftrightarrow: Leftrightarrow, - LessEqualGreater: LessEqualGreater, - LessFullEqual: LessFullEqual, - LessGreater: LessGreater, - LessLess: LessLess, - LessSlantEqual: LessSlantEqual, - LessTilde: LessTilde, - Lfr: Lfr, - Ll: Ll, - Lleftarrow: Lleftarrow, - Lmidot: Lmidot, - LongLeftArrow: LongLeftArrow, - LongLeftRightArrow: LongLeftRightArrow, - LongRightArrow: LongRightArrow, - Longleftarrow: Longleftarrow, - Longleftrightarrow: Longleftrightarrow, - Longrightarrow: Longrightarrow, - Lopf: Lopf, - LowerLeftArrow: LowerLeftArrow, - LowerRightArrow: LowerRightArrow, - Lscr: Lscr, - Lsh: Lsh, - Lstrok: Lstrok, - Lt: Lt, - Mcy: Mcy, - MediumSpace: MediumSpace, - Mellintrf: Mellintrf, - Mfr: Mfr, - MinusPlus: MinusPlus, - Mopf: Mopf, - Mscr: Mscr, - Mu: Mu, - NJcy: NJcy, - Nacute: Nacute, - Ncaron: Ncaron, - Ncedil: Ncedil, - Ncy: Ncy, - NegativeMediumSpace: NegativeMediumSpace, - NegativeThickSpace: NegativeThickSpace, - NegativeThinSpace: NegativeThinSpace, - NegativeVeryThinSpace: NegativeVeryThinSpace, - NestedGreaterGreater: NestedGreaterGreater, - NestedLessLess: NestedLessLess, - NewLine: NewLine, - Nfr: Nfr, - NoBreak: NoBreak, - NonBreakingSpace: NonBreakingSpace, - Nopf: Nopf, - Not: Not, - NotCongruent: NotCongruent, - NotCupCap: NotCupCap, - NotDoubleVerticalBar: NotDoubleVerticalBar, - NotElement: NotElement, - NotEqual: NotEqual, - NotEqualTilde: NotEqualTilde, - NotExists: NotExists, - NotGreater: NotGreater, - NotGreaterEqual: NotGreaterEqual, - NotGreaterFullEqual: NotGreaterFullEqual, - NotGreaterGreater: NotGreaterGreater, - NotGreaterLess: NotGreaterLess, - NotGreaterSlantEqual: NotGreaterSlantEqual, - NotGreaterTilde: NotGreaterTilde, - NotHumpDownHump: NotHumpDownHump, - NotHumpEqual: NotHumpEqual, - NotLeftTriangle: NotLeftTriangle, - NotLeftTriangleBar: NotLeftTriangleBar, - NotLeftTriangleEqual: NotLeftTriangleEqual, - NotLess: NotLess, - NotLessEqual: NotLessEqual, - NotLessGreater: NotLessGreater, - NotLessLess: NotLessLess, - NotLessSlantEqual: NotLessSlantEqual, - NotLessTilde: NotLessTilde, - NotNestedGreaterGreater: NotNestedGreaterGreater, - NotNestedLessLess: NotNestedLessLess, - NotPrecedes: NotPrecedes, - NotPrecedesEqual: NotPrecedesEqual, - NotPrecedesSlantEqual: NotPrecedesSlantEqual, - NotReverseElement: NotReverseElement, - NotRightTriangle: NotRightTriangle, - NotRightTriangleBar: NotRightTriangleBar, - NotRightTriangleEqual: NotRightTriangleEqual, - NotSquareSubset: NotSquareSubset, - NotSquareSubsetEqual: NotSquareSubsetEqual, - NotSquareSuperset: NotSquareSuperset, - NotSquareSupersetEqual: NotSquareSupersetEqual, - NotSubset: NotSubset, - NotSubsetEqual: NotSubsetEqual, - NotSucceeds: NotSucceeds, - NotSucceedsEqual: NotSucceedsEqual, - NotSucceedsSlantEqual: NotSucceedsSlantEqual, - NotSucceedsTilde: NotSucceedsTilde, - NotSuperset: NotSuperset, - NotSupersetEqual: NotSupersetEqual, - NotTilde: NotTilde, - NotTildeEqual: NotTildeEqual, - NotTildeFullEqual: NotTildeFullEqual, - NotTildeTilde: NotTildeTilde, - NotVerticalBar: NotVerticalBar, - Nscr: Nscr, - Ntild: Ntild, - Ntilde: Ntilde$1, - Nu: Nu, - OElig: OElig, - Oacut: Oacut, - Oacute: Oacute$1, - Ocir: Ocir, - Ocirc: Ocirc$1, - Ocy: Ocy, - Odblac: Odblac, - Ofr: Ofr, - Ograv: Ograv, - Ograve: Ograve$1, - Omacr: Omacr, - Omega: Omega, - Omicron: Omicron, - Oopf: Oopf, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, - OpenCurlyQuote: OpenCurlyQuote, - Or: Or, - Oscr: Oscr, - Oslas: Oslas, - Oslash: Oslash$1, - Otild: Otild, - Otilde: Otilde$1, - Otimes: Otimes, - Oum: Oum, - Ouml: Ouml$1, - OverBar: OverBar, - OverBrace: OverBrace, - OverBracket: OverBracket, - OverParenthesis: OverParenthesis, - PartialD: PartialD, - Pcy: Pcy, - Pfr: Pfr, - Phi: Phi, - Pi: Pi, - PlusMinus: PlusMinus, - Poincareplane: Poincareplane, - Popf: Popf, - Pr: Pr, - Precedes: Precedes, - PrecedesEqual: PrecedesEqual, - PrecedesSlantEqual: PrecedesSlantEqual, - PrecedesTilde: PrecedesTilde, - Prime: Prime, - Product: Product, - Proportion: Proportion, - Proportional: Proportional, - Pscr: Pscr, - Psi: Psi, - QUO: QUO, - QUOT: QUOT$1, - Qfr: Qfr, - Qopf: Qopf, - Qscr: Qscr, - RBarr: RBarr, - RE: RE, - REG: REG$1, - Racute: Racute, - Rang: Rang, - Rarr: Rarr, - Rarrtl: Rarrtl, - Rcaron: Rcaron, - Rcedil: Rcedil, - Rcy: Rcy, - Re: Re, - ReverseElement: ReverseElement, - ReverseEquilibrium: ReverseEquilibrium, - ReverseUpEquilibrium: ReverseUpEquilibrium, - Rfr: Rfr, - Rho: Rho, - RightAngleBracket: RightAngleBracket, - RightArrow: RightArrow, - RightArrowBar: RightArrowBar, - RightArrowLeftArrow: RightArrowLeftArrow, - RightCeiling: RightCeiling, - RightDoubleBracket: RightDoubleBracket, - RightDownTeeVector: RightDownTeeVector, - RightDownVector: RightDownVector, - RightDownVectorBar: RightDownVectorBar, - RightFloor: RightFloor, - RightTee: RightTee, - RightTeeArrow: RightTeeArrow, - RightTeeVector: RightTeeVector, - RightTriangle: RightTriangle, - RightTriangleBar: RightTriangleBar, - RightTriangleEqual: RightTriangleEqual, - RightUpDownVector: RightUpDownVector, - RightUpTeeVector: RightUpTeeVector, - RightUpVector: RightUpVector, - RightUpVectorBar: RightUpVectorBar, - RightVector: RightVector, - RightVectorBar: RightVectorBar, - Rightarrow: Rightarrow, - Ropf: Ropf, - RoundImplies: RoundImplies, - Rrightarrow: Rrightarrow, - Rscr: Rscr, - Rsh: Rsh, - RuleDelayed: RuleDelayed, - SHCHcy: SHCHcy, - SHcy: SHcy, - SOFTcy: SOFTcy, - Sacute: Sacute, - Sc: Sc, - Scaron: Scaron, - Scedil: Scedil, - Scirc: Scirc, - Scy: Scy, - Sfr: Sfr, - ShortDownArrow: ShortDownArrow, - ShortLeftArrow: ShortLeftArrow, - ShortRightArrow: ShortRightArrow, - ShortUpArrow: ShortUpArrow, - Sigma: Sigma, - SmallCircle: SmallCircle, - Sopf: Sopf, - Sqrt: Sqrt, - Square: Square, - SquareIntersection: SquareIntersection, - SquareSubset: SquareSubset, - SquareSubsetEqual: SquareSubsetEqual, - SquareSuperset: SquareSuperset, - SquareSupersetEqual: SquareSupersetEqual, - SquareUnion: SquareUnion, - Sscr: Sscr, - Star: Star, - Sub: Sub, - Subset: Subset, - SubsetEqual: SubsetEqual, - Succeeds: Succeeds, - SucceedsEqual: SucceedsEqual, - SucceedsSlantEqual: SucceedsSlantEqual, - SucceedsTilde: SucceedsTilde, - SuchThat: SuchThat, - Sum: Sum, - Sup: Sup, - Superset: Superset, - SupersetEqual: SupersetEqual, - Supset: Supset, - THOR: THOR, - THORN: THORN$1, - TRADE: TRADE, - TSHcy: TSHcy, - TScy: TScy, - Tab: Tab, - Tau: Tau, - Tcaron: Tcaron, - Tcedil: Tcedil, - Tcy: Tcy, - Tfr: Tfr, - Therefore: Therefore, - Theta: Theta, - ThickSpace: ThickSpace, - ThinSpace: ThinSpace, - Tilde: Tilde, - TildeEqual: TildeEqual, - TildeFullEqual: TildeFullEqual, - TildeTilde: TildeTilde, - Topf: Topf, - TripleDot: TripleDot, - Tscr: Tscr, - Tstrok: Tstrok, - Uacut: Uacut, - Uacute: Uacute$1, - Uarr: Uarr, - Uarrocir: Uarrocir, - Ubrcy: Ubrcy, - Ubreve: Ubreve, - Ucir: Ucir, - Ucirc: Ucirc$1, - Ucy: Ucy, - Udblac: Udblac, - Ufr: Ufr, - Ugrav: Ugrav, - Ugrave: Ugrave$1, - Umacr: Umacr, - UnderBar: UnderBar, - UnderBrace: UnderBrace, - UnderBracket: UnderBracket, - UnderParenthesis: UnderParenthesis, - Union: Union, - UnionPlus: UnionPlus, - Uogon: Uogon, - Uopf: Uopf, - UpArrow: UpArrow, - UpArrowBar: UpArrowBar, - UpArrowDownArrow: UpArrowDownArrow, - UpDownArrow: UpDownArrow, - UpEquilibrium: UpEquilibrium, - UpTee: UpTee, - UpTeeArrow: UpTeeArrow, - Uparrow: Uparrow, - Updownarrow: Updownarrow, - UpperLeftArrow: UpperLeftArrow, - UpperRightArrow: UpperRightArrow, - Upsi: Upsi, - Upsilon: Upsilon, - Uring: Uring, - Uscr: Uscr, - Utilde: Utilde, - Uum: Uum, - Uuml: Uuml$1, - VDash: VDash, - Vbar: Vbar, - Vcy: Vcy, - Vdash: Vdash, - Vdashl: Vdashl, - Vee: Vee, - Verbar: Verbar, - Vert: Vert, - VerticalBar: VerticalBar, - VerticalLine: VerticalLine, - VerticalSeparator: VerticalSeparator, - VerticalTilde: VerticalTilde, - VeryThinSpace: VeryThinSpace, - Vfr: Vfr, - Vopf: Vopf, - Vscr: Vscr, - Vvdash: Vvdash, - Wcirc: Wcirc, - Wedge: Wedge, - Wfr: Wfr, - Wopf: Wopf, - Wscr: Wscr, - Xfr: Xfr, - Xi: Xi, - Xopf: Xopf, - Xscr: Xscr, - YAcy: YAcy, - YIcy: YIcy, - YUcy: YUcy, - Yacut: Yacut, - Yacute: Yacute$1, - Ycirc: Ycirc, - Ycy: Ycy, - Yfr: Yfr, - Yopf: Yopf, - Yscr: Yscr, - Yuml: Yuml, - ZHcy: ZHcy, - Zacute: Zacute, - Zcaron: Zcaron, - Zcy: Zcy, - Zdot: Zdot, - ZeroWidthSpace: ZeroWidthSpace, - Zeta: Zeta, - Zfr: Zfr, - Zopf: Zopf, - Zscr: Zscr, - aacut: aacut, - aacute: aacute$1, - abreve: abreve, - ac: ac, - acE: acE, - acd: acd, - acir: acir, - acirc: acirc$1, - acut: acut, - acute: acute$1, - acy: acy, - aeli: aeli, - aelig: aelig$1, - af: af, - afr: afr, - agrav: agrav, - agrave: agrave$1, - alefsym: alefsym, - aleph: aleph, - alpha: alpha, - amacr: amacr, - amalg: amalg, - am: am, - amp: amp$1, - and: and, - andand: andand, - andd: andd, - andslope: andslope, - andv: andv, - ang: ang, - ange: ange, - angle: angle, - angmsd: angmsd, - angmsdaa: angmsdaa, - angmsdab: angmsdab, - angmsdac: angmsdac, - angmsdad: angmsdad, - angmsdae: angmsdae, - angmsdaf: angmsdaf, - angmsdag: angmsdag, - angmsdah: angmsdah, - angrt: angrt, - angrtvb: angrtvb, - angrtvbd: angrtvbd, - angsph: angsph, - angst: angst, - angzarr: angzarr, - aogon: aogon, - aopf: aopf, - ap: ap, - apE: apE, - apacir: apacir, - ape: ape, - apid: apid, - apos: apos, - approx: approx, - approxeq: approxeq, - arin: arin, - aring: aring$1, - ascr: ascr, - ast: ast, - asymp: asymp, - asympeq: asympeq, - atild: atild, - atilde: atilde$1, - aum: aum, - auml: auml$1, - awconint: awconint, - awint: awint, - bNot: bNot, - backcong: backcong, - backepsilon: backepsilon, - backprime: backprime, - backsim: backsim, - backsimeq: backsimeq, - barvee: barvee, - barwed: barwed, - barwedge: barwedge, - bbrk: bbrk, - bbrktbrk: bbrktbrk, - bcong: bcong, - bcy: bcy, - bdquo: bdquo, - becaus: becaus, - because: because, - bemptyv: bemptyv, - bepsi: bepsi, - bernou: bernou, - beta: beta, - beth: beth, - between: between, - bfr: bfr, - bigcap: bigcap, - bigcirc: bigcirc, - bigcup: bigcup, - bigodot: bigodot, - bigoplus: bigoplus, - bigotimes: bigotimes, - bigsqcup: bigsqcup, - bigstar: bigstar, - bigtriangledown: bigtriangledown, - bigtriangleup: bigtriangleup, - biguplus: biguplus, - bigvee: bigvee, - bigwedge: bigwedge, - bkarow: bkarow, - blacklozenge: blacklozenge, - blacksquare: blacksquare, - blacktriangle: blacktriangle, - blacktriangledown: blacktriangledown, - blacktriangleleft: blacktriangleleft, - blacktriangleright: blacktriangleright, - blank: blank, - blk12: blk12, - blk14: blk14, - blk34: blk34, - block: block, - bne: bne, - bnequiv: bnequiv, - bnot: bnot, - bopf: bopf, - bot: bot, - bottom: bottom, - bowtie: bowtie, - boxDL: boxDL, - boxDR: boxDR, - boxDl: boxDl, - boxDr: boxDr, - boxH: boxH, - boxHD: boxHD, - boxHU: boxHU, - boxHd: boxHd, - boxHu: boxHu, - boxUL: boxUL, - boxUR: boxUR, - boxUl: boxUl, - boxUr: boxUr, - boxV: boxV, - boxVH: boxVH, - boxVL: boxVL, - boxVR: boxVR, - boxVh: boxVh, - boxVl: boxVl, - boxVr: boxVr, - boxbox: boxbox, - boxdL: boxdL, - boxdR: boxdR, - boxdl: boxdl, - boxdr: boxdr, - boxh: boxh, - boxhD: boxhD, - boxhU: boxhU, - boxhd: boxhd, - boxhu: boxhu, - boxminus: boxminus, - boxplus: boxplus, - boxtimes: boxtimes, - boxuL: boxuL, - boxuR: boxuR, - boxul: boxul, - boxur: boxur, - boxv: boxv, - boxvH: boxvH, - boxvL: boxvL, - boxvR: boxvR, - boxvh: boxvh, - boxvl: boxvl, - boxvr: boxvr, - bprime: bprime, - breve: breve, - brvba: brvba, - brvbar: brvbar$1, - bscr: bscr, - bsemi: bsemi, - bsim: bsim, - bsime: bsime, - bsol: bsol, - bsolb: bsolb, - bsolhsub: bsolhsub, - bull: bull, - bullet: bullet, - bump: bump, - bumpE: bumpE, - bumpe: bumpe, - bumpeq: bumpeq, - cacute: cacute, - cap: cap, - capand: capand, - capbrcup: capbrcup, - capcap: capcap, - capcup: capcup, - capdot: capdot, - caps: caps, - caret: caret, - caron: caron, - ccaps: ccaps, - ccaron: ccaron, - ccedi: ccedi, - ccedil: ccedil$1, - ccirc: ccirc, - ccups: ccups, - ccupssm: ccupssm, - cdot: cdot, - cedi: cedi, - cedil: cedil$1, - cemptyv: cemptyv, - cen: cen, - cent: cent$1, - centerdot: centerdot, - cfr: cfr, - chcy: chcy, - check: check$2, - checkmark: checkmark, - chi: chi, - cir: cir, - cirE: cirE, - circ: circ, - circeq: circeq, - circlearrowleft: circlearrowleft, - circlearrowright: circlearrowright, - circledR: circledR, - circledS: circledS, - circledast: circledast, - circledcirc: circledcirc, - circleddash: circleddash, - cire: cire, - cirfnint: cirfnint, - cirmid: cirmid, - cirscir: cirscir, - clubs: clubs, - clubsuit: clubsuit, - colon: colon, - colone: colone, - coloneq: coloneq, - comma: comma, - commat: commat, - comp: comp, - compfn: compfn, - complement: complement, - complexes: complexes, - cong: cong, - congdot: congdot, - conint: conint, - copf: copf, - coprod: coprod, - cop: cop, - copy: copy$3, - copysr: copysr, - crarr: crarr, - cross: cross, - cscr: cscr, - csub: csub, - csube: csube, - csup: csup, - csupe: csupe, - ctdot: ctdot, - cudarrl: cudarrl, - cudarrr: cudarrr, - cuepr: cuepr, - cuesc: cuesc, - cularr: cularr, - cularrp: cularrp, - cup: cup, - cupbrcap: cupbrcap, - cupcap: cupcap, - cupcup: cupcup, - cupdot: cupdot, - cupor: cupor, - cups: cups, - curarr: curarr, - curarrm: curarrm, - curlyeqprec: curlyeqprec, - curlyeqsucc: curlyeqsucc, - curlyvee: curlyvee, - curlywedge: curlywedge, - curre: curre, - curren: curren$1, - curvearrowleft: curvearrowleft, - curvearrowright: curvearrowright, - cuvee: cuvee, - cuwed: cuwed, - cwconint: cwconint, - cwint: cwint, - cylcty: cylcty, - dArr: dArr, - dHar: dHar, - dagger: dagger, - daleth: daleth, - darr: darr, - dash: dash, - dashv: dashv, - dbkarow: dbkarow, - dblac: dblac, - dcaron: dcaron, - dcy: dcy, - dd: dd, - ddagger: ddagger, - ddarr: ddarr, - ddotseq: ddotseq, - de: de, - deg: deg$1, - delta: delta, - demptyv: demptyv, - dfisht: dfisht, - dfr: dfr, - dharl: dharl, - dharr: dharr, - diam: diam, - diamond: diamond, - diamondsuit: diamondsuit, - diams: diams, - die: die, - digamma: digamma, - disin: disin, - div: div, - divid: divid, - divide: divide$1, - divideontimes: divideontimes, - divonx: divonx, - djcy: djcy, - dlcorn: dlcorn, - dlcrop: dlcrop, - dollar: dollar, - dopf: dopf, - dot: dot, - doteq: doteq, - doteqdot: doteqdot, - dotminus: dotminus, - dotplus: dotplus, - dotsquare: dotsquare, - doublebarwedge: doublebarwedge, - downarrow: downarrow, - downdownarrows: downdownarrows, - downharpoonleft: downharpoonleft, - downharpoonright: downharpoonright, - drbkarow: drbkarow, - drcorn: drcorn, - drcrop: drcrop, - dscr: dscr, - dscy: dscy, - dsol: dsol, - dstrok: dstrok, - dtdot: dtdot, - dtri: dtri, - dtrif: dtrif, - duarr: duarr, - duhar: duhar, - dwangle: dwangle, - dzcy: dzcy, - dzigrarr: dzigrarr, - eDDot: eDDot, - eDot: eDot, - eacut: eacut, - eacute: eacute$1, - easter: easter, - ecaron: ecaron, - ecir: ecir, - ecirc: ecirc$1, - ecolon: ecolon, - ecy: ecy, - edot: edot, - ee: ee, - efDot: efDot, - efr: efr, - eg: eg, - egrav: egrav, - egrave: egrave$1, - egs: egs, - egsdot: egsdot, - el: el, - elinters: elinters, - ell: ell, - els: els, - elsdot: elsdot, - emacr: emacr, - empty: empty, - emptyset: emptyset, - emptyv: emptyv, - emsp13: emsp13, - emsp14: emsp14, - emsp: emsp, - eng: eng, - ensp: ensp, - eogon: eogon, - eopf: eopf, - epar: epar, - eparsl: eparsl, - eplus: eplus, - epsi: epsi, - epsilon: epsilon, - epsiv: epsiv, - eqcirc: eqcirc, - eqcolon: eqcolon, - eqsim: eqsim, - eqslantgtr: eqslantgtr, - eqslantless: eqslantless, - equals: equals, - equest: equest, - equiv: equiv, - equivDD: equivDD, - eqvparsl: eqvparsl, - erDot: erDot, - erarr: erarr, - escr: escr, - esdot: esdot, - esim: esim, - eta: eta, - et: et, - eth: eth$1, - eum: eum, - euml: euml$1, - euro: euro, - excl: excl, - exist: exist, - expectation: expectation, - exponentiale: exponentiale, - fallingdotseq: fallingdotseq, - fcy: fcy, - female: female, - ffilig: ffilig, - fflig: fflig, - ffllig: ffllig, - ffr: ffr, - filig: filig, - fjlig: fjlig, - flat: flat, - fllig: fllig, - fltns: fltns, - fnof: fnof, - fopf: fopf, - forall: forall, - fork: fork, - forkv: forkv, - fpartint: fpartint, - frac1: frac1, - frac12: frac12$1, - frac13: frac13, - frac14: frac14$1, - frac15: frac15, - frac16: frac16, - frac18: frac18, - frac23: frac23, - frac25: frac25, - frac3: frac3, - frac34: frac34$1, - frac35: frac35, - frac38: frac38, - frac45: frac45, - frac56: frac56, - frac58: frac58, - frac78: frac78, - frasl: frasl, - frown: frown, - fscr: fscr, - gE: gE, - gEl: gEl, - gacute: gacute, - gamma: gamma, - gammad: gammad, - gap: gap, - gbreve: gbreve, - gcirc: gcirc, - gcy: gcy, - gdot: gdot, - ge: ge, - gel: gel, - geq: geq, - geqq: geqq, - geqslant: geqslant, - ges: ges, - gescc: gescc, - gesdot: gesdot, - gesdoto: gesdoto, - gesdotol: gesdotol, - gesl: gesl, - gesles: gesles, - gfr: gfr, - gg: gg, - ggg: ggg, - gimel: gimel, - gjcy: gjcy, - gl: gl, - glE: glE, - gla: gla, - glj: glj, - gnE: gnE, - gnap: gnap, - gnapprox: gnapprox, - gne: gne, - gneq: gneq, - gneqq: gneqq, - gnsim: gnsim, - gopf: gopf, - grave: grave, - gscr: gscr, - gsim: gsim, - gsime: gsime, - gsiml: gsiml, - g: g, - gt: gt$1, - gtcc: gtcc, - gtcir: gtcir, - gtdot: gtdot, - gtlPar: gtlPar, - gtquest: gtquest, - gtrapprox: gtrapprox, - gtrarr: gtrarr, - gtrdot: gtrdot, - gtreqless: gtreqless, - gtreqqless: gtreqqless, - gtrless: gtrless, - gtrsim: gtrsim, - gvertneqq: gvertneqq, - gvnE: gvnE, - hArr: hArr, - hairsp: hairsp, - half: half, - hamilt: hamilt, - hardcy: hardcy, - harr: harr, - harrcir: harrcir, - harrw: harrw, - hbar: hbar, - hcirc: hcirc, - hearts: hearts, - heartsuit: heartsuit, - hellip: hellip, - hercon: hercon, - hfr: hfr, - hksearow: hksearow, - hkswarow: hkswarow, - hoarr: hoarr, - homtht: homtht, - hookleftarrow: hookleftarrow, - hookrightarrow: hookrightarrow, - hopf: hopf, - horbar: horbar, - hscr: hscr, - hslash: hslash, - hstrok: hstrok, - hybull: hybull, - hyphen: hyphen, - iacut: iacut, - iacute: iacute$1, - ic: ic, - icir: icir, - icirc: icirc$1, - icy: icy, - iecy: iecy, - iexc: iexc, - iexcl: iexcl$1, - iff: iff, - ifr: ifr, - igrav: igrav, - igrave: igrave$1, - ii: ii, - iiiint: iiiint, - iiint: iiint, - iinfin: iinfin, - iiota: iiota, - ijlig: ijlig, - imacr: imacr, - image: image, - imagline: imagline, - imagpart: imagpart, - imath: imath, - imof: imof, - imped: imped, - incare: incare, - infin: infin, - infintie: infintie, - inodot: inodot, - int: int, - intcal: intcal, - integers: integers, - intercal: intercal, - intlarhk: intlarhk, - intprod: intprod, - iocy: iocy, - iogon: iogon, - iopf: iopf, - iota: iota, - iprod: iprod, - iques: iques, - iquest: iquest$1, - iscr: iscr, - isin: isin, - isinE: isinE, - isindot: isindot, - isins: isins, - isinsv: isinsv, - isinv: isinv, - it: it, - itilde: itilde, - iukcy: iukcy, - ium: ium, - iuml: iuml$1, - jcirc: jcirc, - jcy: jcy, - jfr: jfr, - jmath: jmath, - jopf: jopf, - jscr: jscr, - jsercy: jsercy, - jukcy: jukcy, - kappa: kappa, - kappav: kappav, - kcedil: kcedil, - kcy: kcy, - kfr: kfr, - kgreen: kgreen, - khcy: khcy, - kjcy: kjcy, - kopf: kopf, - kscr: kscr, - lAarr: lAarr, - lArr: lArr, - lAtail: lAtail, - lBarr: lBarr, - lE: lE, - lEg: lEg, - lHar: lHar, - lacute: lacute, - laemptyv: laemptyv, - lagran: lagran, - lambda: lambda, - lang: lang, - langd: langd, - langle: langle, - lap: lap, - laqu: laqu, - laquo: laquo$1, - larr: larr, - larrb: larrb, - larrbfs: larrbfs, - larrfs: larrfs, - larrhk: larrhk, - larrlp: larrlp, - larrpl: larrpl, - larrsim: larrsim, - larrtl: larrtl, - lat: lat, - latail: latail, - late: late, - lates: lates, - lbarr: lbarr, - lbbrk: lbbrk, - lbrace: lbrace, - lbrack: lbrack, - lbrke: lbrke, - lbrksld: lbrksld, - lbrkslu: lbrkslu, - lcaron: lcaron, - lcedil: lcedil, - lceil: lceil, - lcub: lcub, - lcy: lcy, - ldca: ldca, - ldquo: ldquo, - ldquor: ldquor, - ldrdhar: ldrdhar, - ldrushar: ldrushar, - ldsh: ldsh, - le: le, - leftarrow: leftarrow, - leftarrowtail: leftarrowtail, - leftharpoondown: leftharpoondown, - leftharpoonup: leftharpoonup, - leftleftarrows: leftleftarrows, - leftrightarrow: leftrightarrow, - leftrightarrows: leftrightarrows, - leftrightharpoons: leftrightharpoons, - leftrightsquigarrow: leftrightsquigarrow, - leftthreetimes: leftthreetimes, - leg: leg, - leq: leq, - leqq: leqq, - leqslant: leqslant, - les: les, - lescc: lescc, - lesdot: lesdot, - lesdoto: lesdoto, - lesdotor: lesdotor, - lesg: lesg, - lesges: lesges, - lessapprox: lessapprox, - lessdot: lessdot, - lesseqgtr: lesseqgtr, - lesseqqgtr: lesseqqgtr, - lessgtr: lessgtr, - lesssim: lesssim, - lfisht: lfisht, - lfloor: lfloor, - lfr: lfr, - lg: lg, - lgE: lgE, - lhard: lhard, - lharu: lharu, - lharul: lharul, - lhblk: lhblk, - ljcy: ljcy, - ll: ll, - llarr: llarr, - llcorner: llcorner, - llhard: llhard, - lltri: lltri, - lmidot: lmidot, - lmoust: lmoust, - lmoustache: lmoustache, - lnE: lnE, - lnap: lnap, - lnapprox: lnapprox, - lne: lne, - lneq: lneq, - lneqq: lneqq, - lnsim: lnsim, - loang: loang, - loarr: loarr, - lobrk: lobrk, - longleftarrow: longleftarrow, - longleftrightarrow: longleftrightarrow, - longmapsto: longmapsto, - longrightarrow: longrightarrow, - looparrowleft: looparrowleft, - looparrowright: looparrowright, - lopar: lopar, - lopf: lopf, - loplus: loplus, - lotimes: lotimes, - lowast: lowast, - lowbar: lowbar, - loz: loz, - lozenge: lozenge, - lozf: lozf, - lpar: lpar, - lparlt: lparlt, - lrarr: lrarr, - lrcorner: lrcorner, - lrhar: lrhar, - lrhard: lrhard, - lrm: lrm, - lrtri: lrtri, - lsaquo: lsaquo, - lscr: lscr, - lsh: lsh, - lsim: lsim, - lsime: lsime, - lsimg: lsimg, - lsqb: lsqb, - lsquo: lsquo, - lsquor: lsquor, - lstrok: lstrok, - l: l, - lt: lt$1, - ltcc: ltcc, - ltcir: ltcir, - ltdot: ltdot, - lthree: lthree, - ltimes: ltimes, - ltlarr: ltlarr, - ltquest: ltquest, - ltrPar: ltrPar, - ltri: ltri, - ltrie: ltrie, - ltrif: ltrif, - lurdshar: lurdshar, - luruhar: luruhar, - lvertneqq: lvertneqq, - lvnE: lvnE, - mDDot: mDDot, - mac: mac, - macr: macr$1, - male: male, - malt: malt, - maltese: maltese, - map: map$3, - mapsto: mapsto, - mapstodown: mapstodown, - mapstoleft: mapstoleft, - mapstoup: mapstoup, - marker: marker, - mcomma: mcomma, - mcy: mcy, - mdash: mdash, - measuredangle: measuredangle, - mfr: mfr, - mho: mho, - micr: micr, - micro: micro$1, - mid: mid, - midast: midast, - midcir: midcir, - middo: middo, - middot: middot$1, - minus: minus, - minusb: minusb, - minusd: minusd, - minusdu: minusdu, - mlcp: mlcp, - mldr: mldr, - mnplus: mnplus, - models: models, - mopf: mopf, - mp: mp, - mscr: mscr, - mstpos: mstpos, - mu: mu, - multimap: multimap, - mumap: mumap, - nGg: nGg, - nGt: nGt, - nGtv: nGtv, - nLeftarrow: nLeftarrow, - nLeftrightarrow: nLeftrightarrow, - nLl: nLl, - nLt: nLt, - nLtv: nLtv, - nRightarrow: nRightarrow, - nVDash: nVDash, - nVdash: nVdash, - nabla: nabla, - nacute: nacute, - nang: nang, - nap: nap, - napE: napE, - napid: napid, - napos: napos, - napprox: napprox, - natur: natur, - natural: natural, - naturals: naturals, - nbs: nbs, - nbsp: nbsp$1, - nbump: nbump, - nbumpe: nbumpe, - ncap: ncap, - ncaron: ncaron, - ncedil: ncedil, - ncong: ncong, - ncongdot: ncongdot, - ncup: ncup, - ncy: ncy, - ndash: ndash, - ne: ne, - neArr: neArr, - nearhk: nearhk, - nearr: nearr, - nearrow: nearrow, - nedot: nedot, - nequiv: nequiv, - nesear: nesear, - nesim: nesim, - nexist: nexist, - nexists: nexists, - nfr: nfr, - ngE: ngE, - nge: nge, - ngeq: ngeq, - ngeqq: ngeqq, - ngeqslant: ngeqslant, - nges: nges, - ngsim: ngsim, - ngt: ngt, - ngtr: ngtr, - nhArr: nhArr, - nharr: nharr, - nhpar: nhpar, - ni: ni, - nis: nis, - nisd: nisd, - niv: niv, - njcy: njcy, - nlArr: nlArr, - nlE: nlE, - nlarr: nlarr, - nldr: nldr, - nle: nle, - nleftarrow: nleftarrow, - nleftrightarrow: nleftrightarrow, - nleq: nleq, - nleqq: nleqq, - nleqslant: nleqslant, - nles: nles, - nless: nless, - nlsim: nlsim, - nlt: nlt, - nltri: nltri, - nltrie: nltrie, - nmid: nmid, - nopf: nopf, - no: no, - not: not$1, - notin: notin, - notinE: notinE, - notindot: notindot, - notinva: notinva, - notinvb: notinvb, - notinvc: notinvc, - notni: notni, - notniva: notniva, - notnivb: notnivb, - notnivc: notnivc, - npar: npar, - nparallel: nparallel, - nparsl: nparsl, - npart: npart, - npolint: npolint, - npr: npr, - nprcue: nprcue, - npre: npre, - nprec: nprec, - npreceq: npreceq, - nrArr: nrArr, - nrarr: nrarr, - nrarrc: nrarrc, - nrarrw: nrarrw, - nrightarrow: nrightarrow, - nrtri: nrtri, - nrtrie: nrtrie, - nsc: nsc, - nsccue: nsccue, - nsce: nsce, - nscr: nscr, - nshortmid: nshortmid, - nshortparallel: nshortparallel, - nsim: nsim, - nsime: nsime, - nsimeq: nsimeq, - nsmid: nsmid, - nspar: nspar, - nsqsube: nsqsube, - nsqsupe: nsqsupe, - nsub: nsub, - nsubE: nsubE, - nsube: nsube, - nsubset: nsubset, - nsubseteq: nsubseteq, - nsubseteqq: nsubseteqq, - nsucc: nsucc, - nsucceq: nsucceq, - nsup: nsup, - nsupE: nsupE, - nsupe: nsupe, - nsupset: nsupset, - nsupseteq: nsupseteq, - nsupseteqq: nsupseteqq, - ntgl: ntgl, - ntild: ntild, - ntilde: ntilde$1, - ntlg: ntlg, - ntriangleleft: ntriangleleft, - ntrianglelefteq: ntrianglelefteq, - ntriangleright: ntriangleright, - ntrianglerighteq: ntrianglerighteq, - nu: nu, - num: num, - numero: numero, - numsp: numsp, - nvDash: nvDash, - nvHarr: nvHarr, - nvap: nvap, - nvdash: nvdash, - nvge: nvge, - nvgt: nvgt, - nvinfin: nvinfin, - nvlArr: nvlArr, - nvle: nvle, - nvlt: nvlt, - nvltrie: nvltrie, - nvrArr: nvrArr, - nvrtrie: nvrtrie, - nvsim: nvsim, - nwArr: nwArr, - nwarhk: nwarhk, - nwarr: nwarr, - nwarrow: nwarrow, - nwnear: nwnear, - oS: oS, - oacut: oacut, - oacute: oacute$1, - oast: oast, - ocir: ocir, - ocirc: ocirc$1, - ocy: ocy, - odash: odash, - odblac: odblac, - odiv: odiv, - odot: odot, - odsold: odsold, - oelig: oelig, - ofcir: ofcir, - ofr: ofr, - ogon: ogon, - ograv: ograv, - ograve: ograve$1, - ogt: ogt, - ohbar: ohbar, - ohm: ohm, - oint: oint, - olarr: olarr, - olcir: olcir, - olcross: olcross, - oline: oline, - olt: olt, - omacr: omacr, - omega: omega, - omicron: omicron, - omid: omid, - ominus: ominus, - oopf: oopf, - opar: opar, - operp: operp, - oplus: oplus, - or: or, - orarr: orarr, - ord: ord, - order: order$2, - orderof: orderof, - ordf: ordf$1, - ordm: ordm$1, - origof: origof, - oror: oror, - orslope: orslope, - orv: orv, - oscr: oscr, - oslas: oslas, - oslash: oslash$1, - osol: osol, - otild: otild, - otilde: otilde$1, - otimes: otimes, - otimesas: otimesas, - oum: oum, - ouml: ouml$1, - ovbar: ovbar, - par: par, - para: para$1, - parallel: parallel, - parsim: parsim, - parsl: parsl, - part: part, - pcy: pcy, - percnt: percnt, - period: period, - permil: permil, - perp: perp, - pertenk: pertenk, - pfr: pfr, - phi: phi, - phiv: phiv, - phmmat: phmmat, - phone: phone, - pi: pi, - pitchfork: pitchfork, - piv: piv, - planck: planck, - planckh: planckh, - plankv: plankv, - plus: plus, - plusacir: plusacir, - plusb: plusb, - pluscir: pluscir, - plusdo: plusdo, - plusdu: plusdu, - pluse: pluse, - plusm: plusm, - plusmn: plusmn$1, - plussim: plussim, - plustwo: plustwo, - pm: pm, - pointint: pointint, - popf: popf, - poun: poun, - pound: pound$1, - pr: pr, - prE: prE, - prap: prap, - prcue: prcue, - pre: pre, - prec: prec, - precapprox: precapprox, - preccurlyeq: preccurlyeq, - preceq: preceq, - precnapprox: precnapprox, - precneqq: precneqq, - precnsim: precnsim, - precsim: precsim, - prime: prime, - primes: primes, - prnE: prnE, - prnap: prnap, - prnsim: prnsim, - prod: prod, - profalar: profalar, - profline: profline, - profsurf: profsurf, - prop: prop, - propto: propto, - prsim: prsim, - prurel: prurel, - pscr: pscr, - psi: psi, - puncsp: puncsp, - qfr: qfr, - qint: qint, - qopf: qopf, - qprime: qprime, - qscr: qscr, - quaternions: quaternions, - quatint: quatint, - quest: quest, - questeq: questeq, - quo: quo, - quot: quot$1, - rAarr: rAarr, - rArr: rArr, - rAtail: rAtail, - rBarr: rBarr, - rHar: rHar, - race: race, - racute: racute, - radic: radic, - raemptyv: raemptyv, - rang: rang, - rangd: rangd, - range: range$1, - rangle: rangle, - raqu: raqu, - raquo: raquo$1, - rarr: rarr, - rarrap: rarrap, - rarrb: rarrb, - rarrbfs: rarrbfs, - rarrc: rarrc, - rarrfs: rarrfs, - rarrhk: rarrhk, - rarrlp: rarrlp, - rarrpl: rarrpl, - rarrsim: rarrsim, - rarrtl: rarrtl, - rarrw: rarrw, - ratail: ratail, - ratio: ratio, - rationals: rationals, - rbarr: rbarr, - rbbrk: rbbrk, - rbrace: rbrace, - rbrack: rbrack, - rbrke: rbrke, - rbrksld: rbrksld, - rbrkslu: rbrkslu, - rcaron: rcaron, - rcedil: rcedil, - rceil: rceil, - rcub: rcub, - rcy: rcy, - rdca: rdca, - rdldhar: rdldhar, - rdquo: rdquo, - rdquor: rdquor, - rdsh: rdsh, - real: real, - realine: realine, - realpart: realpart, - reals: reals, - rect: rect, - re: re, - reg: reg$1, - rfisht: rfisht, - rfloor: rfloor, - rfr: rfr, - rhard: rhard, - rharu: rharu, - rharul: rharul, - rho: rho, - rhov: rhov, - rightarrow: rightarrow, - rightarrowtail: rightarrowtail, - rightharpoondown: rightharpoondown, - rightharpoonup: rightharpoonup, - rightleftarrows: rightleftarrows, - rightleftharpoons: rightleftharpoons, - rightrightarrows: rightrightarrows, - rightsquigarrow: rightsquigarrow, - rightthreetimes: rightthreetimes, - ring: ring, - risingdotseq: risingdotseq, - rlarr: rlarr, - rlhar: rlhar, - rlm: rlm, - rmoust: rmoust, - rmoustache: rmoustache, - rnmid: rnmid, - roang: roang, - roarr: roarr, - robrk: robrk, - ropar: ropar, - ropf: ropf, - roplus: roplus, - rotimes: rotimes, - rpar: rpar, - rpargt: rpargt, - rppolint: rppolint, - rrarr: rrarr, - rsaquo: rsaquo, - rscr: rscr, - rsh: rsh, - rsqb: rsqb, - rsquo: rsquo, - rsquor: rsquor, - rthree: rthree, - rtimes: rtimes, - rtri: rtri, - rtrie: rtrie, - rtrif: rtrif, - rtriltri: rtriltri, - ruluhar: ruluhar, - rx: rx, - sacute: sacute, - sbquo: sbquo, - sc: sc, - scE: scE, - scap: scap, - scaron: scaron, - sccue: sccue, - sce: sce, - scedil: scedil, - scirc: scirc, - scnE: scnE, - scnap: scnap, - scnsim: scnsim, - scpolint: scpolint, - scsim: scsim, - scy: scy, - sdot: sdot, - sdotb: sdotb, - sdote: sdote, - seArr: seArr, - searhk: searhk, - searr: searr, - searrow: searrow, - sec: sec, - sect: sect$1, - semi: semi, - seswar: seswar, - setminus: setminus, - setmn: setmn, - sext: sext, - sfr: sfr, - sfrown: sfrown, - sharp: sharp, - shchcy: shchcy, - shcy: shcy, - shortmid: shortmid, - shortparallel: shortparallel, - sh: sh, - shy: shy$1, - sigma: sigma, - sigmaf: sigmaf, - sigmav: sigmav, - sim: sim, - simdot: simdot, - sime: sime, - simeq: simeq, - simg: simg, - simgE: simgE, - siml: siml, - simlE: simlE, - simne: simne, - simplus: simplus, - simrarr: simrarr, - slarr: slarr, - smallsetminus: smallsetminus, - smashp: smashp, - smeparsl: smeparsl, - smid: smid, - smile: smile, - smt: smt, - smte: smte, - smtes: smtes, - softcy: softcy, - sol: sol, - solb: solb, - solbar: solbar, - sopf: sopf, - spades: spades, - spadesuit: spadesuit, - spar: spar, - sqcap: sqcap, - sqcaps: sqcaps, - sqcup: sqcup, - sqcups: sqcups, - sqsub: sqsub, - sqsube: sqsube, - sqsubset: sqsubset, - sqsubseteq: sqsubseteq, - sqsup: sqsup, - sqsupe: sqsupe, - sqsupset: sqsupset, - sqsupseteq: sqsupseteq, - squ: squ, - square: square, - squarf: squarf, - squf: squf, - srarr: srarr, - sscr: sscr, - ssetmn: ssetmn, - ssmile: ssmile, - sstarf: sstarf, - star: star$1, - starf: starf, - straightepsilon: straightepsilon, - straightphi: straightphi, - strns: strns, - sub: sub, - subE: subE, - subdot: subdot, - sube: sube, - subedot: subedot, - submult: submult, - subnE: subnE, - subne: subne, - subplus: subplus, - subrarr: subrarr, - subset: subset, - subseteq: subseteq, - subseteqq: subseteqq, - subsetneq: subsetneq, - subsetneqq: subsetneqq, - subsim: subsim, - subsub: subsub, - subsup: subsup, - succ: succ, - succapprox: succapprox, - succcurlyeq: succcurlyeq, - succeq: succeq, - succnapprox: succnapprox, - succneqq: succneqq, - succnsim: succnsim, - succsim: succsim, - sum: sum, - sung: sung, - sup: sup, - sup1: sup1$1, - sup2: sup2$1, - sup3: sup3$1, - supE: supE, - supdot: supdot, - supdsub: supdsub, - supe: supe, - supedot: supedot, - suphsol: suphsol, - suphsub: suphsub, - suplarr: suplarr, - supmult: supmult, - supnE: supnE, - supne: supne, - supplus: supplus, - supset: supset, - supseteq: supseteq, - supseteqq: supseteqq, - supsetneq: supsetneq, - supsetneqq: supsetneqq, - supsim: supsim, - supsub: supsub, - supsup: supsup, - swArr: swArr, - swarhk: swarhk, - swarr: swarr, - swarrow: swarrow, - swnwar: swnwar, - szli: szli, - szlig: szlig$1, - target: target, - tau: tau, - tbrk: tbrk, - tcaron: tcaron, - tcedil: tcedil, - tcy: tcy, - tdot: tdot, - telrec: telrec, - tfr: tfr, - there4: there4, - therefore: therefore, - theta: theta, - thetasym: thetasym, - thetav: thetav, - thickapprox: thickapprox, - thicksim: thicksim, - thinsp: thinsp, - thkap: thkap, - thksim: thksim, - thor: thor, - thorn: thorn$1, - tilde: tilde, - time: time, - times: times$1, - timesb: timesb, - timesbar: timesbar, - timesd: timesd, - tint: tint, - toea: toea, - top: top, - topbot: topbot, - topcir: topcir, - topf: topf, - topfork: topfork, - tosa: tosa, - tprime: tprime, - trade: trade, - triangle: triangle, - triangledown: triangledown, - triangleleft: triangleleft, - trianglelefteq: trianglelefteq, - triangleq: triangleq, - triangleright: triangleright, - trianglerighteq: trianglerighteq, - tridot: tridot, - trie: trie, - triminus: triminus, - triplus: triplus, - trisb: trisb, - tritime: tritime, - trpezium: trpezium, - tscr: tscr, - tscy: tscy, - tshcy: tshcy, - tstrok: tstrok, - twixt: twixt, - twoheadleftarrow: twoheadleftarrow, - twoheadrightarrow: twoheadrightarrow, - uArr: uArr, - uHar: uHar, - uacut: uacut, - uacute: uacute$1, - uarr: uarr, - ubrcy: ubrcy, - ubreve: ubreve, - ucir: ucir, - ucirc: ucirc$1, - ucy: ucy, - udarr: udarr, - udblac: udblac, - udhar: udhar, - ufisht: ufisht, - ufr: ufr, - ugrav: ugrav, - ugrave: ugrave$1, - uharl: uharl, - uharr: uharr, - uhblk: uhblk, - ulcorn: ulcorn, - ulcorner: ulcorner, - ulcrop: ulcrop, - ultri: ultri, - umacr: umacr, - um: um, - uml: uml$1, - uogon: uogon, - uopf: uopf, - uparrow: uparrow, - updownarrow: updownarrow, - upharpoonleft: upharpoonleft, - upharpoonright: upharpoonright, - uplus: uplus, - upsi: upsi, - upsih: upsih, - upsilon: upsilon, - upuparrows: upuparrows, - urcorn: urcorn, - urcorner: urcorner, - urcrop: urcrop, - uring: uring, - urtri: urtri, - uscr: uscr, - utdot: utdot, - utilde: utilde, - utri: utri, - utrif: utrif, - uuarr: uuarr, - uum: uum, - uuml: uuml$1, - uwangle: uwangle, - vArr: vArr, - vBar: vBar, - vBarv: vBarv, - vDash: vDash, - vangrt: vangrt, - varepsilon: varepsilon, - varkappa: varkappa, - varnothing: varnothing, - varphi: varphi, - varpi: varpi, - varpropto: varpropto, - varr: varr, - varrho: varrho, - varsigma: varsigma, - varsubsetneq: varsubsetneq, - varsubsetneqq: varsubsetneqq, - varsupsetneq: varsupsetneq, - varsupsetneqq: varsupsetneqq, - vartheta: vartheta, - vartriangleleft: vartriangleleft, - vartriangleright: vartriangleright, - vcy: vcy, - vdash: vdash, - vee: vee, - veebar: veebar, - veeeq: veeeq, - vellip: vellip, - verbar: verbar, - vert: vert, - vfr: vfr, - vltri: vltri, - vnsub: vnsub, - vnsup: vnsup, - vopf: vopf, - vprop: vprop, - vrtri: vrtri, - vscr: vscr, - vsubnE: vsubnE, - vsubne: vsubne, - vsupnE: vsupnE, - vsupne: vsupne, - vzigzag: vzigzag, - wcirc: wcirc, - wedbar: wedbar, - wedge: wedge, - wedgeq: wedgeq, - weierp: weierp, - wfr: wfr, - wopf: wopf, - wp: wp, - wr: wr, - wreath: wreath, - wscr: wscr, - xcap: xcap, - xcirc: xcirc, - xcup: xcup, - xdtri: xdtri, - xfr: xfr, - xhArr: xhArr, - xharr: xharr, - xi: xi, - xlArr: xlArr, - xlarr: xlarr, - xmap: xmap, - xnis: xnis, - xodot: xodot, - xopf: xopf, - xoplus: xoplus, - xotime: xotime, - xrArr: xrArr, - xrarr: xrarr, - xscr: xscr, - xsqcup: xsqcup, - xuplus: xuplus, - xutri: xutri, - xvee: xvee, - xwedge: xwedge, - yacut: yacut, - yacute: yacute$1, - yacy: yacy, - ycirc: ycirc, - ycy: ycy, - ye: ye, - yen: yen$1, - yfr: yfr, - yicy: yicy, - yopf: yopf, - yscr: yscr, - yucy: yucy, - yum: yum, - yuml: yuml$1, - zacute: zacute, - zcaron: zcaron, - zcy: zcy, - zdot: zdot, - zeetrf: zeetrf, - zeta: zeta, - zfr: zfr, - zhcy: zhcy, - zigrarr: zigrarr, - zopf: zopf, - zscr: zscr, - zwj: zwj, - zwnj: zwnj, - "Map": "⤅", - "in": "∈" -}; +var path = __webpack_require__(4) +var replace = __webpack_require__(66) +var buffer = __webpack_require__(207) -var characterEntities = Object.freeze({ - AEli: AEli, - AElig: AElig$1, - AM: AM, - AMP: AMP$1, - Aacut: Aacut, - Aacute: Aacute$1, - Abreve: Abreve, - Acir: Acir, - Acirc: Acirc$1, - Acy: Acy, - Afr: Afr, - Agrav: Agrav, - Agrave: Agrave$1, - Alpha: Alpha, - Amacr: Amacr, - And: And, - Aogon: Aogon, - Aopf: Aopf, - ApplyFunction: ApplyFunction, - Arin: Arin, - Aring: Aring$1, - Ascr: Ascr, - Assign: Assign, - Atild: Atild, - Atilde: Atilde$1, - Aum: Aum, - Auml: Auml$1, - Backslash: Backslash, - Barv: Barv, - Barwed: Barwed, - Bcy: Bcy, - Because: Because, - Bernoullis: Bernoullis, - Beta: Beta, - Bfr: Bfr, - Bopf: Bopf, - Breve: Breve, - Bscr: Bscr, - Bumpeq: Bumpeq, - CHcy: CHcy, - COP: COP, - COPY: COPY$1, - Cacute: Cacute, - Cap: Cap, - CapitalDifferentialD: CapitalDifferentialD, - Cayleys: Cayleys, - Ccaron: Ccaron, - Ccedi: Ccedi, - Ccedil: Ccedil$1, - Ccirc: Ccirc, - Cconint: Cconint, - Cdot: Cdot, - Cedilla: Cedilla, - CenterDot: CenterDot, - Cfr: Cfr, - Chi: Chi, - CircleDot: CircleDot, - CircleMinus: CircleMinus, - CirclePlus: CirclePlus, - CircleTimes: CircleTimes, - ClockwiseContourIntegral: ClockwiseContourIntegral, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, - CloseCurlyQuote: CloseCurlyQuote, - Colon: Colon, - Colone: Colone, - Congruent: Congruent, - Conint: Conint, - ContourIntegral: ContourIntegral, - Copf: Copf, - Coproduct: Coproduct, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, - Cross: Cross, - Cscr: Cscr, - Cup: Cup, - CupCap: CupCap, - DD: DD, - DDotrahd: DDotrahd, - DJcy: DJcy, - DScy: DScy, - DZcy: DZcy, - Dagger: Dagger, - Darr: Darr, - Dashv: Dashv, - Dcaron: Dcaron, - Dcy: Dcy, - Del: Del, - Delta: Delta, - Dfr: Dfr, - DiacriticalAcute: DiacriticalAcute, - DiacriticalDot: DiacriticalDot, - DiacriticalDoubleAcute: DiacriticalDoubleAcute, - DiacriticalGrave: DiacriticalGrave, - DiacriticalTilde: DiacriticalTilde, - Diamond: Diamond, - DifferentialD: DifferentialD, - Dopf: Dopf, - Dot: Dot, - DotDot: DotDot, - DotEqual: DotEqual, - DoubleContourIntegral: DoubleContourIntegral, - DoubleDot: DoubleDot, - DoubleDownArrow: DoubleDownArrow, - DoubleLeftArrow: DoubleLeftArrow, - DoubleLeftRightArrow: DoubleLeftRightArrow, - DoubleLeftTee: DoubleLeftTee, - DoubleLongLeftArrow: DoubleLongLeftArrow, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, - DoubleLongRightArrow: DoubleLongRightArrow, - DoubleRightArrow: DoubleRightArrow, - DoubleRightTee: DoubleRightTee, - DoubleUpArrow: DoubleUpArrow, - DoubleUpDownArrow: DoubleUpDownArrow, - DoubleVerticalBar: DoubleVerticalBar, - DownArrow: DownArrow, - DownArrowBar: DownArrowBar, - DownArrowUpArrow: DownArrowUpArrow, - DownBreve: DownBreve, - DownLeftRightVector: DownLeftRightVector, - DownLeftTeeVector: DownLeftTeeVector, - DownLeftVector: DownLeftVector, - DownLeftVectorBar: DownLeftVectorBar, - DownRightTeeVector: DownRightTeeVector, - DownRightVector: DownRightVector, - DownRightVectorBar: DownRightVectorBar, - DownTee: DownTee, - DownTeeArrow: DownTeeArrow, - Downarrow: Downarrow, - Dscr: Dscr, - Dstrok: Dstrok, - ENG: ENG, - ET: ET, - ETH: ETH$1, - Eacut: Eacut, - Eacute: Eacute$1, - Ecaron: Ecaron, - Ecir: Ecir, - Ecirc: Ecirc$1, - Ecy: Ecy, - Edot: Edot, - Efr: Efr, - Egrav: Egrav, - Egrave: Egrave$1, - Element: Element, - Emacr: Emacr, - EmptySmallSquare: EmptySmallSquare, - EmptyVerySmallSquare: EmptyVerySmallSquare, - Eogon: Eogon, - Eopf: Eopf, - Epsilon: Epsilon, - Equal: Equal, - EqualTilde: EqualTilde, - Equilibrium: Equilibrium, - Escr: Escr, - Esim: Esim, - Eta: Eta, - Eum: Eum, - Euml: Euml$1, - Exists: Exists, - ExponentialE: ExponentialE, - Fcy: Fcy, - Ffr: Ffr, - FilledSmallSquare: FilledSmallSquare, - FilledVerySmallSquare: FilledVerySmallSquare, - Fopf: Fopf, - ForAll: ForAll, - Fouriertrf: Fouriertrf, - Fscr: Fscr, - GJcy: GJcy, - G: G, - GT: GT$1, - Gamma: Gamma, - Gammad: Gammad, - Gbreve: Gbreve, - Gcedil: Gcedil, - Gcirc: Gcirc, - Gcy: Gcy, - Gdot: Gdot, - Gfr: Gfr, - Gg: Gg, - Gopf: Gopf, - GreaterEqual: GreaterEqual, - GreaterEqualLess: GreaterEqualLess, - GreaterFullEqual: GreaterFullEqual, - GreaterGreater: GreaterGreater, - GreaterLess: GreaterLess, - GreaterSlantEqual: GreaterSlantEqual, - GreaterTilde: GreaterTilde, - Gscr: Gscr, - Gt: Gt, - HARDcy: HARDcy, - Hacek: Hacek, - Hat: Hat, - Hcirc: Hcirc, - Hfr: Hfr, - HilbertSpace: HilbertSpace, - Hopf: Hopf, - HorizontalLine: HorizontalLine, - Hscr: Hscr, - Hstrok: Hstrok, - HumpDownHump: HumpDownHump, - HumpEqual: HumpEqual, - IEcy: IEcy, - IJlig: IJlig, - IOcy: IOcy, - Iacut: Iacut, - Iacute: Iacute$1, - Icir: Icir, - Icirc: Icirc$1, - Icy: Icy, - Idot: Idot, - Ifr: Ifr, - Igrav: Igrav, - Igrave: Igrave$1, - Im: Im, - Imacr: Imacr, - ImaginaryI: ImaginaryI, - Implies: Implies, - Int: Int, - Integral: Integral, - Intersection: Intersection, - InvisibleComma: InvisibleComma, - InvisibleTimes: InvisibleTimes, - Iogon: Iogon, - Iopf: Iopf, - Iota: Iota, - Iscr: Iscr, - Itilde: Itilde, - Iukcy: Iukcy, - Ium: Ium, - Iuml: Iuml$1, - Jcirc: Jcirc, - Jcy: Jcy, - Jfr: Jfr, - Jopf: Jopf, - Jscr: Jscr, - Jsercy: Jsercy, - Jukcy: Jukcy, - KHcy: KHcy, - KJcy: KJcy, - Kappa: Kappa, - Kcedil: Kcedil, - Kcy: Kcy, - Kfr: Kfr, - Kopf: Kopf, - Kscr: Kscr, - LJcy: LJcy, - L: L, - LT: LT$1, - Lacute: Lacute, - Lambda: Lambda, - Lang: Lang, - Laplacetrf: Laplacetrf, - Larr: Larr, - Lcaron: Lcaron, - Lcedil: Lcedil, - Lcy: Lcy, - LeftAngleBracket: LeftAngleBracket, - LeftArrow: LeftArrow, - LeftArrowBar: LeftArrowBar, - LeftArrowRightArrow: LeftArrowRightArrow, - LeftCeiling: LeftCeiling, - LeftDoubleBracket: LeftDoubleBracket, - LeftDownTeeVector: LeftDownTeeVector, - LeftDownVector: LeftDownVector, - LeftDownVectorBar: LeftDownVectorBar, - LeftFloor: LeftFloor, - LeftRightArrow: LeftRightArrow, - LeftRightVector: LeftRightVector, - LeftTee: LeftTee, - LeftTeeArrow: LeftTeeArrow, - LeftTeeVector: LeftTeeVector, - LeftTriangle: LeftTriangle, - LeftTriangleBar: LeftTriangleBar, - LeftTriangleEqual: LeftTriangleEqual, - LeftUpDownVector: LeftUpDownVector, - LeftUpTeeVector: LeftUpTeeVector, - LeftUpVector: LeftUpVector, - LeftUpVectorBar: LeftUpVectorBar, - LeftVector: LeftVector, - LeftVectorBar: LeftVectorBar, - Leftarrow: Leftarrow, - Leftrightarrow: Leftrightarrow, - LessEqualGreater: LessEqualGreater, - LessFullEqual: LessFullEqual, - LessGreater: LessGreater, - LessLess: LessLess, - LessSlantEqual: LessSlantEqual, - LessTilde: LessTilde, - Lfr: Lfr, - Ll: Ll, - Lleftarrow: Lleftarrow, - Lmidot: Lmidot, - LongLeftArrow: LongLeftArrow, - LongLeftRightArrow: LongLeftRightArrow, - LongRightArrow: LongRightArrow, - Longleftarrow: Longleftarrow, - Longleftrightarrow: Longleftrightarrow, - Longrightarrow: Longrightarrow, - Lopf: Lopf, - LowerLeftArrow: LowerLeftArrow, - LowerRightArrow: LowerRightArrow, - Lscr: Lscr, - Lsh: Lsh, - Lstrok: Lstrok, - Lt: Lt, - Mcy: Mcy, - MediumSpace: MediumSpace, - Mellintrf: Mellintrf, - Mfr: Mfr, - MinusPlus: MinusPlus, - Mopf: Mopf, - Mscr: Mscr, - Mu: Mu, - NJcy: NJcy, - Nacute: Nacute, - Ncaron: Ncaron, - Ncedil: Ncedil, - Ncy: Ncy, - NegativeMediumSpace: NegativeMediumSpace, - NegativeThickSpace: NegativeThickSpace, - NegativeThinSpace: NegativeThinSpace, - NegativeVeryThinSpace: NegativeVeryThinSpace, - NestedGreaterGreater: NestedGreaterGreater, - NestedLessLess: NestedLessLess, - NewLine: NewLine, - Nfr: Nfr, - NoBreak: NoBreak, - NonBreakingSpace: NonBreakingSpace, - Nopf: Nopf, - Not: Not, - NotCongruent: NotCongruent, - NotCupCap: NotCupCap, - NotDoubleVerticalBar: NotDoubleVerticalBar, - NotElement: NotElement, - NotEqual: NotEqual, - NotEqualTilde: NotEqualTilde, - NotExists: NotExists, - NotGreater: NotGreater, - NotGreaterEqual: NotGreaterEqual, - NotGreaterFullEqual: NotGreaterFullEqual, - NotGreaterGreater: NotGreaterGreater, - NotGreaterLess: NotGreaterLess, - NotGreaterSlantEqual: NotGreaterSlantEqual, - NotGreaterTilde: NotGreaterTilde, - NotHumpDownHump: NotHumpDownHump, - NotHumpEqual: NotHumpEqual, - NotLeftTriangle: NotLeftTriangle, - NotLeftTriangleBar: NotLeftTriangleBar, - NotLeftTriangleEqual: NotLeftTriangleEqual, - NotLess: NotLess, - NotLessEqual: NotLessEqual, - NotLessGreater: NotLessGreater, - NotLessLess: NotLessLess, - NotLessSlantEqual: NotLessSlantEqual, - NotLessTilde: NotLessTilde, - NotNestedGreaterGreater: NotNestedGreaterGreater, - NotNestedLessLess: NotNestedLessLess, - NotPrecedes: NotPrecedes, - NotPrecedesEqual: NotPrecedesEqual, - NotPrecedesSlantEqual: NotPrecedesSlantEqual, - NotReverseElement: NotReverseElement, - NotRightTriangle: NotRightTriangle, - NotRightTriangleBar: NotRightTriangleBar, - NotRightTriangleEqual: NotRightTriangleEqual, - NotSquareSubset: NotSquareSubset, - NotSquareSubsetEqual: NotSquareSubsetEqual, - NotSquareSuperset: NotSquareSuperset, - NotSquareSupersetEqual: NotSquareSupersetEqual, - NotSubset: NotSubset, - NotSubsetEqual: NotSubsetEqual, - NotSucceeds: NotSucceeds, - NotSucceedsEqual: NotSucceedsEqual, - NotSucceedsSlantEqual: NotSucceedsSlantEqual, - NotSucceedsTilde: NotSucceedsTilde, - NotSuperset: NotSuperset, - NotSupersetEqual: NotSupersetEqual, - NotTilde: NotTilde, - NotTildeEqual: NotTildeEqual, - NotTildeFullEqual: NotTildeFullEqual, - NotTildeTilde: NotTildeTilde, - NotVerticalBar: NotVerticalBar, - Nscr: Nscr, - Ntild: Ntild, - Ntilde: Ntilde$1, - Nu: Nu, - OElig: OElig, - Oacut: Oacut, - Oacute: Oacute$1, - Ocir: Ocir, - Ocirc: Ocirc$1, - Ocy: Ocy, - Odblac: Odblac, - Ofr: Ofr, - Ograv: Ograv, - Ograve: Ograve$1, - Omacr: Omacr, - Omega: Omega, - Omicron: Omicron, - Oopf: Oopf, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, - OpenCurlyQuote: OpenCurlyQuote, - Or: Or, - Oscr: Oscr, - Oslas: Oslas, - Oslash: Oslash$1, - Otild: Otild, - Otilde: Otilde$1, - Otimes: Otimes, - Oum: Oum, - Ouml: Ouml$1, - OverBar: OverBar, - OverBrace: OverBrace, - OverBracket: OverBracket, - OverParenthesis: OverParenthesis, - PartialD: PartialD, - Pcy: Pcy, - Pfr: Pfr, - Phi: Phi, - Pi: Pi, - PlusMinus: PlusMinus, - Poincareplane: Poincareplane, - Popf: Popf, - Pr: Pr, - Precedes: Precedes, - PrecedesEqual: PrecedesEqual, - PrecedesSlantEqual: PrecedesSlantEqual, - PrecedesTilde: PrecedesTilde, - Prime: Prime, - Product: Product, - Proportion: Proportion, - Proportional: Proportional, - Pscr: Pscr, - Psi: Psi, - QUO: QUO, - QUOT: QUOT$1, - Qfr: Qfr, - Qopf: Qopf, - Qscr: Qscr, - RBarr: RBarr, - RE: RE, - REG: REG$1, - Racute: Racute, - Rang: Rang, - Rarr: Rarr, - Rarrtl: Rarrtl, - Rcaron: Rcaron, - Rcedil: Rcedil, - Rcy: Rcy, - Re: Re, - ReverseElement: ReverseElement, - ReverseEquilibrium: ReverseEquilibrium, - ReverseUpEquilibrium: ReverseUpEquilibrium, - Rfr: Rfr, - Rho: Rho, - RightAngleBracket: RightAngleBracket, - RightArrow: RightArrow, - RightArrowBar: RightArrowBar, - RightArrowLeftArrow: RightArrowLeftArrow, - RightCeiling: RightCeiling, - RightDoubleBracket: RightDoubleBracket, - RightDownTeeVector: RightDownTeeVector, - RightDownVector: RightDownVector, - RightDownVectorBar: RightDownVectorBar, - RightFloor: RightFloor, - RightTee: RightTee, - RightTeeArrow: RightTeeArrow, - RightTeeVector: RightTeeVector, - RightTriangle: RightTriangle, - RightTriangleBar: RightTriangleBar, - RightTriangleEqual: RightTriangleEqual, - RightUpDownVector: RightUpDownVector, - RightUpTeeVector: RightUpTeeVector, - RightUpVector: RightUpVector, - RightUpVectorBar: RightUpVectorBar, - RightVector: RightVector, - RightVectorBar: RightVectorBar, - Rightarrow: Rightarrow, - Ropf: Ropf, - RoundImplies: RoundImplies, - Rrightarrow: Rrightarrow, - Rscr: Rscr, - Rsh: Rsh, - RuleDelayed: RuleDelayed, - SHCHcy: SHCHcy, - SHcy: SHcy, - SOFTcy: SOFTcy, - Sacute: Sacute, - Sc: Sc, - Scaron: Scaron, - Scedil: Scedil, - Scirc: Scirc, - Scy: Scy, - Sfr: Sfr, - ShortDownArrow: ShortDownArrow, - ShortLeftArrow: ShortLeftArrow, - ShortRightArrow: ShortRightArrow, - ShortUpArrow: ShortUpArrow, - Sigma: Sigma, - SmallCircle: SmallCircle, - Sopf: Sopf, - Sqrt: Sqrt, - Square: Square, - SquareIntersection: SquareIntersection, - SquareSubset: SquareSubset, - SquareSubsetEqual: SquareSubsetEqual, - SquareSuperset: SquareSuperset, - SquareSupersetEqual: SquareSupersetEqual, - SquareUnion: SquareUnion, - Sscr: Sscr, - Star: Star, - Sub: Sub, - Subset: Subset, - SubsetEqual: SubsetEqual, - Succeeds: Succeeds, - SucceedsEqual: SucceedsEqual, - SucceedsSlantEqual: SucceedsSlantEqual, - SucceedsTilde: SucceedsTilde, - SuchThat: SuchThat, - Sum: Sum, - Sup: Sup, - Superset: Superset, - SupersetEqual: SupersetEqual, - Supset: Supset, - THOR: THOR, - THORN: THORN$1, - TRADE: TRADE, - TSHcy: TSHcy, - TScy: TScy, - Tab: Tab, - Tau: Tau, - Tcaron: Tcaron, - Tcedil: Tcedil, - Tcy: Tcy, - Tfr: Tfr, - Therefore: Therefore, - Theta: Theta, - ThickSpace: ThickSpace, - ThinSpace: ThinSpace, - Tilde: Tilde, - TildeEqual: TildeEqual, - TildeFullEqual: TildeFullEqual, - TildeTilde: TildeTilde, - Topf: Topf, - TripleDot: TripleDot, - Tscr: Tscr, - Tstrok: Tstrok, - Uacut: Uacut, - Uacute: Uacute$1, - Uarr: Uarr, - Uarrocir: Uarrocir, - Ubrcy: Ubrcy, - Ubreve: Ubreve, - Ucir: Ucir, - Ucirc: Ucirc$1, - Ucy: Ucy, - Udblac: Udblac, - Ufr: Ufr, - Ugrav: Ugrav, - Ugrave: Ugrave$1, - Umacr: Umacr, - UnderBar: UnderBar, - UnderBrace: UnderBrace, - UnderBracket: UnderBracket, - UnderParenthesis: UnderParenthesis, - Union: Union, - UnionPlus: UnionPlus, - Uogon: Uogon, - Uopf: Uopf, - UpArrow: UpArrow, - UpArrowBar: UpArrowBar, - UpArrowDownArrow: UpArrowDownArrow, - UpDownArrow: UpDownArrow, - UpEquilibrium: UpEquilibrium, - UpTee: UpTee, - UpTeeArrow: UpTeeArrow, - Uparrow: Uparrow, - Updownarrow: Updownarrow, - UpperLeftArrow: UpperLeftArrow, - UpperRightArrow: UpperRightArrow, - Upsi: Upsi, - Upsilon: Upsilon, - Uring: Uring, - Uscr: Uscr, - Utilde: Utilde, - Uum: Uum, - Uuml: Uuml$1, - VDash: VDash, - Vbar: Vbar, - Vcy: Vcy, - Vdash: Vdash, - Vdashl: Vdashl, - Vee: Vee, - Verbar: Verbar, - Vert: Vert, - VerticalBar: VerticalBar, - VerticalLine: VerticalLine, - VerticalSeparator: VerticalSeparator, - VerticalTilde: VerticalTilde, - VeryThinSpace: VeryThinSpace, - Vfr: Vfr, - Vopf: Vopf, - Vscr: Vscr, - Vvdash: Vvdash, - Wcirc: Wcirc, - Wedge: Wedge, - Wfr: Wfr, - Wopf: Wopf, - Wscr: Wscr, - Xfr: Xfr, - Xi: Xi, - Xopf: Xopf, - Xscr: Xscr, - YAcy: YAcy, - YIcy: YIcy, - YUcy: YUcy, - Yacut: Yacut, - Yacute: Yacute$1, - Ycirc: Ycirc, - Ycy: Ycy, - Yfr: Yfr, - Yopf: Yopf, - Yscr: Yscr, - Yuml: Yuml, - ZHcy: ZHcy, - Zacute: Zacute, - Zcaron: Zcaron, - Zcy: Zcy, - Zdot: Zdot, - ZeroWidthSpace: ZeroWidthSpace, - Zeta: Zeta, - Zfr: Zfr, - Zopf: Zopf, - Zscr: Zscr, - aacut: aacut, - aacute: aacute$1, - abreve: abreve, - ac: ac, - acE: acE, - acd: acd, - acir: acir, - acirc: acirc$1, - acut: acut, - acute: acute$1, - acy: acy, - aeli: aeli, - aelig: aelig$1, - af: af, - afr: afr, - agrav: agrav, - agrave: agrave$1, - alefsym: alefsym, - aleph: aleph, - alpha: alpha, - amacr: amacr, - amalg: amalg, - am: am, - amp: amp$1, - and: and, - andand: andand, - andd: andd, - andslope: andslope, - andv: andv, - ang: ang, - ange: ange, - angle: angle, - angmsd: angmsd, - angmsdaa: angmsdaa, - angmsdab: angmsdab, - angmsdac: angmsdac, - angmsdad: angmsdad, - angmsdae: angmsdae, - angmsdaf: angmsdaf, - angmsdag: angmsdag, - angmsdah: angmsdah, - angrt: angrt, - angrtvb: angrtvb, - angrtvbd: angrtvbd, - angsph: angsph, - angst: angst, - angzarr: angzarr, - aogon: aogon, - aopf: aopf, - ap: ap, - apE: apE, - apacir: apacir, - ape: ape, - apid: apid, - apos: apos, - approx: approx, - approxeq: approxeq, - arin: arin, - aring: aring$1, - ascr: ascr, - ast: ast, - asymp: asymp, - asympeq: asympeq, - atild: atild, - atilde: atilde$1, - aum: aum, - auml: auml$1, - awconint: awconint, - awint: awint, - bNot: bNot, - backcong: backcong, - backepsilon: backepsilon, - backprime: backprime, - backsim: backsim, - backsimeq: backsimeq, - barvee: barvee, - barwed: barwed, - barwedge: barwedge, - bbrk: bbrk, - bbrktbrk: bbrktbrk, - bcong: bcong, - bcy: bcy, - bdquo: bdquo, - becaus: becaus, - because: because, - bemptyv: bemptyv, - bepsi: bepsi, - bernou: bernou, - beta: beta, - beth: beth, - between: between, - bfr: bfr, - bigcap: bigcap, - bigcirc: bigcirc, - bigcup: bigcup, - bigodot: bigodot, - bigoplus: bigoplus, - bigotimes: bigotimes, - bigsqcup: bigsqcup, - bigstar: bigstar, - bigtriangledown: bigtriangledown, - bigtriangleup: bigtriangleup, - biguplus: biguplus, - bigvee: bigvee, - bigwedge: bigwedge, - bkarow: bkarow, - blacklozenge: blacklozenge, - blacksquare: blacksquare, - blacktriangle: blacktriangle, - blacktriangledown: blacktriangledown, - blacktriangleleft: blacktriangleleft, - blacktriangleright: blacktriangleright, - blank: blank, - blk12: blk12, - blk14: blk14, - blk34: blk34, - block: block, - bne: bne, - bnequiv: bnequiv, - bnot: bnot, - bopf: bopf, - bot: bot, - bottom: bottom, - bowtie: bowtie, - boxDL: boxDL, - boxDR: boxDR, - boxDl: boxDl, - boxDr: boxDr, - boxH: boxH, - boxHD: boxHD, - boxHU: boxHU, - boxHd: boxHd, - boxHu: boxHu, - boxUL: boxUL, - boxUR: boxUR, - boxUl: boxUl, - boxUr: boxUr, - boxV: boxV, - boxVH: boxVH, - boxVL: boxVL, - boxVR: boxVR, - boxVh: boxVh, - boxVl: boxVl, - boxVr: boxVr, - boxbox: boxbox, - boxdL: boxdL, - boxdR: boxdR, - boxdl: boxdl, - boxdr: boxdr, - boxh: boxh, - boxhD: boxhD, - boxhU: boxhU, - boxhd: boxhd, - boxhu: boxhu, - boxminus: boxminus, - boxplus: boxplus, - boxtimes: boxtimes, - boxuL: boxuL, - boxuR: boxuR, - boxul: boxul, - boxur: boxur, - boxv: boxv, - boxvH: boxvH, - boxvL: boxvL, - boxvR: boxvR, - boxvh: boxvh, - boxvl: boxvl, - boxvr: boxvr, - bprime: bprime, - breve: breve, - brvba: brvba, - brvbar: brvbar$1, - bscr: bscr, - bsemi: bsemi, - bsim: bsim, - bsime: bsime, - bsol: bsol, - bsolb: bsolb, - bsolhsub: bsolhsub, - bull: bull, - bullet: bullet, - bump: bump, - bumpE: bumpE, - bumpe: bumpe, - bumpeq: bumpeq, - cacute: cacute, - cap: cap, - capand: capand, - capbrcup: capbrcup, - capcap: capcap, - capcup: capcup, - capdot: capdot, - caps: caps, - caret: caret, - caron: caron, - ccaps: ccaps, - ccaron: ccaron, - ccedi: ccedi, - ccedil: ccedil$1, - ccirc: ccirc, - ccups: ccups, - ccupssm: ccupssm, - cdot: cdot, - cedi: cedi, - cedil: cedil$1, - cemptyv: cemptyv, - cen: cen, - cent: cent$1, - centerdot: centerdot, - cfr: cfr, - chcy: chcy, - check: check$2, - checkmark: checkmark, - chi: chi, - cir: cir, - cirE: cirE, - circ: circ, - circeq: circeq, - circlearrowleft: circlearrowleft, - circlearrowright: circlearrowright, - circledR: circledR, - circledS: circledS, - circledast: circledast, - circledcirc: circledcirc, - circleddash: circleddash, - cire: cire, - cirfnint: cirfnint, - cirmid: cirmid, - cirscir: cirscir, - clubs: clubs, - clubsuit: clubsuit, - colon: colon, - colone: colone, - coloneq: coloneq, - comma: comma, - commat: commat, - comp: comp, - compfn: compfn, - complement: complement, - complexes: complexes, - cong: cong, - congdot: congdot, - conint: conint, - copf: copf, - coprod: coprod, - cop: cop, - copy: copy$3, - copysr: copysr, - crarr: crarr, - cross: cross, - cscr: cscr, - csub: csub, - csube: csube, - csup: csup, - csupe: csupe, - ctdot: ctdot, - cudarrl: cudarrl, - cudarrr: cudarrr, - cuepr: cuepr, - cuesc: cuesc, - cularr: cularr, - cularrp: cularrp, - cup: cup, - cupbrcap: cupbrcap, - cupcap: cupcap, - cupcup: cupcup, - cupdot: cupdot, - cupor: cupor, - cups: cups, - curarr: curarr, - curarrm: curarrm, - curlyeqprec: curlyeqprec, - curlyeqsucc: curlyeqsucc, - curlyvee: curlyvee, - curlywedge: curlywedge, - curre: curre, - curren: curren$1, - curvearrowleft: curvearrowleft, - curvearrowright: curvearrowright, - cuvee: cuvee, - cuwed: cuwed, - cwconint: cwconint, - cwint: cwint, - cylcty: cylcty, - dArr: dArr, - dHar: dHar, - dagger: dagger, - daleth: daleth, - darr: darr, - dash: dash, - dashv: dashv, - dbkarow: dbkarow, - dblac: dblac, - dcaron: dcaron, - dcy: dcy, - dd: dd, - ddagger: ddagger, - ddarr: ddarr, - ddotseq: ddotseq, - de: de, - deg: deg$1, - delta: delta, - demptyv: demptyv, - dfisht: dfisht, - dfr: dfr, - dharl: dharl, - dharr: dharr, - diam: diam, - diamond: diamond, - diamondsuit: diamondsuit, - diams: diams, - die: die, - digamma: digamma, - disin: disin, - div: div, - divid: divid, - divide: divide$1, - divideontimes: divideontimes, - divonx: divonx, - djcy: djcy, - dlcorn: dlcorn, - dlcrop: dlcrop, - dollar: dollar, - dopf: dopf, - dot: dot, - doteq: doteq, - doteqdot: doteqdot, - dotminus: dotminus, - dotplus: dotplus, - dotsquare: dotsquare, - doublebarwedge: doublebarwedge, - downarrow: downarrow, - downdownarrows: downdownarrows, - downharpoonleft: downharpoonleft, - downharpoonright: downharpoonright, - drbkarow: drbkarow, - drcorn: drcorn, - drcrop: drcrop, - dscr: dscr, - dscy: dscy, - dsol: dsol, - dstrok: dstrok, - dtdot: dtdot, - dtri: dtri, - dtrif: dtrif, - duarr: duarr, - duhar: duhar, - dwangle: dwangle, - dzcy: dzcy, - dzigrarr: dzigrarr, - eDDot: eDDot, - eDot: eDot, - eacut: eacut, - eacute: eacute$1, - easter: easter, - ecaron: ecaron, - ecir: ecir, - ecirc: ecirc$1, - ecolon: ecolon, - ecy: ecy, - edot: edot, - ee: ee, - efDot: efDot, - efr: efr, - eg: eg, - egrav: egrav, - egrave: egrave$1, - egs: egs, - egsdot: egsdot, - el: el, - elinters: elinters, - ell: ell, - els: els, - elsdot: elsdot, - emacr: emacr, - empty: empty, - emptyset: emptyset, - emptyv: emptyv, - emsp13: emsp13, - emsp14: emsp14, - emsp: emsp, - eng: eng, - ensp: ensp, - eogon: eogon, - eopf: eopf, - epar: epar, - eparsl: eparsl, - eplus: eplus, - epsi: epsi, - epsilon: epsilon, - epsiv: epsiv, - eqcirc: eqcirc, - eqcolon: eqcolon, - eqsim: eqsim, - eqslantgtr: eqslantgtr, - eqslantless: eqslantless, - equals: equals, - equest: equest, - equiv: equiv, - equivDD: equivDD, - eqvparsl: eqvparsl, - erDot: erDot, - erarr: erarr, - escr: escr, - esdot: esdot, - esim: esim, - eta: eta, - et: et, - eth: eth$1, - eum: eum, - euml: euml$1, - euro: euro, - excl: excl, - exist: exist, - expectation: expectation, - exponentiale: exponentiale, - fallingdotseq: fallingdotseq, - fcy: fcy, - female: female, - ffilig: ffilig, - fflig: fflig, - ffllig: ffllig, - ffr: ffr, - filig: filig, - fjlig: fjlig, - flat: flat, - fllig: fllig, - fltns: fltns, - fnof: fnof, - fopf: fopf, - forall: forall, - fork: fork, - forkv: forkv, - fpartint: fpartint, - frac1: frac1, - frac12: frac12$1, - frac13: frac13, - frac14: frac14$1, - frac15: frac15, - frac16: frac16, - frac18: frac18, - frac23: frac23, - frac25: frac25, - frac3: frac3, - frac34: frac34$1, - frac35: frac35, - frac38: frac38, - frac45: frac45, - frac56: frac56, - frac58: frac58, - frac78: frac78, - frasl: frasl, - frown: frown, - fscr: fscr, - gE: gE, - gEl: gEl, - gacute: gacute, - gamma: gamma, - gammad: gammad, - gap: gap, - gbreve: gbreve, - gcirc: gcirc, - gcy: gcy, - gdot: gdot, - ge: ge, - gel: gel, - geq: geq, - geqq: geqq, - geqslant: geqslant, - ges: ges, - gescc: gescc, - gesdot: gesdot, - gesdoto: gesdoto, - gesdotol: gesdotol, - gesl: gesl, - gesles: gesles, - gfr: gfr, - gg: gg, - ggg: ggg, - gimel: gimel, - gjcy: gjcy, - gl: gl, - glE: glE, - gla: gla, - glj: glj, - gnE: gnE, - gnap: gnap, - gnapprox: gnapprox, - gne: gne, - gneq: gneq, - gneqq: gneqq, - gnsim: gnsim, - gopf: gopf, - grave: grave, - gscr: gscr, - gsim: gsim, - gsime: gsime, - gsiml: gsiml, - g: g, - gt: gt$1, - gtcc: gtcc, - gtcir: gtcir, - gtdot: gtdot, - gtlPar: gtlPar, - gtquest: gtquest, - gtrapprox: gtrapprox, - gtrarr: gtrarr, - gtrdot: gtrdot, - gtreqless: gtreqless, - gtreqqless: gtreqqless, - gtrless: gtrless, - gtrsim: gtrsim, - gvertneqq: gvertneqq, - gvnE: gvnE, - hArr: hArr, - hairsp: hairsp, - half: half, - hamilt: hamilt, - hardcy: hardcy, - harr: harr, - harrcir: harrcir, - harrw: harrw, - hbar: hbar, - hcirc: hcirc, - hearts: hearts, - heartsuit: heartsuit, - hellip: hellip, - hercon: hercon, - hfr: hfr, - hksearow: hksearow, - hkswarow: hkswarow, - hoarr: hoarr, - homtht: homtht, - hookleftarrow: hookleftarrow, - hookrightarrow: hookrightarrow, - hopf: hopf, - horbar: horbar, - hscr: hscr, - hslash: hslash, - hstrok: hstrok, - hybull: hybull, - hyphen: hyphen, - iacut: iacut, - iacute: iacute$1, - ic: ic, - icir: icir, - icirc: icirc$1, - icy: icy, - iecy: iecy, - iexc: iexc, - iexcl: iexcl$1, - iff: iff, - ifr: ifr, - igrav: igrav, - igrave: igrave$1, - ii: ii, - iiiint: iiiint, - iiint: iiint, - iinfin: iinfin, - iiota: iiota, - ijlig: ijlig, - imacr: imacr, - image: image, - imagline: imagline, - imagpart: imagpart, - imath: imath, - imof: imof, - imped: imped, - incare: incare, - infin: infin, - infintie: infintie, - inodot: inodot, - int: int, - intcal: intcal, - integers: integers, - intercal: intercal, - intlarhk: intlarhk, - intprod: intprod, - iocy: iocy, - iogon: iogon, - iopf: iopf, - iota: iota, - iprod: iprod, - iques: iques, - iquest: iquest$1, - iscr: iscr, - isin: isin, - isinE: isinE, - isindot: isindot, - isins: isins, - isinsv: isinsv, - isinv: isinv, - it: it, - itilde: itilde, - iukcy: iukcy, - ium: ium, - iuml: iuml$1, - jcirc: jcirc, - jcy: jcy, - jfr: jfr, - jmath: jmath, - jopf: jopf, - jscr: jscr, - jsercy: jsercy, - jukcy: jukcy, - kappa: kappa, - kappav: kappav, - kcedil: kcedil, - kcy: kcy, - kfr: kfr, - kgreen: kgreen, - khcy: khcy, - kjcy: kjcy, - kopf: kopf, - kscr: kscr, - lAarr: lAarr, - lArr: lArr, - lAtail: lAtail, - lBarr: lBarr, - lE: lE, - lEg: lEg, - lHar: lHar, - lacute: lacute, - laemptyv: laemptyv, - lagran: lagran, - lambda: lambda, - lang: lang, - langd: langd, - langle: langle, - lap: lap, - laqu: laqu, - laquo: laquo$1, - larr: larr, - larrb: larrb, - larrbfs: larrbfs, - larrfs: larrfs, - larrhk: larrhk, - larrlp: larrlp, - larrpl: larrpl, - larrsim: larrsim, - larrtl: larrtl, - lat: lat, - latail: latail, - late: late, - lates: lates, - lbarr: lbarr, - lbbrk: lbbrk, - lbrace: lbrace, - lbrack: lbrack, - lbrke: lbrke, - lbrksld: lbrksld, - lbrkslu: lbrkslu, - lcaron: lcaron, - lcedil: lcedil, - lceil: lceil, - lcub: lcub, - lcy: lcy, - ldca: ldca, - ldquo: ldquo, - ldquor: ldquor, - ldrdhar: ldrdhar, - ldrushar: ldrushar, - ldsh: ldsh, - le: le, - leftarrow: leftarrow, - leftarrowtail: leftarrowtail, - leftharpoondown: leftharpoondown, - leftharpoonup: leftharpoonup, - leftleftarrows: leftleftarrows, - leftrightarrow: leftrightarrow, - leftrightarrows: leftrightarrows, - leftrightharpoons: leftrightharpoons, - leftrightsquigarrow: leftrightsquigarrow, - leftthreetimes: leftthreetimes, - leg: leg, - leq: leq, - leqq: leqq, - leqslant: leqslant, - les: les, - lescc: lescc, - lesdot: lesdot, - lesdoto: lesdoto, - lesdotor: lesdotor, - lesg: lesg, - lesges: lesges, - lessapprox: lessapprox, - lessdot: lessdot, - lesseqgtr: lesseqgtr, - lesseqqgtr: lesseqqgtr, - lessgtr: lessgtr, - lesssim: lesssim, - lfisht: lfisht, - lfloor: lfloor, - lfr: lfr, - lg: lg, - lgE: lgE, - lhard: lhard, - lharu: lharu, - lharul: lharul, - lhblk: lhblk, - ljcy: ljcy, - ll: ll, - llarr: llarr, - llcorner: llcorner, - llhard: llhard, - lltri: lltri, - lmidot: lmidot, - lmoust: lmoust, - lmoustache: lmoustache, - lnE: lnE, - lnap: lnap, - lnapprox: lnapprox, - lne: lne, - lneq: lneq, - lneqq: lneqq, - lnsim: lnsim, - loang: loang, - loarr: loarr, - lobrk: lobrk, - longleftarrow: longleftarrow, - longleftrightarrow: longleftrightarrow, - longmapsto: longmapsto, - longrightarrow: longrightarrow, - looparrowleft: looparrowleft, - looparrowright: looparrowright, - lopar: lopar, - lopf: lopf, - loplus: loplus, - lotimes: lotimes, - lowast: lowast, - lowbar: lowbar, - loz: loz, - lozenge: lozenge, - lozf: lozf, - lpar: lpar, - lparlt: lparlt, - lrarr: lrarr, - lrcorner: lrcorner, - lrhar: lrhar, - lrhard: lrhard, - lrm: lrm, - lrtri: lrtri, - lsaquo: lsaquo, - lscr: lscr, - lsh: lsh, - lsim: lsim, - lsime: lsime, - lsimg: lsimg, - lsqb: lsqb, - lsquo: lsquo, - lsquor: lsquor, - lstrok: lstrok, - l: l, - lt: lt$1, - ltcc: ltcc, - ltcir: ltcir, - ltdot: ltdot, - lthree: lthree, - ltimes: ltimes, - ltlarr: ltlarr, - ltquest: ltquest, - ltrPar: ltrPar, - ltri: ltri, - ltrie: ltrie, - ltrif: ltrif, - lurdshar: lurdshar, - luruhar: luruhar, - lvertneqq: lvertneqq, - lvnE: lvnE, - mDDot: mDDot, - mac: mac, - macr: macr$1, - male: male, - malt: malt, - maltese: maltese, - map: map$3, - mapsto: mapsto, - mapstodown: mapstodown, - mapstoleft: mapstoleft, - mapstoup: mapstoup, - marker: marker, - mcomma: mcomma, - mcy: mcy, - mdash: mdash, - measuredangle: measuredangle, - mfr: mfr, - mho: mho, - micr: micr, - micro: micro$1, - mid: mid, - midast: midast, - midcir: midcir, - middo: middo, - middot: middot$1, - minus: minus, - minusb: minusb, - minusd: minusd, - minusdu: minusdu, - mlcp: mlcp, - mldr: mldr, - mnplus: mnplus, - models: models, - mopf: mopf, - mp: mp, - mscr: mscr, - mstpos: mstpos, - mu: mu, - multimap: multimap, - mumap: mumap, - nGg: nGg, - nGt: nGt, - nGtv: nGtv, - nLeftarrow: nLeftarrow, - nLeftrightarrow: nLeftrightarrow, - nLl: nLl, - nLt: nLt, - nLtv: nLtv, - nRightarrow: nRightarrow, - nVDash: nVDash, - nVdash: nVdash, - nabla: nabla, - nacute: nacute, - nang: nang, - nap: nap, - napE: napE, - napid: napid, - napos: napos, - napprox: napprox, - natur: natur, - natural: natural, - naturals: naturals, - nbs: nbs, - nbsp: nbsp$1, - nbump: nbump, - nbumpe: nbumpe, - ncap: ncap, - ncaron: ncaron, - ncedil: ncedil, - ncong: ncong, - ncongdot: ncongdot, - ncup: ncup, - ncy: ncy, - ndash: ndash, - ne: ne, - neArr: neArr, - nearhk: nearhk, - nearr: nearr, - nearrow: nearrow, - nedot: nedot, - nequiv: nequiv, - nesear: nesear, - nesim: nesim, - nexist: nexist, - nexists: nexists, - nfr: nfr, - ngE: ngE, - nge: nge, - ngeq: ngeq, - ngeqq: ngeqq, - ngeqslant: ngeqslant, - nges: nges, - ngsim: ngsim, - ngt: ngt, - ngtr: ngtr, - nhArr: nhArr, - nharr: nharr, - nhpar: nhpar, - ni: ni, - nis: nis, - nisd: nisd, - niv: niv, - njcy: njcy, - nlArr: nlArr, - nlE: nlE, - nlarr: nlarr, - nldr: nldr, - nle: nle, - nleftarrow: nleftarrow, - nleftrightarrow: nleftrightarrow, - nleq: nleq, - nleqq: nleqq, - nleqslant: nleqslant, - nles: nles, - nless: nless, - nlsim: nlsim, - nlt: nlt, - nltri: nltri, - nltrie: nltrie, - nmid: nmid, - nopf: nopf, - no: no, - not: not$1, - notin: notin, - notinE: notinE, - notindot: notindot, - notinva: notinva, - notinvb: notinvb, - notinvc: notinvc, - notni: notni, - notniva: notniva, - notnivb: notnivb, - notnivc: notnivc, - npar: npar, - nparallel: nparallel, - nparsl: nparsl, - npart: npart, - npolint: npolint, - npr: npr, - nprcue: nprcue, - npre: npre, - nprec: nprec, - npreceq: npreceq, - nrArr: nrArr, - nrarr: nrarr, - nrarrc: nrarrc, - nrarrw: nrarrw, - nrightarrow: nrightarrow, - nrtri: nrtri, - nrtrie: nrtrie, - nsc: nsc, - nsccue: nsccue, - nsce: nsce, - nscr: nscr, - nshortmid: nshortmid, - nshortparallel: nshortparallel, - nsim: nsim, - nsime: nsime, - nsimeq: nsimeq, - nsmid: nsmid, - nspar: nspar, - nsqsube: nsqsube, - nsqsupe: nsqsupe, - nsub: nsub, - nsubE: nsubE, - nsube: nsube, - nsubset: nsubset, - nsubseteq: nsubseteq, - nsubseteqq: nsubseteqq, - nsucc: nsucc, - nsucceq: nsucceq, - nsup: nsup, - nsupE: nsupE, - nsupe: nsupe, - nsupset: nsupset, - nsupseteq: nsupseteq, - nsupseteqq: nsupseteqq, - ntgl: ntgl, - ntild: ntild, - ntilde: ntilde$1, - ntlg: ntlg, - ntriangleleft: ntriangleleft, - ntrianglelefteq: ntrianglelefteq, - ntriangleright: ntriangleright, - ntrianglerighteq: ntrianglerighteq, - nu: nu, - num: num, - numero: numero, - numsp: numsp, - nvDash: nvDash, - nvHarr: nvHarr, - nvap: nvap, - nvdash: nvdash, - nvge: nvge, - nvgt: nvgt, - nvinfin: nvinfin, - nvlArr: nvlArr, - nvle: nvle, - nvlt: nvlt, - nvltrie: nvltrie, - nvrArr: nvrArr, - nvrtrie: nvrtrie, - nvsim: nvsim, - nwArr: nwArr, - nwarhk: nwarhk, - nwarr: nwarr, - nwarrow: nwarrow, - nwnear: nwnear, - oS: oS, - oacut: oacut, - oacute: oacute$1, - oast: oast, - ocir: ocir, - ocirc: ocirc$1, - ocy: ocy, - odash: odash, - odblac: odblac, - odiv: odiv, - odot: odot, - odsold: odsold, - oelig: oelig, - ofcir: ofcir, - ofr: ofr, - ogon: ogon, - ograv: ograv, - ograve: ograve$1, - ogt: ogt, - ohbar: ohbar, - ohm: ohm, - oint: oint, - olarr: olarr, - olcir: olcir, - olcross: olcross, - oline: oline, - olt: olt, - omacr: omacr, - omega: omega, - omicron: omicron, - omid: omid, - ominus: ominus, - oopf: oopf, - opar: opar, - operp: operp, - oplus: oplus, - or: or, - orarr: orarr, - ord: ord, - order: order$2, - orderof: orderof, - ordf: ordf$1, - ordm: ordm$1, - origof: origof, - oror: oror, - orslope: orslope, - orv: orv, - oscr: oscr, - oslas: oslas, - oslash: oslash$1, - osol: osol, - otild: otild, - otilde: otilde$1, - otimes: otimes, - otimesas: otimesas, - oum: oum, - ouml: ouml$1, - ovbar: ovbar, - par: par, - para: para$1, - parallel: parallel, - parsim: parsim, - parsl: parsl, - part: part, - pcy: pcy, - percnt: percnt, - period: period, - permil: permil, - perp: perp, - pertenk: pertenk, - pfr: pfr, - phi: phi, - phiv: phiv, - phmmat: phmmat, - phone: phone, - pi: pi, - pitchfork: pitchfork, - piv: piv, - planck: planck, - planckh: planckh, - plankv: plankv, - plus: plus, - plusacir: plusacir, - plusb: plusb, - pluscir: pluscir, - plusdo: plusdo, - plusdu: plusdu, - pluse: pluse, - plusm: plusm, - plusmn: plusmn$1, - plussim: plussim, - plustwo: plustwo, - pm: pm, - pointint: pointint, - popf: popf, - poun: poun, - pound: pound$1, - pr: pr, - prE: prE, - prap: prap, - prcue: prcue, - pre: pre, - prec: prec, - precapprox: precapprox, - preccurlyeq: preccurlyeq, - preceq: preceq, - precnapprox: precnapprox, - precneqq: precneqq, - precnsim: precnsim, - precsim: precsim, - prime: prime, - primes: primes, - prnE: prnE, - prnap: prnap, - prnsim: prnsim, - prod: prod, - profalar: profalar, - profline: profline, - profsurf: profsurf, - prop: prop, - propto: propto, - prsim: prsim, - prurel: prurel, - pscr: pscr, - psi: psi, - puncsp: puncsp, - qfr: qfr, - qint: qint, - qopf: qopf, - qprime: qprime, - qscr: qscr, - quaternions: quaternions, - quatint: quatint, - quest: quest, - questeq: questeq, - quo: quo, - quot: quot$1, - rAarr: rAarr, - rArr: rArr, - rAtail: rAtail, - rBarr: rBarr, - rHar: rHar, - race: race, - racute: racute, - radic: radic, - raemptyv: raemptyv, - rang: rang, - rangd: rangd, - range: range$1, - rangle: rangle, - raqu: raqu, - raquo: raquo$1, - rarr: rarr, - rarrap: rarrap, - rarrb: rarrb, - rarrbfs: rarrbfs, - rarrc: rarrc, - rarrfs: rarrfs, - rarrhk: rarrhk, - rarrlp: rarrlp, - rarrpl: rarrpl, - rarrsim: rarrsim, - rarrtl: rarrtl, - rarrw: rarrw, - ratail: ratail, - ratio: ratio, - rationals: rationals, - rbarr: rbarr, - rbbrk: rbbrk, - rbrace: rbrace, - rbrack: rbrack, - rbrke: rbrke, - rbrksld: rbrksld, - rbrkslu: rbrkslu, - rcaron: rcaron, - rcedil: rcedil, - rceil: rceil, - rcub: rcub, - rcy: rcy, - rdca: rdca, - rdldhar: rdldhar, - rdquo: rdquo, - rdquor: rdquor, - rdsh: rdsh, - real: real, - realine: realine, - realpart: realpart, - reals: reals, - rect: rect, - re: re, - reg: reg$1, - rfisht: rfisht, - rfloor: rfloor, - rfr: rfr, - rhard: rhard, - rharu: rharu, - rharul: rharul, - rho: rho, - rhov: rhov, - rightarrow: rightarrow, - rightarrowtail: rightarrowtail, - rightharpoondown: rightharpoondown, - rightharpoonup: rightharpoonup, - rightleftarrows: rightleftarrows, - rightleftharpoons: rightleftharpoons, - rightrightarrows: rightrightarrows, - rightsquigarrow: rightsquigarrow, - rightthreetimes: rightthreetimes, - ring: ring, - risingdotseq: risingdotseq, - rlarr: rlarr, - rlhar: rlhar, - rlm: rlm, - rmoust: rmoust, - rmoustache: rmoustache, - rnmid: rnmid, - roang: roang, - roarr: roarr, - robrk: robrk, - ropar: ropar, - ropf: ropf, - roplus: roplus, - rotimes: rotimes, - rpar: rpar, - rpargt: rpargt, - rppolint: rppolint, - rrarr: rrarr, - rsaquo: rsaquo, - rscr: rscr, - rsh: rsh, - rsqb: rsqb, - rsquo: rsquo, - rsquor: rsquor, - rthree: rthree, - rtimes: rtimes, - rtri: rtri, - rtrie: rtrie, - rtrif: rtrif, - rtriltri: rtriltri, - ruluhar: ruluhar, - rx: rx, - sacute: sacute, - sbquo: sbquo, - sc: sc, - scE: scE, - scap: scap, - scaron: scaron, - sccue: sccue, - sce: sce, - scedil: scedil, - scirc: scirc, - scnE: scnE, - scnap: scnap, - scnsim: scnsim, - scpolint: scpolint, - scsim: scsim, - scy: scy, - sdot: sdot, - sdotb: sdotb, - sdote: sdote, - seArr: seArr, - searhk: searhk, - searr: searr, - searrow: searrow, - sec: sec, - sect: sect$1, - semi: semi, - seswar: seswar, - setminus: setminus, - setmn: setmn, - sext: sext, - sfr: sfr, - sfrown: sfrown, - sharp: sharp, - shchcy: shchcy, - shcy: shcy, - shortmid: shortmid, - shortparallel: shortparallel, - sh: sh, - shy: shy$1, - sigma: sigma, - sigmaf: sigmaf, - sigmav: sigmav, - sim: sim, - simdot: simdot, - sime: sime, - simeq: simeq, - simg: simg, - simgE: simgE, - siml: siml, - simlE: simlE, - simne: simne, - simplus: simplus, - simrarr: simrarr, - slarr: slarr, - smallsetminus: smallsetminus, - smashp: smashp, - smeparsl: smeparsl, - smid: smid, - smile: smile, - smt: smt, - smte: smte, - smtes: smtes, - softcy: softcy, - sol: sol, - solb: solb, - solbar: solbar, - sopf: sopf, - spades: spades, - spadesuit: spadesuit, - spar: spar, - sqcap: sqcap, - sqcaps: sqcaps, - sqcup: sqcup, - sqcups: sqcups, - sqsub: sqsub, - sqsube: sqsube, - sqsubset: sqsubset, - sqsubseteq: sqsubseteq, - sqsup: sqsup, - sqsupe: sqsupe, - sqsupset: sqsupset, - sqsupseteq: sqsupseteq, - squ: squ, - square: square, - squarf: squarf, - squf: squf, - srarr: srarr, - sscr: sscr, - ssetmn: ssetmn, - ssmile: ssmile, - sstarf: sstarf, - star: star$1, - starf: starf, - straightepsilon: straightepsilon, - straightphi: straightphi, - strns: strns, - sub: sub, - subE: subE, - subdot: subdot, - sube: sube, - subedot: subedot, - submult: submult, - subnE: subnE, - subne: subne, - subplus: subplus, - subrarr: subrarr, - subset: subset, - subseteq: subseteq, - subseteqq: subseteqq, - subsetneq: subsetneq, - subsetneqq: subsetneqq, - subsim: subsim, - subsub: subsub, - subsup: subsup, - succ: succ, - succapprox: succapprox, - succcurlyeq: succcurlyeq, - succeq: succeq, - succnapprox: succnapprox, - succneqq: succneqq, - succnsim: succnsim, - succsim: succsim, - sum: sum, - sung: sung, - sup: sup, - sup1: sup1$1, - sup2: sup2$1, - sup3: sup3$1, - supE: supE, - supdot: supdot, - supdsub: supdsub, - supe: supe, - supedot: supedot, - suphsol: suphsol, - suphsub: suphsub, - suplarr: suplarr, - supmult: supmult, - supnE: supnE, - supne: supne, - supplus: supplus, - supset: supset, - supseteq: supseteq, - supseteqq: supseteqq, - supsetneq: supsetneq, - supsetneqq: supsetneqq, - supsim: supsim, - supsub: supsub, - supsup: supsup, - swArr: swArr, - swarhk: swarhk, - swarr: swarr, - swarrow: swarrow, - swnwar: swnwar, - szli: szli, - szlig: szlig$1, - target: target, - tau: tau, - tbrk: tbrk, - tcaron: tcaron, - tcedil: tcedil, - tcy: tcy, - tdot: tdot, - telrec: telrec, - tfr: tfr, - there4: there4, - therefore: therefore, - theta: theta, - thetasym: thetasym, - thetav: thetav, - thickapprox: thickapprox, - thicksim: thicksim, - thinsp: thinsp, - thkap: thkap, - thksim: thksim, - thor: thor, - thorn: thorn$1, - tilde: tilde, - time: time, - times: times$1, - timesb: timesb, - timesbar: timesbar, - timesd: timesd, - tint: tint, - toea: toea, - top: top, - topbot: topbot, - topcir: topcir, - topf: topf, - topfork: topfork, - tosa: tosa, - tprime: tprime, - trade: trade, - triangle: triangle, - triangledown: triangledown, - triangleleft: triangleleft, - trianglelefteq: trianglelefteq, - triangleq: triangleq, - triangleright: triangleright, - trianglerighteq: trianglerighteq, - tridot: tridot, - trie: trie, - triminus: triminus, - triplus: triplus, - trisb: trisb, - tritime: tritime, - trpezium: trpezium, - tscr: tscr, - tscy: tscy, - tshcy: tshcy, - tstrok: tstrok, - twixt: twixt, - twoheadleftarrow: twoheadleftarrow, - twoheadrightarrow: twoheadrightarrow, - uArr: uArr, - uHar: uHar, - uacut: uacut, - uacute: uacute$1, - uarr: uarr, - ubrcy: ubrcy, - ubreve: ubreve, - ucir: ucir, - ucirc: ucirc$1, - ucy: ucy, - udarr: udarr, - udblac: udblac, - udhar: udhar, - ufisht: ufisht, - ufr: ufr, - ugrav: ugrav, - ugrave: ugrave$1, - uharl: uharl, - uharr: uharr, - uhblk: uhblk, - ulcorn: ulcorn, - ulcorner: ulcorner, - ulcrop: ulcrop, - ultri: ultri, - umacr: umacr, - um: um, - uml: uml$1, - uogon: uogon, - uopf: uopf, - uparrow: uparrow, - updownarrow: updownarrow, - upharpoonleft: upharpoonleft, - upharpoonright: upharpoonright, - uplus: uplus, - upsi: upsi, - upsih: upsih, - upsilon: upsilon, - upuparrows: upuparrows, - urcorn: urcorn, - urcorner: urcorner, - urcrop: urcrop, - uring: uring, - urtri: urtri, - uscr: uscr, - utdot: utdot, - utilde: utilde, - utri: utri, - utrif: utrif, - uuarr: uuarr, - uum: uum, - uuml: uuml$1, - uwangle: uwangle, - vArr: vArr, - vBar: vBar, - vBarv: vBarv, - vDash: vDash, - vangrt: vangrt, - varepsilon: varepsilon, - varkappa: varkappa, - varnothing: varnothing, - varphi: varphi, - varpi: varpi, - varpropto: varpropto, - varr: varr, - varrho: varrho, - varsigma: varsigma, - varsubsetneq: varsubsetneq, - varsubsetneqq: varsubsetneqq, - varsupsetneq: varsupsetneq, - varsupsetneqq: varsupsetneqq, - vartheta: vartheta, - vartriangleleft: vartriangleleft, - vartriangleright: vartriangleright, - vcy: vcy, - vdash: vdash, - vee: vee, - veebar: veebar, - veeeq: veeeq, - vellip: vellip, - verbar: verbar, - vert: vert, - vfr: vfr, - vltri: vltri, - vnsub: vnsub, - vnsup: vnsup, - vopf: vopf, - vprop: vprop, - vrtri: vrtri, - vscr: vscr, - vsubnE: vsubnE, - vsubne: vsubne, - vsupnE: vsupnE, - vsupne: vsupne, - vzigzag: vzigzag, - wcirc: wcirc, - wedbar: wedbar, - wedge: wedge, - wedgeq: wedgeq, - weierp: weierp, - wfr: wfr, - wopf: wopf, - wp: wp, - wr: wr, - wreath: wreath, - wscr: wscr, - xcap: xcap, - xcirc: xcirc, - xcup: xcup, - xdtri: xdtri, - xfr: xfr, - xhArr: xhArr, - xharr: xharr, - xi: xi, - xlArr: xlArr, - xlarr: xlarr, - xmap: xmap, - xnis: xnis, - xodot: xodot, - xopf: xopf, - xoplus: xoplus, - xotime: xotime, - xrArr: xrArr, - xrarr: xrarr, - xscr: xscr, - xsqcup: xsqcup, - xuplus: xuplus, - xutri: xutri, - xvee: xvee, - xwedge: xwedge, - yacut: yacut, - yacute: yacute$1, - yacy: yacy, - ycirc: ycirc, - ycy: ycy, - ye: ye, - yen: yen$1, - yfr: yfr, - yicy: yicy, - yopf: yopf, - yscr: yscr, - yucy: yucy, - yum: yum, - yuml: yuml$1, - zacute: zacute, - zcaron: zcaron, - zcy: zcy, - zdot: zdot, - zeetrf: zeetrf, - zeta: zeta, - zfr: zfr, - zhcy: zhcy, - zigrarr: zigrarr, - zopf: zopf, - zscr: zscr, - zwj: zwj, - zwnj: zwnj, - default: index$4 -}); +module.exports = VFile -var characterEntities$1 = ( characterEntities && index$4 ) || characterEntities; +var own = {}.hasOwnProperty +var proto = VFile.prototype -var decodeEntity_1 = decodeEntity; +proto.toString = toString -var own$4 = {}.hasOwnProperty; +// Order of setting (least specific to most), we need this because otherwise +// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a +// stem can be set. +var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname'] -function decodeEntity(characters) { - return own$4.call(characterEntities$1, characters) - ? characterEntities$1[characters] - : false -} +// Construct a new file. +function VFile(options) { + var prop + var index + var length -var legacy = ( characterEntitiesLegacy && index$2 ) || characterEntitiesLegacy; + if (!options) { + options = {} + } else if (typeof options === 'string' || buffer(options)) { + options = {contents: options} + } else if ('message' in options && 'messages' in options) { + return options + } -var invalid = ( characterReferenceInvalid && index$3 ) || characterReferenceInvalid; + if (!(this instanceof VFile)) { + return new VFile(options) + } -var parseEntities_1 = parseEntities; + this.data = {} + this.messages = [] + this.history = [] + this.cwd = process.cwd() -var own$5 = {}.hasOwnProperty; -var fromCharCode = String.fromCharCode; -var noop$1 = Function.prototype; + // Set path related properties in the correct order. + index = -1 + length = order.length -/* Default settings. */ -var defaults = { - warning: null, - reference: null, - text: null, - warningContext: null, - referenceContext: null, - textContext: null, - position: {}, - additional: null, - attribute: false, - nonTerminated: true -}; + while (++index < length) { + prop = order[index] -/* Reference types. */ -var NAMED = 'named'; -var HEXADECIMAL = 'hexadecimal'; -var DECIMAL = 'decimal'; + if (own.call(options, prop)) { + this[prop] = options[prop] + } + } -/* Map of bases. */ -var BASE = {}; + // Set non-path related properties. + for (prop in options) { + if (order.indexOf(prop) === -1) { + this[prop] = options[prop] + } + } +} -BASE[HEXADECIMAL] = 16; -BASE[DECIMAL] = 10; +// Access full path (`~/index.min.js`). +Object.defineProperty(proto, 'path', { + get: function() { + return this.history[this.history.length - 1] + }, + set: function(path) { + assertNonEmpty(path, 'path') -/* Map of types to tests. Each type of character reference - * accepts different characters. This test is used to - * detect whether a reference has ended (as the semicolon - * is not strictly needed). */ -var TESTS = {}; + if (path !== this.path) { + this.history.push(path) + } + } +}) -TESTS[NAMED] = isAlphanumerical; -TESTS[DECIMAL] = isDecimal; -TESTS[HEXADECIMAL] = isHexadecimal; +// Access parent path (`~`). +Object.defineProperty(proto, 'dirname', { + get: function() { + return typeof this.path === 'string' ? path.dirname(this.path) : undefined + }, + set: function(dirname) { + assertPath(this.path, 'dirname') + this.path = path.join(dirname || '', this.basename) + } +}) -/* Warning messages. */ -var NAMED_NOT_TERMINATED = 1; -var NUMERIC_NOT_TERMINATED = 2; -var NAMED_EMPTY = 3; -var NUMERIC_EMPTY = 4; -var NAMED_UNKNOWN = 5; -var NUMERIC_DISALLOWED = 6; -var NUMERIC_PROHIBITED = 7; +// Access basename (`index.min.js`). +Object.defineProperty(proto, 'basename', { + get: function() { + return typeof this.path === 'string' ? path.basename(this.path) : undefined + }, + set: function(basename) { + assertNonEmpty(basename, 'basename') + assertPart(basename, 'basename') + this.path = path.join(this.dirname || '', basename) + } +}) -var MESSAGES = {}; +// Access extname (`.js`). +Object.defineProperty(proto, 'extname', { + get: function() { + return typeof this.path === 'string' ? path.extname(this.path) : undefined + }, + set: function(extname) { + var ext = extname || '' -MESSAGES[NAMED_NOT_TERMINATED] = - 'Named character references must be terminated by a semicolon'; -MESSAGES[NUMERIC_NOT_TERMINATED] = - 'Numeric character references must be terminated by a semicolon'; -MESSAGES[NAMED_EMPTY] = 'Named character references cannot be empty'; -MESSAGES[NUMERIC_EMPTY] = 'Numeric character references cannot be empty'; -MESSAGES[NAMED_UNKNOWN] = 'Named character references must be known'; -MESSAGES[NUMERIC_DISALLOWED] = - 'Numeric character references cannot be disallowed'; -MESSAGES[NUMERIC_PROHIBITED] = - 'Numeric character references cannot be outside the permissible Unicode range'; + assertPart(ext, 'extname') + assertPath(this.path, 'extname') -/* Wrap to ensure clean parameters are given to `parse`. */ -function parseEntities(value, options) { - var settings = {}; - var option; - var key; + if (ext) { + if (ext.charAt(0) !== '.') { + throw new Error('`extname` must start with `.`') + } - if (!options) { - options = {}; - } + if (ext.indexOf('.', 1) !== -1) { + throw new Error('`extname` cannot contain multiple dots') + } + } - for (key in defaults) { - option = options[key]; - settings[key] = - option === null || option === undefined ? defaults[key] : option; + this.path = replace(this.path, ext) } +}) - if (settings.position.indent || settings.position.start) { - settings.indent = settings.position.indent || []; - settings.position = settings.position.start; +// Access stem (`index.min`). +Object.defineProperty(proto, 'stem', { + get: function() { + return typeof this.path === 'string' + ? path.basename(this.path, this.extname) + : undefined + }, + set: function(stem) { + assertNonEmpty(stem, 'stem') + assertPart(stem, 'stem') + this.path = path.join(this.dirname || '', stem + (this.extname || '')) } +}) - return parse$7(value, settings) +// Get the value of the file. +function toString(encoding) { + var value = this.contents || '' + return buffer(value) ? value.toString(encoding) : String(value) } -/* Parse entities. */ -function parse$7(value, settings) { - var additional = settings.additional; - var nonTerminated = settings.nonTerminated; - var handleText = settings.text; - var handleReference = settings.reference; - var handleWarning = settings.warning; - var textContext = settings.textContext; - var referenceContext = settings.referenceContext; - var warningContext = settings.warningContext; - var pos = settings.position; - var indent = settings.indent || []; - var length = value.length; - var index = 0; - var lines = -1; - var column = pos.column || 1; - var line = pos.line || 1; - var queue = ''; - var result = []; - var entityCharacters; - var namedEntity; - var terminated; - var characters; - var character; - var reference; - var following; - var warning; - var reason; - var output; - var entity; - var begin; - var start; - var type; - var test; - var prev; - var next; - var diff; - var end; - - /* Cache the current point. */ - prev = now(); +// Assert that `part` is not a path (i.e., does not contain `path.sep`). +function assertPart(part, name) { + if (part.indexOf(path.sep) !== -1) { + throw new Error( + '`' + name + '` cannot be a path: did not expect `' + path.sep + '`' + ) + } +} - /* Wrap `handleWarning`. */ - warning = handleWarning ? parseError : noop$1; +// Assert that `part` is not empty. +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty') + } +} - /* Ensure the algorithm walks over the first character - * and the end (inclusive). */ - index--; - length++; +// Assert `path` exists. +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too') + } +} - while (++index < length) { - /* If the previous character was a newline. */ - if (character === '\n') { - column = indent[lines] || 1; - } - character = at(index); +/***/ }), +/* 207 */ +/***/ (function(module, exports) { - /* Handle anything other than an ampersand, - * including newlines and EOF. */ - if (character !== '&') { - if (character === '\n') { - line++; - lines++; - column = 0; - } +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ - if (character) { - queue += character; - column++; - } else { - flush(); - } - } else { - following = at(index + 1); +module.exports = function isBuffer (obj) { + return obj != null && obj.constructor != null && + typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} - /* The behaviour depends on the identity of the next - * character. */ - if ( - following === '\t' /* Tab */ || - following === '\n' /* Newline */ || - following === '\f' /* Form feed */ || - following === ' ' /* Space */ || - following === '<' /* Less-than */ || - following === '&' /* Ampersand */ || - following === '' || - (additional && following === additional) - ) { - /* Not a character reference. No characters - * are consumed, and nothing is returned. - * This is not an error, either. */ - queue += character; - column++; - continue - } +/***/ }), +/* 208 */ +/***/ (function(module, exports, __webpack_require__) { - start = index + 1; - begin = start; - end = start; +"use strict"; - /* Numerical entity. */ - if (following !== '#') { - type = NAMED; - } else { - end = ++begin; +var toString = Object.prototype.toString; - /* The behaviour further depends on the - * character after the U+0023 NUMBER SIGN. */ - following = at(end); +module.exports = function (x) { + var prototype; + return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +}; - if (following === 'x' || following === 'X') { - /* ASCII hex digits. */ - type = HEXADECIMAL; - end = ++begin; - } else { - /* ASCII digits. */ - type = DECIMAL; - } - } - entityCharacters = ''; - entity = ''; - characters = ''; - test = TESTS[type]; - end--; +/***/ }), +/* 209 */ +/***/ (function(module, exports, __webpack_require__) { - while (++end < length) { - following = at(end); +"use strict"; - if (!test(following)) { - break - } - characters += following; +var unherit = __webpack_require__(75) +var xtend = __webpack_require__(7) +var Parser = __webpack_require__(210) - /* Check if we can match a legacy named - * reference. If so, we cache that as the - * last viable named reference. This - * ensures we do not need to walk backwards - * later. */ - if (type === NAMED && own$5.call(legacy, characters)) { - entityCharacters = characters; - entity = legacy[characters]; - } - } +module.exports = parse +parse.Parser = Parser - terminated = at(end) === ';'; +function parse(options) { + var settings = this.data('settings') + var Local = unherit(Parser) - if (terminated) { - end++; + Local.prototype.options = xtend(Local.prototype.options, settings, options) - namedEntity = type === NAMED ? decodeEntity_1(characters) : false; + this.Parser = Local +} - if (namedEntity) { - entityCharacters = characters; - entity = namedEntity; - } - } - diff = 1 + end - start; +/***/ }), +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { - if (!terminated && !nonTerminated) { - /* Empty. */ - } else if (!characters) { - /* An empty (possible) entity is valid, unless - * its numeric (thus an ampersand followed by - * an octothorp). */ - if (type !== NAMED) { - warning(NUMERIC_EMPTY, diff); - } - } else if (type === NAMED) { - /* An ampersand followed by anything - * unknown, and not terminated, is invalid. */ - if (terminated && !entity) { - warning(NAMED_UNKNOWN, 1); - } else { - /* If theres something after an entity - * name which is not known, cap the - * reference. */ - if (entityCharacters !== characters) { - end = begin + entityCharacters.length; - diff = 1 + end - begin; - terminated = false; - } +"use strict"; - /* If the reference is not terminated, - * warn. */ - if (!terminated) { - reason = entityCharacters ? NAMED_NOT_TERMINATED : NAMED_EMPTY; - if (!settings.attribute) { - warning(reason, diff); - } else { - following = at(end); +var xtend = __webpack_require__(7) +var toggle = __webpack_require__(76) +var vfileLocation = __webpack_require__(19) +var unescape = __webpack_require__(211) +var decode = __webpack_require__(212) +var tokenizer = __webpack_require__(216) - if (following === '=') { - warning(reason, diff); - entity = null; - } else if (isAlphanumerical(following)) { - entity = null; - } else { - warning(reason, diff); - } - } - } - } +module.exports = Parser - reference = entity; - } else { - if (!terminated) { - /* All non-terminated numeric entities are - * not rendered, and trigger a warning. */ - warning(NUMERIC_NOT_TERMINATED, diff); - } +function Parser(doc, file) { + this.file = file + this.offset = {} + this.options = xtend(this.options) + this.setOptions({}) - /* When terminated and number, parse as - * either hexadecimal or decimal. */ - reference = parseInt(characters, BASE[type]); + this.inList = false + this.inBlock = false + this.inLink = false + this.atStart = true - /* Trigger a warning when the parsed number - * is prohibited, and replace with - * replacement character. */ - if (prohibited(reference)) { - warning(NUMERIC_PROHIBITED, diff); - reference = '\uFFFD'; - } else if (reference in invalid) { - /* Trigger a warning when the parsed number - * is disallowed, and replace by an - * alternative. */ - warning(NUMERIC_DISALLOWED, diff); - reference = invalid[reference]; - } else { - /* Parse the number. */ - output = ''; + this.toOffset = vfileLocation(file).toOffset + this.unescape = unescape(this, 'escape') + this.decode = decode(this) +} - /* Trigger a warning when the parsed - * number should not be used. */ - if (disallowed(reference)) { - warning(NUMERIC_DISALLOWED, diff); - } +var proto = Parser.prototype - /* Stringify the number. */ - if (reference > 0xffff) { - reference -= 0x10000; - output += fromCharCode((reference >>> (10 & 0x3ff)) | 0xd800); - reference = 0xdc00 | (reference & 0x3ff); - } +// Expose core. +proto.setOptions = __webpack_require__(217) +proto.parse = __webpack_require__(219) - reference = output + fromCharCode(reference); - } - } +// Expose `defaults`. +proto.options = __webpack_require__(82) - /* If we could not find a reference, queue the - * checked characters (as normal characters), - * and move the pointer to their end. This is - * possible because we can be certain neither - * newlines nor ampersands are included. */ - if (!reference) { - characters = value.slice(start - 1, end); - queue += characters; - column += characters.length; - index = end - 1; - } else { - /* Found it! First eat the queued - * characters as normal text, then eat - * an entity. */ - flush(); +// Enter and exit helpers. +proto.exitStart = toggle('atStart', true) +proto.enterList = toggle('inList', false) +proto.enterLink = toggle('inLink', false) +proto.enterBlock = toggle('inBlock', false) - prev = now(); - index = end - 1; - column += end - start + 1; - result.push(reference); - next = now(); - next.offset++; +// Nodes that can interupt a paragraph: +// +// ```markdown +// A paragraph, followed by a thematic break. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the paragraph. +proto.interruptParagraph = [ + ['thematicBreak'], + ['atxHeading'], + ['fencedCode'], + ['blockquote'], + ['html'], + ['setextHeading', {commonmark: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +] - if (handleReference) { - handleReference.call( - referenceContext, - reference, - {start: prev, end: next}, - value.slice(start - 1, end) - ); - } +// Nodes that can interupt a list: +// +// ```markdown +// - One +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the list. +proto.interruptList = [ + ['atxHeading', {pedantic: false}], + ['fencedCode', {pedantic: false}], + ['thematicBreak', {pedantic: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +] - prev = next; - } - } - } +// Nodes that can interupt a blockquote: +// +// ```markdown +// > A paragraph. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the blockquote. +proto.interruptBlockquote = [ + ['indentedCode', {commonmark: true}], + ['fencedCode', {commonmark: true}], + ['atxHeading', {commonmark: true}], + ['setextHeading', {commonmark: true}], + ['thematicBreak', {commonmark: true}], + ['html', {commonmark: true}], + ['list', {commonmark: true}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +] - /* Return the reduced nodes, and any possible warnings. */ - return result.join('') +// Handlers. +proto.blockTokenizers = { + newline: __webpack_require__(223), + indentedCode: __webpack_require__(224), + fencedCode: __webpack_require__(225), + blockquote: __webpack_require__(226), + atxHeading: __webpack_require__(227), + thematicBreak: __webpack_require__(228), + list: __webpack_require__(229), + setextHeading: __webpack_require__(231), + html: __webpack_require__(232), + footnote: __webpack_require__(233), + definition: __webpack_require__(235), + table: __webpack_require__(236), + paragraph: __webpack_require__(237) +} + +proto.inlineTokenizers = { + escape: __webpack_require__(238), + autoLink: __webpack_require__(240), + url: __webpack_require__(241), + html: __webpack_require__(243), + link: __webpack_require__(244), + reference: __webpack_require__(245), + strong: __webpack_require__(246), + emphasis: __webpack_require__(248), + deletion: __webpack_require__(251), + code: __webpack_require__(253), + break: __webpack_require__(255), + text: __webpack_require__(257) +} - /* Get current position. */ - function now() { - return { - line: line, - column: column, - offset: index + (pos.offset || 0) - } - } +// Expose precedence. +proto.blockMethods = keys(proto.blockTokenizers) +proto.inlineMethods = keys(proto.inlineTokenizers) - /* “Throw” a parse-error: a warning. */ - function parseError(code, offset) { - var position = now(); +// Tokenizers. +proto.tokenizeBlock = tokenizer('block') +proto.tokenizeInline = tokenizer('inline') +proto.tokenizeFactory = tokenizer - position.column += offset; - position.offset += offset; +// Get all keys in `value`. +function keys(value) { + var result = [] + var key - handleWarning.call(warningContext, MESSAGES[code], position, code); + for (key in value) { + result.push(key) } - /* Get character at position. */ - function at(position) { - return value.charAt(position) - } + return result +} - /* Flush `queue` (normal text). Macro invoked before - * each entity and at the end of `value`. - * Does nothing when `queue` is empty. */ - function flush() { - if (queue) { - result.push(queue); - if (handleText) { - handleText.call(textContext, queue, {start: prev, end: now()}); +/***/ }), +/* 211 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = factory + +var backslash = '\\' + +// Factory to de-escape a value, based on a list at `key` in `ctx`. +function factory(ctx, key) { + return unescape + + // De-escape a string using the expression at `key` in `ctx`. + function unescape(value) { + var prev = 0 + var index = value.indexOf(backslash) + var escape = ctx[key] + var queue = [] + var character + + while (index !== -1) { + queue.push(value.slice(prev, index)) + prev = index + 1 + character = value.charAt(prev) + + // If the following character is not a valid escape, add the slash. + if (!character || escape.indexOf(character) === -1) { + queue.push(backslash) } - queue = ''; + index = value.indexOf(backslash, prev + 1) } + + queue.push(value.slice(prev)) + + return queue.join('') } } -/* Check if `character` is outside the permissible unicode range. */ -function prohibited(code) { - return (code >= 0xd800 && code <= 0xdfff) || code > 0x10ffff -} -/* Check if `character` is disallowed. */ -function disallowed(code) { - return ( - (code >= 0x0001 && code <= 0x0008) || - code === 0x000b || - (code >= 0x000d && code <= 0x001f) || - (code >= 0x007f && code <= 0x009f) || - (code >= 0xfdd0 && code <= 0xfdef) || - (code & 0xffff) === 0xffff || - (code & 0xffff) === 0xfffe - ) -} +/***/ }), +/* 212 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + -var decode$1 = factory$3; +var xtend = __webpack_require__(7) +var entities = __webpack_require__(30) + +module.exports = factory // Factory to create an entity decoder. -function factory$3(ctx) { - decoder.raw = decodeRaw; +function factory(ctx) { + decoder.raw = decodeRaw return decoder // Normalize `position` to add an `indent`. function normalize(position) { - var offsets = ctx.offset; - var line = position.line; - var result = []; + var offsets = ctx.offset + var line = position.line + var result = [] while (++line) { if (!(line in offsets)) { break } - result.push((offsets[line] || 0) + 1); + result.push((offsets[line] || 0) + 1) } return {start: position, indent: result} @@ -22941,21 +27958,21 @@ function factory$3(ctx) { // Decode `value` (at `position`) into text-nodes. function decoder(value, position, handler) { - parseEntities_1(value, { + entities(value, { position: normalize(position), warning: handleWarning, text: handler, reference: handler, textContext: ctx, referenceContext: ctx - }); + }) } // Decode `value` (at `position`) into a string. function decodeRaw(value, position, options) { - return parseEntities_1( + return entities( value, - immutable(options, {position: normalize(position), warning: handleWarning}) + xtend(options, {position: normalize(position), warning: handleWarning}) ) } @@ -22963,32 +27980,72 @@ function factory$3(ctx) { // See for the warnings. function handleWarning(reason, position, code) { if (code !== 3) { - ctx.file.message(reason, position); + ctx.file.message(reason, position) } } } -var tokenizer = factory$4; + +/***/ }), +/* 213 */ +/***/ (function(module) { + +module.exports = {"0":"�","128":"€","130":"‚","131":"ƒ","132":"„","133":"…","134":"†","135":"‡","136":"ˆ","137":"‰","138":"Š","139":"‹","140":"Œ","142":"Ž","145":"‘","146":"’","147":"“","148":"”","149":"•","150":"–","151":"—","152":"˜","153":"™","154":"š","155":"›","156":"œ","158":"ž","159":"Ÿ"}; + +/***/ }), +/* 214 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var characterEntities = __webpack_require__(215) + +module.exports = decodeEntity + +var own = {}.hasOwnProperty + +function decodeEntity(characters) { + return own.call(characterEntities, characters) + ? characterEntities[characters] + : false +} + + +/***/ }), +/* 215 */ +/***/ (function(module) { + +module.exports = {"AEli":"Æ","AElig":"Æ","AM":"&","AMP":"&","Aacut":"Á","Aacute":"Á","Abreve":"Ă","Acir":"Â","Acirc":"Â","Acy":"А","Afr":"𝔄","Agrav":"À","Agrave":"À","Alpha":"Α","Amacr":"Ā","And":"⩓","Aogon":"Ą","Aopf":"𝔸","ApplyFunction":"⁡","Arin":"Å","Aring":"Å","Ascr":"𝒜","Assign":"≔","Atild":"Ã","Atilde":"Ã","Aum":"Ä","Auml":"Ä","Backslash":"∖","Barv":"⫧","Barwed":"⌆","Bcy":"Б","Because":"∵","Bernoullis":"ℬ","Beta":"Β","Bfr":"𝔅","Bopf":"𝔹","Breve":"˘","Bscr":"ℬ","Bumpeq":"≎","CHcy":"Ч","COP":"©","COPY":"©","Cacute":"Ć","Cap":"⋒","CapitalDifferentialD":"ⅅ","Cayleys":"ℭ","Ccaron":"Č","Ccedi":"Ç","Ccedil":"Ç","Ccirc":"Ĉ","Cconint":"∰","Cdot":"Ċ","Cedilla":"¸","CenterDot":"·","Cfr":"ℭ","Chi":"Χ","CircleDot":"⊙","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","Colon":"∷","Colone":"⩴","Congruent":"≡","Conint":"∯","ContourIntegral":"∮","Copf":"ℂ","Coproduct":"∐","CounterClockwiseContourIntegral":"∳","Cross":"⨯","Cscr":"𝒞","Cup":"⋓","CupCap":"≍","DD":"ⅅ","DDotrahd":"⤑","DJcy":"Ђ","DScy":"Ѕ","DZcy":"Џ","Dagger":"‡","Darr":"↡","Dashv":"⫤","Dcaron":"Ď","Dcy":"Д","Del":"∇","Delta":"Δ","Dfr":"𝔇","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","Diamond":"⋄","DifferentialD":"ⅆ","Dopf":"𝔻","Dot":"¨","DotDot":"⃜","DotEqual":"≐","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrow":"↓","DownArrowBar":"⤓","DownArrowUpArrow":"⇵","DownBreve":"̑","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVector":"↽","DownLeftVectorBar":"⥖","DownRightTeeVector":"⥟","DownRightVector":"⇁","DownRightVectorBar":"⥗","DownTee":"⊤","DownTeeArrow":"↧","Downarrow":"⇓","Dscr":"𝒟","Dstrok":"Đ","ENG":"Ŋ","ET":"Ð","ETH":"Ð","Eacut":"É","Eacute":"É","Ecaron":"Ě","Ecir":"Ê","Ecirc":"Ê","Ecy":"Э","Edot":"Ė","Efr":"𝔈","Egrav":"È","Egrave":"È","Element":"∈","Emacr":"Ē","EmptySmallSquare":"◻","EmptyVerySmallSquare":"▫","Eogon":"Ę","Eopf":"𝔼","Epsilon":"Ε","Equal":"⩵","EqualTilde":"≂","Equilibrium":"⇌","Escr":"ℰ","Esim":"⩳","Eta":"Η","Eum":"Ë","Euml":"Ë","Exists":"∃","ExponentialE":"ⅇ","Fcy":"Ф","Ffr":"𝔉","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","Fopf":"𝔽","ForAll":"∀","Fouriertrf":"ℱ","Fscr":"ℱ","GJcy":"Ѓ","G":">","GT":">","Gamma":"Γ","Gammad":"Ϝ","Gbreve":"Ğ","Gcedil":"Ģ","Gcirc":"Ĝ","Gcy":"Г","Gdot":"Ġ","Gfr":"𝔊","Gg":"⋙","Gopf":"𝔾","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","Gt":"≫","HARDcy":"Ъ","Hacek":"ˇ","Hat":"^","Hcirc":"Ĥ","Hfr":"ℌ","HilbertSpace":"ℋ","Hopf":"ℍ","HorizontalLine":"─","Hscr":"ℋ","Hstrok":"Ħ","HumpDownHump":"≎","HumpEqual":"≏","IEcy":"Е","IJlig":"IJ","IOcy":"Ё","Iacut":"Í","Iacute":"Í","Icir":"Î","Icirc":"Î","Icy":"И","Idot":"İ","Ifr":"ℑ","Igrav":"Ì","Igrave":"Ì","Im":"ℑ","Imacr":"Ī","ImaginaryI":"ⅈ","Implies":"⇒","Int":"∬","Integral":"∫","Intersection":"⋂","InvisibleComma":"⁣","InvisibleTimes":"⁢","Iogon":"Į","Iopf":"𝕀","Iota":"Ι","Iscr":"ℐ","Itilde":"Ĩ","Iukcy":"І","Ium":"Ï","Iuml":"Ï","Jcirc":"Ĵ","Jcy":"Й","Jfr":"𝔍","Jopf":"𝕁","Jscr":"𝒥","Jsercy":"Ј","Jukcy":"Є","KHcy":"Х","KJcy":"Ќ","Kappa":"Κ","Kcedil":"Ķ","Kcy":"К","Kfr":"𝔎","Kopf":"𝕂","Kscr":"𝒦","LJcy":"Љ","L":"<","LT":"<","Lacute":"Ĺ","Lambda":"Λ","Lang":"⟪","Laplacetrf":"ℒ","Larr":"↞","Lcaron":"Ľ","Lcedil":"Ļ","Lcy":"Л","LeftAngleBracket":"⟨","LeftArrow":"←","LeftArrowBar":"⇤","LeftArrowRightArrow":"⇆","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVector":"⇃","LeftDownVectorBar":"⥙","LeftFloor":"⌊","LeftRightArrow":"↔","LeftRightVector":"⥎","LeftTee":"⊣","LeftTeeArrow":"↤","LeftTeeVector":"⥚","LeftTriangle":"⊲","LeftTriangleBar":"⧏","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVector":"↿","LeftUpVectorBar":"⥘","LeftVector":"↼","LeftVectorBar":"⥒","Leftarrow":"⇐","Leftrightarrow":"⇔","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","LessLess":"⪡","LessSlantEqual":"⩽","LessTilde":"≲","Lfr":"𝔏","Ll":"⋘","Lleftarrow":"⇚","Lmidot":"Ŀ","LongLeftArrow":"⟵","LongLeftRightArrow":"⟷","LongRightArrow":"⟶","Longleftarrow":"⟸","Longleftrightarrow":"⟺","Longrightarrow":"⟹","Lopf":"𝕃","LowerLeftArrow":"↙","LowerRightArrow":"↘","Lscr":"ℒ","Lsh":"↰","Lstrok":"Ł","Lt":"≪","Map":"⤅","Mcy":"М","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","MinusPlus":"∓","Mopf":"𝕄","Mscr":"ℳ","Mu":"Μ","NJcy":"Њ","Nacute":"Ń","Ncaron":"Ň","Ncedil":"Ņ","Ncy":"Н","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","Nfr":"𝔑","NoBreak":"⁠","NonBreakingSpace":" ","Nopf":"ℕ","Not":"⫬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","NotLeftTriangle":"⋪","NotLeftTriangleBar":"⧏̸","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangle":"⋫","NotRightTriangleBar":"⧐̸","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","Nscr":"𝒩","Ntild":"Ñ","Ntilde":"Ñ","Nu":"Ν","OElig":"Œ","Oacut":"Ó","Oacute":"Ó","Ocir":"Ô","Ocirc":"Ô","Ocy":"О","Odblac":"Ő","Ofr":"𝔒","Ograv":"Ò","Ograve":"Ò","Omacr":"Ō","Omega":"Ω","Omicron":"Ο","Oopf":"𝕆","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","Or":"⩔","Oscr":"𝒪","Oslas":"Ø","Oslash":"Ø","Otild":"Õ","Otilde":"Õ","Otimes":"⨷","Oum":"Ö","Ouml":"Ö","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","PartialD":"∂","Pcy":"П","Pfr":"𝔓","Phi":"Φ","Pi":"Π","PlusMinus":"±","Poincareplane":"ℌ","Popf":"ℙ","Pr":"⪻","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","Prime":"″","Product":"∏","Proportion":"∷","Proportional":"∝","Pscr":"𝒫","Psi":"Ψ","QUO":"\"","QUOT":"\"","Qfr":"𝔔","Qopf":"ℚ","Qscr":"𝒬","RBarr":"⤐","RE":"®","REG":"®","Racute":"Ŕ","Rang":"⟫","Rarr":"↠","Rarrtl":"⤖","Rcaron":"Ř","Rcedil":"Ŗ","Rcy":"Р","Re":"ℜ","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","Rfr":"ℜ","Rho":"Ρ","RightAngleBracket":"⟩","RightArrow":"→","RightArrowBar":"⇥","RightArrowLeftArrow":"⇄","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVector":"⇂","RightDownVectorBar":"⥕","RightFloor":"⌋","RightTee":"⊢","RightTeeArrow":"↦","RightTeeVector":"⥛","RightTriangle":"⊳","RightTriangleBar":"⧐","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVector":"↾","RightUpVectorBar":"⥔","RightVector":"⇀","RightVectorBar":"⥓","Rightarrow":"⇒","Ropf":"ℝ","RoundImplies":"⥰","Rrightarrow":"⇛","Rscr":"ℛ","Rsh":"↱","RuleDelayed":"⧴","SHCHcy":"Щ","SHcy":"Ш","SOFTcy":"Ь","Sacute":"Ś","Sc":"⪼","Scaron":"Š","Scedil":"Ş","Scirc":"Ŝ","Scy":"С","Sfr":"𝔖","ShortDownArrow":"↓","ShortLeftArrow":"←","ShortRightArrow":"→","ShortUpArrow":"↑","Sigma":"Σ","SmallCircle":"∘","Sopf":"𝕊","Sqrt":"√","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","Sscr":"𝒮","Star":"⋆","Sub":"⋐","Subset":"⋐","SubsetEqual":"⊆","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","SuchThat":"∋","Sum":"∑","Sup":"⋑","Superset":"⊃","SupersetEqual":"⊇","Supset":"⋑","THOR":"Þ","THORN":"Þ","TRADE":"™","TSHcy":"Ћ","TScy":"Ц","Tab":"\t","Tau":"Τ","Tcaron":"Ť","Tcedil":"Ţ","Tcy":"Т","Tfr":"𝔗","Therefore":"∴","Theta":"Θ","ThickSpace":"  ","ThinSpace":" ","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","Topf":"𝕋","TripleDot":"⃛","Tscr":"𝒯","Tstrok":"Ŧ","Uacut":"Ú","Uacute":"Ú","Uarr":"↟","Uarrocir":"⥉","Ubrcy":"Ў","Ubreve":"Ŭ","Ucir":"Û","Ucirc":"Û","Ucy":"У","Udblac":"Ű","Ufr":"𝔘","Ugrav":"Ù","Ugrave":"Ù","Umacr":"Ū","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","Uopf":"𝕌","UpArrow":"↑","UpArrowBar":"⤒","UpArrowDownArrow":"⇅","UpDownArrow":"↕","UpEquilibrium":"⥮","UpTee":"⊥","UpTeeArrow":"↥","Uparrow":"⇑","Updownarrow":"⇕","UpperLeftArrow":"↖","UpperRightArrow":"↗","Upsi":"ϒ","Upsilon":"Υ","Uring":"Ů","Uscr":"𝒰","Utilde":"Ũ","Uum":"Ü","Uuml":"Ü","VDash":"⊫","Vbar":"⫫","Vcy":"В","Vdash":"⊩","Vdashl":"⫦","Vee":"⋁","Verbar":"‖","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","Vopf":"𝕍","Vscr":"𝒱","Vvdash":"⊪","Wcirc":"Ŵ","Wedge":"⋀","Wfr":"𝔚","Wopf":"𝕎","Wscr":"𝒲","Xfr":"𝔛","Xi":"Ξ","Xopf":"𝕏","Xscr":"𝒳","YAcy":"Я","YIcy":"Ї","YUcy":"Ю","Yacut":"Ý","Yacute":"Ý","Ycirc":"Ŷ","Ycy":"Ы","Yfr":"𝔜","Yopf":"𝕐","Yscr":"𝒴","Yuml":"Ÿ","ZHcy":"Ж","Zacute":"Ź","Zcaron":"Ž","Zcy":"З","Zdot":"Ż","ZeroWidthSpace":"​","Zeta":"Ζ","Zfr":"ℨ","Zopf":"ℤ","Zscr":"𝒵","aacut":"á","aacute":"á","abreve":"ă","ac":"∾","acE":"∾̳","acd":"∿","acir":"â","acirc":"â","acut":"´","acute":"´","acy":"а","aeli":"æ","aelig":"æ","af":"⁡","afr":"𝔞","agrav":"à","agrave":"à","alefsym":"ℵ","aleph":"ℵ","alpha":"α","amacr":"ā","amalg":"⨿","am":"&","amp":"&","and":"∧","andand":"⩕","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsd":"∡","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","aogon":"ą","aopf":"𝕒","ap":"≈","apE":"⩰","apacir":"⩯","ape":"≊","apid":"≋","apos":"'","approx":"≈","approxeq":"≊","arin":"å","aring":"å","ascr":"𝒶","ast":"*","asymp":"≈","asympeq":"≍","atild":"ã","atilde":"ã","aum":"ä","auml":"ä","awconint":"∳","awint":"⨑","bNot":"⫭","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","barvee":"⊽","barwed":"⌅","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","beta":"β","beth":"ℶ","between":"≬","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bnot":"⌐","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxDL":"╗","boxDR":"╔","boxDl":"╖","boxDr":"╓","boxH":"═","boxHD":"╦","boxHU":"╩","boxHd":"╤","boxHu":"╧","boxUL":"╝","boxUR":"╚","boxUl":"╜","boxUr":"╙","boxV":"║","boxVH":"╬","boxVL":"╣","boxVR":"╠","boxVh":"╫","boxVl":"╢","boxVr":"╟","boxbox":"⧉","boxdL":"╕","boxdR":"╒","boxdl":"┐","boxdr":"┌","boxh":"─","boxhD":"╥","boxhU":"╨","boxhd":"┬","boxhu":"┴","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxuL":"╛","boxuR":"╘","boxul":"┘","boxur":"└","boxv":"│","boxvH":"╪","boxvL":"╡","boxvR":"╞","boxvh":"┼","boxvl":"┤","boxvr":"├","bprime":"‵","breve":"˘","brvba":"¦","brvbar":"¦","bscr":"𝒷","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsol":"\\","bsolb":"⧅","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","bumpeq":"≏","cacute":"ć","cap":"∩","capand":"⩄","capbrcup":"⩉","capcap":"⩋","capcup":"⩇","capdot":"⩀","caps":"∩︀","caret":"⁁","caron":"ˇ","ccaps":"⩍","ccaron":"č","ccedi":"ç","ccedil":"ç","ccirc":"ĉ","ccups":"⩌","ccupssm":"⩐","cdot":"ċ","cedi":"¸","cedil":"¸","cemptyv":"⦲","cen":"¢","cent":"¢","centerdot":"·","cfr":"𝔠","chcy":"ч","check":"✓","checkmark":"✓","chi":"χ","cir":"○","cirE":"⧃","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledR":"®","circledS":"Ⓢ","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","clubs":"♣","clubsuit":"♣","colon":":","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","conint":"∮","copf":"𝕔","coprod":"∐","cop":"©","copy":"©","copysr":"℗","crarr":"↵","cross":"✗","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cup":"∪","cupbrcap":"⩈","cupcap":"⩆","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curre":"¤","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dArr":"⇓","dHar":"⥥","dagger":"†","daleth":"ℸ","darr":"↓","dash":"‐","dashv":"⊣","dbkarow":"⤏","dblac":"˝","dcaron":"ď","dcy":"д","dd":"ⅆ","ddagger":"‡","ddarr":"⇊","ddotseq":"⩷","de":"°","deg":"°","delta":"δ","demptyv":"⦱","dfisht":"⥿","dfr":"𝔡","dharl":"⇃","dharr":"⇂","diam":"⋄","diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","digamma":"ϝ","disin":"⋲","div":"÷","divid":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","dopf":"𝕕","dot":"˙","doteq":"≐","doteqdot":"≑","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","downarrow":"↓","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","dscr":"𝒹","dscy":"ѕ","dsol":"⧶","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","dzcy":"џ","dzigrarr":"⟿","eDDot":"⩷","eDot":"≑","eacut":"é","eacute":"é","easter":"⩮","ecaron":"ě","ecir":"ê","ecirc":"ê","ecolon":"≕","ecy":"э","edot":"ė","ee":"ⅇ","efDot":"≒","efr":"𝔢","eg":"⪚","egrav":"è","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","emacr":"ē","empty":"∅","emptyset":"∅","emptyv":"∅","emsp13":" ","emsp14":" ","emsp":" ","eng":"ŋ","ensp":" ","eogon":"ę","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","equals":"=","equest":"≟","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erDot":"≓","erarr":"⥱","escr":"ℯ","esdot":"≐","esim":"≂","eta":"η","et":"ð","eth":"ð","eum":"ë","euml":"ë","euro":"€","excl":"!","exist":"∃","expectation":"ℰ","exponentiale":"ⅇ","fallingdotseq":"≒","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","ffr":"𝔣","filig":"fi","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","fopf":"𝕗","forall":"∀","fork":"⋔","forkv":"⫙","fpartint":"⨍","frac1":"¼","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac3":"¾","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","gE":"≧","gEl":"⪌","gacute":"ǵ","gamma":"γ","gammad":"ϝ","gap":"⪆","gbreve":"ğ","gcirc":"ĝ","gcy":"г","gdot":"ġ","ge":"≥","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","ges":"⩾","gescc":"⪩","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","gfr":"𝔤","gg":"≫","ggg":"⋙","gimel":"ℷ","gjcy":"ѓ","gl":"≷","glE":"⪒","gla":"⪥","glj":"⪤","gnE":"≩","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gneq":"⪈","gneqq":"≩","gnsim":"⋧","gopf":"𝕘","grave":"`","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","g":">","gt":">","gtcc":"⪧","gtcir":"⩺","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","hArr":"⇔","hairsp":" ","half":"½","hamilt":"ℋ","hardcy":"ъ","harr":"↔","harrcir":"⥈","harrw":"↭","hbar":"ℏ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","horbar":"―","hscr":"𝒽","hslash":"ℏ","hstrok":"ħ","hybull":"⁃","hyphen":"‐","iacut":"í","iacute":"í","ic":"⁣","icir":"î","icirc":"î","icy":"и","iecy":"е","iexc":"¡","iexcl":"¡","iff":"⇔","ifr":"𝔦","igrav":"ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","ijlig":"ij","imacr":"ī","image":"ℑ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","imof":"⊷","imped":"Ƶ","in":"∈","incare":"℅","infin":"∞","infintie":"⧝","inodot":"ı","int":"∫","intcal":"⊺","integers":"ℤ","intercal":"⊺","intlarhk":"⨗","intprod":"⨼","iocy":"ё","iogon":"į","iopf":"𝕚","iota":"ι","iprod":"⨼","iques":"¿","iquest":"¿","iscr":"𝒾","isin":"∈","isinE":"⋹","isindot":"⋵","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","itilde":"ĩ","iukcy":"і","ium":"ï","iuml":"ï","jcirc":"ĵ","jcy":"й","jfr":"𝔧","jmath":"ȷ","jopf":"𝕛","jscr":"𝒿","jsercy":"ј","jukcy":"є","kappa":"κ","kappav":"ϰ","kcedil":"ķ","kcy":"к","kfr":"𝔨","kgreen":"ĸ","khcy":"х","kjcy":"ќ","kopf":"𝕜","kscr":"𝓀","lAarr":"⇚","lArr":"⇐","lAtail":"⤛","lBarr":"⤎","lE":"≦","lEg":"⪋","lHar":"⥢","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","lambda":"λ","lang":"⟨","langd":"⦑","langle":"⟨","lap":"⪅","laqu":"«","laquo":"«","larr":"←","larrb":"⇤","larrbfs":"⤟","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","lat":"⪫","latail":"⤙","late":"⪭","lates":"⪭︀","lbarr":"⤌","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","lcaron":"ľ","lcedil":"ļ","lceil":"⌈","lcub":"{","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","leftarrow":"←","leftarrowtail":"↢","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","leftthreetimes":"⋋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","les":"⩽","lescc":"⪨","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","lessgtr":"≶","lesssim":"≲","lfisht":"⥼","lfloor":"⌊","lfr":"𝔩","lg":"≶","lgE":"⪑","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","ljcy":"љ","ll":"≪","llarr":"⇇","llcorner":"⌞","llhard":"⥫","lltri":"◺","lmidot":"ŀ","lmoust":"⎰","lmoustache":"⎰","lnE":"≨","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","longleftrightarrow":"⟷","longmapsto":"⟼","longrightarrow":"⟶","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","lstrok":"ł","l":"<","lt":"<","ltcc":"⪦","ltcir":"⩹","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltrPar":"⦖","ltri":"◃","ltrie":"⊴","ltrif":"◂","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","mDDot":"∺","mac":"¯","macr":"¯","male":"♂","malt":"✠","maltese":"✠","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","mcy":"м","mdash":"—","measuredangle":"∡","mfr":"𝔪","mho":"℧","micr":"µ","micro":"µ","mid":"∣","midast":"*","midcir":"⫰","middo":"·","middot":"·","minus":"−","minusb":"⊟","minusd":"∸","minusdu":"⨪","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","mopf":"𝕞","mp":"∓","mscr":"𝓂","mstpos":"∾","mu":"μ","multimap":"⊸","mumap":"⊸","nGg":"⋙̸","nGt":"≫⃒","nGtv":"≫̸","nLeftarrow":"⇍","nLeftrightarrow":"⇎","nLl":"⋘̸","nLt":"≪⃒","nLtv":"≪̸","nRightarrow":"⇏","nVDash":"⊯","nVdash":"⊮","nabla":"∇","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natur":"♮","natural":"♮","naturals":"ℕ","nbs":" ","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","ncaron":"ň","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","ncy":"н","ndash":"–","ne":"≠","neArr":"⇗","nearhk":"⤤","nearr":"↗","nearrow":"↗","nedot":"≐̸","nequiv":"≢","nesear":"⤨","nesim":"≂̸","nexist":"∄","nexists":"∄","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","ngsim":"≵","ngt":"≯","ngtr":"≯","nhArr":"⇎","nharr":"↮","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","njcy":"њ","nlArr":"⇍","nlE":"≦̸","nlarr":"↚","nldr":"‥","nle":"≰","nleftarrow":"↚","nleftrightarrow":"↮","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nlsim":"≴","nlt":"≮","nltri":"⋪","nltrie":"⋬","nmid":"∤","nopf":"𝕟","no":"¬","not":"¬","notin":"∉","notinE":"⋹̸","notindot":"⋵̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","npar":"∦","nparallel":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","npre":"⪯̸","nprec":"⊀","npreceq":"⪯̸","nrArr":"⇏","nrarr":"↛","nrarrc":"⤳̸","nrarrw":"↝̸","nrightarrow":"↛","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","ntild":"ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","nu":"ν","num":"#","numero":"№","numsp":" ","nvDash":"⊭","nvHarr":"⤄","nvap":"≍⃒","nvdash":"⊬","nvge":"≥⃒","nvgt":">⃒","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwArr":"⇖","nwarhk":"⤣","nwarr":"↖","nwarrow":"↖","nwnear":"⤧","oS":"Ⓢ","oacut":"ó","oacute":"ó","oast":"⊛","ocir":"ô","ocirc":"ô","ocy":"о","odash":"⊝","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","oelig":"œ","ofcir":"⦿","ofr":"𝔬","ogon":"˛","ograv":"ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","omacr":"ō","omega":"ω","omicron":"ο","omid":"⦶","ominus":"⊖","oopf":"𝕠","opar":"⦷","operp":"⦹","oplus":"⊕","or":"∨","orarr":"↻","ord":"º","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oscr":"ℴ","oslas":"ø","oslash":"ø","osol":"⊘","otild":"õ","otilde":"õ","otimes":"⊗","otimesas":"⨶","oum":"ö","ouml":"ö","ovbar":"⌽","par":"¶","para":"¶","parallel":"∥","parsim":"⫳","parsl":"⫽","part":"∂","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","pfr":"𝔭","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plus":"+","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plusdo":"∔","plusdu":"⨥","pluse":"⩲","plusm":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","pointint":"⨕","popf":"𝕡","poun":"£","pound":"£","pr":"≺","prE":"⪳","prap":"⪷","prcue":"≼","pre":"⪯","prec":"≺","precapprox":"⪷","preccurlyeq":"≼","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","precsim":"≾","prime":"′","primes":"ℙ","prnE":"⪵","prnap":"⪹","prnsim":"⋨","prod":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","propto":"∝","prsim":"≾","prurel":"⊰","pscr":"𝓅","psi":"ψ","puncsp":" ","qfr":"𝔮","qint":"⨌","qopf":"𝕢","qprime":"⁗","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quo":"\"","quot":"\"","rAarr":"⇛","rArr":"⇒","rAtail":"⤜","rBarr":"⤏","rHar":"⥤","race":"∽̱","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","rangd":"⦒","range":"⦥","rangle":"⟩","raqu":"»","raquo":"»","rarr":"→","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","rarrtl":"↣","rarrw":"↝","ratail":"⤚","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","rcaron":"ř","rcedil":"ŗ","rceil":"⌉","rcub":"}","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","rect":"▭","re":"®","reg":"®","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","rhard":"⇁","rharu":"⇀","rharul":"⥬","rho":"ρ","rhov":"ϱ","rightarrow":"→","rightarrowtail":"↣","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","rightthreetimes":"⋌","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoust":"⎱","rmoustache":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","roplus":"⨮","rotimes":"⨵","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","rsaquo":"›","rscr":"𝓇","rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","ruluhar":"⥨","rx":"℞","sacute":"ś","sbquo":"‚","sc":"≻","scE":"⪴","scap":"⪸","scaron":"š","sccue":"≽","sce":"⪰","scedil":"ş","scirc":"ŝ","scnE":"⪶","scnap":"⪺","scnsim":"⋩","scpolint":"⨓","scsim":"≿","scy":"с","sdot":"⋅","sdotb":"⊡","sdote":"⩦","seArr":"⇘","searhk":"⤥","searr":"↘","searrow":"↘","sec":"§","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","sfr":"𝔰","sfrown":"⌢","sharp":"♯","shchcy":"щ","shcy":"ш","shortmid":"∣","shortparallel":"∥","sh":"­","shy":"­","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","softcy":"ь","sol":"/","solb":"⧄","solbar":"⌿","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","squ":"□","square":"□","squarf":"▪","squf":"▪","srarr":"→","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","subE":"⫅","subdot":"⪽","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","subseteq":"⊆","subseteqq":"⫅","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succ":"≻","succapprox":"⪸","succcurlyeq":"≽","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","sum":"∑","sung":"♪","sup":"⊃","sup1":"¹","sup2":"²","sup3":"³","supE":"⫆","supdot":"⪾","supdsub":"⫘","supe":"⊇","supedot":"⫄","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swArr":"⇙","swarhk":"⤦","swarr":"↙","swarrow":"↙","swnwar":"⤪","szli":"ß","szlig":"ß","target":"⌖","tau":"τ","tbrk":"⎴","tcaron":"ť","tcedil":"ţ","tcy":"т","tdot":"⃛","telrec":"⌕","tfr":"𝔱","there4":"∴","therefore":"∴","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","thinsp":" ","thkap":"≈","thksim":"∼","thor":"þ","thorn":"þ","tilde":"˜","time":"×","times":"×","timesb":"⊠","timesbar":"⨱","timesd":"⨰","tint":"∭","toea":"⤨","top":"⊤","topbot":"⌶","topcir":"⫱","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","tscr":"𝓉","tscy":"ц","tshcy":"ћ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","uArr":"⇑","uHar":"⥣","uacut":"ú","uacute":"ú","uarr":"↑","ubrcy":"ў","ubreve":"ŭ","ucir":"û","ucirc":"û","ucy":"у","udarr":"⇅","udblac":"ű","udhar":"⥮","ufisht":"⥾","ufr":"𝔲","ugrav":"ù","ugrave":"ù","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","umacr":"ū","um":"¨","uml":"¨","uogon":"ų","uopf":"𝕦","uparrow":"↑","updownarrow":"↕","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","upsi":"υ","upsih":"ϒ","upsilon":"υ","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","uring":"ů","urtri":"◹","uscr":"𝓊","utdot":"⋰","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","uum":"ü","uuml":"ü","uwangle":"⦧","vArr":"⇕","vBar":"⫨","vBarv":"⫩","vDash":"⊨","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vcy":"в","vdash":"⊢","vee":"∨","veebar":"⊻","veeeq":"≚","vellip":"⋮","verbar":"|","vert":"|","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","vopf":"𝕧","vprop":"∝","vrtri":"⊳","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","vzigzag":"⦚","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","wedgeq":"≙","weierp":"℘","wfr":"𝔴","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","xfr":"𝔵","xhArr":"⟺","xharr":"⟷","xi":"ξ","xlArr":"⟸","xlarr":"⟵","xmap":"⟼","xnis":"⋻","xodot":"⨀","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrArr":"⟹","xrarr":"⟶","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","yacut":"ý","yacute":"ý","yacy":"я","ycirc":"ŷ","ycy":"ы","ye":"¥","yen":"¥","yfr":"𝔶","yicy":"ї","yopf":"𝕪","yscr":"𝓎","yucy":"ю","yum":"ÿ","yuml":"ÿ","zacute":"ź","zcaron":"ž","zcy":"з","zdot":"ż","zeetrf":"ℨ","zeta":"ζ","zfr":"𝔷","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","zscr":"𝓏","zwj":"‍","zwnj":"‌"}; + +/***/ }), +/* 216 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = factory // Construct a tokenizer. This creates both `tokenizeInline` and `tokenizeBlock`. -function factory$4(type) { +function factory(type) { return tokenize // Tokenizer for a bound `type`. function tokenize(value, location) { - var self = this; - var offset = self.offset; - var tokens = []; - var methods = self[type + 'Methods']; - var tokenizers = self[type + 'Tokenizers']; - var line = location.line; - var column = location.column; - var index; - var length; - var method; - var name; - var matched; - var valueLength; + var self = this + var offset = self.offset + var tokens = [] + var methods = self[type + 'Methods'] + var tokenizers = self[type + 'Tokenizers'] + var line = location.line + var column = location.column + var index + var length + var method + var name + var matched + var valueLength // Trim white space only lines. if (!value) { @@ -22996,23 +28053,23 @@ function factory$4(type) { } // Expose on `eat`. - eat.now = now; - eat.file = self.file; + eat.now = now + eat.file = self.file // Sync initial offset. - updatePosition(''); + updatePosition('') // Iterate over `value`, and iterate over all tokenizers. When one eats // something, re-iterate with the remaining value. If no tokenizer eats, // something failed (should not happen) and an exception is thrown. while (value) { - index = -1; - length = methods.length; - matched = false; + index = -1 + length = methods.length + matched = false while (++index < length) { - name = methods[index]; - method = tokenizers[name]; + name = methods[index] + method = tokenizers[name] if ( method && @@ -23021,11 +28078,11 @@ function factory$4(type) { (!method.notInBlock || !self.inBlock) && (!method.notInLink || !self.inLink) ) { - valueLength = value.length; + valueLength = value.length - method.apply(self, [eat, value]); + method.apply(self, [eat, value]) - matched = valueLength !== value.length; + matched = valueLength !== value.length if (matched) { break @@ -23035,36 +28092,36 @@ function factory$4(type) { /* istanbul ignore if */ if (!matched) { - self.file.fail(new Error('Infinite loop'), eat.now()); + self.file.fail(new Error('Infinite loop'), eat.now()) } } - self.eof = now(); + self.eof = now() return tokens // Update line, column, and offset based on `value`. function updatePosition(subvalue) { - var lastIndex = -1; - var index = subvalue.indexOf('\n'); + var lastIndex = -1 + var index = subvalue.indexOf('\n') while (index !== -1) { - line++; - lastIndex = index; - index = subvalue.indexOf('\n', index + 1); + line++ + lastIndex = index + index = subvalue.indexOf('\n', index + 1) } if (lastIndex === -1) { - column += subvalue.length; + column += subvalue.length } else { - column = subvalue.length - lastIndex; + column = subvalue.length - lastIndex } if (line in offset) { if (lastIndex !== -1) { - column += offset[line]; + column += offset[line] } else if (column <= offset[line]) { - column = offset[line] + 1; + column = offset[line] + 1 } } } @@ -23072,18 +28129,18 @@ function factory$4(type) { // Get offset. Called before the first character is eaten to retrieve the // range’s offsets. function getOffset() { - var indentation = []; - var pos = line + 1; + var indentation = [] + var pos = line + 1 // Done. Called when the last character is eaten to retrieve the range’s // offsets. return function() { - var last = line + 1; + var last = line + 1 while (pos < last) { - indentation.push((offset[pos] || 0) + 1); + indentation.push((offset[pos] || 0) + 1) - pos++; + pos++ } return indentation @@ -23092,17 +28149,17 @@ function factory$4(type) { // Get the current position. function now() { - var pos = {line: line, column: column}; + var pos = {line: line, column: column} - pos.offset = self.toOffset(pos); + pos.offset = self.toOffset(pos) return pos } // Store position information for a node. function Position(start) { - this.start = start; - this.end = now(); + this.start = start + this.end = now() } // Throw when a value is incorrectly eaten. This shouldn’t happen but will @@ -23116,25 +28173,25 @@ function factory$4(type) { 'Incorrectly eaten value: please report this warning on https://git.io/vg5Ft' ), now() - ); + ) } } // Mark position and patch `node.position`. function position() { - var before = now(); + var before = now() return update // Add the position to a node. function update(node, indent) { - var prev = node.position; - var start = prev ? prev.start : before; - var combined = []; - var n = prev && prev.end.line; - var l = before.line; + var prev = node.position + var start = prev ? prev.start : before + var combined = [] + var n = prev && prev.end.line + var l = before.line - node.position = new Position(start); + node.position = new Position(start) // If there was already a `position`, this node was merged. Fixing // `start` wasn’t hard, but the indent is different. Especially @@ -23142,20 +28199,20 @@ function factory$4(type) { // tracked. Luckily, that space is (should be?) empty, so we can // safely check for it now. if (prev && indent && prev.indent) { - combined = prev.indent; + combined = prev.indent if (n < l) { while (++n < l) { - combined.push((offset[n] || 0) + 1); + combined.push((offset[n] || 0) + 1) } - combined.push(before.column); + combined.push(before.column) } - indent = combined.concat(indent); + indent = combined.concat(indent) } - node.position.indent = indent || []; + node.position.indent = indent || [] return node } @@ -23164,9 +28221,9 @@ function factory$4(type) { // Add `node` to `parent`s children or to `tokens`. Performs merges where // possible. function add(node, parent) { - var children = parent ? parent.children : tokens; - var prev = children[children.length - 1]; - var fn; + var children = parent ? parent.children : tokens + var prev = children[children.length - 1] + var fn if ( prev && @@ -23175,16 +28232,16 @@ function factory$4(type) { mergeable(prev) && mergeable(node) ) { - fn = node.type === 'text' ? mergeText : mergeBlockquote; - node = fn.call(self, prev, node); + fn = node.type === 'text' ? mergeText : mergeBlockquote + node = fn.call(self, prev, node) } if (node !== prev) { - children.push(node); + children.push(node) } if (self.atStart && tokens.length !== 0) { - self.exitStart(); + self.exitStart() } return node @@ -23193,21 +28250,21 @@ function factory$4(type) { // Remove `subvalue` from `value`. `subvalue` must be at the start of // `value`. function eat(subvalue) { - var indent = getOffset(); - var pos = position(); - var current = now(); + var indent = getOffset() + var pos = position() + var current = now() - validateEat(subvalue); + validateEat(subvalue) - apply.reset = reset; - reset.test = test; - apply.test = test; + apply.reset = reset + reset.test = test + apply.test = test - value = value.substring(subvalue.length); + value = value.substring(subvalue.length) - updatePosition(subvalue); + updatePosition(subvalue) - indent = indent(); + indent = indent() return apply @@ -23222,22 +28279,22 @@ function factory$4(type) { // useful for nodes with a single type of content, such as lists and // tables. See `apply` above for what parameters are expected. function reset() { - var node = apply.apply(null, arguments); + var node = apply.apply(null, arguments) - line = current.line; - column = current.column; - value = subvalue + value; + line = current.line + column = current.column + value = subvalue + value return node } // Test the position, after eating, and reverse to a not-eaten state. function test() { - var result = pos({}); + var result = pos({}) - line = current.line; - column = current.column; - value = subvalue + value; + line = current.line + column = current.column + value = subvalue + value return result.position } @@ -23247,15 +28304,15 @@ function factory$4(type) { // Check whether a node is mergeable with adjacent nodes. function mergeable(node) { - var start; - var end; + var start + var end if (node.type !== 'text' || !node.position) { return true } - start = node.position.start; - end = node.position.end; + start = node.position.start + end = node.position.end // Only merge nodes which occupy the same size as their `value`. return ( @@ -23265,7 +28322,7 @@ function mergeable(node) { // Merge two text nodes: `node` into `prev`. function mergeText(prev, node) { - prev.value += node.value; + prev.value += node.value return prev } @@ -23276,68 +28333,73 @@ function mergeBlockquote(prev, node) { return node } - prev.children = prev.children.concat(node.children); + prev.children = prev.children.concat(node.children) + + return prev +} + + +/***/ }), +/* 217 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var xtend = __webpack_require__(7) +var escapes = __webpack_require__(81) +var defaults = __webpack_require__(82) + +module.exports = setOptions + +function setOptions(options) { + var self = this + var current = self.options + var key + var value + + if (options == null) { + options = {} + } else if (typeof options === 'object') { + options = xtend(options) + } else { + throw new Error('Invalid value `' + options + '` for setting `options`') + } + + for (key in defaults) { + value = options[key] - return prev -} + if (value == null) { + value = current[key] + } -var markdownEscapes = escapes; + if ( + (key !== 'blocks' && typeof value !== 'boolean') || + (key === 'blocks' && typeof value !== 'object') + ) { + throw new Error( + 'Invalid value `' + value + '` for setting `options.' + key + '`' + ) + } -var defaults$1 = [ - '\\', - '`', - '*', - '{', - '}', - '[', - ']', - '(', - ')', - '#', - '+', - '-', - '.', - '!', - '_', - '>' -]; + options[key] = value + } -var gfm = defaults$1.concat(['~', '|']); + self.options = options + self.escape = escapes(options) -var commonmark = gfm.concat([ - '\n', - '"', - '$', - '%', - '&', - "'", - ',', - '/', - ':', - ';', - '<', - '=', - '?', - '@', - '^' -]); + return self +} -escapes.default = defaults$1; -escapes.gfm = gfm; -escapes.commonmark = commonmark; -/* Get markdown escapes. */ -function escapes(options) { - var settings = options || {}; +/***/ }), +/* 218 */ +/***/ (function(module, exports, __webpack_require__) { - if (settings.commonmark) { - return commonmark - } +"use strict"; - return settings.gfm ? gfm : defaults$1 -} -var blockElements = [ +module.exports = [ 'address', 'article', 'aside', @@ -23404,69 +28466,171 @@ var blockElements = [ 'tr', 'track', 'ul' -]; +] -var defaults$2 = { - position: true, - gfm: true, - commonmark: false, - footnotes: false, - pedantic: false, - blocks: blockElements -}; -var setOptions_1 = setOptions; +/***/ }), +/* 219 */ +/***/ (function(module, exports, __webpack_require__) { -function setOptions(options) { - var self = this; - var current = self.options; - var key; - var value; +"use strict"; - if (options == null) { - options = {}; - } else if (typeof options === 'object') { - options = immutable(options); - } else { - throw new Error('Invalid value `' + options + '` for setting `options`') + +var xtend = __webpack_require__(7) +var removePosition = __webpack_require__(220) + +module.exports = parse + +var lineFeed = '\n' +var lineBreaksExpression = /\r\n|\r/g + +// Parse the bound file. +function parse() { + var self = this + var value = String(self.file) + var start = {line: 1, column: 1, offset: 0} + var content = xtend(start) + var node + + // Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`. + // This should not affect positional information. + value = value.replace(lineBreaksExpression, lineFeed) + + // BOM. + if (value.charCodeAt(0) === 0xfeff) { + value = value.slice(1) + + content.column++ + content.offset++ + } + + node = { + type: 'root', + children: self.tokenizeBlock(value, content), + position: {start: start, end: self.eof || xtend(start)} } - for (key in defaults$2) { - value = options[key]; + if (!self.options.position) { + removePosition(node, true) + } - if (value == null) { - value = current[key]; + return node +} + + +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var visit = __webpack_require__(1) + +module.exports = removePosition + +/* Remove `position`s from `tree`. */ +function removePosition(node, force) { + visit(node, force ? hard : soft) + return node +} + +function hard(node) { + delete node.position +} + +function soft(node) { + node.position = undefined +} + + +/***/ }), +/* 221 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = visitParents + +var is = __webpack_require__(222) + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + one(tree, null, []) + + // Visit a single node. + function one(node, index, parents) { + var result + + if (!test || is(test, node, index, parents[parents.length - 1] || null)) { + result = visitor(node, parents) + + if (result === EXIT) { + return result + } } - if ( - (key !== 'blocks' && typeof value !== 'boolean') || - (key === 'blocks' && typeof value !== 'object') - ) { - throw new Error( - 'Invalid value `' + value + '` for setting `options.' + key + '`' - ) + if (node.children && result !== SKIP) { + return all(node.children, parents.concat(node)) === EXIT ? EXIT : result } - options[key] = value; + return result } - self.options = options; - self.escape = markdownEscapes(options); + // Visit children in `parent`. + function all(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = child && one(child, index, parents) - return self + if (result === EXIT) { + return result + } + + index = typeof result === 'number' ? result : index + step + } + } } + +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + /* eslint-disable max-params */ /* Expose. */ -var unistUtilIs = is; +module.exports = is /* Assert if `test` passes for `node`. * When a `parent` node is known the `index` of node */ function is(test, node, index, parent, context) { - var hasParent = parent !== null && parent !== undefined; - var hasIndex = index !== null && index !== undefined; - var check = convert(test); + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) if ( hasIndex && @@ -23496,7 +28660,7 @@ function convert(test) { } if (test === null || test === undefined) { - return ok$1 + return ok } if (typeof test === 'object') { @@ -23511,12 +28675,12 @@ function convert(test) { } function convertAll(tests) { - var results = []; - var length = tests.length; - var index = -1; + var results = [] + var length = tests.length + var index = -1 while (++index < length) { - results[index] = convert(tests[index]); + results[index] = convert(tests[index]) } return results @@ -23528,7 +28692,7 @@ function matchesFactory(test) { return matches function matches(node) { - var key; + var key for (key in test) { if (node[key] !== test[key]) { @@ -23541,13 +28705,13 @@ function matchesFactory(test) { } function anyFactory(tests) { - var checks = convertAll(tests); - var length = checks.length; + var checks = convertAll(tests) + var length = checks.length return matches function matches() { - var index = -1; + var index = -1 while (++index < length) { if (checks[index].apply(this, arguments)) { @@ -23565,183 +28729,37 @@ function typeFactory(test) { return type function type(node) { - return Boolean(node && node.type === test) - } -} - -/* Utility to return true. */ -function ok$1() { - return true -} - -var unistUtilVisitParents = visitParents; - - - -var CONTINUE = true; -var SKIP = 'skip'; -var EXIT = false; - -visitParents.CONTINUE = CONTINUE; -visitParents.SKIP = SKIP; -visitParents.EXIT = EXIT; - -function visitParents(tree, test, visitor, reverse) { - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - one(tree, null, []); - - // Visit a single node. - function one(node, index, parents) { - var result; - - if (!test || unistUtilIs(test, node, index, parents[parents.length - 1] || null)) { - result = visitor(node, parents); - - if (result === EXIT) { - return result - } - } - - if (node.children && result !== SKIP) { - return all(node.children, parents.concat(node)) === EXIT ? EXIT : result - } - - return result - } - - // Visit children in `parent`. - function all(children, parents) { - var min = -1; - var step = reverse ? -1 : 1; - var index = (reverse ? children.length : min) + step; - var child; - var result; - - while (index > min && index < children.length) { - child = children[index]; - result = child && one(child, index, parents); - - if (result === EXIT) { - return result - } - - index = typeof result === 'number' ? result : index + step; - } - } -} - -var unistUtilVisit = visit; - - - -var CONTINUE$1 = unistUtilVisitParents.CONTINUE; -var SKIP$1 = unistUtilVisitParents.SKIP; -var EXIT$1 = unistUtilVisitParents.EXIT; - -visit.CONTINUE = CONTINUE$1; -visit.SKIP = SKIP$1; -visit.EXIT = EXIT$1; - -function visit(tree, test, visitor, reverse) { - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - - unistUtilVisitParents(tree, test, overload, reverse); - - function overload(node, parents) { - var parent = parents[parents.length - 1]; - var index = parent ? parent.children.indexOf(node) : null; - return visitor(node, index, parent) - } -} - -var unistUtilRemovePosition = removePosition; - -/* Remove `position`s from `tree`. */ -function removePosition(node, force) { - unistUtilVisit(node, force ? hard : soft); - return node -} - -function hard(node) { - delete node.position; -} - -function soft(node) { - node.position = undefined; -} - -var parse_1$3 = parse$8; - -var lineFeed = '\n'; -var lineBreaksExpression = /\r\n|\r/g; - -// Parse the bound file. -function parse$8() { - var self = this; - var value = String(self.file); - var start = {line: 1, column: 1, offset: 0}; - var content = immutable(start); - var node; - - // Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`. - // This should not affect positional information. - value = value.replace(lineBreaksExpression, lineFeed); - - // BOM. - if (value.charCodeAt(0) === 0xfeff) { - value = value.slice(1); - - content.column++; - content.offset++; - } - - node = { - type: 'root', - children: self.tokenizeBlock(value, content), - position: {start: start, end: self.eof || immutable(start)} - }; - - if (!self.options.position) { - unistUtilRemovePosition(node, true); + return Boolean(node && node.type === test) } +} - return node +/* Utility to return true. */ +function ok() { + return true } -var isWhitespaceCharacter = whitespace; -var fromCode = String.fromCharCode; -var re$1 = /\s/; +/***/ }), +/* 223 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -/* Check if the given character code, or the character - * code at the first character, is a whitespace character. */ -function whitespace(character) { - return re$1.test( - typeof character === 'number' ? fromCode(character) : character.charAt(0) - ) -} -var newline_1 = newline; +var whitespace = __webpack_require__(8) -var lineFeed$1 = '\n'; +module.exports = newline + +var lineFeed = '\n' function newline(eat, value, silent) { - var character = value.charAt(0); - var length; - var subvalue; - var queue; - var index; + var character = value.charAt(0) + var length + var subvalue + var queue + var index - if (character !== lineFeed$1) { + if (character !== lineFeed) { return } @@ -23750,96 +28768,91 @@ function newline(eat, value, silent) { return true } - index = 1; - length = value.length; - subvalue = character; - queue = ''; + index = 1 + length = value.length + subvalue = character + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - queue += character; + queue += character - if (character === lineFeed$1) { - subvalue += queue; - queue = ''; + if (character === lineFeed) { + subvalue += queue + queue = '' } - index++; + index++ } - eat(subvalue); + eat(subvalue) } -var trimTrailingLines_1 = trimTrailingLines; -var line = '\n'; +/***/ }), +/* 224 */ +/***/ (function(module, exports, __webpack_require__) { -/* Remove final newline characters from `value`. */ -function trimTrailingLines(value) { - var val = String(value); - var index = val.length; +"use strict"; - while (val.charAt(--index) === line) { - /* Empty */ - } - return val.slice(0, index + 1) -} +var repeat = __webpack_require__(10) +var trim = __webpack_require__(40) -var codeIndented = indentedCode; +module.exports = indentedCode -var lineFeed$2 = '\n'; -var tab = '\t'; -var space = ' '; +var lineFeed = '\n' +var tab = '\t' +var space = ' ' -var tabSize = 4; -var codeIndent = repeatString(space, tabSize); +var tabSize = 4 +var codeIndent = repeat(space, tabSize) function indentedCode(eat, value, silent) { - var index = -1; - var length = value.length; - var subvalue = ''; - var content = ''; - var subvalueQueue = ''; - var contentQueue = ''; - var character; - var blankQueue; - var indent; + var index = -1 + var length = value.length + var subvalue = '' + var content = '' + var subvalueQueue = '' + var contentQueue = '' + var character + var blankQueue + var indent while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) if (indent) { - indent = false; + indent = false - subvalue += subvalueQueue; - content += contentQueue; - subvalueQueue = ''; - contentQueue = ''; + subvalue += subvalueQueue + content += contentQueue + subvalueQueue = '' + contentQueue = '' - if (character === lineFeed$2) { - subvalueQueue = character; - contentQueue = character; + if (character === lineFeed) { + subvalueQueue = character + contentQueue = character } else { - subvalue += character; - content += character; + subvalue += character + content += character while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!character || character === lineFeed$2) { - contentQueue = character; - subvalueQueue = character; + if (!character || character === lineFeed) { + contentQueue = character + subvalueQueue = character break } - subvalue += character; - content += character; + subvalue += character + content += character } } } else if ( @@ -23848,26 +28861,26 @@ function indentedCode(eat, value, silent) { value.charAt(index + 2) === character && value.charAt(index + 3) === character ) { - subvalueQueue += codeIndent; - index += 3; - indent = true; + subvalueQueue += codeIndent + index += 3 + indent = true } else if (character === tab) { - subvalueQueue += character; - indent = true; + subvalueQueue += character + indent = true } else { - blankQueue = ''; + blankQueue = '' while (character === tab || character === space) { - blankQueue += character; - character = value.charAt(++index); + blankQueue += character + character = value.charAt(++index) } - if (character !== lineFeed$2) { + if (character !== lineFeed) { break } - subvalueQueue += blankQueue + character; - contentQueue += character; + subvalueQueue += blankQueue + character + contentQueue += character } } @@ -23880,41 +28893,51 @@ function indentedCode(eat, value, silent) { type: 'code', lang: null, meta: null, - value: trimTrailingLines_1(content) + value: trim(content) }) } } -var codeFenced = fencedCode; -var lineFeed$3 = '\n'; -var tab$1 = '\t'; -var space$1 = ' '; -var tilde$1 = '~'; -var graveAccent = '`'; +/***/ }), +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { -var minFenceCount = 3; -var tabSize$1 = 4; +"use strict"; + + +var trim = __webpack_require__(40) + +module.exports = fencedCode + +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var tilde = '~' +var graveAccent = '`' + +var minFenceCount = 3 +var tabSize = 4 function fencedCode(eat, value, silent) { - var self = this; - var gfm = self.options.gfm; - var length = value.length + 1; - var index = 0; - var subvalue = ''; - var fenceCount; - var marker; - var character; - var flag; - var lang; - var meta; - var queue; - var content; - var exdentedContent; - var closing; - var exdentedClosing; - var indent; - var now; + var self = this + var gfm = self.options.gfm + var length = value.length + 1 + var index = 0 + var subvalue = '' + var fenceCount + var marker + var character + var flag + var lang + var meta + var queue + var content + var exdentedContent + var closing + var exdentedClosing + var indent + var now if (!gfm) { return @@ -23922,40 +28945,40 @@ function fencedCode(eat, value, silent) { // Eat initial spacing. while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$1 && character !== tab$1) { + if (character !== space && character !== tab) { break } - subvalue += character; - index++; + subvalue += character + index++ } - indent = index; + indent = index // Eat the fence. - character = value.charAt(index); + character = value.charAt(index) - if (character !== tilde$1 && character !== graveAccent) { + if (character !== tilde && character !== graveAccent) { return } - index++; - marker = character; - fenceCount = 1; - subvalue += character; + index++ + marker = character + fenceCount = 1 + subvalue += character while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character !== marker) { break } - subvalue += character; - fenceCount++; - index++; + subvalue += character + fenceCount++ + index++ } if (fenceCount < minFenceCount) { @@ -23964,44 +28987,44 @@ function fencedCode(eat, value, silent) { // Eat spacing before flag. while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$1 && character !== tab$1) { + if (character !== space && character !== tab) { break } - subvalue += character; - index++; + subvalue += character + index++ } // Eat flag. - flag = ''; - queue = ''; + flag = '' + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if ( - character === lineFeed$3 || - character === tilde$1 || + character === lineFeed || + character === tilde || character === graveAccent ) { break } - if (character === space$1 || character === tab$1) { - queue += character; + if (character === space || character === tab) { + queue += character } else { - flag += queue + character; - queue = ''; + flag += queue + character + queue = '' } - index++; + index++ } - character = value.charAt(index); + character = value.charAt(index) - if (character && character !== lineFeed$3) { + if (character && character !== lineFeed) { return } @@ -24009,122 +29032,122 @@ function fencedCode(eat, value, silent) { return true } - now = eat.now(); - now.column += subvalue.length; - now.offset += subvalue.length; + now = eat.now() + now.column += subvalue.length + now.offset += subvalue.length - subvalue += flag; - flag = self.decode.raw(self.unescape(flag), now); + subvalue += flag + flag = self.decode.raw(self.unescape(flag), now) if (queue) { - subvalue += queue; + subvalue += queue } - queue = ''; - closing = ''; - exdentedClosing = ''; - content = ''; - exdentedContent = ''; + queue = '' + closing = '' + exdentedClosing = '' + content = '' + exdentedContent = '' // Eat content. while (index < length) { - character = value.charAt(index); - content += closing; - exdentedContent += exdentedClosing; - closing = ''; - exdentedClosing = ''; - - if (character !== lineFeed$3) { - content += character; - exdentedClosing += character; - index++; + character = value.charAt(index) + content += closing + exdentedContent += exdentedClosing + closing = '' + exdentedClosing = '' + + if (character !== lineFeed) { + content += character + exdentedClosing += character + index++ continue } // Add the newline to `subvalue` if its the first character. Otherwise, // add it to the `closing` queue. if (content) { - closing += character; - exdentedClosing += character; + closing += character + exdentedClosing += character } else { - subvalue += character; + subvalue += character } - queue = ''; - index++; + queue = '' + index++ while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$1) { + if (character !== space) { break } - queue += character; - index++; + queue += character + index++ } - closing += queue; - exdentedClosing += queue.slice(indent); + closing += queue + exdentedClosing += queue.slice(indent) - if (queue.length >= tabSize$1) { + if (queue.length >= tabSize) { continue } - queue = ''; + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character !== marker) { break } - queue += character; - index++; + queue += character + index++ } - closing += queue; - exdentedClosing += queue; + closing += queue + exdentedClosing += queue if (queue.length < fenceCount) { continue } - queue = ''; + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$1 && character !== tab$1) { + if (character !== space && character !== tab) { break } - closing += character; - exdentedClosing += character; - index++; + closing += character + exdentedClosing += character + index++ } - if (!character || character === lineFeed$3) { + if (!character || character === lineFeed) { break } } - subvalue += content + closing; + subvalue += content + closing // Get lang and meta from the flag. - index = -1; - length = flag.length; + index = -1 + length = flag.length while (++index < length) { - character = flag.charAt(index); + character = flag.charAt(index) - if (character === space$1 || character === tab$1) { + if (character === space || character === tab) { if (!lang) { - lang = flag.slice(0, index); + lang = flag.slice(0, index) } } else if (lang) { - meta = flag.slice(index); + meta = flag.slice(index) break } } @@ -24133,100 +29156,58 @@ function fencedCode(eat, value, silent) { type: 'code', lang: lang || flag || null, meta: meta || null, - value: trimTrailingLines_1(exdentedContent) + value: trim(exdentedContent) }) } -var trim_1 = createCommonjsModule(function (module, exports) { -exports = module.exports = trim; - -function trim(str){ - return str.replace(/^\s*|\s*$/g, ''); -} - -exports.left = function(str){ - return str.replace(/^\s*/, ''); -}; - -exports.right = function(str){ - return str.replace(/\s*$/, ''); -}; -}); - -var trim_2 = trim_1.left; -var trim_3 = trim_1.right; -var interrupt_1 = interrupt; - -function interrupt(interruptors, tokenizers, ctx, params) { - var length = interruptors.length; - var index = -1; - var interruptor; - var config; - - while (++index < length) { - interruptor = interruptors[index]; - config = interruptor[1] || {}; - - if ( - config.pedantic !== undefined && - config.pedantic !== ctx.options.pedantic - ) { - continue - } +/***/ }), +/* 226 */ +/***/ (function(module, exports, __webpack_require__) { - if ( - config.commonmark !== undefined && - config.commonmark !== ctx.options.commonmark - ) { - continue - } +"use strict"; - if (tokenizers[interruptor[0]].apply(ctx, params)) { - return true - } - } - return false -} +var trim = __webpack_require__(14) +var interrupt = __webpack_require__(41) -var blockquote_1 = blockquote; +module.exports = blockquote -var lineFeed$4 = '\n'; -var tab$2 = '\t'; -var space$2 = ' '; -var greaterThan = '>'; +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var greaterThan = '>' function blockquote(eat, value, silent) { - var self = this; - var offsets = self.offset; - var tokenizers = self.blockTokenizers; - var interruptors = self.interruptBlockquote; - var now = eat.now(); - var currentLine = now.line; - var length = value.length; - var values = []; - var contents = []; - var indents = []; - var add; - var index = 0; - var character; - var rest; - var nextIndex; - var content; - var line; - var startIndex; - var prefixed; - var exit; + var self = this + var offsets = self.offset + var tokenizers = self.blockTokenizers + var interruptors = self.interruptBlockquote + var now = eat.now() + var currentLine = now.line + var length = value.length + var values = [] + var contents = [] + var indents = [] + var add + var index = 0 + var character + var rest + var nextIndex + var content + var line + var startIndex + var prefixed + var exit while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$2 && character !== tab$2) { + if (character !== space && character !== tab) { break } - index++; + index++ } if (value.charAt(index) !== greaterThan) { @@ -24237,125 +29218,133 @@ function blockquote(eat, value, silent) { return true } - index = 0; + index = 0 while (index < length) { - nextIndex = value.indexOf(lineFeed$4, index); - startIndex = index; - prefixed = false; + nextIndex = value.indexOf(lineFeed, index) + startIndex = index + prefixed = false if (nextIndex === -1) { - nextIndex = length; + nextIndex = length } while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$2 && character !== tab$2) { + if (character !== space && character !== tab) { break } - index++; + index++ } if (value.charAt(index) === greaterThan) { - index++; - prefixed = true; + index++ + prefixed = true - if (value.charAt(index) === space$2) { - index++; + if (value.charAt(index) === space) { + index++ } } else { - index = startIndex; + index = startIndex } - content = value.slice(index, nextIndex); + content = value.slice(index, nextIndex) - if (!prefixed && !trim_1(content)) { - index = startIndex; + if (!prefixed && !trim(content)) { + index = startIndex break } if (!prefixed) { - rest = value.slice(index); + rest = value.slice(index) // Check if the following code contains a possible block. - if (interrupt_1(interruptors, tokenizers, self, [eat, rest, true])) { + if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) { break } } - line = startIndex === index ? content : value.slice(startIndex, nextIndex); + line = startIndex === index ? content : value.slice(startIndex, nextIndex) - indents.push(index - startIndex); - values.push(line); - contents.push(content); + indents.push(index - startIndex) + values.push(line) + contents.push(content) - index = nextIndex + 1; + index = nextIndex + 1 } - index = -1; - length = indents.length; - add = eat(values.join(lineFeed$4)); + index = -1 + length = indents.length + add = eat(values.join(lineFeed)) while (++index < length) { - offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; - currentLine++; + offsets[currentLine] = (offsets[currentLine] || 0) + indents[index] + currentLine++ } - exit = self.enterBlock(); - contents = self.tokenizeBlock(contents.join(lineFeed$4), now); - exit(); + exit = self.enterBlock() + contents = self.tokenizeBlock(contents.join(lineFeed), now) + exit() return add({type: 'blockquote', children: contents}) } -var headingAtx = atxHeading; -var lineFeed$5 = '\n'; -var tab$3 = '\t'; -var space$3 = ' '; -var numberSign = '#'; +/***/ }), +/* 227 */ +/***/ (function(module, exports, __webpack_require__) { -var maxFenceCount = 6; +"use strict"; + + +module.exports = atxHeading + +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var numberSign = '#' + +var maxFenceCount = 6 function atxHeading(eat, value, silent) { - var self = this; - var pedantic = self.options.pedantic; - var length = value.length + 1; - var index = -1; - var now = eat.now(); - var subvalue = ''; - var content = ''; - var character; - var queue; - var depth; + var self = this + var pedantic = self.options.pedantic + var length = value.length + 1 + var index = -1 + var now = eat.now() + var subvalue = '' + var content = '' + var character + var queue + var depth // Eat initial spacing. while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$3 && character !== tab$3) { - index--; + if (character !== space && character !== tab) { + index-- break } - subvalue += character; + subvalue += character } // Eat hashes. - depth = 0; + depth = 0 while (++index <= length) { - character = value.charAt(index); + character = value.charAt(index) if (character !== numberSign) { - index--; + index-- break } - subvalue += character; - depth++; + subvalue += character + depth++ } if (depth > maxFenceCount) { @@ -24366,24 +29355,24 @@ function atxHeading(eat, value, silent) { return } - length = value.length + 1; + length = value.length + 1 // Eat intermediate white-space. - queue = ''; + queue = '' while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$3 && character !== tab$3) { - index--; + if (character !== space && character !== tab) { + index-- break } - queue += character; + queue += character } // Exit when not in pedantic mode without spacing. - if (!pedantic && queue.length === 0 && character && character !== lineFeed$5) { + if (!pedantic && queue.length === 0 && character && character !== lineFeed) { return } @@ -24392,50 +29381,50 @@ function atxHeading(eat, value, silent) { } // Eat content. - subvalue += queue; - queue = ''; - content = ''; + subvalue += queue + queue = '' + content = '' while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!character || character === lineFeed$5) { + if (!character || character === lineFeed) { break } - if (character !== space$3 && character !== tab$3 && character !== numberSign) { - content += queue + character; - queue = ''; + if (character !== space && character !== tab && character !== numberSign) { + content += queue + character + queue = '' continue } - while (character === space$3 || character === tab$3) { - queue += character; - character = value.charAt(++index); + while (character === space || character === tab) { + queue += character + character = value.charAt(++index) } // `#` without a queue is part of the content. if (!pedantic && content && !queue && character === numberSign) { - content += character; + content += character continue } while (character === numberSign) { - queue += character; - character = value.charAt(++index); + queue += character + character = value.charAt(++index) } - while (character === space$3 || character === tab$3) { - queue += character; - character = value.charAt(++index); + while (character === space || character === tab) { + queue += character + character = value.charAt(++index) } - index--; + index-- } - now.column += subvalue.length; - now.offset += subvalue.length; - subvalue += content + queue; + now.column += subvalue.length + now.offset += subvalue.length + subvalue += content + queue return eat(subvalue)({ type: 'heading', @@ -24444,63 +29433,71 @@ function atxHeading(eat, value, silent) { }) } -var thematicBreak_1 = thematicBreak; -var tab$4 = '\t'; -var lineFeed$6 = '\n'; -var space$4 = ' '; -var asterisk = '*'; -var dash$1 = '-'; -var underscore = '_'; +/***/ }), +/* 228 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + -var maxCount = 3; +module.exports = thematicBreak + +var tab = '\t' +var lineFeed = '\n' +var space = ' ' +var asterisk = '*' +var dash = '-' +var underscore = '_' + +var maxCount = 3 function thematicBreak(eat, value, silent) { - var index = -1; - var length = value.length + 1; - var subvalue = ''; - var character; - var marker; - var markerCount; - var queue; + var index = -1 + var length = value.length + 1 + var subvalue = '' + var character + var marker + var markerCount + var queue while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$4 && character !== space$4) { + if (character !== tab && character !== space) { break } - subvalue += character; + subvalue += character } if ( character !== asterisk && - character !== dash$1 && + character !== dash && character !== underscore ) { return } - marker = character; - subvalue += character; - markerCount = 1; - queue = ''; + marker = character + subvalue += character + markerCount = 1 + queue = '' while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character === marker) { - markerCount++; - subvalue += queue + marker; - queue = ''; - } else if (character === space$4) { - queue += character; + markerCount++ + subvalue += queue + marker + queue = '' + } else if (character === space) { + queue += character } else if ( markerCount >= maxCount && - (!character || character === lineFeed$6) + (!character || character === lineFeed) ) { - subvalue += queue; + subvalue += queue if (silent) { return true @@ -24513,230 +29510,134 @@ function thematicBreak(eat, value, silent) { } } -var getIndentation = indentation; - -var tab$5 = '\t'; -var space$5 = ' '; - -var spaceSize = 1; -var tabSize$2 = 4; - -// Gets indentation information for a line. -function indentation(value) { - var index = 0; - var indent = 0; - var character = value.charAt(index); - var stops = {}; - var size; - - while (character === tab$5 || character === space$5) { - size = character === tab$5 ? tabSize$2 : spaceSize; - - indent += size; - - if (size > 1) { - indent = Math.floor(indent / size) * size; - } - - stops[indent] = index; - character = value.charAt(++index); - } - - return {indent: indent, stops: stops} -} - -var removeIndentation = indentation$1; - -var tab$6 = '\t'; -var lineFeed$7 = '\n'; -var space$6 = ' '; -var exclamationMark = '!'; - -// Remove the minimum indent from every line in `value`. Supports both tab, -// spaced, and mixed indentation (as well as possible). -function indentation$1(value, maximum) { - var values = value.split(lineFeed$7); - var position = values.length + 1; - var minIndent = Infinity; - var matrix = []; - var index; - var indentation; - var stops; - var padding; - - values.unshift(repeatString(space$6, maximum) + exclamationMark); - - while (position--) { - indentation = getIndentation(values[position]); - - matrix[position] = indentation.stops; - - if (trim_1(values[position]).length === 0) { - continue - } - - if (indentation.indent) { - if (indentation.indent > 0 && indentation.indent < minIndent) { - minIndent = indentation.indent; - } - } else { - minIndent = Infinity; - - break - } - } - - if (minIndent !== Infinity) { - position = values.length; - - while (position--) { - stops = matrix[position]; - index = minIndent; - - while (index && !(index in stops)) { - index--; - } - - if ( - trim_1(values[position]).length !== 0 && - minIndent && - index !== minIndent - ) { - padding = tab$6; - } else { - padding = ''; - } - values[position] = - padding + values[position].slice(index in stops ? stops[index] + 1 : 0); - } - } +/***/ }), +/* 229 */ +/***/ (function(module, exports, __webpack_require__) { - values.shift(); +"use strict"; - return values.join(lineFeed$7) -} /* eslint-disable max-params */ - - - - - - - -var list_1 = list; - -var asterisk$1 = '*'; -var underscore$1 = '_'; -var plusSign = '+'; -var dash$2 = '-'; -var dot$1 = '.'; -var space$7 = ' '; -var lineFeed$8 = '\n'; -var tab$7 = '\t'; -var rightParenthesis = ')'; -var lowercaseX = 'x'; - -var tabSize$3 = 4; -var looseListItemExpression = /\n\n(?!\s*$)/; -var taskItemExpression = /^\[([ \t]|x|X)][ \t]/; -var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; -var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; -var initialIndentExpression = /^( {1,4}|\t)?/gm; +var trim = __webpack_require__(14) +var repeat = __webpack_require__(10) +var decimal = __webpack_require__(23) +var getIndent = __webpack_require__(83) +var removeIndent = __webpack_require__(230) +var interrupt = __webpack_require__(41) + +module.exports = list + +var asterisk = '*' +var underscore = '_' +var plusSign = '+' +var dash = '-' +var dot = '.' +var space = ' ' +var lineFeed = '\n' +var tab = '\t' +var rightParenthesis = ')' +var lowercaseX = 'x' + +var tabSize = 4 +var looseListItemExpression = /\n\n(?!\s*$)/ +var taskItemExpression = /^\[([ \t]|x|X)][ \t]/ +var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/ +var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/ +var initialIndentExpression = /^( {1,4}|\t)?/gm function list(eat, value, silent) { - var self = this; - var commonmark = self.options.commonmark; - var pedantic = self.options.pedantic; - var tokenizers = self.blockTokenizers; - var interuptors = self.interruptList; - var index = 0; - var length = value.length; - var start = null; - var size = 0; - var queue; - var ordered; - var character; - var marker; - var nextIndex; - var startIndex; - var prefixed; - var currentMarker; - var content; - var line; - var prevEmpty; - var empty; - var items; - var allLines; - var emptyLines; - var item; - var enterTop; - var exitBlockquote; - var spread = false; - var node; - var now; - var end; - var indented; + var self = this + var commonmark = self.options.commonmark + var pedantic = self.options.pedantic + var tokenizers = self.blockTokenizers + var interuptors = self.interruptList + var index = 0 + var length = value.length + var start = null + var size = 0 + var queue + var ordered + var character + var marker + var nextIndex + var startIndex + var prefixed + var currentMarker + var content + var line + var prevEmpty + var empty + var items + var allLines + var emptyLines + var item + var enterTop + var exitBlockquote + var spread = false + var node + var now + var end + var indented while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === tab$7) { - size += tabSize$3 - (size % tabSize$3); - } else if (character === space$7) { - size++; + if (character === tab) { + size += tabSize - (size % tabSize) + } else if (character === space) { + size++ } else { break } - index++; + index++ } - if (size >= tabSize$3) { + if (size >= tabSize) { return } - character = value.charAt(index); + character = value.charAt(index) - if (character === asterisk$1 || character === plusSign || character === dash$2) { - marker = character; - ordered = false; + if (character === asterisk || character === plusSign || character === dash) { + marker = character + ordered = false } else { - ordered = true; - queue = ''; + ordered = true + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isDecimal(character)) { + if (!decimal(character)) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) if ( !queue || - !(character === dot$1 || (commonmark && character === rightParenthesis)) + !(character === dot || (commonmark && character === rightParenthesis)) ) { return } - start = parseInt(queue, 10); - marker = character; + start = parseInt(queue, 10) + marker = character } - character = value.charAt(++index); + character = value.charAt(++index) if ( - character !== space$7 && - character !== tab$7 && - (pedantic || (character !== lineFeed$8 && character !== '')) + character !== space && + character !== tab && + (pedantic || (character !== lineFeed && character !== '')) ) { return } @@ -24745,108 +29646,108 @@ function list(eat, value, silent) { return true } - index = 0; - items = []; - allLines = []; - emptyLines = []; + index = 0 + items = [] + allLines = [] + emptyLines = [] while (index < length) { - nextIndex = value.indexOf(lineFeed$8, index); - startIndex = index; - prefixed = false; - indented = false; + nextIndex = value.indexOf(lineFeed, index) + startIndex = index + prefixed = false + indented = false if (nextIndex === -1) { - nextIndex = length; + nextIndex = length } - end = index + tabSize$3; - size = 0; + end = index + tabSize + size = 0 while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === tab$7) { - size += tabSize$3 - (size % tabSize$3); - } else if (character === space$7) { - size++; + if (character === tab) { + size += tabSize - (size % tabSize) + } else if (character === space) { + size++ } else { break } - index++; + index++ } - if (size >= tabSize$3) { - indented = true; + if (size >= tabSize) { + indented = true } if (item && size >= item.indent) { - indented = true; + indented = true } - character = value.charAt(index); - currentMarker = null; + character = value.charAt(index) + currentMarker = null if (!indented) { if ( - character === asterisk$1 || + character === asterisk || character === plusSign || - character === dash$2 + character === dash ) { - currentMarker = character; - index++; - size++; + currentMarker = character + index++ + size++ } else { - queue = ''; + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isDecimal(character)) { + if (!decimal(character)) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); - index++; + character = value.charAt(index) + index++ if ( queue && - (character === dot$1 || (commonmark && character === rightParenthesis)) + (character === dot || (commonmark && character === rightParenthesis)) ) { - currentMarker = character; - size += queue.length + 1; + currentMarker = character + size += queue.length + 1 } } if (currentMarker) { - character = value.charAt(index); + character = value.charAt(index) - if (character === tab$7) { - size += tabSize$3 - (size % tabSize$3); - index++; - } else if (character === space$7) { - end = index + tabSize$3; + if (character === tab) { + size += tabSize - (size % tabSize) + index++ + } else if (character === space) { + end = index + tabSize while (index < end) { - if (value.charAt(index) !== space$7) { + if (value.charAt(index) !== space) { break } - index++; - size++; + index++ + size++ } - if (index === end && value.charAt(index) === space$7) { - index -= tabSize$3 - 1; - size -= tabSize$3 - 1; + if (index === end && value.charAt(index) === space) { + index -= tabSize - 1 + size -= tabSize - 1 } - } else if (character !== lineFeed$8 && character !== '') { - currentMarker = null; + } else if (character !== lineFeed && character !== '') { + currentMarker = null } } } @@ -24856,128 +29757,128 @@ function list(eat, value, silent) { break } - prefixed = true; + prefixed = true } else { - if (!commonmark && !indented && value.charAt(startIndex) === space$7) { - indented = true; + if (!commonmark && !indented && value.charAt(startIndex) === space) { + indented = true } else if (commonmark && item) { - indented = size >= item.indent || size > tabSize$3; + indented = size >= item.indent || size > tabSize } - prefixed = false; - index = startIndex; + prefixed = false + index = startIndex } - line = value.slice(startIndex, nextIndex); - content = startIndex === index ? line : value.slice(index, nextIndex); + line = value.slice(startIndex, nextIndex) + content = startIndex === index ? line : value.slice(index, nextIndex) if ( - currentMarker === asterisk$1 || - currentMarker === underscore$1 || - currentMarker === dash$2 + currentMarker === asterisk || + currentMarker === underscore || + currentMarker === dash ) { if (tokenizers.thematicBreak.call(self, eat, line, true)) { break } } - prevEmpty = empty; - empty = !prefixed && !trim_1(content).length; + prevEmpty = empty + empty = !prefixed && !trim(content).length if (indented && item) { - item.value = item.value.concat(emptyLines, line); - allLines = allLines.concat(emptyLines, line); - emptyLines = []; + item.value = item.value.concat(emptyLines, line) + allLines = allLines.concat(emptyLines, line) + emptyLines = [] } else if (prefixed) { if (emptyLines.length !== 0) { - spread = true; - item.value.push(''); - item.trail = emptyLines.concat(); + spread = true + item.value.push('') + item.trail = emptyLines.concat() } item = { value: [line], indent: size, trail: [] - }; + } - items.push(item); - allLines = allLines.concat(emptyLines, line); - emptyLines = []; + items.push(item) + allLines = allLines.concat(emptyLines, line) + emptyLines = [] } else if (empty) { if (prevEmpty && !commonmark) { break } - emptyLines.push(line); + emptyLines.push(line) } else { if (prevEmpty) { break } - if (interrupt_1(interuptors, tokenizers, self, [eat, line, true])) { + if (interrupt(interuptors, tokenizers, self, [eat, line, true])) { break } - item.value = item.value.concat(emptyLines, line); - allLines = allLines.concat(emptyLines, line); - emptyLines = []; + item.value = item.value.concat(emptyLines, line) + allLines = allLines.concat(emptyLines, line) + emptyLines = [] } - index = nextIndex + 1; + index = nextIndex + 1 } - node = eat(allLines.join(lineFeed$8)).reset({ + node = eat(allLines.join(lineFeed)).reset({ type: 'list', ordered: ordered, start: start, spread: spread, children: [] - }); + }) - enterTop = self.enterList(); - exitBlockquote = self.enterBlock(); - index = -1; - length = items.length; + enterTop = self.enterList() + exitBlockquote = self.enterBlock() + index = -1 + length = items.length while (++index < length) { - item = items[index].value.join(lineFeed$8); - now = eat.now(); + item = items[index].value.join(lineFeed) + now = eat.now() - eat(item)(listItem(self, item, now), node); + eat(item)(listItem(self, item, now), node) - item = items[index].trail.join(lineFeed$8); + item = items[index].trail.join(lineFeed) if (index !== length - 1) { - item += lineFeed$8; + item += lineFeed } - eat(item); + eat(item) } - enterTop(); - exitBlockquote(); + enterTop() + exitBlockquote() return node } function listItem(ctx, value, position) { - var offsets = ctx.offset; - var fn = ctx.options.pedantic ? pedanticListItem : normalListItem; - var checked = null; - var task; - var indent; + var offsets = ctx.offset + var fn = ctx.options.pedantic ? pedanticListItem : normalListItem + var checked = null + var task + var indent - value = fn.apply(null, arguments); + value = fn.apply(null, arguments) if (ctx.options.gfm) { - task = value.match(taskItemExpression); + task = value.match(taskItemExpression) if (task) { - indent = task[0].length; - checked = task[1].toLowerCase() === lowercaseX; - offsets[position.line] += indent; - value = value.slice(indent); + indent = task[0].length + checked = task[1].toLowerCase() === lowercaseX + offsets[position.line] += indent + value = value.slice(indent) } } @@ -24991,22 +29892,22 @@ function listItem(ctx, value, position) { // Create a list-item using overly simple mechanics. function pedanticListItem(ctx, value, position) { - var offsets = ctx.offset; - var line = position.line; + var offsets = ctx.offset + var line = position.line // Remove the list-item’s bullet. - value = value.replace(pedanticBulletExpression, replacer); + value = value.replace(pedanticBulletExpression, replacer) // The initial line was also matched by the below, so we reset the `line`. - line = position.line; + line = position.line return value.replace(initialIndentExpression, replacer) // A simple replacer which removed all matches, and adds their length to // `offset`. function replacer($0) { - offsets[line] = (offsets[line] || 0) + $0.length; - line++; + offsets[line] = (offsets[line] || 0) + $0.length + line++ return '' } @@ -25014,148 +29915,240 @@ function pedanticListItem(ctx, value, position) { // Create a list-item using sane mechanics. function normalListItem(ctx, value, position) { - var offsets = ctx.offset; - var line = position.line; - var max; - var bullet; - var rest; - var lines; - var trimmedLines; - var index; - var length; + var offsets = ctx.offset + var line = position.line + var max + var bullet + var rest + var lines + var trimmedLines + var index + var length // Remove the list-item’s bullet. - value = value.replace(bulletExpression, replacer); + value = value.replace(bulletExpression, replacer) - lines = value.split(lineFeed$8); + lines = value.split(lineFeed) - trimmedLines = removeIndentation(value, getIndentation(max).indent).split(lineFeed$8); + trimmedLines = removeIndent(value, getIndent(max).indent).split(lineFeed) // We replaced the initial bullet with something else above, which was used // to trick `removeIndentation` into removing some more characters when // possible. However, that could result in the initial line to be stripped // more than it should be. - trimmedLines[0] = rest; + trimmedLines[0] = rest - offsets[line] = (offsets[line] || 0) + bullet.length; - line++; + offsets[line] = (offsets[line] || 0) + bullet.length + line++ - index = 0; - length = lines.length; + index = 0 + length = lines.length while (++index < length) { offsets[line] = - (offsets[line] || 0) + lines[index].length - trimmedLines[index].length; - line++; + (offsets[line] || 0) + lines[index].length - trimmedLines[index].length + line++ } - return trimmedLines.join(lineFeed$8) + return trimmedLines.join(lineFeed) function replacer($0, $1, $2, $3, $4) { - bullet = $1 + $2 + $3; - rest = $4; + bullet = $1 + $2 + $3 + rest = $4 // Make sure that the first nine numbered list items can indent with an // extra space. That is, when the bullet did not receive an extra final // space. if (Number($2) < 10 && bullet.length % 2 === 1) { - $2 = space$7 + $2; + $2 = space + $2 } - max = $1 + repeatString(space$7, $2.length) + $3; + max = $1 + repeat(space, $2.length) + $3 return max + rest } } -var headingSetext = setextHeading; -var lineFeed$9 = '\n'; -var tab$8 = '\t'; -var space$8 = ' '; -var equalsTo = '='; -var dash$3 = '-'; +/***/ }), +/* 230 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var trim = __webpack_require__(14) +var repeat = __webpack_require__(10) +var getIndent = __webpack_require__(83) + +module.exports = indentation + +var tab = '\t' +var lineFeed = '\n' +var space = ' ' +var exclamationMark = '!' + +// Remove the minimum indent from every line in `value`. Supports both tab, +// spaced, and mixed indentation (as well as possible). +function indentation(value, maximum) { + var values = value.split(lineFeed) + var position = values.length + 1 + var minIndent = Infinity + var matrix = [] + var index + var indentation + var stops + var padding + + values.unshift(repeat(space, maximum) + exclamationMark) + + while (position--) { + indentation = getIndent(values[position]) + + matrix[position] = indentation.stops + + if (trim(values[position]).length === 0) { + continue + } + + if (indentation.indent) { + if (indentation.indent > 0 && indentation.indent < minIndent) { + minIndent = indentation.indent + } + } else { + minIndent = Infinity + + break + } + } + + if (minIndent !== Infinity) { + position = values.length + + while (position--) { + stops = matrix[position] + index = minIndent + + while (index && !(index in stops)) { + index-- + } + + if ( + trim(values[position]).length !== 0 && + minIndent && + index !== minIndent + ) { + padding = tab + } else { + padding = '' + } + + values[position] = + padding + values[position].slice(index in stops ? stops[index] + 1 : 0) + } + } + + values.shift() + + return values.join(lineFeed) +} + + +/***/ }), +/* 231 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = setextHeading -var maxIndent = 3; +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var equalsTo = '=' +var dash = '-' -var equalsToDepth = 1; -var dashDepth = 2; +var maxIndent = 3 + +var equalsToDepth = 1 +var dashDepth = 2 function setextHeading(eat, value, silent) { - var self = this; - var now = eat.now(); - var length = value.length; - var index = -1; - var subvalue = ''; - var content; - var queue; - var character; - var marker; - var depth; + var self = this + var now = eat.now() + var length = value.length + var index = -1 + var subvalue = '' + var content + var queue + var character + var marker + var depth // Eat initial indentation. while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$8 || index >= maxIndent) { - index--; + if (character !== space || index >= maxIndent) { + index-- break } - subvalue += character; + subvalue += character } // Eat content. - content = ''; - queue = ''; + content = '' + queue = '' while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === lineFeed$9) { - index--; + if (character === lineFeed) { + index-- break } - if (character === space$8 || character === tab$8) { - queue += character; + if (character === space || character === tab) { + queue += character } else { - content += queue + character; - queue = ''; + content += queue + character + queue = '' } } - now.column += subvalue.length; - now.offset += subvalue.length; - subvalue += content + queue; + now.column += subvalue.length + now.offset += subvalue.length + subvalue += content + queue // Ensure the content is followed by a newline and a valid marker. - character = value.charAt(++index); - marker = value.charAt(++index); + character = value.charAt(++index) + marker = value.charAt(++index) - if (character !== lineFeed$9 || (marker !== equalsTo && marker !== dash$3)) { + if (character !== lineFeed || (marker !== equalsTo && marker !== dash)) { return } - subvalue += character; + subvalue += character // Eat Setext-line. - queue = marker; - depth = marker === equalsTo ? equalsToDepth : dashDepth; + queue = marker + depth = marker === equalsTo ? equalsToDepth : dashDepth while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character !== marker) { - if (character !== lineFeed$9) { + if (character !== lineFeed) { return } - index--; + index-- break } - queue += character; + queue += character } if (silent) { @@ -25169,82 +30162,52 @@ function setextHeading(eat, value, silent) { }) } -var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; -var unquoted = '[^"\'=<>`\\u0000-\\u0020]+'; -var singleQuoted = "'[^']*'"; -var doubleQuoted = '"[^"]*"'; -var attributeValue = - '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; -var attribute = - '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; -var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; -var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; -var comment = '|'; -var processing = '<[?].*?[?]>'; -var declaration = ']*>'; -var cdata = ''; -var openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { -var tag = new RegExp( - '^(?:' + - openTag + - '|' + - closeTag + - '|' + - comment + - '|' + - processing + - '|' + - declaration + - '|' + - cdata + - ')' -); +"use strict"; -var html = { - openCloseTag: openCloseTag, - tag: tag -}; -var openCloseTag$1 = html.openCloseTag; +var openCloseTag = __webpack_require__(84).openCloseTag -var htmlBlock = blockHtml; +module.exports = blockHtml -var tab$9 = '\t'; -var space$9 = ' '; -var lineFeed$10 = '\n'; -var lessThan = '<'; +var tab = '\t' +var space = ' ' +var lineFeed = '\n' +var lessThan = '<' -var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i; -var rawCloseExpression = /<\/(script|pre|style)>/i; -var commentOpenExpression = /^/; -var instructionOpenExpression = /^<\?/; -var instructionCloseExpression = /\?>/; -var directiveOpenExpression = /^/; -var cdataOpenExpression = /^/; -var elementCloseExpression = /^$/; -var otherElementOpenExpression = new RegExp(openCloseTag$1.source + '\\s*$'); +var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i +var rawCloseExpression = /<\/(script|pre|style)>/i +var commentOpenExpression = /^/ +var instructionOpenExpression = /^<\?/ +var instructionCloseExpression = /\?>/ +var directiveOpenExpression = /^/ +var cdataOpenExpression = /^/ +var elementCloseExpression = /^$/ +var otherElementOpenExpression = new RegExp(openCloseTag.source + '\\s*$') function blockHtml(eat, value, silent) { - var self = this; - var blocks = self.options.blocks.join('|'); + var self = this + var blocks = self.options.blocks.join('|') var elementOpenExpression = new RegExp( '^|$))', 'i' - ); - var length = value.length; - var index = 0; - var next; - var line; - var offset; - var character; - var count; - var sequence; - var subvalue; + ) + var length = value.length + var index = 0 + var next + var line + var offset + var character + var count + var sequence + var subvalue var sequences = [ [rawOpenExpression, rawCloseExpression, true], @@ -25254,32 +30217,32 @@ function blockHtml(eat, value, silent) { [cdataOpenExpression, cdataCloseExpression, true], [elementOpenExpression, elementCloseExpression, true], [otherElementOpenExpression, elementCloseExpression, false] - ]; + ] // Eat initial spacing. while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$9 && character !== space$9) { + if (character !== tab && character !== space) { break } - index++; + index++ } if (value.charAt(index) !== lessThan) { return } - next = value.indexOf(lineFeed$10, index + 1); - next = next === -1 ? length : next; - line = value.slice(index, next); - offset = -1; - count = sequences.length; + next = value.indexOf(lineFeed, index + 1) + next = next === -1 ? length : next + line = value.slice(index, next) + offset = -1 + count = sequences.length while (++offset < count) { if (sequences[offset][0].test(line)) { - sequence = sequences[offset]; + sequence = sequences[offset] break } } @@ -25292,128 +30255,124 @@ function blockHtml(eat, value, silent) { return sequence[2] } - index = next; + index = next if (!sequence[1].test(line)) { while (index < length) { - next = value.indexOf(lineFeed$10, index + 1); - next = next === -1 ? length : next; - line = value.slice(index + 1, next); + next = value.indexOf(lineFeed, index + 1) + next = next === -1 ? length : next + line = value.slice(index + 1, next) if (sequence[1].test(line)) { if (line) { - index = next; + index = next } break } - index = next; + index = next } } - subvalue = value.slice(0, index); + subvalue = value.slice(0, index) return eat(subvalue)({type: 'html', value: subvalue}) } -var collapseWhiteSpace = collapse; -/* collapse(' \t\nbar \nbaz\t'); // ' bar baz ' */ -function collapse(value) { - return String(value).replace(/\s+/g, ' ') -} +/***/ }), +/* 233 */ +/***/ (function(module, exports, __webpack_require__) { -var normalize_1 = normalize$2; +"use strict"; -// Normalize an identifier. Collapses multiple white space characters into a -// single space, and removes casing. -function normalize$2(value) { - return collapseWhiteSpace(value).toLowerCase() -} -var footnoteDefinition_1 = footnoteDefinition; -footnoteDefinition.notInList = true; -footnoteDefinition.notInBlock = true; +var whitespace = __webpack_require__(8) +var normalize = __webpack_require__(42) -var backslash$1 = '\\'; -var lineFeed$11 = '\n'; -var tab$10 = '\t'; -var space$10 = ' '; -var leftSquareBracket = '['; -var rightSquareBracket = ']'; -var caret$1 = '^'; -var colon$1 = ':'; +module.exports = footnoteDefinition +footnoteDefinition.notInList = true +footnoteDefinition.notInBlock = true -var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; +var backslash = '\\' +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var caret = '^' +var colon = ':' + +var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm function footnoteDefinition(eat, value, silent) { - var self = this; - var offsets = self.offset; - var index; - var length; - var subvalue; - var now; - var currentLine; - var content; - var queue; - var subqueue; - var character; - var identifier; - var add; - var exit; + var self = this + var offsets = self.offset + var index + var length + var subvalue + var now + var currentLine + var content + var queue + var subqueue + var character + var identifier + var add + var exit if (!self.options.footnotes) { return } - index = 0; - length = value.length; - subvalue = ''; - now = eat.now(); - currentLine = now.line; + index = 0 + length = value.length + subvalue = '' + now = eat.now() + currentLine = now.line while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - subvalue += character; - index++; + subvalue += character + index++ } if ( value.charAt(index) !== leftSquareBracket || - value.charAt(index + 1) !== caret$1 + value.charAt(index + 1) !== caret ) { return } - subvalue += leftSquareBracket + caret$1; - index = subvalue.length; - queue = ''; + subvalue += leftSquareBracket + caret + index = subvalue.length + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character === rightSquareBracket) { break - } else if (character === backslash$1) { - queue += character; - index++; - character = value.charAt(index); + } else if (character === backslash) { + queue += character + index++ + character = value.charAt(index) } - queue += character; - index++; + queue += character + index++ } if ( !queue || value.charAt(index) !== rightSquareBracket || - value.charAt(index + 1) !== colon$1 + value.charAt(index + 1) !== colon ) { return } @@ -25422,342 +30381,368 @@ function footnoteDefinition(eat, value, silent) { return true } - identifier = queue; - subvalue += queue + rightSquareBracket + colon$1; - index = subvalue.length; + identifier = queue + subvalue += queue + rightSquareBracket + colon + index = subvalue.length while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$10 && character !== space$10) { + if (character !== tab && character !== space) { break } - subvalue += character; - index++; + subvalue += character + index++ } - now.column += subvalue.length; - now.offset += subvalue.length; - queue = ''; - content = ''; - subqueue = ''; + now.column += subvalue.length + now.offset += subvalue.length + queue = '' + content = '' + subqueue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === lineFeed$11) { - subqueue = character; - index++; + if (character === lineFeed) { + subqueue = character + index++ while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== lineFeed$11) { + if (character !== lineFeed) { break } - subqueue += character; - index++; + subqueue += character + index++ } - queue += subqueue; - subqueue = ''; + queue += subqueue + subqueue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$10) { + if (character !== space) { break } - subqueue += character; - index++; + subqueue += character + index++ } if (subqueue.length === 0) { break } - queue += subqueue; + queue += subqueue } if (queue) { - content += queue; - queue = ''; + content += queue + queue = '' } - content += character; - index++; + content += character + index++ } - subvalue += content; + subvalue += content content = content.replace(EXPRESSION_INITIAL_TAB, function(line) { - offsets[currentLine] = (offsets[currentLine] || 0) + line.length; - currentLine++; + offsets[currentLine] = (offsets[currentLine] || 0) + line.length + currentLine++ return '' - }); + }) - add = eat(subvalue); + add = eat(subvalue) - exit = self.enterBlock(); - content = self.tokenizeBlock(content, now); - exit(); + exit = self.enterBlock() + content = self.tokenizeBlock(content, now) + exit() return add({ type: 'footnoteDefinition', - identifier: normalize_1(identifier), + identifier: normalize(identifier), label: identifier, children: content }) } -var definition_1 = definition; -definition.notInList = true; -definition.notInBlock = true; - -var quotationMark = '"'; -var apostrophe = "'"; -var backslash$2 = '\\'; -var lineFeed$12 = '\n'; -var tab$11 = '\t'; -var space$11 = ' '; -var leftSquareBracket$1 = '['; -var rightSquareBracket$1 = ']'; -var leftParenthesis = '('; -var rightParenthesis$1 = ')'; -var colon$2 = ':'; -var lessThan$1 = '<'; -var greaterThan$1 = '>'; + +/***/ }), +/* 234 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = collapse + +/* collapse(' \t\nbar \nbaz\t'); // ' bar baz ' */ +function collapse(value) { + return String(value).replace(/\s+/g, ' ') +} + + +/***/ }), +/* 235 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) +var normalize = __webpack_require__(42) + +module.exports = definition +definition.notInList = true +definition.notInBlock = true + +var quotationMark = '"' +var apostrophe = "'" +var backslash = '\\' +var lineFeed = '\n' +var tab = '\t' +var space = ' ' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var leftParenthesis = '(' +var rightParenthesis = ')' +var colon = ':' +var lessThan = '<' +var greaterThan = '>' function definition(eat, value, silent) { - var self = this; - var commonmark = self.options.commonmark; - var index = 0; - var length = value.length; - var subvalue = ''; - var beforeURL; - var beforeTitle; - var queue; - var character; - var test; - var identifier; - var url; - var title; + var self = this + var commonmark = self.options.commonmark + var index = 0 + var length = value.length + var subvalue = '' + var beforeURL + var beforeTitle + var queue + var character + var test + var identifier + var url + var title while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== space$11 && character !== tab$11) { + if (character !== space && character !== tab) { break } - subvalue += character; - index++; + subvalue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) - if (character !== leftSquareBracket$1) { + if (character !== leftSquareBracket) { return } - index++; - subvalue += character; - queue = ''; + index++ + subvalue += character + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === rightSquareBracket$1) { + if (character === rightSquareBracket) { break - } else if (character === backslash$2) { - queue += character; - index++; - character = value.charAt(index); + } else if (character === backslash) { + queue += character + index++ + character = value.charAt(index) } - queue += character; - index++; + queue += character + index++ } if ( !queue || - value.charAt(index) !== rightSquareBracket$1 || - value.charAt(index + 1) !== colon$2 + value.charAt(index) !== rightSquareBracket || + value.charAt(index + 1) !== colon ) { return } - identifier = queue; - subvalue += queue + rightSquareBracket$1 + colon$2; - index = subvalue.length; - queue = ''; + identifier = queue + subvalue += queue + rightSquareBracket + colon + index = subvalue.length + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + if (character !== tab && character !== space && character !== lineFeed) { break } - subvalue += character; - index++; + subvalue += character + index++ } - character = value.charAt(index); - queue = ''; - beforeURL = subvalue; + character = value.charAt(index) + queue = '' + beforeURL = subvalue - if (character === lessThan$1) { - index++; + if (character === lessThan) { + index++ while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (!isEnclosedURLCharacter(character)) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) if (character === isEnclosedURLCharacter.delimiter) { - subvalue += lessThan$1 + queue + character; - index++; + subvalue += lessThan + queue + character + index++ } else { if (commonmark) { return } - index -= queue.length + 1; - queue = ''; + index -= queue.length + 1 + queue = '' } } if (!queue) { while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (!isUnclosedURLCharacter(character)) { break } - queue += character; - index++; + queue += character + index++ } - subvalue += queue; + subvalue += queue } if (!queue) { return } - url = queue; - queue = ''; + url = queue + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + if (character !== tab && character !== space && character !== lineFeed) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); - test = null; + character = value.charAt(index) + test = null if (character === quotationMark) { - test = quotationMark; + test = quotationMark } else if (character === apostrophe) { - test = apostrophe; + test = apostrophe } else if (character === leftParenthesis) { - test = rightParenthesis$1; + test = rightParenthesis } if (!test) { - queue = ''; - index = subvalue.length; + queue = '' + index = subvalue.length } else if (queue) { - subvalue += queue + character; - index = subvalue.length; - queue = ''; + subvalue += queue + character + index = subvalue.length + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character === test) { break } - if (character === lineFeed$12) { - index++; - character = value.charAt(index); + if (character === lineFeed) { + index++ + character = value.charAt(index) - if (character === lineFeed$12 || character === test) { + if (character === lineFeed || character === test) { return } - queue += lineFeed$12; + queue += lineFeed } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) if (character !== test) { return } - beforeTitle = subvalue; - subvalue += queue + character; - index++; - title = queue; - queue = ''; + beforeTitle = subvalue + subvalue += queue + character + index++ + title = queue + queue = '' } else { return } while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character !== tab$11 && character !== space$11) { + if (character !== tab && character !== space) { break } - subvalue += character; - index++; + subvalue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) - if (!character || character === lineFeed$12) { + if (!character || character === lineFeed) { if (silent) { return true } - beforeURL = eat(beforeURL).test().end; - url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}); + beforeURL = eat(beforeURL).test().end + url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}) if (title) { - beforeTitle = eat(beforeTitle).test().end; - title = self.decode.raw(self.unescape(title), beforeTitle); + beforeTitle = eat(beforeTitle).test().end + title = self.decode.raw(self.unescape(title), beforeTitle) } return eat(subvalue)({ type: 'definition', - identifier: normalize_1(identifier), + identifier: normalize(identifier), label: identifier, title: title || null, url: url @@ -25768,67 +30753,77 @@ function definition(eat, value, silent) { // Check if `character` can be inside an enclosed URI. function isEnclosedURLCharacter(character) { return ( - character !== greaterThan$1 && - character !== leftSquareBracket$1 && - character !== rightSquareBracket$1 + character !== greaterThan && + character !== leftSquareBracket && + character !== rightSquareBracket ) } -isEnclosedURLCharacter.delimiter = greaterThan$1; +isEnclosedURLCharacter.delimiter = greaterThan // Check if `character` can be inside an unclosed URI. function isUnclosedURLCharacter(character) { return ( - character !== leftSquareBracket$1 && - character !== rightSquareBracket$1 && - !isWhitespaceCharacter(character) + character !== leftSquareBracket && + character !== rightSquareBracket && + !whitespace(character) ) } -var table_1 = table$1; - -var tab$12 = '\t'; -var lineFeed$13 = '\n'; -var space$12 = ' '; -var dash$4 = '-'; -var colon$3 = ':'; -var backslash$3 = '\\'; -var graveAccent$1 = '`'; -var verticalBar = '|'; -var minColumns = 1; -var minRows = 2; - -var left = 'left'; -var center = 'center'; -var right = 'right'; - -function table$1(eat, value, silent) { - var self = this; - var index; - var alignments; - var alignment; - var subvalue; - var row; - var length; - var lines; - var queue; - var character; - var hasDash; - var align; - var cell; - var preamble; - var count; - var opening; - var now; - var position; - var lineCount; - var line; - var rows; - var table; - var lineIndex; - var pipeIndex; - var first; +/***/ }), +/* 236 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) + +module.exports = table + +var tab = '\t' +var lineFeed = '\n' +var space = ' ' +var dash = '-' +var colon = ':' +var backslash = '\\' +var graveAccent = '`' +var verticalBar = '|' + +var minColumns = 1 +var minRows = 2 + +var left = 'left' +var center = 'center' +var right = 'right' + +function table(eat, value, silent) { + var self = this + var index + var alignments + var alignment + var subvalue + var row + var length + var lines + var queue + var character + var hasDash + var align + var cell + var preamble + var count + var opening + var now + var position + var lineCount + var line + var rows + var table + var lineIndex + var pipeIndex + var first // Exit when not in gfm-mode. if (!self.options.gfm) { @@ -25839,17 +30834,17 @@ function table$1(eat, value, silent) { // Detecting tables soon is hard, so there are some checks for performance // here, such as the minimum number of rows, and allowed characters in the // alignment row. - index = 0; - lineCount = 0; - length = value.length + 1; - lines = []; + index = 0 + lineCount = 0 + length = value.length + 1 + lines = [] while (index < length) { - lineIndex = value.indexOf(lineFeed$13, index); - pipeIndex = value.indexOf(verticalBar, index + 1); + lineIndex = value.indexOf(lineFeed, index) + pipeIndex = value.indexOf(verticalBar, index + 1) if (lineIndex === -1) { - lineIndex = value.length; + lineIndex = value.length } if (pipeIndex === -1 || pipeIndex > lineIndex) { @@ -25860,56 +30855,56 @@ function table$1(eat, value, silent) { break } - lines.push(value.slice(index, lineIndex)); - lineCount++; - index = lineIndex + 1; + lines.push(value.slice(index, lineIndex)) + lineCount++ + index = lineIndex + 1 } // Parse the alignment row. - subvalue = lines.join(lineFeed$13); - alignments = lines.splice(1, 1)[0] || []; - index = 0; - length = alignments.length; - lineCount--; - alignment = false; - align = []; + subvalue = lines.join(lineFeed) + alignments = lines.splice(1, 1)[0] || [] + index = 0 + length = alignments.length + lineCount-- + alignment = false + align = [] while (index < length) { - character = alignments.charAt(index); + character = alignments.charAt(index) if (character === verticalBar) { - hasDash = null; + hasDash = null if (alignment === false) { if (first === false) { return } } else { - align.push(alignment); - alignment = false; + align.push(alignment) + alignment = false } - first = false; - } else if (character === dash$4) { - hasDash = true; - alignment = alignment || null; - } else if (character === colon$3) { + first = false + } else if (character === dash) { + hasDash = true + alignment = alignment || null + } else if (character === colon) { if (alignment === left) { - alignment = center; + alignment = center } else if (hasDash && alignment === null) { - alignment = right; + alignment = right } else { - alignment = left; + alignment = left } - } else if (!isWhitespaceCharacter(character)) { + } else if (!whitespace(character)) { return } - index++; + index++ } if (alignment !== false) { - align.push(alignment); + align.push(alignment) } // Exit when without enough columns. @@ -25923,190 +30918,203 @@ function table$1(eat, value, silent) { } // Parse the rows. - position = -1; - rows = []; + position = -1 + rows = [] - table = eat(subvalue).reset({type: 'table', align: align, children: rows}); + table = eat(subvalue).reset({type: 'table', align: align, children: rows}) while (++position < lineCount) { - line = lines[position]; - row = {type: 'tableRow', children: []}; + line = lines[position] + row = {type: 'tableRow', children: []} // Eat a newline character when this is not the first row. if (position) { - eat(lineFeed$13); + eat(lineFeed) } // Eat the row. - eat(line).reset(row, table); + eat(line).reset(row, table) - length = line.length + 1; - index = 0; - queue = ''; - cell = ''; - preamble = true; - count = null; - opening = null; + length = line.length + 1 + index = 0 + queue = '' + cell = '' + preamble = true + count = null + opening = null while (index < length) { - character = line.charAt(index); + character = line.charAt(index) - if (character === tab$12 || character === space$12) { + if (character === tab || character === space) { if (cell) { - queue += character; + queue += character } else { - eat(character); + eat(character) } - index++; + index++ continue } if (character === '' || character === verticalBar) { if (preamble) { - eat(character); + eat(character) } else { if (character && opening) { - queue += character; - index++; + queue += character + index++ continue } if ((cell || character) && !preamble) { - subvalue = cell; + subvalue = cell if (queue.length > 1) { if (character) { - subvalue += queue.slice(0, queue.length - 1); - queue = queue.charAt(queue.length - 1); + subvalue += queue.slice(0, queue.length - 1) + queue = queue.charAt(queue.length - 1) } else { - subvalue += queue; - queue = ''; + subvalue += queue + queue = '' } } - now = eat.now(); + now = eat.now() eat(subvalue)( {type: 'tableCell', children: self.tokenizeInline(cell, now)}, row - ); + ) } - eat(queue + character); + eat(queue + character) - queue = ''; - cell = ''; + queue = '' + cell = '' } } else { if (queue) { - cell += queue; - queue = ''; + cell += queue + queue = '' } - cell += character; + cell += character - if (character === backslash$3 && index !== length - 2) { - cell += line.charAt(index + 1); - index++; + if (character === backslash && index !== length - 2) { + cell += line.charAt(index + 1) + index++ } - if (character === graveAccent$1) { - count = 1; + if (character === graveAccent) { + count = 1 while (line.charAt(index + 1) === character) { - cell += character; - index++; - count++; + cell += character + index++ + count++ } if (!opening) { - opening = count; + opening = count } else if (count >= opening) { - opening = 0; + opening = 0 } } } - preamble = false; - index++; + preamble = false + index++ } // Eat the alignment row. if (!position) { - eat(lineFeed$13 + alignments); + eat(lineFeed + alignments) } } return table } -var paragraph_1 = paragraph; -var tab$13 = '\t'; -var lineFeed$14 = '\n'; -var space$13 = ' '; +/***/ }), +/* 237 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var trim = __webpack_require__(14) +var decimal = __webpack_require__(23) +var trimTrailingLines = __webpack_require__(40) +var interrupt = __webpack_require__(41) + +module.exports = paragraph + +var tab = '\t' +var lineFeed = '\n' +var space = ' ' -var tabSize$4 = 4; +var tabSize = 4 // Tokenise paragraph. function paragraph(eat, value, silent) { - var self = this; - var settings = self.options; - var commonmark = settings.commonmark; - var gfm = settings.gfm; - var tokenizers = self.blockTokenizers; - var interruptors = self.interruptParagraph; - var index = value.indexOf(lineFeed$14); - var length = value.length; - var position; - var subvalue; - var character; - var size; - var now; + var self = this + var settings = self.options + var commonmark = settings.commonmark + var gfm = settings.gfm + var tokenizers = self.blockTokenizers + var interruptors = self.interruptParagraph + var index = value.indexOf(lineFeed) + var length = value.length + var position + var subvalue + var character + var size + var now while (index < length) { // Eat everything if there’s no following newline. if (index === -1) { - index = length; + index = length break } // Stop if the next character is NEWLINE. - if (value.charAt(index + 1) === lineFeed$14) { + if (value.charAt(index + 1) === lineFeed) { break } // In commonmark-mode, following indented lines are part of the paragraph. if (commonmark) { - size = 0; - position = index + 1; + size = 0 + position = index + 1 while (position < length) { - character = value.charAt(position); + character = value.charAt(position) - if (character === tab$13) { - size = tabSize$4; + if (character === tab) { + size = tabSize break - } else if (character === space$13) { - size++; + } else if (character === space) { + size++ } else { break } - position++; + position++ } - if (size >= tabSize$4 && character !== lineFeed$14) { - index = value.indexOf(lineFeed$14, index + 1); + if (size >= tabSize && character !== lineFeed) { + index = value.indexOf(lineFeed, index + 1) continue } } - subvalue = value.slice(index + 1); + subvalue = value.slice(index + 1) // Check if the following code contains a possible block. - if (interrupt_1(interruptors, tokenizers, self, [eat, subvalue, true])) { + if (interrupt(interruptors, tokenizers, self, [eat, subvalue, true])) { break } @@ -26116,24 +31124,24 @@ function paragraph(eat, value, silent) { tokenizers.list.call(self, eat, subvalue, true) && (self.inList || commonmark || - (gfm && !isDecimal(trim_1.left(subvalue).charAt(0)))) + (gfm && !decimal(trim.left(subvalue).charAt(0)))) ) { break } - position = index; - index = value.indexOf(lineFeed$14, index + 1); + position = index + index = value.indexOf(lineFeed, index + 1) - if (index !== -1 && trim_1(value.slice(position, index)) === '') { - index = position; + if (index !== -1 && trim(value.slice(position, index)) === '') { + index = position break } } - subvalue = value.slice(0, index); + subvalue = value.slice(0, index) - if (trim_1(subvalue) === '') { - eat(subvalue); + if (trim(subvalue) === '') { + eat(subvalue) return null } @@ -26143,8 +31151,8 @@ function paragraph(eat, value, silent) { return true } - now = eat.now(); - subvalue = trimTrailingLines_1(subvalue); + now = eat.now() + subvalue = trimTrailingLines(subvalue) return eat(subvalue)({ type: 'paragraph', @@ -26152,25 +31160,29 @@ function paragraph(eat, value, silent) { }) } -var _escape = locate; -function locate(value, fromIndex) { - return value.indexOf('\\', fromIndex) -} +/***/ }), +/* 238 */ +/***/ (function(module, exports, __webpack_require__) { -var _escape$2 = escape; -escape.locator = _escape; +"use strict"; -var lineFeed$15 = '\n'; -var backslash$4 = '\\'; + +var locate = __webpack_require__(239) + +module.exports = escape +escape.locator = locate + +var lineFeed = '\n' +var backslash = '\\' function escape(eat, value, silent) { - var self = this; - var character; - var node; + var self = this + var character + var node - if (value.charAt(0) === backslash$4) { - character = value.charAt(1); + if (value.charAt(0) === backslash) { + character = value.charAt(1) if (self.escape.indexOf(character) !== -1) { /* istanbul ignore if - never used (yet) */ @@ -26178,107 +31190,127 @@ function escape(eat, value, silent) { return true } - if (character === lineFeed$15) { - node = {type: 'break'}; + if (character === lineFeed) { + node = {type: 'break'} } else { - node = {type: 'text', value: character}; + node = {type: 'text', value: character} } - return eat(backslash$4 + character)(node) + return eat(backslash + character)(node) } } } -var tag$1 = locate$2; -function locate$2(value, fromIndex) { - return value.indexOf('<', fromIndex) +/***/ }), +/* 239 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +function locate(value, fromIndex) { + return value.indexOf('\\', fromIndex) } -var autoLink_1 = autoLink; -autoLink.locator = tag$1; -autoLink.notInLink = true; -var lessThan$2 = '<'; -var greaterThan$2 = '>'; -var atSign = '@'; -var slash = '/'; -var mailto = 'mailto:'; -var mailtoLength = mailto.length; +/***/ }), +/* 240 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) +var decode = __webpack_require__(30) +var locate = __webpack_require__(85) + +module.exports = autoLink +autoLink.locator = locate +autoLink.notInLink = true + +var lessThan = '<' +var greaterThan = '>' +var atSign = '@' +var slash = '/' +var mailto = 'mailto:' +var mailtoLength = mailto.length function autoLink(eat, value, silent) { - var self = this; - var subvalue = ''; - var length = value.length; - var index = 0; - var queue = ''; - var hasAtCharacter = false; - var link = ''; - var character; - var now; - var content; - var tokenizers; - var exit; - - if (value.charAt(0) !== lessThan$2) { + var self = this + var subvalue = '' + var length = value.length + var index = 0 + var queue = '' + var hasAtCharacter = false + var link = '' + var character + var now + var content + var tokenizers + var exit + + if (value.charAt(0) !== lessThan) { return } - index++; - subvalue = lessThan$2; + index++ + subvalue = lessThan while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if ( - isWhitespaceCharacter(character) || - character === greaterThan$2 || + whitespace(character) || + character === greaterThan || character === atSign || (character === ':' && value.charAt(index + 1) === slash) ) { break } - queue += character; - index++; + queue += character + index++ } if (!queue) { return } - link += queue; - queue = ''; + link += queue + queue = '' - character = value.charAt(index); - link += character; - index++; + character = value.charAt(index) + link += character + index++ if (character === atSign) { - hasAtCharacter = true; + hasAtCharacter = true } else { if (character !== ':' || value.charAt(index + 1) !== slash) { return } - link += slash; - index++; + link += slash + index++ } while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (isWhitespaceCharacter(character) || character === greaterThan$2) { + if (whitespace(character) || character === greaterThan) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); + character = value.charAt(index) - if (!queue || character !== greaterThan$2) { + if (!queue || character !== greaterThan) { return } @@ -26287,121 +31319,108 @@ function autoLink(eat, value, silent) { return true } - link += queue; - content = link; - subvalue += link + character; - now = eat.now(); - now.column++; - now.offset++; + link += queue + content = link + subvalue += link + character + now = eat.now() + now.column++ + now.offset++ if (hasAtCharacter) { if (link.slice(0, mailtoLength).toLowerCase() === mailto) { - content = content.substr(mailtoLength); - now.column += mailtoLength; - now.offset += mailtoLength; + content = content.substr(mailtoLength) + now.column += mailtoLength + now.offset += mailtoLength } else { - link = mailto + link; + link = mailto + link } } // Temporarily remove all tokenizers except text in autolinks. - tokenizers = self.inlineTokenizers; - self.inlineTokenizers = {text: tokenizers.text}; + tokenizers = self.inlineTokenizers + self.inlineTokenizers = {text: tokenizers.text} - exit = self.enterLink(); + exit = self.enterLink() - content = self.tokenizeInline(content, now); + content = self.tokenizeInline(content, now) - self.inlineTokenizers = tokenizers; - exit(); + self.inlineTokenizers = tokenizers + exit() return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(link, {nonTerminated: false}), + url: decode(link, {nonTerminated: false}), children: content }) } -var url = locate$4; - -var protocols = ['https://', 'http://', 'mailto:']; - -function locate$4(value, fromIndex) { - var length = protocols.length; - var index = -1; - var min = -1; - var position; - if (!this.options.gfm) { - return -1 - } +/***/ }), +/* 241 */ +/***/ (function(module, exports, __webpack_require__) { - while (++index < length) { - position = value.indexOf(protocols[index], fromIndex); +"use strict"; - if (position !== -1 && (position < min || min === -1)) { - min = position; - } - } - return min -} +var decode = __webpack_require__(30) +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(242) -var url_1 = url$2; -url$2.locator = url; -url$2.notInLink = true; +module.exports = url +url.locator = locate +url.notInLink = true -var quotationMark$1 = '"'; -var apostrophe$1 = "'"; -var leftParenthesis$1 = '('; -var rightParenthesis$2 = ')'; -var comma$1 = ','; -var dot$2 = '.'; -var colon$4 = ':'; -var semicolon = ';'; -var lessThan$3 = '<'; -var atSign$1 = '@'; -var leftSquareBracket$2 = '['; -var rightSquareBracket$2 = ']'; +var quotationMark = '"' +var apostrophe = "'" +var leftParenthesis = '(' +var rightParenthesis = ')' +var comma = ',' +var dot = '.' +var colon = ':' +var semicolon = ';' +var lessThan = '<' +var atSign = '@' +var leftSquareBracket = '[' +var rightSquareBracket = ']' -var http = 'http://'; -var https = 'https://'; -var mailto$1 = 'mailto:'; +var http = 'http://' +var https = 'https://' +var mailto = 'mailto:' -var protocols$1 = [http, https, mailto$1]; +var protocols = [http, https, mailto] -var protocolsLength = protocols$1.length; +var protocolsLength = protocols.length -function url$2(eat, value, silent) { - var self = this; - var subvalue; - var content; - var character; - var index; - var position; - var protocol; - var match; - var length; - var queue; - var parenCount; - var nextCharacter; - var tokenizers; - var exit; +function url(eat, value, silent) { + var self = this + var subvalue + var content + var character + var index + var position + var protocol + var match + var length + var queue + var parenCount + var nextCharacter + var tokenizers + var exit if (!self.options.gfm) { return } - subvalue = ''; - index = -1; + subvalue = '' + index = -1 while (++index < protocolsLength) { - protocol = protocols$1[index]; - match = value.slice(0, protocol.length); + protocol = protocols[index] + match = value.slice(0, protocol.length) if (match.toLowerCase() === protocol) { - subvalue = match; + subvalue = match break } } @@ -26410,66 +31429,66 @@ function url$2(eat, value, silent) { return } - index = subvalue.length; - length = value.length; - queue = ''; - parenCount = 0; + index = subvalue.length + length = value.length + queue = '' + parenCount = 0 while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (isWhitespaceCharacter(character) || character === lessThan$3) { + if (whitespace(character) || character === lessThan) { break } if ( - character === dot$2 || - character === comma$1 || - character === colon$4 || + character === dot || + character === comma || + character === colon || character === semicolon || - character === quotationMark$1 || - character === apostrophe$1 || - character === rightParenthesis$2 || - character === rightSquareBracket$2 + character === quotationMark || + character === apostrophe || + character === rightParenthesis || + character === rightSquareBracket ) { - nextCharacter = value.charAt(index + 1); + nextCharacter = value.charAt(index + 1) - if (!nextCharacter || isWhitespaceCharacter(nextCharacter)) { + if (!nextCharacter || whitespace(nextCharacter)) { break } } - if (character === leftParenthesis$1 || character === leftSquareBracket$2) { - parenCount++; + if (character === leftParenthesis || character === leftSquareBracket) { + parenCount++ } - if (character === rightParenthesis$2 || character === rightSquareBracket$2) { - parenCount--; + if (character === rightParenthesis || character === rightSquareBracket) { + parenCount-- if (parenCount < 0) { break } } - queue += character; - index++; + queue += character + index++ } if (!queue) { return } - subvalue += queue; - content = subvalue; + subvalue += queue + content = subvalue - if (protocol === mailto$1) { - position = queue.indexOf(atSign$1); + if (protocol === mailto) { + position = queue.indexOf(atSign) if (position === -1 || position === length - 1) { return } - content = content.substr(mailto$1.length); + content = content.substr(mailto.length) } /* istanbul ignore if - never used (yet) */ @@ -26477,60 +31496,103 @@ function url$2(eat, value, silent) { return true } - exit = self.enterLink(); + exit = self.enterLink() // Temporarily remove all tokenizers except text in url. - tokenizers = self.inlineTokenizers; - self.inlineTokenizers = {text: tokenizers.text}; + tokenizers = self.inlineTokenizers + self.inlineTokenizers = {text: tokenizers.text} - content = self.tokenizeInline(content, eat.now()); + content = self.tokenizeInline(content, eat.now()) - self.inlineTokenizers = tokenizers; - exit(); + self.inlineTokenizers = tokenizers + exit() return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(subvalue, {nonTerminated: false}), + url: decode(subvalue, {nonTerminated: false}), children: content }) } -var tag$3 = html.tag; -var htmlInline = inlineHTML; -inlineHTML.locator = tag$1; +/***/ }), +/* 242 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +var protocols = ['https://', 'http://', 'mailto:'] + +function locate(value, fromIndex) { + var length = protocols.length + var index = -1 + var min = -1 + var position + + if (!this.options.gfm) { + return -1 + } + + while (++index < length) { + position = value.indexOf(protocols[index], fromIndex) + + if (position !== -1 && (position < min || min === -1)) { + min = position + } + } + + return min +} + + +/***/ }), +/* 243 */ +/***/ (function(module, exports, __webpack_require__) { -var lessThan$4 = '<'; -var questionMark = '?'; -var exclamationMark$1 = '!'; -var slash$1 = '/'; +"use strict"; -var htmlLinkOpenExpression = /^/i; + +var alphabetical = __webpack_require__(80) +var locate = __webpack_require__(85) +var tag = __webpack_require__(84).tag + +module.exports = inlineHTML +inlineHTML.locator = locate + +var lessThan = '<' +var questionMark = '?' +var exclamationMark = '!' +var slash = '/' + +var htmlLinkOpenExpression = /^/i function inlineHTML(eat, value, silent) { - var self = this; - var length = value.length; - var character; - var subvalue; + var self = this + var length = value.length + var character + var subvalue - if (value.charAt(0) !== lessThan$4 || length < 3) { + if (value.charAt(0) !== lessThan || length < 3) { return } - character = value.charAt(1); + character = value.charAt(1) if ( - !isAlphabetical(character) && + !alphabetical(character) && character !== questionMark && - character !== exclamationMark$1 && - character !== slash$1 + character !== exclamationMark && + character !== slash ) { return } - subvalue = value.match(tag$3); + subvalue = value.match(tag) if (!subvalue) { return @@ -26541,84 +31603,80 @@ function inlineHTML(eat, value, silent) { return true } - subvalue = subvalue[0]; + subvalue = subvalue[0] if (!self.inLink && htmlLinkOpenExpression.test(subvalue)) { - self.inLink = true; + self.inLink = true } else if (self.inLink && htmlLinkCloseExpression.test(subvalue)) { - self.inLink = false; + self.inLink = false } return eat(subvalue)({type: 'html', value: subvalue}) } -var link = locate$6; - -function locate$6(value, fromIndex) { - var link = value.indexOf('[', fromIndex); - var image = value.indexOf('![', fromIndex); - - if (image === -1) { - return link - } - - // Link can never be `-1` if an image is found, so we don’t need to check - // for that :) - return link < image ? link : image -} - -var link_1 = link$2; -link$2.locator = link; -var lineFeed$16 = '\n'; -var exclamationMark$2 = '!'; -var quotationMark$2 = '"'; -var apostrophe$2 = "'"; -var leftParenthesis$2 = '('; -var rightParenthesis$3 = ')'; -var lessThan$5 = '<'; -var greaterThan$3 = '>'; -var leftSquareBracket$3 = '['; -var backslash$5 = '\\'; -var rightSquareBracket$3 = ']'; -var graveAccent$2 = '`'; - -function link$2(eat, value, silent) { - var self = this; - var subvalue = ''; - var index = 0; - var character = value.charAt(0); - var pedantic = self.options.pedantic; - var commonmark = self.options.commonmark; - var gfm = self.options.gfm; - var closed; - var count; - var opening; - var beforeURL; - var beforeTitle; - var subqueue; - var hasMarker; - var isImage; - var content; - var marker; - var length; - var title; - var depth; - var queue; - var url; - var now; - var exit; - var node; +/***/ }), +/* 244 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(86) + +module.exports = link +link.locator = locate + +var lineFeed = '\n' +var exclamationMark = '!' +var quotationMark = '"' +var apostrophe = "'" +var leftParenthesis = '(' +var rightParenthesis = ')' +var lessThan = '<' +var greaterThan = '>' +var leftSquareBracket = '[' +var backslash = '\\' +var rightSquareBracket = ']' +var graveAccent = '`' + +function link(eat, value, silent) { + var self = this + var subvalue = '' + var index = 0 + var character = value.charAt(0) + var pedantic = self.options.pedantic + var commonmark = self.options.commonmark + var gfm = self.options.gfm + var closed + var count + var opening + var beforeURL + var beforeTitle + var subqueue + var hasMarker + var isImage + var content + var marker + var length + var title + var depth + var queue + var url + var now + var exit + var node // Detect whether this is an image. - if (character === exclamationMark$2) { - isImage = true; - subvalue = character; - character = value.charAt(++index); + if (character === exclamationMark) { + isImage = true + subvalue = character + character = value.charAt(++index) } // Eat the opening. - if (character !== leftSquareBracket$3) { + if (character !== leftSquareBracket) { return } @@ -26627,78 +31685,78 @@ function link$2(eat, value, silent) { return } - subvalue += character; - queue = ''; - index++; + subvalue += character + queue = '' + index++ // Eat the content. - length = value.length; - now = eat.now(); - depth = 0; + length = value.length + now = eat.now() + depth = 0 - now.column += index; - now.offset += index; + now.column += index + now.offset += index while (index < length) { - character = value.charAt(index); - subqueue = character; + character = value.charAt(index) + subqueue = character - if (character === graveAccent$2) { + if (character === graveAccent) { // Inline-code in link content. - count = 1; + count = 1 - while (value.charAt(index + 1) === graveAccent$2) { - subqueue += character; - index++; - count++; + while (value.charAt(index + 1) === graveAccent) { + subqueue += character + index++ + count++ } if (!opening) { - opening = count; + opening = count } else if (count >= opening) { - opening = 0; + opening = 0 } - } else if (character === backslash$5) { + } else if (character === backslash) { // Allow brackets to be escaped. - index++; - subqueue += value.charAt(index); - } else if ((!opening || gfm) && character === leftSquareBracket$3) { + index++ + subqueue += value.charAt(index) + } else if ((!opening || gfm) && character === leftSquareBracket) { // In GFM mode, brackets in code still count. In all other modes, // they don’t. - depth++; - } else if ((!opening || gfm) && character === rightSquareBracket$3) { + depth++ + } else if ((!opening || gfm) && character === rightSquareBracket) { if (depth) { - depth--; + depth-- } else { // Allow white-space between content and url in GFM mode. if (!pedantic) { while (index < length) { - character = value.charAt(index + 1); + character = value.charAt(index + 1) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - subqueue += character; - index++; + subqueue += character + index++ } } - if (value.charAt(index + 1) !== leftParenthesis$2) { + if (value.charAt(index + 1) !== leftParenthesis) { return } - subqueue += leftParenthesis$2; - closed = true; - index++; + subqueue += leftParenthesis + closed = true + index++ break } } - queue += subqueue; - subqueue = ''; - index++; + queue += subqueue + subqueue = '' + index++ } // Eat the content closing. @@ -26706,208 +31764,208 @@ function link$2(eat, value, silent) { return } - content = queue; - subvalue += queue + subqueue; - index++; + content = queue + subvalue += queue + subqueue + index++ // Eat white-space. while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - subvalue += character; - index++; + subvalue += character + index++ } // Eat the URL. - character = value.charAt(index); - queue = ''; - beforeURL = subvalue; + character = value.charAt(index) + queue = '' + beforeURL = subvalue - if (character === lessThan$5) { - index++; - beforeURL += lessThan$5; + if (character === lessThan) { + index++ + beforeURL += lessThan while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === greaterThan$3) { + if (character === greaterThan) { break } - if (commonmark && character === lineFeed$16) { + if (commonmark && character === lineFeed) { return } - queue += character; - index++; + queue += character + index++ } - if (value.charAt(index) !== greaterThan$3) { + if (value.charAt(index) !== greaterThan) { return } - subvalue += lessThan$5 + queue + greaterThan$3; - url = queue; - index++; + subvalue += lessThan + queue + greaterThan + url = queue + index++ } else { - character = null; - subqueue = ''; + character = null + subqueue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if ( subqueue && - (character === quotationMark$2 || - character === apostrophe$2 || - (commonmark && character === leftParenthesis$2)) + (character === quotationMark || + character === apostrophe || + (commonmark && character === leftParenthesis)) ) { break } - if (isWhitespaceCharacter(character)) { + if (whitespace(character)) { if (!pedantic) { break } - subqueue += character; + subqueue += character } else { - if (character === leftParenthesis$2) { - depth++; - } else if (character === rightParenthesis$3) { + if (character === leftParenthesis) { + depth++ + } else if (character === rightParenthesis) { if (depth === 0) { break } - depth--; + depth-- } - queue += subqueue; - subqueue = ''; + queue += subqueue + subqueue = '' - if (character === backslash$5) { - queue += backslash$5; - character = value.charAt(++index); + if (character === backslash) { + queue += backslash + character = value.charAt(++index) } - queue += character; + queue += character } - index++; + index++ } - subvalue += queue; - url = queue; - index = subvalue.length; + subvalue += queue + url = queue + index = subvalue.length } // Eat white-space. - queue = ''; + queue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - queue += character; - index++; + queue += character + index++ } - character = value.charAt(index); - subvalue += queue; + character = value.charAt(index) + subvalue += queue // Eat the title. if ( queue && - (character === quotationMark$2 || - character === apostrophe$2 || - (commonmark && character === leftParenthesis$2)) + (character === quotationMark || + character === apostrophe || + (commonmark && character === leftParenthesis)) ) { - index++; - subvalue += character; - queue = ''; - marker = character === leftParenthesis$2 ? rightParenthesis$3 : character; - beforeTitle = subvalue; + index++ + subvalue += character + queue = '' + marker = character === leftParenthesis ? rightParenthesis : character + beforeTitle = subvalue // In commonmark-mode, things are pretty easy: the marker cannot occur // inside the title. Non-commonmark does, however, support nested // delimiters. if (commonmark) { while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character === marker) { break } - if (character === backslash$5) { - queue += backslash$5; - character = value.charAt(++index); + if (character === backslash) { + queue += backslash + character = value.charAt(++index) } - index++; - queue += character; + index++ + queue += character } - character = value.charAt(index); + character = value.charAt(index) if (character !== marker) { return } - title = queue; - subvalue += queue + character; - index++; + title = queue + subvalue += queue + character + index++ while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - subvalue += character; - index++; + subvalue += character + index++ } } else { - subqueue = ''; + subqueue = '' while (index < length) { - character = value.charAt(index); + character = value.charAt(index) if (character === marker) { if (hasMarker) { - queue += marker + subqueue; - subqueue = ''; + queue += marker + subqueue + subqueue = '' } - hasMarker = true; + hasMarker = true } else if (!hasMarker) { - queue += character; - } else if (character === rightParenthesis$3) { - subvalue += queue + marker + subqueue; - title = queue; + queue += character + } else if (character === rightParenthesis) { + subvalue += queue + marker + subqueue + title = queue break - } else if (isWhitespaceCharacter(character)) { - subqueue += character; + } else if (whitespace(character)) { + subqueue += character } else { - queue += marker + subqueue + character; - subqueue = ''; - hasMarker = false; + queue += marker + subqueue + character + subqueue = '' + hasMarker = false } - index++; + index++ } } } - if (value.charAt(index) !== rightParenthesis$3) { + if (value.charAt(index) !== rightParenthesis) { return } @@ -26916,193 +31974,205 @@ function link$2(eat, value, silent) { return true } - subvalue += rightParenthesis$3; + subvalue += rightParenthesis url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, { nonTerminated: false - }); + }) if (title) { - beforeTitle = eat(beforeTitle).test().end; - title = self.decode.raw(self.unescape(title), beforeTitle); + beforeTitle = eat(beforeTitle).test().end + title = self.decode.raw(self.unescape(title), beforeTitle) } node = { type: isImage ? 'image' : 'link', title: title || null, url: url - }; + } if (isImage) { - node.alt = self.decode.raw(self.unescape(content), now) || null; + node.alt = self.decode.raw(self.unescape(content), now) || null } else { - exit = self.enterLink(); - node.children = self.tokenizeInline(content, now); - exit(); + exit = self.enterLink() + node.children = self.tokenizeInline(content, now) + exit() } return eat(subvalue)(node) } -var reference_1 = reference; -reference.locator = link; -var link$3 = 'link'; -var image$1 = 'image'; -var footnote = 'footnote'; -var shortcut = 'shortcut'; -var collapsed = 'collapsed'; -var full = 'full'; -var space$14 = ' '; -var exclamationMark$3 = '!'; -var leftSquareBracket$4 = '['; -var backslash$6 = '\\'; -var rightSquareBracket$4 = ']'; -var caret$2 = '^'; +/***/ }), +/* 245 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(86) +var normalize = __webpack_require__(42) + +module.exports = reference +reference.locator = locate + +var link = 'link' +var image = 'image' +var footnote = 'footnote' +var shortcut = 'shortcut' +var collapsed = 'collapsed' +var full = 'full' +var space = ' ' +var exclamationMark = '!' +var leftSquareBracket = '[' +var backslash = '\\' +var rightSquareBracket = ']' +var caret = '^' function reference(eat, value, silent) { - var self = this; - var commonmark = self.options.commonmark; - var character = value.charAt(0); - var index = 0; - var length = value.length; - var subvalue = ''; - var intro = ''; - var type = link$3; - var referenceType = shortcut; - var content; - var identifier; - var now; - var node; - var exit; - var queue; - var bracketed; - var depth; + var self = this + var commonmark = self.options.commonmark + var character = value.charAt(0) + var index = 0 + var length = value.length + var subvalue = '' + var intro = '' + var type = link + var referenceType = shortcut + var content + var identifier + var now + var node + var exit + var queue + var bracketed + var depth // Check whether we’re eating an image. - if (character === exclamationMark$3) { - type = image$1; - intro = character; - character = value.charAt(++index); + if (character === exclamationMark) { + type = image + intro = character + character = value.charAt(++index) } - if (character !== leftSquareBracket$4) { + if (character !== leftSquareBracket) { return } - index++; - intro += character; - queue = ''; + index++ + intro += character + queue = '' // Check whether we’re eating a footnote. - if (self.options.footnotes && value.charAt(index) === caret$2) { + if (self.options.footnotes && value.charAt(index) === caret) { // Exit if `![^` is found, so the `!` will be seen as text after this, // and we’ll enter this function again when `[^` is found. - if (type === image$1) { + if (type === image) { return } - intro += caret$2; - index++; - type = footnote; + intro += caret + index++ + type = footnote } // Eat the text. - depth = 0; + depth = 0 while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === leftSquareBracket$4) { - bracketed = true; - depth++; - } else if (character === rightSquareBracket$4) { + if (character === leftSquareBracket) { + bracketed = true + depth++ + } else if (character === rightSquareBracket) { if (!depth) { break } - depth--; + depth-- } - if (character === backslash$6) { - queue += backslash$6; - character = value.charAt(++index); + if (character === backslash) { + queue += backslash + character = value.charAt(++index) } - queue += character; - index++; + queue += character + index++ } - subvalue = queue; - content = queue; - character = value.charAt(index); + subvalue = queue + content = queue + character = value.charAt(index) - if (character !== rightSquareBracket$4) { + if (character !== rightSquareBracket) { return } - index++; - subvalue += character; - queue = ''; + index++ + subvalue += character + queue = '' if (!commonmark) { // The original markdown syntax definition explicitly allows for whitespace // between the link text and link label; commonmark departs from this, in // part to improve support for shortcut reference links while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (!isWhitespaceCharacter(character)) { + if (!whitespace(character)) { break } - queue += character; - index++; + queue += character + index++ } } - character = value.charAt(index); + character = value.charAt(index) // Inline footnotes cannot have an identifier. - if (type !== footnote && character === leftSquareBracket$4) { - identifier = ''; - queue += character; - index++; + if (type !== footnote && character === leftSquareBracket) { + identifier = '' + queue += character + index++ while (index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === leftSquareBracket$4 || character === rightSquareBracket$4) { + if (character === leftSquareBracket || character === rightSquareBracket) { break } - if (character === backslash$6) { - identifier += backslash$6; - character = value.charAt(++index); + if (character === backslash) { + identifier += backslash + character = value.charAt(++index) } - identifier += character; - index++; + identifier += character + index++ } - character = value.charAt(index); + character = value.charAt(index) - if (character === rightSquareBracket$4) { - referenceType = identifier ? full : collapsed; - queue += identifier + character; - index++; + if (character === rightSquareBracket) { + referenceType = identifier ? full : collapsed + queue += identifier + character + index++ } else { - identifier = ''; + identifier = '' } - subvalue += queue; - queue = ''; + subvalue += queue + queue = '' } else { if (!content) { return } - identifier = content; + identifier = content } // Brackets cannot be inside the identifier. @@ -27110,9 +32180,9 @@ function reference(eat, value, silent) { return } - subvalue = intro + subvalue; + subvalue = intro + subvalue - if (type === link$3 && self.inLink) { + if (type === link && self.inLink) { return null } @@ -27121,107 +32191,102 @@ function reference(eat, value, silent) { return true } - if (type === footnote && content.indexOf(space$14) !== -1) { + if (type === footnote && content.indexOf(space) !== -1) { return eat(subvalue)({ type: footnote, children: this.tokenizeInline(content, eat.now()) }) } - now = eat.now(); - now.column += intro.length; - now.offset += intro.length; - identifier = referenceType === full ? identifier : content; + now = eat.now() + now.column += intro.length + now.offset += intro.length + identifier = referenceType === full ? identifier : content node = { type: type + 'Reference', - identifier: normalize_1(identifier), + identifier: normalize(identifier), label: identifier - }; + } - if (type === link$3 || type === image$1) { - node.referenceType = referenceType; + if (type === link || type === image) { + node.referenceType = referenceType } - if (type === link$3) { - exit = self.enterLink(); - node.children = self.tokenizeInline(content, now); - exit(); - } else if (type === image$1) { - node.alt = self.decode.raw(self.unescape(content), now) || null; + if (type === link) { + exit = self.enterLink() + node.children = self.tokenizeInline(content, now) + exit() + } else if (type === image) { + node.alt = self.decode.raw(self.unescape(content), now) || null } return eat(subvalue)(node) } -var strong = locate$8; -function locate$8(value, fromIndex) { - var asterisk = value.indexOf('**', fromIndex); - var underscore = value.indexOf('__', fromIndex); +/***/ }), +/* 246 */ +/***/ (function(module, exports, __webpack_require__) { - if (underscore === -1) { - return asterisk - } +"use strict"; - if (asterisk === -1) { - return underscore - } - return underscore < asterisk ? underscore : asterisk -} +var trim = __webpack_require__(14) +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(247) -var strong_1 = strong$2; -strong$2.locator = strong; +module.exports = strong +strong.locator = locate -var backslash$7 = '\\'; -var asterisk$2 = '*'; -var underscore$2 = '_'; +var backslash = '\\' +var asterisk = '*' +var underscore = '_' -function strong$2(eat, value, silent) { - var self = this; - var index = 0; - var character = value.charAt(index); - var now; - var pedantic; - var marker; - var queue; - var subvalue; - var length; - var prev; +function strong(eat, value, silent) { + var self = this + var index = 0 + var character = value.charAt(index) + var now + var pedantic + var marker + var queue + var subvalue + var length + var prev if ( - (character !== asterisk$2 && character !== underscore$2) || + (character !== asterisk && character !== underscore) || value.charAt(++index) !== character ) { return } - pedantic = self.options.pedantic; - marker = character; - subvalue = marker + marker; - length = value.length; - index++; - queue = ''; - character = ''; + pedantic = self.options.pedantic + marker = character + subvalue = marker + marker + length = value.length + index++ + queue = '' + character = '' - if (pedantic && isWhitespaceCharacter(value.charAt(index))) { + if (pedantic && whitespace(value.charAt(index))) { return } while (index < length) { - prev = character; - character = value.charAt(index); + prev = character + character = value.charAt(index) if ( character === marker && value.charAt(index + 1) === marker && - (!pedantic || !isWhitespaceCharacter(prev)) + (!pedantic || !whitespace(prev)) ) { - character = value.charAt(index + 2); + character = value.charAt(index + 2) if (character !== marker) { - if (!trim_1(queue)) { + if (!trim(queue)) { return } @@ -27230,9 +32295,9 @@ function strong$2(eat, value, silent) { return true } - now = eat.now(); - now.column += 2; - now.offset += 2; + now = eat.now() + now.column += 2 + now.offset += 2 return eat(subvalue + queue + subvalue)({ type: 'strong', @@ -27241,34 +32306,29 @@ function strong$2(eat, value, silent) { } } - if (!pedantic && character === backslash$7) { - queue += character; - character = value.charAt(++index); + if (!pedantic && character === backslash) { + queue += character + character = value.charAt(++index) } - queue += character; - index++; + queue += character + index++ } } -var isWordCharacter = wordCharacter; -var fromCode$1 = String.fromCharCode; -var re$2 = /\w/; +/***/ }), +/* 247 */ +/***/ (function(module, exports, __webpack_require__) { -/* Check if the given character code, or the character - * code at the first character, is a word character. */ -function wordCharacter(character) { - return re$2.test( - typeof character === 'number' ? fromCode$1(character) : character.charAt(0) - ) -} +"use strict"; -var emphasis = locate$10; -function locate$10(value, fromIndex) { - var asterisk = value.indexOf('*', fromIndex); - var underscore = value.indexOf('_', fromIndex); +module.exports = locate + +function locate(value, fromIndex) { + var asterisk = value.indexOf('**', fromIndex) + var underscore = value.indexOf('__', fromIndex) if (underscore === -1) { return asterisk @@ -27281,130 +32341,194 @@ function locate$10(value, fromIndex) { return underscore < asterisk ? underscore : asterisk } -var emphasis_1 = emphasis$2; -emphasis$2.locator = emphasis; -var asterisk$3 = '*'; -var underscore$3 = '_'; -var backslash$8 = '\\'; +/***/ }), +/* 248 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -function emphasis$2(eat, value, silent) { - var self = this; - var index = 0; - var character = value.charAt(index); - var now; - var pedantic; - var marker; - var queue; - var subvalue; - var length; - var prev; - if (character !== asterisk$3 && character !== underscore$3) { +var trim = __webpack_require__(14) +var word = __webpack_require__(249) +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(250) + +module.exports = emphasis +emphasis.locator = locate + +var asterisk = '*' +var underscore = '_' +var backslash = '\\' + +function emphasis(eat, value, silent) { + var self = this + var index = 0 + var character = value.charAt(index) + var now + var pedantic + var marker + var queue + var subvalue + var length + var prev + + if (character !== asterisk && character !== underscore) { return } - pedantic = self.options.pedantic; - subvalue = character; - marker = character; - length = value.length; - index++; - queue = ''; - character = ''; + pedantic = self.options.pedantic + subvalue = character + marker = character + length = value.length + index++ + queue = '' + character = '' - if (pedantic && isWhitespaceCharacter(value.charAt(index))) { + if (pedantic && whitespace(value.charAt(index))) { return } while (index < length) { - prev = character; - character = value.charAt(index); + prev = character + character = value.charAt(index) - if (character === marker && (!pedantic || !isWhitespaceCharacter(prev))) { - character = value.charAt(++index); + if (character === marker && (!pedantic || !whitespace(prev))) { + character = value.charAt(++index) if (character !== marker) { - if (!trim_1(queue) || prev === marker) { + if (!trim(queue) || prev === marker) { return } - if (!pedantic && marker === underscore$3 && isWordCharacter(character)) { - queue += marker; - continue - } + if (!pedantic && marker === underscore && word(character)) { + queue += marker + continue + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true + } + + now = eat.now() + now.column++ + now.offset++ + + return eat(subvalue + queue + marker)({ + type: 'emphasis', + children: self.tokenizeInline(queue, now) + }) + } + + queue += marker + } + + if (!pedantic && character === backslash) { + queue += character + character = value.charAt(++index) + } + + queue += character + index++ + } +} + + +/***/ }), +/* 249 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = wordCharacter + +var fromCode = String.fromCharCode +var re = /\w/ + +/* Check if the given character code, or the character + * code at the first character, is a word character. */ +function wordCharacter(character) { + return re.test( + typeof character === 'number' ? fromCode(character) : character.charAt(0) + ) +} + + +/***/ }), +/* 250 */ +/***/ (function(module, exports, __webpack_require__) { - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true - } +"use strict"; - now = eat.now(); - now.column++; - now.offset++; - return eat(subvalue + queue + marker)({ - type: 'emphasis', - children: self.tokenizeInline(queue, now) - }) - } +module.exports = locate - queue += marker; - } +function locate(value, fromIndex) { + var asterisk = value.indexOf('*', fromIndex) + var underscore = value.indexOf('_', fromIndex) - if (!pedantic && character === backslash$8) { - queue += character; - character = value.charAt(++index); - } + if (underscore === -1) { + return asterisk + } - queue += character; - index++; + if (asterisk === -1) { + return underscore } + + return underscore < asterisk ? underscore : asterisk } -var _delete = locate$12; -function locate$12(value, fromIndex) { - return value.indexOf('~~', fromIndex) -} +/***/ }), +/* 251 */ +/***/ (function(module, exports, __webpack_require__) { -var _delete$2 = strikethrough; -strikethrough.locator = _delete; +"use strict"; -var tilde$2 = '~'; -var fence = '~~'; + +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(252) + +module.exports = strikethrough +strikethrough.locator = locate + +var tilde = '~' +var fence = '~~' function strikethrough(eat, value, silent) { - var self = this; - var character = ''; - var previous = ''; - var preceding = ''; - var subvalue = ''; - var index; - var length; - var now; + var self = this + var character = '' + var previous = '' + var preceding = '' + var subvalue = '' + var index + var length + var now if ( !self.options.gfm || - value.charAt(0) !== tilde$2 || - value.charAt(1) !== tilde$2 || - isWhitespaceCharacter(value.charAt(2)) + value.charAt(0) !== tilde || + value.charAt(1) !== tilde || + whitespace(value.charAt(2)) ) { return } - index = 1; - length = value.length; - now = eat.now(); - now.column += 2; - now.offset += 2; + index = 1 + length = value.length + now = eat.now() + now.column += 2 + now.offset += 2 while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) if ( - character === tilde$2 && - previous === tilde$2 && - (!preceding || !isWhitespaceCharacter(preceding)) + character === tilde && + previous === tilde && + (!preceding || !whitespace(preceding)) ) { /* istanbul ignore if - never used (yet) */ if (silent) { @@ -27417,80 +32541,99 @@ function strikethrough(eat, value, silent) { }) } - subvalue += previous; - preceding = previous; - previous = character; + subvalue += previous + preceding = previous + previous = character } } -var codeInline = locate$14; -function locate$14(value, fromIndex) { - return value.indexOf('`', fromIndex) +/***/ }), +/* 252 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +function locate(value, fromIndex) { + return value.indexOf('~~', fromIndex) } -var codeInline$2 = inlineCode; -inlineCode.locator = codeInline; -var graveAccent$3 = '`'; +/***/ }), +/* 253 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var whitespace = __webpack_require__(8) +var locate = __webpack_require__(254) + +module.exports = inlineCode +inlineCode.locator = locate + +var graveAccent = '`' function inlineCode(eat, value, silent) { - var length = value.length; - var index = 0; - var queue = ''; - var tickQueue = ''; - var contentQueue; - var subqueue; - var count; - var openingCount; - var subvalue; - var character; - var found; - var next; + var length = value.length + var index = 0 + var queue = '' + var tickQueue = '' + var contentQueue + var subqueue + var count + var openingCount + var subvalue + var character + var found + var next while (index < length) { - if (value.charAt(index) !== graveAccent$3) { + if (value.charAt(index) !== graveAccent) { break } - queue += graveAccent$3; - index++; + queue += graveAccent + index++ } if (!queue) { return } - subvalue = queue; - openingCount = index; - queue = ''; - next = value.charAt(index); - count = 0; + subvalue = queue + openingCount = index + queue = '' + next = value.charAt(index) + count = 0 while (index < length) { - character = next; - next = value.charAt(index + 1); + character = next + next = value.charAt(index + 1) - if (character === graveAccent$3) { - count++; - tickQueue += character; + if (character === graveAccent) { + count++ + tickQueue += character } else { - count = 0; - queue += character; + count = 0 + queue += character } - if (count && next !== graveAccent$3) { + if (count && next !== graveAccent) { if (count === openingCount) { - subvalue += queue + tickQueue; - found = true; + subvalue += queue + tickQueue + found = true break } - queue += tickQueue; - tickQueue = ''; + queue += tickQueue + tickQueue = '' } - index++; + index++ } if (!found) { @@ -27498,7 +32641,7 @@ function inlineCode(eat, value, silent) { return } - queue = ''; + queue = '' } /* istanbul ignore if - never used (yet) */ @@ -27506,66 +32649,74 @@ function inlineCode(eat, value, silent) { return true } - contentQueue = ''; - subqueue = ''; - length = queue.length; - index = -1; + contentQueue = '' + subqueue = '' + length = queue.length + index = -1 while (++index < length) { - character = queue.charAt(index); + character = queue.charAt(index) - if (isWhitespaceCharacter(character)) { - subqueue += character; + if (whitespace(character)) { + subqueue += character continue } if (subqueue) { if (contentQueue) { - contentQueue += subqueue; + contentQueue += subqueue } - subqueue = ''; + subqueue = '' } - contentQueue += character; + contentQueue += character } return eat(subvalue)({type: 'inlineCode', value: contentQueue}) } -var _break = locate$16; -function locate$16(value, fromIndex) { - var index = value.indexOf('\n', fromIndex); +/***/ }), +/* 254 */ +/***/ (function(module, exports, __webpack_require__) { - while (index > fromIndex) { - if (value.charAt(index - 1) !== ' ') { - break - } +"use strict"; - index--; - } - return index +module.exports = locate + +function locate(value, fromIndex) { + return value.indexOf('`', fromIndex) } -var _break$2 = hardBreak; -hardBreak.locator = _break; -var space$15 = ' '; -var lineFeed$17 = '\n'; -var minBreakLength = 2; +/***/ }), +/* 255 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var locate = __webpack_require__(256) + +module.exports = hardBreak +hardBreak.locator = locate + +var space = ' ' +var lineFeed = '\n' +var minBreakLength = 2 function hardBreak(eat, value, silent) { - var length = value.length; - var index = -1; - var queue = ''; - var character; + var length = value.length + var index = -1 + var queue = '' + var character while (++index < length) { - character = value.charAt(index); + character = value.charAt(index) - if (character === lineFeed$17) { + if (character === lineFeed) { if (index < minBreakLength) { return } @@ -27575,1107 +32726,456 @@ function hardBreak(eat, value, silent) { return true } - queue += character; + queue += character return eat(queue)({type: 'break'}) } - if (character !== space$15) { + if (character !== space) { return } - queue += character; + queue += character + } +} + + +/***/ }), +/* 256 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = locate + +function locate(value, fromIndex) { + var index = value.indexOf('\n', fromIndex) + + while (index > fromIndex) { + if (value.charAt(index - 1) !== ' ') { + break + } + + index-- } + + return index } -var text_1 = text; + +/***/ }), +/* 257 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = text function text(eat, value, silent) { - var self = this; - var methods; - var tokenizers; - var index; - var length; - var subvalue; - var position; - var tokenizer; - var name; - var min; - var now; + var self = this + var methods + var tokenizers + var index + var length + var subvalue + var position + var tokenizer + var name + var min + var now /* istanbul ignore if - never used (yet) */ if (silent) { return true } - methods = self.inlineMethods; - length = methods.length; - tokenizers = self.inlineTokenizers; - index = -1; - min = value.length; + methods = self.inlineMethods + length = methods.length + tokenizers = self.inlineTokenizers + index = -1 + min = value.length while (++index < length) { - name = methods[index]; + name = methods[index] if (name === 'text' || !tokenizers[name]) { continue } - tokenizer = tokenizers[name].locator; + tokenizer = tokenizers[name].locator if (!tokenizer) { - eat.file.fail('Missing locator: `' + name + '`'); + eat.file.fail('Missing locator: `' + name + '`') } - position = tokenizer.call(self, value, 1); + position = tokenizer.call(self, value, 1) if (position !== -1 && position < min) { - min = position; + min = position } } - subvalue = value.slice(0, min); - now = eat.now(); + subvalue = value.slice(0, min) + now = eat.now() - self.decode(subvalue, now, handler); + self.decode(subvalue, now, handler) function handler(content, position, source) { - eat(source || content)({type: 'text', value: content}); + eat(source || content)({type: 'text', value: content}) } } -var parser = Parser; -function Parser(doc, file) { - this.file = file; - this.offset = {}; - this.options = immutable(this.options); - this.setOptions({}); +/***/ }), +/* 258 */ +/***/ (function(module, exports, __webpack_require__) { - this.inList = false; - this.inBlock = false; - this.inLink = false; - this.atStart = true; +"use strict"; - this.toOffset = vfileLocation(file).toOffset; - this.unescape = _unescape(this, 'escape'); - this.decode = decode$1(this); + +var unherit = __webpack_require__(75) +var xtend = __webpack_require__(7) +var Compiler = __webpack_require__(259) + +module.exports = stringify +stringify.Compiler = Compiler + +function stringify(options) { + var Local = unherit(Compiler) + Local.prototype.options = xtend( + Local.prototype.options, + this.data('settings'), + options + ) + this.Compiler = Local } -var proto$5 = Parser.prototype; -// Expose core. -proto$5.setOptions = setOptions_1; -proto$5.parse = parse_1$3; +/***/ }), +/* 259 */ +/***/ (function(module, exports, __webpack_require__) { -// Expose `defaults`. -proto$5.options = defaults$2; +"use strict"; -// Enter and exit helpers. -proto$5.exitStart = stateToggle('atStart', true); -proto$5.enterList = stateToggle('inList', false); -proto$5.enterLink = stateToggle('inLink', false); -proto$5.enterBlock = stateToggle('inBlock', false); -// Nodes that can interupt a paragraph: -// -// ```markdown -// A paragraph, followed by a thematic break. -// ___ -// ``` -// -// In the above example, the thematic break “interupts” the paragraph. -proto$5.interruptParagraph = [ - ['thematicBreak'], - ['atxHeading'], - ['fencedCode'], - ['blockquote'], - ['html'], - ['setextHeading', {commonmark: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -]; +var xtend = __webpack_require__(7) +var toggle = __webpack_require__(76) -// Nodes that can interupt a list: -// -// ```markdown -// - One -// ___ -// ``` -// -// In the above example, the thematic break “interupts” the list. -proto$5.interruptList = [ - ['atxHeading', {pedantic: false}], - ['fencedCode', {pedantic: false}], - ['thematicBreak', {pedantic: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -]; +module.exports = Compiler -// Nodes that can interupt a blockquote: +// Construct a new compiler. +function Compiler(tree, file) { + this.inLink = false + this.inTable = false + this.tree = tree + this.file = file + this.options = xtend(this.options) + this.setOptions({}) +} + +var proto = Compiler.prototype + +// Enter and exit helpers. */ +proto.enterLink = toggle('inLink', false) +proto.enterTable = toggle('inTable', false) +proto.enterLinkReference = __webpack_require__(260) + +// Configuration. +proto.options = __webpack_require__(88) +proto.setOptions = __webpack_require__(261) + +proto.compile = __webpack_require__(267) +proto.visit = __webpack_require__(269) +proto.all = __webpack_require__(270) +proto.block = __webpack_require__(271) +proto.visitOrderedItems = __webpack_require__(272) +proto.visitUnorderedItems = __webpack_require__(273) + +// Expose visitors. +proto.visitors = { + root: __webpack_require__(274), + text: __webpack_require__(275), + heading: __webpack_require__(276), + paragraph: __webpack_require__(277), + blockquote: __webpack_require__(278), + list: __webpack_require__(279), + listItem: __webpack_require__(280), + inlineCode: __webpack_require__(281), + code: __webpack_require__(282), + html: __webpack_require__(283), + thematicBreak: __webpack_require__(284), + strong: __webpack_require__(285), + emphasis: __webpack_require__(286), + break: __webpack_require__(287), + delete: __webpack_require__(288), + link: __webpack_require__(289), + linkReference: __webpack_require__(291), + imageReference: __webpack_require__(293), + definition: __webpack_require__(294), + image: __webpack_require__(295), + footnote: __webpack_require__(296), + footnoteReference: __webpack_require__(297), + footnoteDefinition: __webpack_require__(298), + table: __webpack_require__(299), + tableCell: __webpack_require__(301) +} + + +/***/ }), +/* 260 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var identity = __webpack_require__(87) + +module.exports = enter + +// Shortcut and collapsed link references need no escaping and encoding during +// the processing of child nodes (it must be implied from identifier). // -// ```markdown -// > A paragraph. -// ___ -// ``` +// This toggler turns encoding and escaping off for shortcut and collapsed +// references. // -// In the above example, the thematic break “interupts” the blockquote. -proto$5.interruptBlockquote = [ - ['indentedCode', {commonmark: true}], - ['fencedCode', {commonmark: true}], - ['atxHeading', {commonmark: true}], - ['setextHeading', {commonmark: true}], - ['thematicBreak', {commonmark: true}], - ['html', {commonmark: true}], - ['list', {commonmark: true}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] -]; +// Implies `enterLink`. +function enter(compiler, node) { + var encode = compiler.encode + var escape = compiler.escape + var exitLink = compiler.enterLink() -// Handlers. -proto$5.blockTokenizers = { - newline: newline_1, - indentedCode: codeIndented, - fencedCode: codeFenced, - blockquote: blockquote_1, - atxHeading: headingAtx, - thematicBreak: thematicBreak_1, - list: list_1, - setextHeading: headingSetext, - html: htmlBlock, - footnote: footnoteDefinition_1, - definition: definition_1, - table: table_1, - paragraph: paragraph_1 -}; + if (node.referenceType !== 'shortcut' && node.referenceType !== 'collapsed') { + return exitLink + } -proto$5.inlineTokenizers = { - escape: _escape$2, - autoLink: autoLink_1, - url: url_1, - html: htmlInline, - link: link_1, - reference: reference_1, - strong: strong_1, - emphasis: emphasis_1, - deletion: _delete$2, - code: codeInline$2, - break: _break$2, - text: text_1 -}; + compiler.escape = identity + compiler.encode = identity -// Expose precedence. -proto$5.blockMethods = keys$1(proto$5.blockTokenizers); -proto$5.inlineMethods = keys$1(proto$5.inlineTokenizers); + return exit -// Tokenizers. -proto$5.tokenizeBlock = tokenizer('block'); -proto$5.tokenizeInline = tokenizer('inline'); -proto$5.tokenizeFactory = tokenizer; + function exit() { + compiler.encode = encode + compiler.escape = escape + exitLink() + } +} -// Get all keys in `value`. -function keys$1(value) { - var result = []; - var key; - for (key in value) { - result.push(key); +/***/ }), +/* 261 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var xtend = __webpack_require__(7) +var encode = __webpack_require__(262) +var defaults = __webpack_require__(88) +var escapeFactory = __webpack_require__(265) +var identity = __webpack_require__(87) + +module.exports = setOptions + +// Map of applicable enums. +var maps = { + entities: {true: true, false: true, numbers: true, escape: true}, + bullet: {'*': true, '-': true, '+': true}, + rule: {'-': true, _: true, '*': true}, + listItemIndent: {tab: true, mixed: true, 1: true}, + emphasis: {_: true, '*': true}, + strong: {_: true, '*': true}, + fence: {'`': true, '~': true} +} + +// Expose `validate`. +var validate = { + boolean: validateBoolean, + string: validateString, + number: validateNumber, + function: validateFunction +} + +// Set options. Does not overwrite previously set options. +function setOptions(options) { + var self = this + var current = self.options + var ruleRepetition + var key + + if (options == null) { + options = {} + } else if (typeof options === 'object') { + options = xtend(options) + } else { + throw new Error('Invalid value `' + options + '` for setting `options`') + } + + for (key in defaults) { + validate[typeof defaults[key]](options, key, current[key], maps[key]) + } + + ruleRepetition = options.ruleRepetition + + if (ruleRepetition && ruleRepetition < 3) { + raise(ruleRepetition, 'options.ruleRepetition') + } + + self.encode = encodeFactory(String(options.entities)) + self.escape = escapeFactory(options) + + self.options = options + + return self +} + +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. +function validateBoolean(context, name, def) { + var value = context[name] + + if (value == null) { + value = def + } + + if (typeof value !== 'boolean') { + raise(value, 'options.' + name) + } + + context[name] = value +} + +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. +function validateNumber(context, name, def) { + var value = context[name] + + if (value == null) { + value = def + } + + if (isNaN(value)) { + raise(value, 'options.' + name) + } + + context[name] = value +} + +// Validate a value to be in `map`. Defaults to `def`. Raises an exception +// with `context[name]` when not in `map`. +function validateString(context, name, def, map) { + var value = context[name] + + if (value == null) { + value = def + } + + value = String(value) + + if (!(value in map)) { + raise(value, 'options.' + name) } - return result + context[name] = value } -var remarkParse = parse$9; -parse$9.Parser = parser; - -function parse$9(options) { - var settings = this.data('settings'); - var Local = unherit_1(parser); - - Local.prototype.options = immutable(Local.prototype.options, settings, options); +// Validate a value to be function. Defaults to `def`. Raises an exception +// with `context[name]` when not a function. +function validateFunction(context, name, def) { + var value = context[name] - this.Parser = Local; -} + if (value == null) { + value = def + } -var identity_1 = identity$1; + if (typeof value !== 'function') { + raise(value, 'options.' + name) + } -function identity$1(value) { - return value + context[name] = value } -var enterLinkReference = enter; +// Factory to encode HTML entities. Creates a no-operation function when +// `type` is `'false'`, a function which encodes using named references when +// `type` is `'true'`, and a function which encodes using numbered references +// when `type` is `'numbers'`. +function encodeFactory(type) { + var options = {} -// Shortcut and collapsed link references need no escaping and encoding during -// the processing of child nodes (it must be implied from identifier). -// -// This toggler turns encoding and escaping off for shortcut and collapsed -// references. -// -// Implies `enterLink`. -function enter(compiler, node) { - var encode = compiler.encode; - var escape = compiler.escape; - var exitLink = compiler.enterLink(); + if (type === 'false') { + return identity + } - if (node.referenceType !== 'shortcut' && node.referenceType !== 'collapsed') { - return exitLink + if (type === 'true') { + options.useNamedReferences = true } - compiler.escape = identity_1; - compiler.encode = identity_1; + if (type === 'escape') { + options.escapeOnly = true + options.useNamedReferences = true + } - return exit + return wrapped - function exit() { - compiler.encode = encode; - compiler.escape = escape; - exitLink(); + // Encode HTML entities using the bound options. + function wrapped(value) { + return encode(value, options) } } -var defaults$5 = { - gfm: true, - commonmark: false, - pedantic: false, - entities: 'false', - setext: false, - closeAtx: false, - looseTable: false, - spacedTable: true, - paddedTable: true, - stringLength: stringLength, - incrementListMarker: true, - fences: false, - fence: '`', - bullet: '-', - listItemIndent: 'tab', - rule: '*', - ruleSpaces: true, - ruleRepetition: 3, - strong: '*', - emphasis: '_' -}; - -function stringLength(value) { - return value.length +// Throw an exception with in its `message` `value` and `name`. +function raise(value, name) { + throw new Error('Invalid value `' + value + '` for setting `' + name + '`') } -const nbsp$2 = " "; -const iexcl$2 = "¡"; -const cent$2 = "¢"; -const pound$2 = "£"; -const curren$2 = "¤"; -const yen$2 = "¥"; -const brvbar$2 = "¦"; -const sect$2 = "§"; -const uml$2 = "¨"; -const copy$4 = "©"; -const ordf$2 = "ª"; -const laquo$2 = "«"; -const not$2 = "¬"; -const shy$2 = "­"; -const reg$2 = "®"; -const macr$2 = "¯"; -const deg$2 = "°"; -const plusmn$2 = "±"; -const sup2$2 = "²"; -const sup3$2 = "³"; -const acute$2 = "´"; -const micro$2 = "µ"; -const para$2 = "¶"; -const middot$2 = "·"; -const cedil$2 = "¸"; -const sup1$2 = "¹"; -const ordm$2 = "º"; -const raquo$2 = "»"; -const frac14$2 = "¼"; -const frac12$2 = "½"; -const frac34$2 = "¾"; -const iquest$2 = "¿"; -const Agrave$2 = "À"; -const Aacute$2 = "Á"; -const Acirc$2 = "Â"; -const Atilde$2 = "Ã"; -const Auml$2 = "Ä"; -const Aring$2 = "Å"; -const AElig$2 = "Æ"; -const Ccedil$2 = "Ç"; -const Egrave$2 = "È"; -const Eacute$2 = "É"; -const Ecirc$2 = "Ê"; -const Euml$2 = "Ë"; -const Igrave$2 = "Ì"; -const Iacute$2 = "Í"; -const Icirc$2 = "Î"; -const Iuml$2 = "Ï"; -const ETH$2 = "Ð"; -const Ntilde$2 = "Ñ"; -const Ograve$2 = "Ò"; -const Oacute$2 = "Ó"; -const Ocirc$2 = "Ô"; -const Otilde$2 = "Õ"; -const Ouml$2 = "Ö"; -const times$2 = "×"; -const Oslash$2 = "Ø"; -const Ugrave$2 = "Ù"; -const Uacute$2 = "Ú"; -const Ucirc$2 = "Û"; -const Uuml$2 = "Ü"; -const Yacute$2 = "Ý"; -const THORN$2 = "Þ"; -const szlig$2 = "ß"; -const agrave$2 = "à"; -const aacute$2 = "á"; -const acirc$2 = "â"; -const atilde$2 = "ã"; -const auml$2 = "ä"; -const aring$2 = "å"; -const aelig$2 = "æ"; -const ccedil$2 = "ç"; -const egrave$2 = "è"; -const eacute$2 = "é"; -const ecirc$2 = "ê"; -const euml$2 = "ë"; -const igrave$2 = "ì"; -const iacute$2 = "í"; -const icirc$2 = "î"; -const iuml$2 = "ï"; -const eth$2 = "ð"; -const ntilde$2 = "ñ"; -const ograve$2 = "ò"; -const oacute$2 = "ó"; -const ocirc$2 = "ô"; -const otilde$2 = "õ"; -const ouml$2 = "ö"; -const divide$2 = "÷"; -const oslash$2 = "ø"; -const ugrave$2 = "ù"; -const uacute$2 = "ú"; -const ucirc$2 = "û"; -const uuml$2 = "ü"; -const yacute$2 = "ý"; -const thorn$2 = "þ"; -const yuml$2 = "ÿ"; -const fnof$1 = "ƒ"; -const Alpha$1 = "Α"; -const Beta$1 = "Β"; -const Gamma$1 = "Γ"; -const Delta$1 = "Δ"; -const Epsilon$1 = "Ε"; -const Zeta$1 = "Ζ"; -const Eta$1 = "Η"; -const Theta$1 = "Θ"; -const Iota$1 = "Ι"; -const Kappa$1 = "Κ"; -const Lambda$1 = "Λ"; -const Mu$1 = "Μ"; -const Nu$1 = "Ν"; -const Xi$1 = "Ξ"; -const Omicron$1 = "Ο"; -const Pi$1 = "Π"; -const Rho$1 = "Ρ"; -const Sigma$1 = "Σ"; -const Tau$1 = "Τ"; -const Upsilon$1 = "Υ"; -const Phi$1 = "Φ"; -const Chi$1 = "Χ"; -const Psi$1 = "Ψ"; -const Omega$1 = "Ω"; -const alpha$1 = "α"; -const beta$1 = "β"; -const gamma$1 = "γ"; -const delta$1 = "δ"; -const epsilon$1 = "ε"; -const zeta$1 = "ζ"; -const eta$1 = "η"; -const theta$1 = "θ"; -const iota$1 = "ι"; -const kappa$1 = "κ"; -const lambda$1 = "λ"; -const mu$1 = "μ"; -const nu$1 = "ν"; -const xi$1 = "ξ"; -const omicron$1 = "ο"; -const pi$1 = "π"; -const rho$1 = "ρ"; -const sigmaf$1 = "ς"; -const sigma$1 = "σ"; -const tau$1 = "τ"; -const upsilon$1 = "υ"; -const phi$1 = "φ"; -const chi$1 = "χ"; -const psi$1 = "ψ"; -const omega$1 = "ω"; -const thetasym$1 = "ϑ"; -const upsih$1 = "ϒ"; -const piv$1 = "ϖ"; -const bull$1 = "•"; -const hellip$1 = "…"; -const prime$1 = "′"; -const Prime$1 = "″"; -const oline$1 = "‾"; -const frasl$1 = "⁄"; -const weierp$1 = "℘"; -const image$2 = "ℑ"; -const real$1 = "ℜ"; -const trade$1 = "™"; -const alefsym$1 = "ℵ"; -const larr$1 = "←"; -const uarr$1 = "↑"; -const rarr$1 = "→"; -const darr$1 = "↓"; -const harr$1 = "↔"; -const crarr$1 = "↵"; -const lArr$1 = "⇐"; -const uArr$1 = "⇑"; -const rArr$1 = "⇒"; -const dArr$1 = "⇓"; -const hArr$1 = "⇔"; -const forall$1 = "∀"; -const part$1 = "∂"; -const exist$1 = "∃"; -const empty$1 = "∅"; -const nabla$1 = "∇"; -const isin$1 = "∈"; -const notin$1 = "∉"; -const ni$1 = "∋"; -const prod$1 = "∏"; -const sum$1 = "∑"; -const minus$1 = "−"; -const lowast$1 = "∗"; -const radic$1 = "√"; -const prop$1 = "∝"; -const infin$1 = "∞"; -const ang$1 = "∠"; -const and$1 = "∧"; -const or$1 = "∨"; -const cap$1 = "∩"; -const cup$1 = "∪"; -const int$1 = "∫"; -const there4$1 = "∴"; -const sim$1 = "∼"; -const cong$1 = "≅"; -const asymp$1 = "≈"; -const ne$1 = "≠"; -const equiv$1 = "≡"; -const le$1 = "≤"; -const ge$1 = "≥"; -const sub$1 = "⊂"; -const sup$1 = "⊃"; -const nsub$1 = "⊄"; -const sube$1 = "⊆"; -const supe$1 = "⊇"; -const oplus$1 = "⊕"; -const otimes$1 = "⊗"; -const perp$1 = "⊥"; -const sdot$1 = "⋅"; -const lceil$1 = "⌈"; -const rceil$1 = "⌉"; -const lfloor$1 = "⌊"; -const rfloor$1 = "⌋"; -const lang$1 = "〈"; -const rang$1 = "〉"; -const loz$1 = "◊"; -const spades$1 = "♠"; -const clubs$1 = "♣"; -const hearts$1 = "♥"; -const diams$1 = "♦"; -const quot$2 = "\""; -const amp$2 = "&"; -const lt$2 = "<"; -const gt$2 = ">"; -const OElig$1 = "Œ"; -const oelig$1 = "œ"; -const Scaron$1 = "Š"; -const scaron$1 = "š"; -const Yuml$1 = "Ÿ"; -const circ$1 = "ˆ"; -const tilde$3 = "˜"; -const ensp$1 = " "; -const emsp$1 = " "; -const thinsp$1 = " "; -const zwnj$1 = "‌"; -const zwj$1 = "‍"; -const lrm$1 = "‎"; -const rlm$1 = "‏"; -const ndash$1 = "–"; -const mdash$1 = "—"; -const lsquo$1 = "‘"; -const rsquo$1 = "’"; -const sbquo$1 = "‚"; -const ldquo$1 = "“"; -const rdquo$1 = "”"; -const bdquo$1 = "„"; -const dagger$1 = "†"; -const Dagger$1 = "‡"; -const permil$1 = "‰"; -const lsaquo$1 = "‹"; -const rsaquo$1 = "›"; -const euro$1 = "€"; -var index$5 = { - nbsp: nbsp$2, - iexcl: iexcl$2, - cent: cent$2, - pound: pound$2, - curren: curren$2, - yen: yen$2, - brvbar: brvbar$2, - sect: sect$2, - uml: uml$2, - copy: copy$4, - ordf: ordf$2, - laquo: laquo$2, - not: not$2, - shy: shy$2, - reg: reg$2, - macr: macr$2, - deg: deg$2, - plusmn: plusmn$2, - sup2: sup2$2, - sup3: sup3$2, - acute: acute$2, - micro: micro$2, - para: para$2, - middot: middot$2, - cedil: cedil$2, - sup1: sup1$2, - ordm: ordm$2, - raquo: raquo$2, - frac14: frac14$2, - frac12: frac12$2, - frac34: frac34$2, - iquest: iquest$2, - Agrave: Agrave$2, - Aacute: Aacute$2, - Acirc: Acirc$2, - Atilde: Atilde$2, - Auml: Auml$2, - Aring: Aring$2, - AElig: AElig$2, - Ccedil: Ccedil$2, - Egrave: Egrave$2, - Eacute: Eacute$2, - Ecirc: Ecirc$2, - Euml: Euml$2, - Igrave: Igrave$2, - Iacute: Iacute$2, - Icirc: Icirc$2, - Iuml: Iuml$2, - ETH: ETH$2, - Ntilde: Ntilde$2, - Ograve: Ograve$2, - Oacute: Oacute$2, - Ocirc: Ocirc$2, - Otilde: Otilde$2, - Ouml: Ouml$2, - times: times$2, - Oslash: Oslash$2, - Ugrave: Ugrave$2, - Uacute: Uacute$2, - Ucirc: Ucirc$2, - Uuml: Uuml$2, - Yacute: Yacute$2, - THORN: THORN$2, - szlig: szlig$2, - agrave: agrave$2, - aacute: aacute$2, - acirc: acirc$2, - atilde: atilde$2, - auml: auml$2, - aring: aring$2, - aelig: aelig$2, - ccedil: ccedil$2, - egrave: egrave$2, - eacute: eacute$2, - ecirc: ecirc$2, - euml: euml$2, - igrave: igrave$2, - iacute: iacute$2, - icirc: icirc$2, - iuml: iuml$2, - eth: eth$2, - ntilde: ntilde$2, - ograve: ograve$2, - oacute: oacute$2, - ocirc: ocirc$2, - otilde: otilde$2, - ouml: ouml$2, - divide: divide$2, - oslash: oslash$2, - ugrave: ugrave$2, - uacute: uacute$2, - ucirc: ucirc$2, - uuml: uuml$2, - yacute: yacute$2, - thorn: thorn$2, - yuml: yuml$2, - fnof: fnof$1, - Alpha: Alpha$1, - Beta: Beta$1, - Gamma: Gamma$1, - Delta: Delta$1, - Epsilon: Epsilon$1, - Zeta: Zeta$1, - Eta: Eta$1, - Theta: Theta$1, - Iota: Iota$1, - Kappa: Kappa$1, - Lambda: Lambda$1, - Mu: Mu$1, - Nu: Nu$1, - Xi: Xi$1, - Omicron: Omicron$1, - Pi: Pi$1, - Rho: Rho$1, - Sigma: Sigma$1, - Tau: Tau$1, - Upsilon: Upsilon$1, - Phi: Phi$1, - Chi: Chi$1, - Psi: Psi$1, - Omega: Omega$1, - alpha: alpha$1, - beta: beta$1, - gamma: gamma$1, - delta: delta$1, - epsilon: epsilon$1, - zeta: zeta$1, - eta: eta$1, - theta: theta$1, - iota: iota$1, - kappa: kappa$1, - lambda: lambda$1, - mu: mu$1, - nu: nu$1, - xi: xi$1, - omicron: omicron$1, - pi: pi$1, - rho: rho$1, - sigmaf: sigmaf$1, - sigma: sigma$1, - tau: tau$1, - upsilon: upsilon$1, - phi: phi$1, - chi: chi$1, - psi: psi$1, - omega: omega$1, - thetasym: thetasym$1, - upsih: upsih$1, - piv: piv$1, - bull: bull$1, - hellip: hellip$1, - prime: prime$1, - Prime: Prime$1, - oline: oline$1, - frasl: frasl$1, - weierp: weierp$1, - image: image$2, - real: real$1, - trade: trade$1, - alefsym: alefsym$1, - larr: larr$1, - uarr: uarr$1, - rarr: rarr$1, - darr: darr$1, - harr: harr$1, - crarr: crarr$1, - lArr: lArr$1, - uArr: uArr$1, - rArr: rArr$1, - dArr: dArr$1, - hArr: hArr$1, - forall: forall$1, - part: part$1, - exist: exist$1, - empty: empty$1, - nabla: nabla$1, - isin: isin$1, - notin: notin$1, - ni: ni$1, - prod: prod$1, - sum: sum$1, - minus: minus$1, - lowast: lowast$1, - radic: radic$1, - prop: prop$1, - infin: infin$1, - ang: ang$1, - and: and$1, - or: or$1, - cap: cap$1, - cup: cup$1, - int: int$1, - there4: there4$1, - sim: sim$1, - cong: cong$1, - asymp: asymp$1, - ne: ne$1, - equiv: equiv$1, - le: le$1, - ge: ge$1, - sub: sub$1, - sup: sup$1, - nsub: nsub$1, - sube: sube$1, - supe: supe$1, - oplus: oplus$1, - otimes: otimes$1, - perp: perp$1, - sdot: sdot$1, - lceil: lceil$1, - rceil: rceil$1, - lfloor: lfloor$1, - rfloor: rfloor$1, - lang: lang$1, - rang: rang$1, - loz: loz$1, - spades: spades$1, - clubs: clubs$1, - hearts: hearts$1, - diams: diams$1, - quot: quot$2, - amp: amp$2, - lt: lt$2, - gt: gt$2, - OElig: OElig$1, - oelig: oelig$1, - Scaron: Scaron$1, - scaron: scaron$1, - Yuml: Yuml$1, - circ: circ$1, - tilde: tilde$3, - ensp: ensp$1, - emsp: emsp$1, - thinsp: thinsp$1, - zwnj: zwnj$1, - zwj: zwj$1, - lrm: lrm$1, - rlm: rlm$1, - ndash: ndash$1, - mdash: mdash$1, - lsquo: lsquo$1, - rsquo: rsquo$1, - sbquo: sbquo$1, - ldquo: ldquo$1, - rdquo: rdquo$1, - bdquo: bdquo$1, - dagger: dagger$1, - Dagger: Dagger$1, - permil: permil$1, - lsaquo: lsaquo$1, - rsaquo: rsaquo$1, - euro: euro$1 -}; - -var characterEntitiesHtml4 = Object.freeze({ - nbsp: nbsp$2, - iexcl: iexcl$2, - cent: cent$2, - pound: pound$2, - curren: curren$2, - yen: yen$2, - brvbar: brvbar$2, - sect: sect$2, - uml: uml$2, - copy: copy$4, - ordf: ordf$2, - laquo: laquo$2, - not: not$2, - shy: shy$2, - reg: reg$2, - macr: macr$2, - deg: deg$2, - plusmn: plusmn$2, - sup2: sup2$2, - sup3: sup3$2, - acute: acute$2, - micro: micro$2, - para: para$2, - middot: middot$2, - cedil: cedil$2, - sup1: sup1$2, - ordm: ordm$2, - raquo: raquo$2, - frac14: frac14$2, - frac12: frac12$2, - frac34: frac34$2, - iquest: iquest$2, - Agrave: Agrave$2, - Aacute: Aacute$2, - Acirc: Acirc$2, - Atilde: Atilde$2, - Auml: Auml$2, - Aring: Aring$2, - AElig: AElig$2, - Ccedil: Ccedil$2, - Egrave: Egrave$2, - Eacute: Eacute$2, - Ecirc: Ecirc$2, - Euml: Euml$2, - Igrave: Igrave$2, - Iacute: Iacute$2, - Icirc: Icirc$2, - Iuml: Iuml$2, - ETH: ETH$2, - Ntilde: Ntilde$2, - Ograve: Ograve$2, - Oacute: Oacute$2, - Ocirc: Ocirc$2, - Otilde: Otilde$2, - Ouml: Ouml$2, - times: times$2, - Oslash: Oslash$2, - Ugrave: Ugrave$2, - Uacute: Uacute$2, - Ucirc: Ucirc$2, - Uuml: Uuml$2, - Yacute: Yacute$2, - THORN: THORN$2, - szlig: szlig$2, - agrave: agrave$2, - aacute: aacute$2, - acirc: acirc$2, - atilde: atilde$2, - auml: auml$2, - aring: aring$2, - aelig: aelig$2, - ccedil: ccedil$2, - egrave: egrave$2, - eacute: eacute$2, - ecirc: ecirc$2, - euml: euml$2, - igrave: igrave$2, - iacute: iacute$2, - icirc: icirc$2, - iuml: iuml$2, - eth: eth$2, - ntilde: ntilde$2, - ograve: ograve$2, - oacute: oacute$2, - ocirc: ocirc$2, - otilde: otilde$2, - ouml: ouml$2, - divide: divide$2, - oslash: oslash$2, - ugrave: ugrave$2, - uacute: uacute$2, - ucirc: ucirc$2, - uuml: uuml$2, - yacute: yacute$2, - thorn: thorn$2, - yuml: yuml$2, - fnof: fnof$1, - Alpha: Alpha$1, - Beta: Beta$1, - Gamma: Gamma$1, - Delta: Delta$1, - Epsilon: Epsilon$1, - Zeta: Zeta$1, - Eta: Eta$1, - Theta: Theta$1, - Iota: Iota$1, - Kappa: Kappa$1, - Lambda: Lambda$1, - Mu: Mu$1, - Nu: Nu$1, - Xi: Xi$1, - Omicron: Omicron$1, - Pi: Pi$1, - Rho: Rho$1, - Sigma: Sigma$1, - Tau: Tau$1, - Upsilon: Upsilon$1, - Phi: Phi$1, - Chi: Chi$1, - Psi: Psi$1, - Omega: Omega$1, - alpha: alpha$1, - beta: beta$1, - gamma: gamma$1, - delta: delta$1, - epsilon: epsilon$1, - zeta: zeta$1, - eta: eta$1, - theta: theta$1, - iota: iota$1, - kappa: kappa$1, - lambda: lambda$1, - mu: mu$1, - nu: nu$1, - xi: xi$1, - omicron: omicron$1, - pi: pi$1, - rho: rho$1, - sigmaf: sigmaf$1, - sigma: sigma$1, - tau: tau$1, - upsilon: upsilon$1, - phi: phi$1, - chi: chi$1, - psi: psi$1, - omega: omega$1, - thetasym: thetasym$1, - upsih: upsih$1, - piv: piv$1, - bull: bull$1, - hellip: hellip$1, - prime: prime$1, - Prime: Prime$1, - oline: oline$1, - frasl: frasl$1, - weierp: weierp$1, - image: image$2, - real: real$1, - trade: trade$1, - alefsym: alefsym$1, - larr: larr$1, - uarr: uarr$1, - rarr: rarr$1, - darr: darr$1, - harr: harr$1, - crarr: crarr$1, - lArr: lArr$1, - uArr: uArr$1, - rArr: rArr$1, - dArr: dArr$1, - hArr: hArr$1, - forall: forall$1, - part: part$1, - exist: exist$1, - empty: empty$1, - nabla: nabla$1, - isin: isin$1, - notin: notin$1, - ni: ni$1, - prod: prod$1, - sum: sum$1, - minus: minus$1, - lowast: lowast$1, - radic: radic$1, - prop: prop$1, - infin: infin$1, - ang: ang$1, - and: and$1, - or: or$1, - cap: cap$1, - cup: cup$1, - int: int$1, - there4: there4$1, - sim: sim$1, - cong: cong$1, - asymp: asymp$1, - ne: ne$1, - equiv: equiv$1, - le: le$1, - ge: ge$1, - sub: sub$1, - sup: sup$1, - nsub: nsub$1, - sube: sube$1, - supe: supe$1, - oplus: oplus$1, - otimes: otimes$1, - perp: perp$1, - sdot: sdot$1, - lceil: lceil$1, - rceil: rceil$1, - lfloor: lfloor$1, - rfloor: rfloor$1, - lang: lang$1, - rang: rang$1, - loz: loz$1, - spades: spades$1, - clubs: clubs$1, - hearts: hearts$1, - diams: diams$1, - quot: quot$2, - amp: amp$2, - lt: lt$2, - gt: gt$2, - OElig: OElig$1, - oelig: oelig$1, - Scaron: Scaron$1, - scaron: scaron$1, - Yuml: Yuml$1, - circ: circ$1, - tilde: tilde$3, - ensp: ensp$1, - emsp: emsp$1, - thinsp: thinsp$1, - zwnj: zwnj$1, - zwj: zwj$1, - lrm: lrm$1, - rlm: rlm$1, - ndash: ndash$1, - mdash: mdash$1, - lsquo: lsquo$1, - rsquo: rsquo$1, - sbquo: sbquo$1, - ldquo: ldquo$1, - rdquo: rdquo$1, - bdquo: bdquo$1, - dagger: dagger$1, - Dagger: Dagger$1, - permil: permil$1, - lsaquo: lsaquo$1, - rsaquo: rsaquo$1, - euro: euro$1, - default: index$5 -}); -var dangerous = [ - "cent", - "copy", - "divide", - "gt", - "lt", - "not", - "para", - "times" -] -; +/***/ }), +/* 262 */ +/***/ (function(module, exports, __webpack_require__) { -var dangerous$1 = Object.freeze({ - default: dangerous -}); +"use strict"; -var entities = ( characterEntitiesHtml4 && index$5 ) || characterEntitiesHtml4; -var dangerous$2 = ( dangerous$1 && dangerous ) || dangerous$1; +var entities = __webpack_require__(263) +var legacy = __webpack_require__(77) +var hexadecimal = __webpack_require__(78) +var alphanumerical = __webpack_require__(79) +var dangerous = __webpack_require__(264) /* Expose. */ -var stringifyEntities = encode; -encode.escape = escape$1; +module.exports = encode +encode.escape = escape -var own$6 = {}.hasOwnProperty; +var own = {}.hasOwnProperty /* List of enforced escapes. */ -var escapes$2 = ['"', "'", '<', '>', '&', '`']; +var escapes = ['"', "'", '<', '>', '&', '`'] /* Map of characters to names. */ -var characters = construct(); +var characters = construct() /* Default escapes. */ -var defaultEscapes = toExpression(escapes$2); +var defaultEscapes = toExpression(escapes) /* Surrogate pairs. */ -var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; +var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g /* Non-ASCII characters. */ // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape -var bmp = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g; +var bmp = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g /* Encode special characters in `value`. */ function encode(value, options) { - var settings = options || {}; - var subset = settings.subset; - var set = subset ? toExpression(subset) : defaultEscapes; - var escapeOnly = settings.escapeOnly; - var omit = settings.omitOptionalSemicolons; + var settings = options || {} + var subset = settings.subset + var set = subset ? toExpression(subset) : defaultEscapes + var escapeOnly = settings.escapeOnly + var omit = settings.omitOptionalSemicolons value = value.replace(set, function(char, pos, val) { - return one$1(char, val.charAt(pos + 1), settings) - }); + return one(char, val.charAt(pos + 1), settings) + }) if (subset || escapeOnly) { return value @@ -28697,12 +33197,12 @@ function encode(value, options) { } function replaceBmp(char, pos, val) { - return one$1(char, val.charAt(pos + 1), settings) + return one(char, val.charAt(pos + 1), settings) } } /* Shortcut to escape special characters in HTML. */ -function escape$1(value) { +function escape(value) { return encode(value, { escapeOnly: true, useNamedReferences: true @@ -28710,18 +33210,18 @@ function escape$1(value) { } /* Encode `char` according to `options`. */ -function one$1(char, next, options) { - var shortest = options.useShortestReferences; - var omit = options.omitOptionalSemicolons; - var named; - var numeric; +function one(char, next, options) { + var shortest = options.useShortestReferences + var omit = options.omitOptionalSemicolons + var named + var numeric - if ((shortest || options.useNamedReferences) && own$6.call(characters, char)) { - named = toNamed(characters[char], next, omit, options.attribute); + if ((shortest || options.useNamedReferences) && own.call(characters, char)) { + named = toNamed(characters[char], next, omit, options.attribute) } if (shortest || !named) { - numeric = toHexReference(char.charCodeAt(0), next, omit); + numeric = toHexReference(char.charCodeAt(0), next, omit) } if (named && (!shortest || named.length < numeric.length)) { @@ -28733,13 +33233,13 @@ function one$1(char, next, options) { /* Transform `code` into an entity. */ function toNamed(name, next, omit, attribute) { - var value = '&' + name; + var value = '&' + name if ( omit && - own$6.call(legacy, name) && - dangerous$2.indexOf(name) === -1 && - (!attribute || (next && next !== '=' && !isAlphanumerical(next))) + own.call(legacy, name) && + dangerous.indexOf(name) === -1 && + (!attribute || (next && next !== '=' && !alphanumerical(next))) ) { return value } @@ -28749,8 +33249,8 @@ function toNamed(name, next, omit, attribute) { /* Transform `code` into a hexadecimal character reference. */ function toHexReference(code, next, omit) { - var value = '&#x' + code.toString(16).toUpperCase(); - return omit && next && !isHexadecimal(next) ? value : value + ';' + var value = '&#x' + code.toString(16).toUpperCase() + return omit && next && !hexadecimal(next) ? value : value + ';' } /* Create an expression for `characters`. */ @@ -28760,205 +33260,203 @@ function toExpression(characters) { /* Construct the map. */ function construct() { - var chars = {}; - var name; + var chars = {} + var name for (name in entities) { - chars[entities[name]] = name; + chars[entities[name]] = name } return chars } -var isAlphanumeric = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - return !/[^0-9a-z\xDF-\xFF]/.test(str.toLowerCase()); -}; +/***/ }), +/* 263 */ +/***/ (function(module) { -var entityPrefixLength = length; +module.exports = {"nbsp":" ","iexcl":"¡","cent":"¢","pound":"£","curren":"¤","yen":"¥","brvbar":"¦","sect":"§","uml":"¨","copy":"©","ordf":"ª","laquo":"«","not":"¬","shy":"­","reg":"®","macr":"¯","deg":"°","plusmn":"±","sup2":"²","sup3":"³","acute":"´","micro":"µ","para":"¶","middot":"·","cedil":"¸","sup1":"¹","ordm":"º","raquo":"»","frac14":"¼","frac12":"½","frac34":"¾","iquest":"¿","Agrave":"À","Aacute":"Á","Acirc":"Â","Atilde":"Ã","Auml":"Ä","Aring":"Å","AElig":"Æ","Ccedil":"Ç","Egrave":"È","Eacute":"É","Ecirc":"Ê","Euml":"Ë","Igrave":"Ì","Iacute":"Í","Icirc":"Î","Iuml":"Ï","ETH":"Ð","Ntilde":"Ñ","Ograve":"Ò","Oacute":"Ó","Ocirc":"Ô","Otilde":"Õ","Ouml":"Ö","times":"×","Oslash":"Ø","Ugrave":"Ù","Uacute":"Ú","Ucirc":"Û","Uuml":"Ü","Yacute":"Ý","THORN":"Þ","szlig":"ß","agrave":"à","aacute":"á","acirc":"â","atilde":"ã","auml":"ä","aring":"å","aelig":"æ","ccedil":"ç","egrave":"è","eacute":"é","ecirc":"ê","euml":"ë","igrave":"ì","iacute":"í","icirc":"î","iuml":"ï","eth":"ð","ntilde":"ñ","ograve":"ò","oacute":"ó","ocirc":"ô","otilde":"õ","ouml":"ö","divide":"÷","oslash":"ø","ugrave":"ù","uacute":"ú","ucirc":"û","uuml":"ü","yacute":"ý","thorn":"þ","yuml":"ÿ","fnof":"ƒ","Alpha":"Α","Beta":"Β","Gamma":"Γ","Delta":"Δ","Epsilon":"Ε","Zeta":"Ζ","Eta":"Η","Theta":"Θ","Iota":"Ι","Kappa":"Κ","Lambda":"Λ","Mu":"Μ","Nu":"Ν","Xi":"Ξ","Omicron":"Ο","Pi":"Π","Rho":"Ρ","Sigma":"Σ","Tau":"Τ","Upsilon":"Υ","Phi":"Φ","Chi":"Χ","Psi":"Ψ","Omega":"Ω","alpha":"α","beta":"β","gamma":"γ","delta":"δ","epsilon":"ε","zeta":"ζ","eta":"η","theta":"θ","iota":"ι","kappa":"κ","lambda":"λ","mu":"μ","nu":"ν","xi":"ξ","omicron":"ο","pi":"π","rho":"ρ","sigmaf":"ς","sigma":"σ","tau":"τ","upsilon":"υ","phi":"φ","chi":"χ","psi":"ψ","omega":"ω","thetasym":"ϑ","upsih":"ϒ","piv":"ϖ","bull":"•","hellip":"…","prime":"′","Prime":"″","oline":"‾","frasl":"⁄","weierp":"℘","image":"ℑ","real":"ℜ","trade":"™","alefsym":"ℵ","larr":"←","uarr":"↑","rarr":"→","darr":"↓","harr":"↔","crarr":"↵","lArr":"⇐","uArr":"⇑","rArr":"⇒","dArr":"⇓","hArr":"⇔","forall":"∀","part":"∂","exist":"∃","empty":"∅","nabla":"∇","isin":"∈","notin":"∉","ni":"∋","prod":"∏","sum":"∑","minus":"−","lowast":"∗","radic":"√","prop":"∝","infin":"∞","ang":"∠","and":"∧","or":"∨","cap":"∩","cup":"∪","int":"∫","there4":"∴","sim":"∼","cong":"≅","asymp":"≈","ne":"≠","equiv":"≡","le":"≤","ge":"≥","sub":"⊂","sup":"⊃","nsub":"⊄","sube":"⊆","supe":"⊇","oplus":"⊕","otimes":"⊗","perp":"⊥","sdot":"⋅","lceil":"⌈","rceil":"⌉","lfloor":"⌊","rfloor":"⌋","lang":"〈","rang":"〉","loz":"◊","spades":"♠","clubs":"♣","hearts":"♥","diams":"♦","quot":"\"","amp":"&","lt":"<","gt":">","OElig":"Œ","oelig":"œ","Scaron":"Š","scaron":"š","Yuml":"Ÿ","circ":"ˆ","tilde":"˜","ensp":" ","emsp":" ","thinsp":" ","zwnj":"‌","zwj":"‍","lrm":"‎","rlm":"‏","ndash":"–","mdash":"—","lsquo":"‘","rsquo":"’","sbquo":"‚","ldquo":"“","rdquo":"”","bdquo":"„","dagger":"†","Dagger":"‡","permil":"‰","lsaquo":"‹","rsaquo":"›","euro":"€"}; -var ampersand = '&'; +/***/ }), +/* 264 */ +/***/ (function(module) { -// Returns the length of HTML entity that is a prefix of the given string -// (excluding the ampersand), 0 if it does not start with an entity. -function length(value) { - var prefix; +module.exports = ["cent","copy","divide","gt","lt","not","para","times"]; + +/***/ }), +/* 265 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; - /* istanbul ignore if - Currently also tested for at implemention, but we - * keep it here because that’s proper. */ - if (value.charAt(0) !== ampersand) { - return 0 - } - prefix = value.split(ampersand, 2).join(ampersand); - - return prefix.length - parseEntities_1(prefix).length -} - -var _escape$4 = factory$5; - -var tab$14 = '\t'; -var lineFeed$18 = '\n'; -var space$16 = ' '; -var numberSign$1 = '#'; -var ampersand$1 = '&'; -var leftParenthesis$3 = '('; -var rightParenthesis$4 = ')'; -var asterisk$4 = '*'; -var plusSign$1 = '+'; -var dash$5 = '-'; -var dot$3 = '.'; -var colon$5 = ':'; -var lessThan$6 = '<'; -var greaterThan$4 = '>'; -var leftSquareBracket$5 = '['; -var backslash$9 = '\\'; -var rightSquareBracket$5 = ']'; -var underscore$4 = '_'; -var graveAccent$4 = '`'; -var verticalBar$1 = '|'; -var tilde$4 = '~'; -var exclamationMark$4 = '!'; - -var entities$1 = { +var decimal = __webpack_require__(23) +var alphanumeric = __webpack_require__(266) +var whitespace = __webpack_require__(8) +var escapes = __webpack_require__(81) +var prefix = __webpack_require__(89) + +module.exports = factory + +var tab = '\t' +var lineFeed = '\n' +var space = ' ' +var numberSign = '#' +var ampersand = '&' +var leftParenthesis = '(' +var rightParenthesis = ')' +var asterisk = '*' +var plusSign = '+' +var dash = '-' +var dot = '.' +var colon = ':' +var lessThan = '<' +var greaterThan = '>' +var leftSquareBracket = '[' +var backslash = '\\' +var rightSquareBracket = ']' +var underscore = '_' +var graveAccent = '`' +var verticalBar = '|' +var tilde = '~' +var exclamationMark = '!' + +var entities = { '<': '<', ':': ':', '&': '&', '|': '|', '~': '~' -}; +} -var shortcut$1 = 'shortcut'; -var mailto$2 = 'mailto'; -var https$1 = 'https'; -var http$1 = 'http'; +var shortcut = 'shortcut' +var mailto = 'mailto' +var https = 'https' +var http = 'http' -var blankExpression = /\n\s*$/; +var blankExpression = /\n\s*$/ // Factory to escape characters. -function factory$5(options) { +function factory(options) { return escape // Escape punctuation characters in a node’s value. function escape(value, node, parent) { - var self = this; - var gfm = options.gfm; - var commonmark = options.commonmark; - var pedantic = options.pedantic; - var markers = commonmark ? [dot$3, rightParenthesis$4] : [dot$3]; - var siblings = parent && parent.children; - var index = siblings && siblings.indexOf(node); - var prev = siblings && siblings[index - 1]; - var next = siblings && siblings[index + 1]; - var length = value.length; - var escapable = markdownEscapes(options); - var position = -1; - var queue = []; - var escaped = queue; - var afterNewLine; - var character; - var wordCharBefore; - var wordCharAfter; - var offset; - var replace; + var self = this + var gfm = options.gfm + var commonmark = options.commonmark + var pedantic = options.pedantic + var markers = commonmark ? [dot, rightParenthesis] : [dot] + var siblings = parent && parent.children + var index = siblings && siblings.indexOf(node) + var prev = siblings && siblings[index - 1] + var next = siblings && siblings[index + 1] + var length = value.length + var escapable = escapes(options) + var position = -1 + var queue = [] + var escaped = queue + var afterNewLine + var character + var wordCharBefore + var wordCharAfter + var offset + var replace if (prev) { - afterNewLine = text$1(prev) && blankExpression.test(prev.value); + afterNewLine = text(prev) && blankExpression.test(prev.value) } else { afterNewLine = - !parent || parent.type === 'root' || parent.type === 'paragraph'; + !parent || parent.type === 'root' || parent.type === 'paragraph' } while (++position < length) { - character = value.charAt(position); - replace = false; + character = value.charAt(position) + replace = false if (character === '\n') { - afterNewLine = true; + afterNewLine = true } else if ( - character === backslash$9 || - character === graveAccent$4 || - character === asterisk$4 || - (character === exclamationMark$4 && - value.charAt(position + 1) === leftSquareBracket$5) || - character === leftSquareBracket$5 || - character === lessThan$6 || - (character === ampersand$1 && entityPrefixLength(value.slice(position)) > 0) || - (character === rightSquareBracket$5 && self.inLink) || - (gfm && character === tilde$4 && value.charAt(position + 1) === tilde$4) || + character === backslash || + character === graveAccent || + character === asterisk || + (character === exclamationMark && + value.charAt(position + 1) === leftSquareBracket) || + character === leftSquareBracket || + character === lessThan || + (character === ampersand && prefix(value.slice(position)) > 0) || + (character === rightSquareBracket && self.inLink) || + (gfm && character === tilde && value.charAt(position + 1) === tilde) || (gfm && - character === verticalBar$1 && + character === verticalBar && (self.inTable || alignment(value, position))) || - (character === underscore$4 && + (character === underscore && // Delegate leading/trailing underscores to the multinode version below. position > 0 && position < length - 1 && (pedantic || - !isAlphanumeric(value.charAt(position - 1)) || - !isAlphanumeric(value.charAt(position + 1)))) || - (gfm && !self.inLink && character === colon$5 && protocol(queue.join(''))) + !alphanumeric(value.charAt(position - 1)) || + !alphanumeric(value.charAt(position + 1)))) || + (gfm && !self.inLink && character === colon && protocol(queue.join(''))) ) { - replace = true; + replace = true } else if (afterNewLine) { if ( - character === greaterThan$4 || - character === numberSign$1 || - character === asterisk$4 || - character === dash$5 || - character === plusSign$1 + character === greaterThan || + character === numberSign || + character === asterisk || + character === dash || + character === plusSign ) { - replace = true; - } else if (isDecimal(character)) { - offset = position + 1; + replace = true + } else if (decimal(character)) { + offset = position + 1 while (offset < length) { - if (!isDecimal(value.charAt(offset))) { + if (!decimal(value.charAt(offset))) { break } - offset++; + offset++ } if (markers.indexOf(value.charAt(offset)) !== -1) { - next = value.charAt(offset + 1); + next = value.charAt(offset + 1) - if (!next || next === space$16 || next === tab$14 || next === lineFeed$18) { - queue.push(value.slice(position, offset)); - position = offset; - character = value.charAt(position); - replace = true; + if (!next || next === space || next === tab || next === lineFeed) { + queue.push(value.slice(position, offset)) + position = offset + character = value.charAt(position) + replace = true } } } } - if (afterNewLine && !isWhitespaceCharacter(character)) { - afterNewLine = false; + if (afterNewLine && !whitespace(character)) { + afterNewLine = false } - queue.push(replace ? one(character) : character); + queue.push(replace ? one(character) : character) } // Multi-node versions. - if (siblings && text$1(node)) { + if (siblings && text(node)) { // Check for an opening parentheses after a link-reference (which can be // joined by white-space). - if (prev && prev.referenceType === shortcut$1) { - position = -1; - length = escaped.length; + if (prev && prev.referenceType === shortcut) { + position = -1 + length = escaped.length while (++position < length) { - character = escaped[position]; + character = escaped[position] - if (character === space$16 || character === tab$14) { + if (character === space || character === tab) { continue } - if (character === leftParenthesis$3 || character === colon$5) { - escaped[position] = one(character); + if (character === leftParenthesis || character === colon) { + escaped[position] = one(character) } break @@ -28967,11 +33465,11 @@ function factory$5(options) { // If the current node is all spaces / tabs, preceded by a shortcut, // and followed by a text starting with `(`, escape it. if ( - text$1(next) && + text(next) && position === length && - next.value.charAt(0) === leftParenthesis$3 + next.value.charAt(0) === leftParenthesis ) { - escaped.push(backslash$9); + escaped.push(backslash) } } @@ -28980,67 +33478,67 @@ function factory$5(options) { if ( gfm && !self.inLink && - text$1(prev) && - value.charAt(0) === colon$5 && + text(prev) && + value.charAt(0) === colon && protocol(prev.value.slice(-6)) ) { - escaped[0] = one(colon$5); + escaped[0] = one(colon) } // Escape ampersand if it would otherwise start an entity. if ( - text$1(next) && - value.charAt(length - 1) === ampersand$1 && - entityPrefixLength(ampersand$1 + next.value) !== 0 + text(next) && + value.charAt(length - 1) === ampersand && + prefix(ampersand + next.value) !== 0 ) { - escaped[escaped.length - 1] = one(ampersand$1); + escaped[escaped.length - 1] = one(ampersand) } // Escape exclamation marks immediately followed by links. if ( next && next.type === 'link' && - value.charAt(length - 1) === exclamationMark$4 + value.charAt(length - 1) === exclamationMark ) { - escaped[escaped.length - 1] = one(exclamationMark$4); + escaped[escaped.length - 1] = one(exclamationMark) } // Escape double tildes in GFM. if ( gfm && - text$1(next) && - value.charAt(length - 1) === tilde$4 && - next.value.charAt(0) === tilde$4 + text(next) && + value.charAt(length - 1) === tilde && + next.value.charAt(0) === tilde ) { - escaped.splice(escaped.length - 1, 0, backslash$9); + escaped.splice(escaped.length - 1, 0, backslash) } // Escape underscores, but not mid-word (unless in pedantic mode). - wordCharBefore = text$1(prev) && isAlphanumeric(prev.value.slice(-1)); - wordCharAfter = text$1(next) && isAlphanumeric(next.value.charAt(0)); + wordCharBefore = text(prev) && alphanumeric(prev.value.slice(-1)) + wordCharAfter = text(next) && alphanumeric(next.value.charAt(0)) if (length === 1) { if ( - value === underscore$4 && + value === underscore && (pedantic || !wordCharBefore || !wordCharAfter) ) { - escaped.unshift(backslash$9); + escaped.unshift(backslash) } } else { if ( - value.charAt(0) === underscore$4 && - (pedantic || !wordCharBefore || !isAlphanumeric(value.charAt(1))) + value.charAt(0) === underscore && + (pedantic || !wordCharBefore || !alphanumeric(value.charAt(1))) ) { - escaped.unshift(backslash$9); + escaped.unshift(backslash) } if ( - value.charAt(length - 1) === underscore$4 && + value.charAt(length - 1) === underscore && (pedantic || !wordCharAfter || - !isAlphanumeric(value.charAt(length - 2))) + !alphanumeric(value.charAt(length - 2))) ) { - escaped.splice(escaped.length - 1, 0, backslash$9); + escaped.splice(escaped.length - 1, 0, backslash) } } } @@ -29049,28 +33547,28 @@ function factory$5(options) { function one(character) { return escapable.indexOf(character) === -1 - ? entities$1[character] - : backslash$9 + character + ? entities[character] + : backslash + character } } } // Check if `index` in `value` is inside an alignment row. function alignment(value, index) { - var start = value.lastIndexOf(lineFeed$18, index); - var end = value.indexOf(lineFeed$18, index); - var char; + var start = value.lastIndexOf(lineFeed, index) + var end = value.indexOf(lineFeed, index) + var char - end = end === -1 ? value.length : end; + end = end === -1 ? value.length : end while (++start < end) { - char = value.charAt(start); + char = value.charAt(start) if ( - char !== colon$5 && - char !== dash$5 && - char !== space$16 && - char !== verticalBar$1 + char !== colon && + char !== dash && + char !== space && + char !== verticalBar ) { return false } @@ -29080,199 +33578,88 @@ function alignment(value, index) { } // Check if `node` is a text node. -function text$1(node) { +function text(node) { return node && node.type === 'text' } // Check if `value` ends in a protocol. function protocol(value) { - var val = value.slice(-6).toLowerCase(); - return val === mailto$2 || val.slice(-5) === https$1 || val.slice(-4) === http$1 -} - -var setOptions_1$2 = setOptions$1; - -// Map of applicable enums. -var maps = { - entities: {true: true, false: true, numbers: true, escape: true}, - bullet: {'*': true, '-': true, '+': true}, - rule: {'-': true, _: true, '*': true}, - listItemIndent: {tab: true, mixed: true, 1: true}, - emphasis: {_: true, '*': true}, - strong: {_: true, '*': true}, - fence: {'`': true, '~': true} -}; - -// Expose `validate`. -var validate = { - boolean: validateBoolean, - string: validateString, - number: validateNumber, - function: validateFunction -}; - -// Set options. Does not overwrite previously set options. -function setOptions$1(options) { - var self = this; - var current = self.options; - var ruleRepetition; - var key; - - if (options == null) { - options = {}; - } else if (typeof options === 'object') { - options = immutable(options); - } else { - throw new Error('Invalid value `' + options + '` for setting `options`') - } - - for (key in defaults$5) { - validate[typeof defaults$5[key]](options, key, current[key], maps[key]); - } - - ruleRepetition = options.ruleRepetition; - - if (ruleRepetition && ruleRepetition < 3) { - raise(ruleRepetition, 'options.ruleRepetition'); - } - - self.encode = encodeFactory(String(options.entities)); - self.escape = _escape$4(options); - - self.options = options; - - return self -} - -// Validate a value to be boolean. Defaults to `def`. Raises an exception with -// `context[name]` when not a boolean. -function validateBoolean(context, name, def) { - var value = context[name]; - - if (value == null) { - value = def; - } - - if (typeof value !== 'boolean') { - raise(value, 'options.' + name); - } - - context[name] = value; + var val = value.slice(-6).toLowerCase() + return val === mailto || val.slice(-5) === https || val.slice(-4) === http } -// Validate a value to be boolean. Defaults to `def`. Raises an exception with -// `context[name]` when not a boolean. -function validateNumber(context, name, def) { - var value = context[name]; - - if (value == null) { - value = def; - } - if (isNaN(value)) { - raise(value, 'options.' + name); - } +/***/ }), +/* 266 */ +/***/ (function(module, exports, __webpack_require__) { - context[name] = value; -} +"use strict"; -// Validate a value to be in `map`. Defaults to `def`. Raises an exception -// with `context[name]` when not in `map`. -function validateString(context, name, def, map) { - var value = context[name]; +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } - if (value == null) { - value = def; - } + return !/[^0-9a-z\xDF-\xFF]/.test(str.toLowerCase()); +}; - value = String(value); - if (!(value in map)) { - raise(value, 'options.' + name); - } +/***/ }), +/* 267 */ +/***/ (function(module, exports, __webpack_require__) { - context[name] = value; -} +"use strict"; -// Validate a value to be function. Defaults to `def`. Raises an exception -// with `context[name]` when not a function. -function validateFunction(context, name, def) { - var value = context[name]; - if (value == null) { - value = def; - } +var compact = __webpack_require__(268) - if (typeof value !== 'function') { - raise(value, 'options.' + name); - } +module.exports = compile - context[name] = value; +// Stringify the given tree. +function compile() { + return this.visit(compact(this.tree, this.options.commonmark)) } -// Factory to encode HTML entities. Creates a no-operation function when -// `type` is `'false'`, a function which encodes using named references when -// `type` is `'true'`, and a function which encodes using numbered references -// when `type` is `'numbers'`. -function encodeFactory(type) { - var options = {}; - - if (type === 'false') { - return identity_1 - } - - if (type === 'true') { - options.useNamedReferences = true; - } - if (type === 'escape') { - options.escapeOnly = true; - options.useNamedReferences = true; - } +/***/ }), +/* 268 */ +/***/ (function(module, exports, __webpack_require__) { - return wrapped +"use strict"; - // Encode HTML entities using the bound options. - function wrapped(value) { - return stringifyEntities(value, options) - } -} -// Throw an exception with in its `message` `value` and `name`. -function raise(value, name) { - throw new Error('Invalid value `' + value + '` for setting `' + name + '`') -} +var visit = __webpack_require__(1) -var mdastUtilCompact = compact; +module.exports = compact /* Make an MDAST tree compact by merging adjacent text nodes. */ function compact(tree, commonmark) { - unistUtilVisit(tree, visitor); + visit(tree, visitor) return tree function visitor(child, index, parent) { - var siblings = parent ? parent.children : []; - var prev = index && siblings[index - 1]; + var siblings = parent ? parent.children : [] + var prev = index && siblings[index - 1] if ( prev && child.type === prev.type && - mergeable$1(prev, commonmark) && - mergeable$1(child, commonmark) + mergeable(prev, commonmark) && + mergeable(child, commonmark) ) { if (child.value) { - prev.value += child.value; + prev.value += child.value } if (child.children) { - prev.children = prev.children.concat(child.children); + prev.children = prev.children.concat(child.children) } - siblings.splice(index, 1); + siblings.splice(index, 1) if (prev.position && child.position) { - prev.position.end = child.position.end; + prev.position.end = child.position.end } return index @@ -29280,17 +33667,17 @@ function compact(tree, commonmark) { } } -function mergeable$1(node, commonmark) { - var start; - var end; +function mergeable(node, commonmark) { + var start + var end if (node.type === 'text') { if (!node.position) { return true } - start = node.position.start; - end = node.position.end; + start = node.position.start + end = node.position.end /* Only merge nodes which occupy the same size as their `value`. */ return ( @@ -29301,18 +33688,19 @@ function mergeable$1(node, commonmark) { return commonmark && node.type === 'blockquote' } -var compile_1 = compile$2; -// Stringify the given tree. -function compile$2() { - return this.visit(mdastUtilCompact(this.tree, this.options.commonmark)) -} +/***/ }), +/* 269 */ +/***/ (function(module, exports, __webpack_require__) { -var one_1 = one$2; +"use strict"; -function one$2(node, parent) { - var self = this; - var visitors = self.visitors; + +module.exports = one + +function one(node, parent) { + var self = this + var visitors = self.visitors // Fail on unknown nodes. if (typeof visitors[node.type] !== 'function') { @@ -29321,55 +33709,71 @@ function one$2(node, parent) { 'Missing compiler for node of type `' + node.type + '`: `' + node + '`' ), node - ); + ) } return visitors[node.type].call(self, node, parent) } -var all_1 = all; + +/***/ }), +/* 270 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = all // Visit all children of `parent`. function all(parent) { - var self = this; - var children = parent.children; - var length = children.length; - var results = []; - var index = -1; + var self = this + var children = parent.children + var length = children.length + var results = [] + var index = -1 while (++index < length) { - results[index] = self.visit(children[index], parent); + results[index] = self.visit(children[index], parent) } return results } -var block_1 = block$1; -var lineFeed$19 = '\n'; +/***/ }), +/* 271 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = block -var blank$1 = lineFeed$19 + lineFeed$19; -var triple = blank$1 + lineFeed$19; -var comment$1 = blank$1 + '' + blank$1; +var lineFeed = '\n' + +var blank = lineFeed + lineFeed +var triple = blank + lineFeed +var comment = blank + '' + blank // Stringify a block node with block children (e.g., `root` or `blockquote`). // Knows about code following a list, or adjacent lists with similar bullets, // and places an extra line feed between them. -function block$1(node) { - var self = this; - var options = self.options; - var fences = options.fences; - var gap = options.commonmark ? comment$1 : triple; - var values = []; - var children = node.children; - var length = children.length; - var index = -1; - var prev; - var child; +function block(node) { + var self = this + var options = self.options + var fences = options.fences + var gap = options.commonmark ? comment : triple + var values = [] + var children = node.children + var length = children.length + var index = -1 + var prev + var child while (++index < length) { - prev = child; - child = children[index]; + prev = child + child = children[index] if (prev) { // A list preceding another list that are equally ordered, or a @@ -29385,24 +33789,32 @@ function block$1(node) { ((child.type === 'list' && prev.ordered === child.ordered) || (child.type === 'code' && (!child.lang && !fences))) ) { - values.push(gap); + values.push(gap) } else { - values.push(blank$1); + values.push(blank) } } - values.push(self.visit(child, node)); + values.push(self.visit(child, node)) } return values.join('') } -var orderedItems_1 = orderedItems; -var lineFeed$20 = '\n'; -var dot$4 = '.'; +/***/ }), +/* 272 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -var blank$2 = lineFeed$20 + lineFeed$20; + +module.exports = orderedItems + +var lineFeed = '\n' +var dot = '.' + +var blank = lineFeed + lineFeed // Visit ordered list items. // @@ -29419,60 +33831,84 @@ var blank$2 = lineFeed$20 + lineFeed$20; // 1. foo // 1. bar function orderedItems(node) { - var self = this; - var fn = self.visitors.listItem; - var increment = self.options.incrementListMarker; - var values = []; - var start = node.start; - var children = node.children; - var length = children.length; - var index = -1; - var bullet; - - start = start == null ? 1 : start; + var self = this + var fn = self.visitors.listItem + var increment = self.options.incrementListMarker + var values = [] + var start = node.start + var children = node.children + var length = children.length + var index = -1 + var bullet + + start = start == null ? 1 : start while (++index < length) { - bullet = (increment ? start + index : start) + dot$4; - values[index] = fn.call(self, children[index], node, index, bullet); + bullet = (increment ? start + index : start) + dot + values[index] = fn.call(self, children[index], node, index, bullet) } - return values.join(node.spread ? blank$2 : lineFeed$20) + return values.join(node.spread ? blank : lineFeed) } -var unorderedItems_1 = unorderedItems; -var lineFeed$21 = '\n'; +/***/ }), +/* 273 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + -var blank$3 = lineFeed$21 + lineFeed$21; +module.exports = unorderedItems + +var lineFeed = '\n' + +var blank = lineFeed + lineFeed // Visit unordered list items. Uses `options.bullet` as each item’s bullet. function unorderedItems(node) { - var self = this; - var bullet = self.options.bullet; - var fn = self.visitors.listItem; - var children = node.children; - var length = children.length; - var index = -1; - var values = []; + var self = this + var bullet = self.options.bullet + var fn = self.visitors.listItem + var children = node.children + var length = children.length + var index = -1 + var values = [] while (++index < length) { - values[index] = fn.call(self, children[index], node, index, bullet); + values[index] = fn.call(self, children[index], node, index, bullet) } - return values.join(node.spread ? blank$3 : lineFeed$21) + return values.join(node.spread ? blank : lineFeed) } -var root_1 = root; -var lineFeed$22 = '\n'; +/***/ }), +/* 274 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = root + +var lineFeed = '\n' // Stringify a root. // Adds a final newline to ensure valid POSIX files. */ function root(node) { - return this.block(node) + lineFeed$22 + return this.block(node) + lineFeed } -var text_1$2 = text$2; + +/***/ }), +/* 275 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = text // Stringify text. // Supports named entities in `settings.encode: true` mode: @@ -29486,17 +33922,27 @@ var text_1$2 = text$2; // ```markdown // AT&T // ``` -function text$2(node, parent) { +function text(node, parent) { return this.encode(this.escape(node.value, node, parent), node) } -var heading_1 = heading; -var lineFeed$23 = '\n'; -var space$17 = ' '; -var numberSign$2 = '#'; -var dash$6 = '-'; -var equalsTo$1 = '='; +/***/ }), +/* 276 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var repeat = __webpack_require__(10) + +module.exports = heading + +var lineFeed = '\n' +var space = ' ' +var numberSign = '#' +var dash = '-' +var equalsTo = '=' // Stringify a heading. // @@ -29520,93 +33966,105 @@ var equalsTo$1 = '='; // ### Foo ### // ``` function heading(node) { - var self = this; - var depth = node.depth; - var setext = self.options.setext; - var closeAtx = self.options.closeAtx; - var content = self.all(node).join(''); - var prefix; + var self = this + var depth = node.depth + var setext = self.options.setext + var closeAtx = self.options.closeAtx + var content = self.all(node).join('') + var prefix if (setext && depth < 3) { return ( - content + lineFeed$23 + repeatString(depth === 1 ? equalsTo$1 : dash$6, content.length) + content + lineFeed + repeat(depth === 1 ? equalsTo : dash, content.length) ) } - prefix = repeatString(numberSign$2, node.depth); + prefix = repeat(numberSign, node.depth) + + return prefix + space + content + (closeAtx ? space + prefix : '') +} + + +/***/ }), +/* 277 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + - return prefix + space$17 + content + (closeAtx ? space$17 + prefix : '') +module.exports = paragraph + +function paragraph(node) { + return this.all(node).join('') } -var paragraph_1$2 = paragraph$1; -function paragraph$1(node) { - return this.all(node).join('') -} +/***/ }), +/* 278 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + -var blockquote_1$2 = blockquote$1; +module.exports = blockquote -var lineFeed$24 = '\n'; -var space$18 = ' '; -var greaterThan$5 = '>'; +var lineFeed = '\n' +var space = ' ' +var greaterThan = '>' -function blockquote$1(node) { - var values = this.block(node).split(lineFeed$24); - var result = []; - var length = values.length; - var index = -1; - var value; +function blockquote(node) { + var values = this.block(node).split(lineFeed) + var result = [] + var length = values.length + var index = -1 + var value while (++index < length) { - value = values[index]; - result[index] = (value ? space$18 : '') + value; + value = values[index] + result[index] = (value ? space : '') + value } - return greaterThan$5 + result.join(lineFeed$24 + greaterThan$5) + return greaterThan + result.join(lineFeed + greaterThan) } -var list_1$2 = list$1; -function list$1(node) { - var fn = node.ordered ? this.visitOrderedItems : this.visitUnorderedItems; +/***/ }), +/* 279 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = list + +function list(node) { + var fn = node.ordered ? this.visitOrderedItems : this.visitUnorderedItems return fn.call(this, node) } -var pad_1 = pad; - -var lineFeed$25 = '\n'; -var space$19 = ' '; -var tabSize$5 = 4; +/***/ }), +/* 280 */ +/***/ (function(module, exports, __webpack_require__) { -// Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty -// lines. -function pad(value, level) { - var values = value.split(lineFeed$25); - var index = values.length; - var padding = repeatString(space$19, level * tabSize$5); +"use strict"; - while (index--) { - if (values[index].length !== 0) { - values[index] = padding + values[index]; - } - } - return values.join(lineFeed$25) -} +var repeat = __webpack_require__(10) +var pad = __webpack_require__(90) -var listItem_1 = listItem$1; +module.exports = listItem -var lineFeed$26 = '\n'; -var space$20 = ' '; -var leftSquareBracket$6 = '['; -var rightSquareBracket$6 = ']'; -var lowercaseX$1 = 'x'; +var lineFeed = '\n' +var space = ' ' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var lowercaseX = 'x' -var ceil = Math.ceil; -var blank$4 = lineFeed$26 + lineFeed$26; +var ceil = Math.ceil +var blank = lineFeed + lineFeed -var tabSize$6 = 4; +var tabSize = 4 // Stringify a list item. // @@ -29621,92 +34079,66 @@ var tabSize$6 = 4; // ```markdown // [ ] foo // ``` -function listItem$1(node, parent, position, bullet) { - var self = this; - var style = self.options.listItemIndent; - var marker = bullet || self.options.bullet; - var spread = node.spread == null ? true : node.spread; - var checked = node.checked; - var children = node.children; - var length = children.length; - var values = []; - var index = -1; - var value; - var indent; - var spacing; +function listItem(node, parent, position, bullet) { + var self = this + var style = self.options.listItemIndent + var marker = bullet || self.options.bullet + var spread = node.spread == null ? true : node.spread + var checked = node.checked + var children = node.children + var length = children.length + var values = [] + var index = -1 + var value + var indent + var spacing while (++index < length) { - values[index] = self.visit(children[index], node); + values[index] = self.visit(children[index], node) } - value = values.join(spread ? blank$4 : lineFeed$26); + value = values.join(spread ? blank : lineFeed) if (typeof checked === 'boolean') { // Note: I’d like to be able to only add the space between the check and // the value, but unfortunately github does not support empty list-items // with a checkbox :( value = - leftSquareBracket$6 + - (checked ? lowercaseX$1 : space$20) + - rightSquareBracket$6 + - space$20 + - value; + leftSquareBracket + + (checked ? lowercaseX : space) + + rightSquareBracket + + space + + value } - if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed$26) === -1)) { - indent = marker.length + 1; - spacing = space$20; + if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed) === -1)) { + indent = marker.length + 1 + spacing = space } else { - indent = ceil((marker.length + 1) / tabSize$6) * tabSize$6; - spacing = repeatString(space$20, indent - marker.length); + indent = ceil((marker.length + 1) / tabSize) * tabSize + spacing = repeat(space, indent - marker.length) } return value - ? marker + spacing + pad_1(value, indent / tabSize$6).slice(indent) + ? marker + spacing + pad(value, indent / tabSize).slice(indent) : marker } -/* Expose. */ -var longestStreak_1 = longestStreak; - -/* Get the count of the longest repeating streak of - * `character` in `value`. */ -function longestStreak(value, character) { - var count = 0; - var maximum = 0; - var expected; - var index; - - if (typeof character !== 'string' || character.length !== 1) { - throw new Error('Expected character'); - } - - value = String(value); - index = value.indexOf(character); - expected = index; - while (index !== -1) { - count++; +/***/ }), +/* 281 */ +/***/ (function(module, exports, __webpack_require__) { - if (index === expected) { - if (count > maximum) { - maximum = count; - } - } else { - count = 1; - } +"use strict"; - expected = index + 1; - index = value.indexOf(character, expected); - } - return maximum; -} +var streak = __webpack_require__(91) +var repeat = __webpack_require__(10) -var inlineCode_1 = inlineCode$1; +module.exports = inlineCode -var space$21 = ' '; -var graveAccent$5 = '`'; +var space = ' ' +var graveAccent = '`' // Stringify inline code. // @@ -29723,27 +34155,39 @@ var graveAccent$5 = '`'; // `` `foo `` // `` foo` `` // ``` -function inlineCode$1(node) { - var value = node.value; - var ticks = repeatString(graveAccent$5, longestStreak_1(value, graveAccent$5) + 1); - var start = ticks; - var end = ticks; +function inlineCode(node) { + var value = node.value + var ticks = repeat(graveAccent, streak(value, graveAccent) + 1) + var start = ticks + var end = ticks - if (value.charAt(0) === graveAccent$5) { - start += space$21; + if (value.charAt(0) === graveAccent) { + start += space } - if (value.charAt(value.length - 1) === graveAccent$5) { - end = space$21 + end; + if (value.charAt(value.length - 1) === graveAccent) { + end = space + end } return start + value + end } -var code_1 = code; -var lineFeed$27 = '\n'; -var space$22 = ' '; +/***/ }), +/* 282 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var streak = __webpack_require__(91) +var repeat = __webpack_require__(10) +var pad = __webpack_require__(90) + +module.exports = code + +var lineFeed = '\n' +var space = ' ' // Stringify code. // Creates indented code when: @@ -29778,18 +34222,18 @@ var space$22 = ' '; // ```` // ````` function code(node, parent) { - var self = this; - var value = node.value; - var options = self.options; - var marker = options.fence; - var info = node.lang || ''; - var fence; + var self = this + var value = node.value + var options = self.options + var marker = options.fence + var info = node.lang || '' + var fence if (info && node.meta) { - info += space$22 + node.meta; + info += space + node.meta } - info = self.encode(self.escape(info, node)); + info = self.encode(self.escape(info, node)) // Without (needed) fences. if (!info && !options.fences && value) { @@ -29803,26 +34247,44 @@ function code(node, parent) { self.file.fail( 'Cannot indent code properly. See https://git.io/fxKR8', node.position - ); + ) } - return pad_1(value, 1) + return pad(value, 1) } - fence = repeatString(marker, Math.max(longestStreak_1(value, marker) + 1, 3)); + fence = repeat(marker, Math.max(streak(value, marker) + 1, 3)) - return fence + info + lineFeed$27 + value + lineFeed$27 + fence + return fence + info + lineFeed + value + lineFeed + fence } -var html_1 = html$2; -function html$2(node) { +/***/ }), +/* 283 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = html + +function html(node) { return node.value } -var thematicBreak$1 = thematic; -var space$23 = ' '; +/***/ }), +/* 284 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var repeat = __webpack_require__(10) + +module.exports = thematic + +var space = ' ' // Stringify a `thematic-break`. // The character used is configurable through `rule`: (`'_'`): @@ -29843,12 +34305,22 @@ var space$23 = ' '; // * * * // ``` function thematic() { - var options = this.options; - var rule = repeatString(options.rule, options.ruleRepetition); - return options.ruleSpaces ? rule.split('').join(space$23) : rule + var options = this.options + var rule = repeat(options.rule, options.ruleRepetition) + return options.ruleSpaces ? rule.split('').join(space) : rule } -var strong_1$2 = strong$3; + +/***/ }), +/* 285 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var repeat = __webpack_require__(10) + +module.exports = strong // Stringify a `strong`. // @@ -29858,15 +34330,23 @@ var strong_1$2 = strong$3; // ```markdown // __foo__ // ``` -function strong$3(node) { - var marker = repeatString(this.options.strong, 2); +function strong(node) { + var marker = repeat(this.options.strong, 2) return marker + this.all(node).join('') + marker } -var emphasis_1$2 = emphasis$3; -var underscore$5 = '_'; -var asterisk$5 = '*'; +/***/ }), +/* 286 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = emphasis + +var underscore = '_' +var asterisk = '*' // Stringify an `emphasis`. // @@ -29883,125 +34363,84 @@ var asterisk$5 = '*'; // ```markdown // *foo_bar* // ``` -function emphasis$3(node) { - var marker = this.options.emphasis; - var content = this.all(node).join(''); +function emphasis(node) { + var marker = this.options.emphasis + var content = this.all(node).join('') // When in pedantic mode, prevent using underscore as the marker when there // are underscores in the content. if ( this.options.pedantic && - marker === underscore$5 && + marker === underscore && content.indexOf(marker) !== -1 ) { - marker = asterisk$5; + marker = asterisk } return marker + content + marker } -var _break$4 = lineBreak; -var backslash$10 = '\\'; -var lineFeed$28 = '\n'; -var space$24 = ' '; +/***/ }), +/* 287 */ +/***/ (function(module, exports, __webpack_require__) { -var commonmark$1 = backslash$10 + lineFeed$28; -var normal = space$24 + space$24 + lineFeed$28; +"use strict"; -function lineBreak() { - return this.options.commonmark ? commonmark$1 : normal -} -var _delete$4 = strikethrough$1; +module.exports = lineBreak -var tilde$5 = '~'; +var backslash = '\\' +var lineFeed = '\n' +var space = ' ' -var fence$1 = tilde$5 + tilde$5; +var commonmark = backslash + lineFeed +var normal = space + space + lineFeed -function strikethrough$1(node) { - return fence$1 + this.all(node).join('') + fence$1 +function lineBreak() { + return this.options.commonmark ? commonmark : normal } -var ccount_1 = ccount; - -function ccount(value, character) { - var count = 0; - var index; - - value = String(value); - if (typeof character !== 'string' || character.length !== 1) { - throw new Error('Expected character') - } +/***/ }), +/* 288 */ +/***/ (function(module, exports, __webpack_require__) { - index = value.indexOf(character); +"use strict"; - while (index !== -1) { - count++; - index = value.indexOf(character, index + 1); - } - return count -} +module.exports = strikethrough -var encloseUri = enclose; +var tilde = '~' -var leftParenthesis$4 = '('; -var rightParenthesis$5 = ')'; -var lessThan$7 = '<'; -var greaterThan$6 = '>'; +var fence = tilde + tilde -var expression = /\s/; +function strikethrough(node) { + return fence + this.all(node).join('') + fence +} -// Wrap `url` in angle brackets when needed, or when -// forced. -// In links, images, and definitions, the URL part needs -// to be enclosed when it: -// -// - has a length of `0` -// - contains white-space -// - has more or less opening than closing parentheses -function enclose(uri, always) { - if ( - always || - uri.length === 0 || - expression.test(uri) || - ccount_1(uri, leftParenthesis$4) !== ccount_1(uri, rightParenthesis$5) - ) { - return lessThan$7 + uri + greaterThan$6 - } - return uri -} +/***/ }), +/* 289 */ +/***/ (function(module, exports, __webpack_require__) { -var encloseTitle = enclose$1; +"use strict"; -var quotationMark$3 = '"'; -var apostrophe$3 = "'"; -// There is currently no way to support nested delimiters across Markdown.pl, -// CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl -// and GitHub. -// CommonMark is not supported when mixing double- and single quotes inside a -// title. -function enclose$1(title) { - var delimiter = - title.indexOf(quotationMark$3) === -1 ? quotationMark$3 : apostrophe$3; - return delimiter + title + delimiter -} +var uri = __webpack_require__(43) +var title = __webpack_require__(44) -var link_1$2 = link$4; +module.exports = link -var space$25 = ' '; -var leftSquareBracket$7 = '['; -var rightSquareBracket$7 = ']'; -var leftParenthesis$5 = '('; -var rightParenthesis$6 = ')'; +var space = ' ' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var leftParenthesis = '(' +var rightParenthesis = ')' // Expression for a protocol: // See . -var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; +var protocol = /^[a-z][a-z+.-]+:\/?/i // Stringify a link. // @@ -30022,41 +34461,115 @@ var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; // // Supports named entities in the `url` and `title` when in `settings.encode` // mode. -function link$4(node) { - var self = this; - var content = self.encode(node.url || '', node); - var exit = self.enterLink(); - var escaped = self.encode(self.escape(node.url || '', node)); - var value = self.all(node).join(''); +function link(node) { + var self = this + var content = self.encode(node.url || '', node) + var exit = self.enterLink() + var escaped = self.encode(self.escape(node.url || '', node)) + var value = self.all(node).join('') - exit(); + exit() - if (node.title == null && protocol$1.test(content) && escaped === value) { + if (node.title == null && protocol.test(content) && escaped === value) { // Backslash escapes do not work in autolinks, so we do not escape. - return encloseUri(self.encode(node.url), true) + return uri(self.encode(node.url), true) } - content = encloseUri(content); + content = uri(content) if (node.title) { - content += space$25 + encloseTitle(self.encode(self.escape(node.title, node), node)); + content += space + title(self.encode(self.escape(node.title, node), node)) } return ( - leftSquareBracket$7 + + leftSquareBracket + value + - rightSquareBracket$7 + - leftParenthesis$5 + + rightSquareBracket + + leftParenthesis + content + - rightParenthesis$6 + rightParenthesis ) } -var copyIdentifierEncoding = copy$5; -var ampersand$2 = '&'; +/***/ }), +/* 290 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = ccount + +function ccount(value, character) { + var count = 0 + var index + + value = String(value) + + if (typeof character !== 'string' || character.length !== 1) { + throw new Error('Expected character') + } + + index = value.indexOf(character) + + while (index !== -1) { + count++ + index = value.indexOf(character, index + 1) + } + + return count +} + + +/***/ }), +/* 291 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var copy = __webpack_require__(292) +var label = __webpack_require__(92) + +module.exports = linkReference + +var leftSquareBracket = '[' +var rightSquareBracket = ']' + +var shortcut = 'shortcut' +var collapsed = 'collapsed' + +function linkReference(node) { + var self = this + var type = node.referenceType + var exit = self.enterLinkReference(self, node) + var value = self.all(node).join('') + + exit() + + if (type === shortcut || type === collapsed) { + value = copy(value, node.label || node.identifier) + } + + return leftSquareBracket + value + rightSquareBracket + label(node) +} + + +/***/ }), +/* 292 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var entityPrefixLength = __webpack_require__(89) -var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; +module.exports = copy + +var ampersand = '&' + +var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/ // For shortcut and collapsed reference links, the contents is also an // identifier, so we need to restore the original encoding and escaping @@ -30065,128 +34578,100 @@ var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; // This function takes the unescaped & unencoded value from shortcut’s // child nodes and the identifier and encodes the former according to // the latter. -function copy$5(value, identifier) { - var length = value.length; - var count = identifier.length; - var result = []; - var position = 0; - var index = 0; - var start; +function copy(value, identifier) { + var length = value.length + var count = identifier.length + var result = [] + var position = 0 + var index = 0 + var start while (index < length) { // Take next non-punctuation characters from `value`. - start = index; + start = index while (index < length && !punctuationExppresion.test(value.charAt(index))) { - index += 1; + index += 1 } - result.push(value.slice(start, index)); + result.push(value.slice(start, index)) // Advance `position` to the next punctuation character. while ( position < count && !punctuationExppresion.test(identifier.charAt(position)) ) { - position += 1; + position += 1 } // Take next punctuation characters from `identifier`. - start = position; + start = position while ( position < count && punctuationExppresion.test(identifier.charAt(position)) ) { - if (identifier.charAt(position) === ampersand$2) { - position += entityPrefixLength(identifier.slice(position)); + if (identifier.charAt(position) === ampersand) { + position += entityPrefixLength(identifier.slice(position)) } - position += 1; + position += 1 } - result.push(identifier.slice(start, position)); + result.push(identifier.slice(start, position)) // Advance `index` to the next non-punctuation character. while (index < length && punctuationExppresion.test(value.charAt(index))) { - index += 1; + index += 1 } } return result.join('') } -var label_1 = label; -var leftSquareBracket$8 = '['; -var rightSquareBracket$8 = ']'; +/***/ }), +/* 293 */ +/***/ (function(module, exports, __webpack_require__) { -var shortcut$2 = 'shortcut'; -var collapsed$1 = 'collapsed'; +"use strict"; -// Stringify a reference label. -// Because link references are easily, mistakingly, created (for example, -// `[foo]`), reference nodes have an extra property depicting how it looked in -// the original document, so stringification can cause minimal changes. -function label(node) { - var type = node.referenceType; - if (type === shortcut$2) { - return '' - } +var label = __webpack_require__(92) + +module.exports = imageReference +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var exclamationMark = '!' + +function imageReference(node) { return ( - leftSquareBracket$8 + - (type === collapsed$1 ? '' : node.label || node.identifier) + - rightSquareBracket$8 + exclamationMark + + leftSquareBracket + + (this.encode(node.alt, node) || '') + + rightSquareBracket + + label(node) ) } -var linkReference_1 = linkReference; - -var leftSquareBracket$9 = '['; -var rightSquareBracket$9 = ']'; -var shortcut$3 = 'shortcut'; -var collapsed$2 = 'collapsed'; +/***/ }), +/* 294 */ +/***/ (function(module, exports, __webpack_require__) { -function linkReference(node) { - var self = this; - var type = node.referenceType; - var exit = self.enterLinkReference(self, node); - var value = self.all(node).join(''); - - exit(); - - if (type === shortcut$3 || type === collapsed$2) { - value = copyIdentifierEncoding(value, node.label || node.identifier); - } - - return leftSquareBracket$9 + value + rightSquareBracket$9 + label_1(node) -} - -var imageReference_1 = imageReference; +"use strict"; -var leftSquareBracket$10 = '['; -var rightSquareBracket$10 = ']'; -var exclamationMark$5 = '!'; -function imageReference(node) { - return ( - exclamationMark$5 + - leftSquareBracket$10 + - (this.encode(node.alt, node) || '') + - rightSquareBracket$10 + - label_1(node) - ) -} +var uri = __webpack_require__(43) +var title = __webpack_require__(44) -var definition_1$2 = definition$1; +module.exports = definition -var space$26 = ' '; -var colon$6 = ':'; -var leftSquareBracket$11 = '['; -var rightSquareBracket$11 = ']'; +var space = ' ' +var colon = ':' +var leftSquareBracket = '[' +var rightSquareBracket = ']' // Stringify an URL definition. // @@ -30196,31 +34681,42 @@ var rightSquareBracket$11 = ']'; // ```markdown // [foo]: 'An "example" e-mail' // ``` -function definition$1(node) { - var content = encloseUri(node.url); +function definition(node) { + var content = uri(node.url) if (node.title) { - content += space$26 + encloseTitle(node.title); + content += space + title(node.title) } return ( - leftSquareBracket$11 + + leftSquareBracket + (node.label || node.identifier) + - rightSquareBracket$11 + - colon$6 + - space$26 + + rightSquareBracket + + colon + + space + content ) } -var image_1 = image$3; -var space$27 = ' '; -var leftParenthesis$6 = '('; -var rightParenthesis$7 = ')'; -var leftSquareBracket$12 = '['; -var rightSquareBracket$12 = ']'; -var exclamationMark$6 = '!'; +/***/ }), +/* 295 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var uri = __webpack_require__(43) +var title = __webpack_require__(44) + +module.exports = image + +var space = ' ' +var leftParenthesis = '(' +var rightParenthesis = ')' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var exclamationMark = '!' // Stringify an image. // @@ -30233,313 +34729,422 @@ var exclamationMark$6 = '!'; // // Supports named entities in `url`, `alt`, and `title` when in // `settings.encode` mode. -function image$3(node) { - var self = this; - var content = encloseUri(self.encode(node.url || '', node)); - var exit = self.enterLink(); - var alt = self.encode(self.escape(node.alt || '', node)); +function image(node) { + var self = this + var content = uri(self.encode(node.url || '', node)) + var exit = self.enterLink() + var alt = self.encode(self.escape(node.alt || '', node)) - exit(); + exit() if (node.title) { - content += space$27 + encloseTitle(self.encode(node.title, node)); + content += space + title(self.encode(node.title, node)) } return ( - exclamationMark$6 + - leftSquareBracket$12 + + exclamationMark + + leftSquareBracket + alt + - rightSquareBracket$12 + - leftParenthesis$6 + + rightSquareBracket + + leftParenthesis + content + - rightParenthesis$7 + rightParenthesis ) } -var footnote_1 = footnote$1; -var leftSquareBracket$13 = '['; -var rightSquareBracket$13 = ']'; -var caret$3 = '^'; +/***/ }), +/* 296 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -function footnote$1(node) { + +module.exports = footnote + +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var caret = '^' + +function footnote(node) { return ( - leftSquareBracket$13 + caret$3 + this.all(node).join('') + rightSquareBracket$13 + leftSquareBracket + caret + this.all(node).join('') + rightSquareBracket ) } -var footnoteReference_1 = footnoteReference; -var leftSquareBracket$14 = '['; -var rightSquareBracket$14 = ']'; -var caret$4 = '^'; +/***/ }), +/* 297 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = footnoteReference + +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var caret = '^' function footnoteReference(node) { return ( - leftSquareBracket$14 + - caret$4 + + leftSquareBracket + + caret + (node.label || node.identifier) + - rightSquareBracket$14 + rightSquareBracket ) } -var lineFeed$29 = '\n'; -var space$28 = ' '; -var colon$7 = ':'; -var leftSquareBracket$15 = '['; -var rightSquareBracket$15 = ']'; -var caret$5 = '^'; -var tabSize$7 = 4; -var blank$5 = lineFeed$29 + lineFeed$29; -var indent = repeatString(space$28, tabSize$7); +/***/ }), +/* 298 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var repeat = __webpack_require__(10) + +var lineFeed = '\n' +var space = ' ' +var colon = ':' +var leftSquareBracket = '[' +var rightSquareBracket = ']' +var caret = '^' + +var tabSize = 4 +var blank = lineFeed + lineFeed +var indent = repeat(space, tabSize) -var footnoteDefinition_1$2 = footnoteDefinition$1; +module.exports = footnoteDefinition -function footnoteDefinition$1(node) { - var content = this.all(node).join(blank$5 + indent); +function footnoteDefinition(node) { + var content = this.all(node).join(blank + indent) return ( - leftSquareBracket$15 + - caret$5 + + leftSquareBracket + + caret + (node.label || node.identifier) + - rightSquareBracket$15 + - colon$7 + - space$28 + + rightSquareBracket + + colon + + space + content ) } + +/***/ }), +/* 299 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var markdownTable = __webpack_require__(300) + +module.exports = table + +var space = ' ' +var verticalBar = '|' + +// Stringify table. +// +// Creates a fenced table by default, but not in `looseTable: true` mode: +// +// ```markdown +// Foo | Bar +// :-: | --- +// Baz | Qux +// +// NOTE: Be careful with `looseTable: true` mode, as a loose table inside an +// indented code block on GitHub renders as an actual table! +// +// Creates a spaced table by default, but not in `spacedTable: false`: +// +// ```markdown +// |Foo|Bar| +// |:-:|---| +// |Baz|Qux| +// ``` +function table(node) { + var self = this + var options = self.options + var loose = options.looseTable + var spaced = options.spacedTable + var pad = options.paddedTable + var stringLength = options.stringLength + var rows = node.children + var index = rows.length + var exit = self.enterTable() + var result = [] + var start + var end + + while (index--) { + result[index] = self.all(rows[index]) + } + + exit() + + if (loose) { + start = '' + end = '' + } else if (spaced) { + start = verticalBar + space + end = space + verticalBar + } else { + start = verticalBar + end = verticalBar + } + + return markdownTable(result, { + align: node.align, + pad: pad, + start: start, + end: end, + stringLength: stringLength, + delimiter: spaced ? space + verticalBar + space : verticalBar + }) +} + + +/***/ }), +/* 300 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + /* Expose. */ -var markdownTable_1 = markdownTable; +module.exports = markdownTable /* Expressions. */ -var EXPRESSION_DOT = /\./; -var EXPRESSION_LAST_DOT = /\.[^.]*$/; +var EXPRESSION_DOT = /\./ +var EXPRESSION_LAST_DOT = /\.[^.]*$/ /* Allowed alignment values. */ -var LEFT = 'l'; -var RIGHT = 'r'; -var CENTER = 'c'; -var DOT = '.'; -var NULL = ''; +var LEFT = 'l' +var RIGHT = 'r' +var CENTER = 'c' +var DOT = '.' +var NULL = '' -var ALLIGNMENT = [LEFT, RIGHT, CENTER, DOT, NULL]; -var MIN_CELL_SIZE = 3; +var ALLIGNMENT = [LEFT, RIGHT, CENTER, DOT, NULL] +var MIN_CELL_SIZE = 3 /* Characters. */ -var COLON = ':'; -var DASH = '-'; -var PIPE = '|'; -var SPACE = ' '; -var NEW_LINE = '\n'; +var COLON = ':' +var DASH = '-' +var PIPE = '|' +var SPACE = ' ' +var NEW_LINE = '\n' /* Create a table from a matrix of strings. */ function markdownTable(table, options) { - var settings = options || {}; - var delimiter = settings.delimiter; - var start = settings.start; - var end = settings.end; - var alignment = settings.align; - var calculateStringLength = settings.stringLength || lengthNoop; - var cellCount = 0; - var rowIndex = -1; - var rowLength = table.length; - var sizes = []; - var align; - var rule; - var rows; - var row; - var cells; - var index; - var position; - var size; - var value; - var spacing; - var before; - var after; - - alignment = alignment ? alignment.concat() : []; + var settings = options || {} + var delimiter = settings.delimiter + var start = settings.start + var end = settings.end + var alignment = settings.align + var calculateStringLength = settings.stringLength || lengthNoop + var cellCount = 0 + var rowIndex = -1 + var rowLength = table.length + var sizes = [] + var align + var rule + var rows + var row + var cells + var index + var position + var size + var value + var spacing + var before + var after + + alignment = alignment ? alignment.concat() : [] if (delimiter === null || delimiter === undefined) { - delimiter = SPACE + PIPE + SPACE; + delimiter = SPACE + PIPE + SPACE } if (start === null || start === undefined) { - start = PIPE + SPACE; + start = PIPE + SPACE } if (end === null || end === undefined) { - end = SPACE + PIPE; + end = SPACE + PIPE } while (++rowIndex < rowLength) { - row = table[rowIndex]; + row = table[rowIndex] - index = -1; + index = -1 if (row.length > cellCount) { - cellCount = row.length; + cellCount = row.length } while (++index < cellCount) { - position = row[index] ? dotindex$1(row[index]) : null; + position = row[index] ? dotindex(row[index]) : null if (!sizes[index]) { - sizes[index] = MIN_CELL_SIZE; + sizes[index] = MIN_CELL_SIZE } if (position > sizes[index]) { - sizes[index] = position; + sizes[index] = position } } } if (typeof alignment === 'string') { - alignment = pad$2(cellCount, alignment).split(''); + alignment = pad(cellCount, alignment).split('') } /* Make sure only valid alignments are used. */ - index = -1; + index = -1 while (++index < cellCount) { - align = alignment[index]; + align = alignment[index] if (typeof align === 'string') { - align = align.charAt(0).toLowerCase(); + align = align.charAt(0).toLowerCase() } if (ALLIGNMENT.indexOf(align) === -1) { - align = NULL; + align = NULL } - alignment[index] = align; + alignment[index] = align } - rowIndex = -1; - rows = []; + rowIndex = -1 + rows = [] while (++rowIndex < rowLength) { - row = table[rowIndex]; + row = table[rowIndex] - index = -1; - cells = []; + index = -1 + cells = [] while (++index < cellCount) { - value = row[index]; + value = row[index] - value = stringify$6(value); + value = stringify(value) if (alignment[index] === DOT) { - position = dotindex$1(value); + position = dotindex(value) size = sizes[index] + (EXPRESSION_DOT.test(value) ? 0 : 1) - - (calculateStringLength(value) - position); + (calculateStringLength(value) - position) - cells[index] = value + pad$2(size - 1); + cells[index] = value + pad(size - 1) } else { - cells[index] = value; + cells[index] = value } } - rows[rowIndex] = cells; + rows[rowIndex] = cells } - sizes = []; - rowIndex = -1; + sizes = [] + rowIndex = -1 while (++rowIndex < rowLength) { - cells = rows[rowIndex]; + cells = rows[rowIndex] - index = -1; + index = -1 while (++index < cellCount) { - value = cells[index]; + value = cells[index] if (!sizes[index]) { - sizes[index] = MIN_CELL_SIZE; + sizes[index] = MIN_CELL_SIZE } - size = calculateStringLength(value); + size = calculateStringLength(value) if (size > sizes[index]) { - sizes[index] = size; + sizes[index] = size } } } - rowIndex = -1; + rowIndex = -1 while (++rowIndex < rowLength) { - cells = rows[rowIndex]; + cells = rows[rowIndex] - index = -1; + index = -1 if (settings.pad !== false) { while (++index < cellCount) { - value = cells[index]; + value = cells[index] - position = sizes[index] - (calculateStringLength(value) || 0); - spacing = pad$2(position); + position = sizes[index] - (calculateStringLength(value) || 0) + spacing = pad(position) if (alignment[index] === RIGHT || alignment[index] === DOT) { - value = spacing + value; + value = spacing + value } else if (alignment[index] === CENTER) { - position /= 2; + position /= 2 if (position % 1 === 0) { - before = position; - after = position; + before = position + after = position } else { - before = position + 0.5; - after = position - 0.5; + before = position + 0.5 + after = position - 0.5 } - value = pad$2(before) + value + pad$2(after); + value = pad(before) + value + pad(after) } else { - value += spacing; + value += spacing } - cells[index] = value; + cells[index] = value } } - rows[rowIndex] = cells.join(delimiter); + rows[rowIndex] = cells.join(delimiter) } if (settings.rule !== false) { - index = -1; - rule = []; + index = -1 + rule = [] while (++index < cellCount) { /* When `pad` is false, make the rule the same size as the first row. */ if (settings.pad === false) { - value = table[0][index]; - spacing = calculateStringLength(stringify$6(value)); - spacing = spacing > MIN_CELL_SIZE ? spacing : MIN_CELL_SIZE; + value = table[0][index] + spacing = calculateStringLength(stringify(value)) + spacing = spacing > MIN_CELL_SIZE ? spacing : MIN_CELL_SIZE } else { - spacing = sizes[index]; + spacing = sizes[index] } - align = alignment[index]; + align = alignment[index] /* When `align` is left, don't add colons. */ - value = align === RIGHT || align === NULL ? DASH : COLON; - value += pad$2(spacing - 2, DASH); - value += align !== LEFT && align !== NULL ? COLON : DASH; + value = align === RIGHT || align === NULL ? DASH : COLON + value += pad(spacing - 2, DASH) + value += align !== LEFT && align !== NULL ? COLON : DASH - rule[index] = value; + rule[index] = value } - rows.splice(1, 0, rule.join(delimiter)); + rows.splice(1, 0, rule.join(delimiter)) } return start + rows.join(end + NEW_LINE + start) + end } -function stringify$6(value) { +function stringify(value) { return value === null || value === undefined ? '' : String(value) } @@ -30549,296 +35154,186 @@ function lengthNoop(value) { } /* Get a string consisting of `length` `character`s. */ -function pad$2(length, character) { +function pad(length, character) { return new Array(length + 1).join(character || SPACE) } /* Get the position of the last dot in `value`. */ -function dotindex$1(value) { - var match = EXPRESSION_LAST_DOT.exec(value); +function dotindex(value) { + var match = EXPRESSION_LAST_DOT.exec(value) return match ? match.index + 1 : value.length } -var table_1$2 = table$2; - -var space$29 = ' '; -var verticalBar$2 = '|'; - -// Stringify table. -// -// Creates a fenced table by default, but not in `looseTable: true` mode: -// -// ```markdown -// Foo | Bar -// :-: | --- -// Baz | Qux -// -// NOTE: Be careful with `looseTable: true` mode, as a loose table inside an -// indented code block on GitHub renders as an actual table! -// -// Creates a spaced table by default, but not in `spacedTable: false`: -// -// ```markdown -// |Foo|Bar| -// |:-:|---| -// |Baz|Qux| -// ``` -function table$2(node) { - var self = this; - var options = self.options; - var loose = options.looseTable; - var spaced = options.spacedTable; - var pad = options.paddedTable; - var stringLength = options.stringLength; - var rows = node.children; - var index = rows.length; - var exit = self.enterTable(); - var result = []; - var start; - var end; - - while (index--) { - result[index] = self.all(rows[index]); - } - exit(); +/***/ }), +/* 301 */ +/***/ (function(module, exports, __webpack_require__) { - if (loose) { - start = ''; - end = ''; - } else if (spaced) { - start = verticalBar$2 + space$29; - end = space$29 + verticalBar$2; - } else { - start = verticalBar$2; - end = verticalBar$2; - } +"use strict"; - return markdownTable_1(result, { - align: node.align, - pad: pad, - start: start, - end: end, - stringLength: stringLength, - delimiter: spaced ? space$29 + verticalBar$2 + space$29 : verticalBar$2 - }) -} -var tableCell_1 = tableCell; +module.exports = tableCell function tableCell(node) { return this.all(node).join('') } -var compiler = Compiler; -// Construct a new compiler. -function Compiler(tree, file) { - this.inLink = false; - this.inTable = false; - this.tree = tree; - this.file = file; - this.options = immutable(this.options); - this.setOptions({}); +/***/ }), +/* 302 */ +/***/ (function(module) { + +module.exports = {"name":"remark","version":"10.0.0","description":"Markdown processor powered by plugins","license":"MIT","keywords":["markdown","abstract","syntax","tree","ast","parse","stringify","process"],"homepage":"http://remark.js.org","repository":"https://github.com/remarkjs/remark/tree/master/packages/remark","bugs":"https://github.com/remarkjs/remark/issues","author":"Titus Wormer (http://wooorm.com)","contributors":["Titus Wormer (http://wooorm.com)"],"files":["index.js"],"dependencies":{"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"},"devDependencies":{"tape":"^4.9.1"},"scripts":{"test":"tape test.js"},"xo":false,"_resolved":"https://registry.npmjs.org/remark/-/remark-10.0.0.tgz","_integrity":"sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==","_from":"remark@10.0.0"}; + +/***/ }), +/* 303 */ +/***/ (function(module) { + +module.exports = {"name":"node-lint-md-cli-rollup","description":"remark packaged for node markdown linting","version":"1.0.0","devDependencies":{"@zeit/ncc":"^0.2.0"},"dependencies":{"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.3.1","unified-args":"^6.0.0","unified-engine":"^5.1.0"},"main":"src/cli-entry.js","scripts":{"build":"ncc build","build-node":"npm run build && cp dist/index.js ../lint-md.js"}}; + +/***/ }), +/* 304 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// @see https://github.com/nodejs/node/blob/master/doc/STYLE_GUIDE.md + + + +module.exports.plugins = [ + __webpack_require__(305), + __webpack_require__(309), + __webpack_require__(313), + __webpack_require__(314), + __webpack_require__(315), + __webpack_require__(316), + __webpack_require__(93), + __webpack_require__(93), + [ + __webpack_require__(317), + 'space' + ], + __webpack_require__(320), + __webpack_require__(321), + __webpack_require__(322), + __webpack_require__(323), + __webpack_require__(324), + __webpack_require__(325), + __webpack_require__(326), + __webpack_require__(327), + __webpack_require__(328), + __webpack_require__(329), + __webpack_require__(330), + __webpack_require__(331), + __webpack_require__(332), + __webpack_require__(333), + __webpack_require__(334), + __webpack_require__(335), + __webpack_require__(336), + __webpack_require__(337), + __webpack_require__(338), + [__webpack_require__(339), 2], + [ + __webpack_require__(340), + { + 'checked': 'x', 'unchecked': ' ' + } + ], + [__webpack_require__(341), 'fenced'], + [__webpack_require__(342), '`'], + [__webpack_require__(343), 'md'], + [__webpack_require__(344), 1], + [__webpack_require__(345), 'atx'], + [ + __webpack_require__(346), + [ + { no: 'Github', yes: 'GitHub' }, + { no: 'Javascript', yes: 'JavaScript' }, + { no: 'Node.JS', yes: 'Node.js' }, + { no: 'v8', yes: 'V8' } + ] + ], + [__webpack_require__(347), '*'], + [__webpack_require__(348), 'padded'] +]; + + +/***/ }), +/* 305 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var control = __webpack_require__(306) + +module.exports = lint + +/* `remark-lint`. This adds support for ignoring stuff from + * messages (``). + * All rules are in their own packages and presets. */ +function lint() { + this.use(lintMessageControl) } -var proto$6 = Compiler.prototype; +function lintMessageControl() { + return control({name: 'lint', source: 'remark-lint'}) +} -// Enter and exit helpers. */ -proto$6.enterLink = stateToggle('inLink', false); -proto$6.enterTable = stateToggle('inTable', false); -proto$6.enterLinkReference = enterLinkReference; -// Configuration. -proto$6.options = defaults$5; -proto$6.setOptions = setOptions_1$2; +/***/ }), +/* 306 */ +/***/ (function(module, exports, __webpack_require__) { -proto$6.compile = compile_1; -proto$6.visit = one_1; -proto$6.all = all_1; -proto$6.block = block_1; -proto$6.visitOrderedItems = orderedItems_1; -proto$6.visitUnorderedItems = unorderedItems_1; +"use strict"; -// Expose visitors. -proto$6.visitors = { - root: root_1, - text: text_1$2, - heading: heading_1, - paragraph: paragraph_1$2, - blockquote: blockquote_1$2, - list: list_1$2, - listItem: listItem_1, - inlineCode: inlineCode_1, - code: code_1, - html: html_1, - thematicBreak: thematicBreak$1, - strong: strong_1$2, - emphasis: emphasis_1$2, - break: _break$4, - delete: _delete$4, - link: link_1$2, - linkReference: linkReference_1, - imageReference: imageReference_1, - definition: definition_1$2, - image: image_1, - footnote: footnote_1, - footnoteReference: footnoteReference_1, - footnoteDefinition: footnoteDefinition_1$2, - table: table_1$2, - tableCell: tableCell_1 -}; -var remarkStringify = stringify$7; -stringify$7.Compiler = compiler; +var control = __webpack_require__(307); +var marker = __webpack_require__(308); +var xtend = __webpack_require__(7); -function stringify$7(options) { - var Local = unherit_1(compiler); - Local.prototype.options = immutable( - Local.prototype.options, - this.data('settings'), - options - ); - this.Compiler = Local; -} - -var remark = unified_1() - .use(remarkParse) - .use(remarkStringify) - .freeze(); - -const _args = [["remark@10.0.0","/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"]]; -const _from = "remark@10.0.0"; -const _id = "remark@10.0.0"; -const _inBundle = false; -const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; -const _location = "/remark"; -const _phantomChildren = {}; -const _requested = {"type":"version","registry":true,"raw":"remark@10.0.0","name":"remark","escapedName":"remark","rawSpec":"10.0.0","saveSpec":null,"fetchSpec":"10.0.0"}; -const _requiredBy = ["/"]; -const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; -const _spec = "10.0.0"; -const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"; -const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; -const bugs = {"url":"https://github.com/remarkjs/remark/issues"}; -const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; -const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; -const description = "Markdown processor powered by plugins"; -const devDependencies = {"tape":"^4.9.1"}; -const files = ["index.js"]; -const homepage = "http://remark.js.org"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; -const license = "MIT"; -const name = "remark"; -const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"}; -const scripts = {"test":"tape test.js"}; -const version$1 = "10.0.0"; -const xo = false; -var _package = { - _args: _args, - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _spec: _spec, - _where: _where, - author: author, - bugs: bugs, - contributors: contributors, - dependencies: dependencies, - description: description, - devDependencies: devDependencies, - files: files, - homepage: homepage, - keywords: keywords, - license: license, - name: name, - repository: repository, - scripts: scripts, - version: version$1, - xo: xo -}; +module.exports = messageControl; -var _package$1 = Object.freeze({ - _args: _args, - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _spec: _spec, - _where: _where, - author: author, - bugs: bugs, - contributors: contributors, - dependencies: dependencies, - description: description, - devDependencies: devDependencies, - files: files, - homepage: homepage, - keywords: keywords, - license: license, - name: name, - repository: repository, - scripts: scripts, - version: version$1, - xo: xo, - default: _package -}); +function messageControl(options) { + var settings = options || {}; -const name$1 = "node-lint-md-cli-rollup"; -const description$1 = "remark packaged for node markdown linting"; -const version$2 = "1.0.0"; -const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.3.1","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; -const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; -var _package$2 = { - name: name$1, - description: description$1, - version: version$2, - devDependencies: devDependencies$1, - dependencies: dependencies$1, - scripts: scripts$1 -}; + return control(xtend(options, { + marker: settings.marker || marker, + test: settings.test || 'html' + })); +} -var _package$3 = Object.freeze({ - name: name$1, - description: description$1, - version: version$2, - devDependencies: devDependencies$1, - dependencies: dependencies$1, - scripts: scripts$1, - default: _package$2 -}); + +/***/ }), +/* 307 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var trim = __webpack_require__(14) +var location = __webpack_require__(19) +var visit = __webpack_require__(1) /* Map of allowed verbs. */ var ALLOWED_VERBS = { enable: true, disable: true, ignore: true -}; +} -var unifiedMessageControl = messageControl; +module.exports = messageControl function messageControl(options) { - var name = options && options.name; - var marker = options && options.marker; - var test = options && options.test; - var sources; - var known; - var reset; - var enable; - var disable; + var name = options && options.name + var marker = options && options.marker + var test = options && options.test + var sources + var known + var reset + var enable + var disable if (!name) { throw new Error('Expected `name` in `options`, got `' + name + '`') @@ -30852,51 +35347,51 @@ function messageControl(options) { throw new Error('Expected `test` in `options`, got `' + test + '`') } - known = options.known; - reset = options.reset; - enable = options.enable || []; - disable = options.disable || []; - sources = options.source; + known = options.known + reset = options.reset + enable = options.enable || [] + disable = options.disable || [] + sources = options.source if (!sources) { - sources = [name]; + sources = [name] } else if (typeof sources === 'string') { - sources = [sources]; + sources = [sources] } return transformer function transformer(tree, file) { - var toOffset = vfileLocation(file).toOffset; - var initial = !reset; - var gaps = detectGaps(tree, file); - var scope = {}; - var globals = []; + var toOffset = location(file).toOffset + var initial = !reset + var gaps = detectGaps(tree, file) + var scope = {} + var globals = [] - unistUtilVisit(tree, test, visitor); + visit(tree, test, visitor) - file.messages = file.messages.filter(filter); + file.messages = file.messages.filter(filter) function visitor(node, position, parent) { - var mark = marker(node); - var ruleIds; - var ruleId; - var verb; - var index; - var length; - var next; - var pos; - var tail; + var mark = marker(node) + var ruleIds + var ruleId + var verb + var index + var length + var next + var pos + var tail if (!mark || mark.name !== options.name) { return } - ruleIds = mark.attributes.split(/\s/g); - verb = ruleIds.shift(); - next = parent.children[position + 1]; - pos = mark.node.position && mark.node.position.start; - tail = next && next.position && next.position.end; + ruleIds = mark.attributes.split(/\s/g) + verb = ruleIds.shift() + next = parent.children[position + 1] + pos = mark.node.position && mark.node.position.start + tail = next && next.position && next.position.end if (!verb || !ALLOWED_VERBS[verb] === true) { file.fail( @@ -30905,20 +35400,20 @@ function messageControl(options) { '`: expected ' + "`'enable'`, `'disable'`, or `'ignore'`", mark.node - ); + ) } - length = ruleIds.length; - index = -1; + length = ruleIds.length + index = -1 while (++index < length) { - ruleId = ruleIds[index]; + ruleId = ruleIds[index] if (isKnown(ruleId, verb, mark.node)) { - toggle(pos, verb === 'enable', ruleId); + toggle(pos, verb === 'enable', ruleId) if (verb === 'ignore') { - toggle(tail, true, ruleId); + toggle(tail, true, ruleId) } } } @@ -30926,20 +35421,20 @@ function messageControl(options) { /* Apply to all rules. */ if (!length) { if (verb === 'ignore') { - toggle(pos, false); - toggle(tail, true); + toggle(pos, false) + toggle(tail, true) } else { - toggle(pos, verb === 'enable'); - reset = verb !== 'enable'; + toggle(pos, verb === 'enable') + reset = verb !== 'enable' } } } function filter(message) { - var gapIndex = gaps.length; - var ruleId = message.ruleId; - var ranges = scope[ruleId]; - var pos; + var gapIndex = gaps.length + var ruleId = message.ruleId + var ranges = scope[ruleId] + var pos /* Keep messages from a different source. */ if (!message.source || sources.indexOf(message.source) === -1) { @@ -30949,15 +35444,15 @@ function messageControl(options) { /* We only ignore messages if they‘re disabled, * *not* when they’re not in the document. */ if (!message.line) { - message.line = 1; + message.line = 1 } if (!message.column) { - message.column = 1; + message.column = 1 } /* Check whether the warning is inside a gap. */ - pos = toOffset(message); + pos = toOffset(message) while (gapIndex--) { if (gaps[gapIndex].start <= pos && gaps[gapIndex].end > pos) { @@ -30971,10 +35466,10 @@ function messageControl(options) { /* Helper to check (and possibly warn) if a ruleId is unknown. */ function isKnown(ruleId, verb, pos) { - var result = known ? known.indexOf(ruleId) !== -1 : true; + var result = known ? known.indexOf(ruleId) !== -1 : true if (!result) { - file.warn('Unknown rule: cannot ' + verb + " `'" + ruleId + "'`", pos); + file.warn('Unknown rule: cannot ' + verb + " `'" + ruleId + "'`", pos) } return result @@ -30982,7 +35477,7 @@ function messageControl(options) { /* Get the latest state of a rule. When without `ruleId`, gets global state. */ function getState(ruleId) { - var ranges = ruleId ? scope[ruleId] : globals; + var ranges = ruleId ? scope[ruleId] : globals if (ranges && ranges.length !== 0) { return ranges[ranges.length - 1].state @@ -31001,26 +35496,26 @@ function messageControl(options) { /* Handle a rule. */ function toggle(pos, state, ruleId) { - var markers = ruleId ? scope[ruleId] : globals; - var currentState; - var previousState; + var markers = ruleId ? scope[ruleId] : globals + var currentState + var previousState if (!markers) { - markers = []; - scope[ruleId] = markers; + markers = [] + scope[ruleId] = markers } - previousState = getState(ruleId); - currentState = state; + previousState = getState(ruleId) + currentState = state if (currentState !== previousState) { - markers.push({state: currentState, position: pos}); + markers.push({state: currentState, position: pos}) } /* Toggle all known rules. */ if (!ruleId) { for (ruleId in scope) { - toggle(pos, state, ruleId); + toggle(pos, state, ruleId) } } } @@ -31028,12 +35523,12 @@ function messageControl(options) { /* Check all `ranges` for `message`. */ function check(message, ranges, id) { /* Check the state at the message's position. */ - var index = ranges && ranges.length; - var length = -1; - var range; + var index = ranges && ranges.length + var length = -1 + var range while (--index > length) { - range = ranges[index]; + range = ranges[index] /* istanbul ignore if - generated marker. */ if (!range.position || !range.position.line || !range.position.column) { @@ -31062,13 +35557,13 @@ function messageControl(options) { /* Detect gaps in `ast`. */ function detectGaps(tree, file) { - var lastNode = tree.children[tree.children.length - 1]; - var offset = 0; - var isGap = false; - var gaps = []; + var lastNode = tree.children[tree.children.length - 1] + var offset = 0 + var isGap = false + var gaps = [] /* Find all gaps. */ - unistUtilVisit(tree, one); + visit(tree, one) /* Get the end of the document. * This detects if the last node was the last node. @@ -31079,31 +35574,31 @@ function detectGaps(tree, file) { lastNode.position && lastNode.position.end && offset === lastNode.position.end.offset && - trim_1(file.toString().slice(offset)) !== '' + trim(file.toString().slice(offset)) !== '' ) { - update(); + update() update( tree && tree.position && tree.position.end && tree.position.end.offset - 1 - ); + ) } return gaps function one(node) { - var pos = node.position; + var pos = node.position - update(pos && pos.start && pos.start.offset); + update(pos && pos.start && pos.start.offset) if (!node.children) { - update(pos && pos.end && pos.end.offset); + update(pos && pos.end && pos.end.offset) } } /* Detect a new position. */ function update(latest) { if (latest === null || latest === undefined) { - isGap = true; + isGap = true return } @@ -31112,22 +35607,30 @@ function detectGaps(tree, file) { } if (isGap) { - gaps.push({start: offset, end: latest}); - isGap = false; + gaps.push({start: offset, end: latest}) + isGap = false } - offset = latest; + offset = latest } } + +/***/ }), +/* 308 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + /* Expose. */ -var mdastCommentMarker = marker$1; +module.exports = marker /* HTML type. */ -var T_HTML = 'html'; +var T_HTML = 'html' /* Expression for eliminating extra spaces */ -var SPACES = /\s+/g; +var SPACES = /\s+/g /* Expression for parsing parameters. */ var PARAMETERS = new RegExp( @@ -31168,7 +35671,7 @@ var PARAMETERS = new RegExp( ')' + ')?', 'gi' -); +) var MARKER = new RegExp( '(' + @@ -31181,26 +35684,26 @@ var MARKER = new RegExp( '-->' + '\\s*' + ')' -); +) /* Parse a comment marker */ -function marker$1(node) { - var value; - var match; - var params; +function marker(node) { + var value + var match + var params if (!node || node.type !== T_HTML) { return null } - value = node.value; - match = value.match(MARKER); + value = node.value + match = value.match(MARKER) if (!match || match[1].length !== value.length) { return null } - params = parameters(match[3] || ''); + params = parameters(match[3] || '') if (!params) { return null @@ -31216,52 +35719,243 @@ function marker$1(node) { /* Parse `value` into an object. */ function parameters(value) { - var attributes = {}; - var rest = value.replace(PARAMETERS, replacer); + var attributes = {} + var rest = value.replace(PARAMETERS, replacer) return rest.replace(SPACES, '') ? null : attributes /* eslint-disable max-params */ function replacer($0, $1, $2, $3, $4) { - var result = $2 || $3 || $4 || ''; + var result = $2 || $3 || $4 || '' if (result === 'true' || result === '') { - result = true; + result = true } else if (result === 'false') { - result = false; + result = false } else if (!isNaN(result)) { - result = Number(result); + result = Number(result) } - attributes[$1] = result; + attributes[$1] = result return '' } } -var remarkMessageControl = messageControl$1; -function messageControl$1(options) { - var settings = options || {}; +/***/ }), +/* 309 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-content-indent + * @fileoverview + * Warn when list item checkboxes are followed by too much white-space. + * + * @example {"name": "valid.md"} + * + * - [ ] List item + * + [x] List Item + * * [X] List item + * - [ ] List item + * + * @example {"name": "invalid.md", "label": "input"} + * + * - [ ] List item + * + [x] List item + * * [X] List item + * - [ ] List item + * + * @example {"name": "invalid.md", "label": "output"} + * + * 2:7-2:8: Checkboxes should be followed by a single character + * 3:7-3:9: Checkboxes should be followed by a single character + * 4:7-4:10: Checkboxes should be followed by a single character + */ + + + +var rule = __webpack_require__(0) +var vfileLocation = __webpack_require__(19) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule( + 'remark-lint:checkbox-content-indent', + checkboxContentIndent +) + +var start = position.start +var end = position.end + +var reason = 'Checkboxes should be followed by a single character' + +function checkboxContentIndent(tree, file) { + var contents = String(file) + var location = vfileLocation(file) + + visit(tree, 'listItem', visitor) + + function visitor(node) { + var initial + var final + var value + + /* Exit early for items without checkbox. */ + if (typeof node.checked !== 'boolean' || generated(node)) { + return + } + + initial = start(node).offset + /* istanbul ignore next - hard to test, couldn’t find a case. */ + final = (node.children.length ? start(node.children[0]) : end(node)).offset + + while (/[^\S\n]/.test(contents.charAt(final))) { + final++ + } + + /* For a checkbox to be parsed, it must be followed + * by a white space. */ + value = contents.slice(initial, final) + value = value.slice(value.indexOf(']') + 1) + + if (value.length !== 1) { + file.message(reason, { + start: location.toPosition(final - value.length + 1), + end: location.toPosition(final) + }) + } + } +} + + +/***/ }), +/* 310 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Module Dependencies + */ + +var sliced = __webpack_require__(311); +var noop = function(){}; +var co = __webpack_require__(312); + +/** + * Export `wrapped` + */ + +module.exports = wrapped; + +/** + * Wrap a function to support + * sync, async, and gen functions. + * + * @param {Function} fn + * @return {Function} + * @api public + */ + +function wrapped(fn) { + function wrap() { + var args = sliced(arguments); + var last = args[args.length - 1]; + var ctx = this; + + // done + var done = typeof last == 'function' ? args.pop() : noop; + + // nothing + if (!fn) { + return done.apply(ctx, [null].concat(args)); + } + + // generator + if (generator(fn)) { + return co(fn).apply(ctx, args.concat(done)); + } + + // async + if (fn.length > args.length) { + // NOTE: this only handles uncaught synchronous errors + try { + return fn.apply(ctx, args.concat(done)); + } catch (e) { + return done(e); + } + } + + // sync + return sync(fn, done).apply(ctx, args); + } + + return wrap; +} + +/** + * Wrap a synchronous function execution. + * + * @param {Function} fn + * @param {Function} done + * @return {Function} + * @api private + */ + +function sync(fn, done) { + return function () { + var ret; + + try { + ret = fn.apply(this, arguments); + } catch (err) { + return done(err); + } + + if (promise(ret)) { + ret.then(function (value) { done(null, value); }, done); + } else { + ret instanceof Error ? done(ret) : done(null, ret); + } + } +} + +/** + * Is `value` a generator? + * + * @param {Mixed} value + * @return {Boolean} + * @api private + */ + +function generator(value) { + return value + && value.constructor + && 'GeneratorFunction' == value.constructor.name; +} + + +/** + * Is `value` a promise? + * + * @param {Mixed} value + * @return {Boolean} + * @api private + */ - return unifiedMessageControl(immutable(options, { - marker: settings.marker || mdastCommentMarker, - test: settings.test || 'html' - })); +function promise(value) { + return value && 'function' == typeof value.then; } -var remarkLint = lint; -/* `remark-lint`. This adds support for ignoring stuff from - * messages (``). - * All rules are in their own packages and presets. */ -function lint() { - this.use(lintMessageControl); -} +/***/ }), +/* 311 */ +/***/ (function(module, exports) { -function lintMessageControl() { - return remarkMessageControl({name: 'lint', source: 'remark-lint'}) -} /** * An Array.prototype.slice.call(arguments) alternative @@ -31272,7 +35966,7 @@ function lintMessageControl() { * @api public */ -var sliced = function (args, slice, sliceEnd) { +module.exports = function (args, slice, sliceEnd) { var ret = []; var len = args.length; @@ -31285,7 +35979,7 @@ var sliced = function (args, slice, sliceEnd) { if (sliceEnd !== undefined) { len = sliceEnd < 0 ? sliceEnd + len - : sliceEnd; + : sliceEnd } while (len-- > start) { @@ -31293,19 +35987,26 @@ var sliced = function (args, slice, sliceEnd) { } return ret; -}; +} + + + +/***/ }), +/* 312 */ +/***/ (function(module, exports) { + /** * slice() reference. */ -var slice$4 = Array.prototype.slice; +var slice = Array.prototype.slice; /** * Expose `co`. */ -var co_1 = co; +module.exports = co; /** * Wrap the given generator `fn` and @@ -31330,7 +36031,7 @@ function co(fn) { // we only need to parse the arguments // if gen is a generator function. if (isGenFun) { - var args = slice$4.call(arguments), len = args.length; + var args = slice.call(arguments), len = args.length; var hasCallback = len && 'function' == typeof args[len - 1]; done = hasCallback ? args.pop() : error; gen = fn.apply(this, args); @@ -31353,7 +36054,7 @@ function co(fn) { var ret; // multiple args - if (arguments.length > 2) res = slice$4.call(arguments, 1); + if (arguments.length > 2) res = slice.call(arguments, 1); // error if (err) { @@ -31432,7 +36133,7 @@ function toThunk(obj, ctx) { return obj; } - if (isObject$3(obj) || Array.isArray(obj)) { + if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); } @@ -31461,7 +36162,7 @@ function objectToThunk(obj){ if (!pending) { setImmediate(function(){ - done(null, results); + done(null, results) }); return; } @@ -31566,7 +36267,7 @@ function isGeneratorFunction(obj) { * @api private */ -function isObject$3(val) { +function isObject(val) { return val && Object == val.constructor; } @@ -31589,404 +36290,240 @@ function error(err) { }); } -/** - * Module Dependencies - */ - - -var noop$2 = function(){}; - - -/** - * Export `wrapped` - */ - -var wrapped_1 = wrapped; - -/** - * Wrap a function to support - * sync, async, and gen functions. - * - * @param {Function} fn - * @return {Function} - * @api public - */ - -function wrapped(fn) { - function wrap() { - var args = sliced(arguments); - var last = args[args.length - 1]; - var ctx = this; - - // done - var done = typeof last == 'function' ? args.pop() : noop$2; - - // nothing - if (!fn) { - return done.apply(ctx, [null].concat(args)); - } - - // generator - if (generator(fn)) { - return co_1(fn).apply(ctx, args.concat(done)); - } - - // async - if (fn.length > args.length) { - // NOTE: this only handles uncaught synchronous errors - try { - return fn.apply(ctx, args.concat(done)); - } catch (e) { - return done(e); - } - } - - // sync - return sync$2(fn, done).apply(ctx, args); - } - return wrap; -} +/***/ }), +/* 313 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; /** - * Wrap a synchronous function execution. + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module definition-spacing + * @fileoverview + * Warn when consecutive white space is used in a definition. * - * @param {Function} fn - * @param {Function} done - * @return {Function} - * @api private - */ - -function sync$2(fn, done) { - return function () { - var ret; - - try { - ret = fn.apply(this, arguments); - } catch (err) { - return done(err); - } - - if (promise(ret)) { - ret.then(function (value) { done(null, value); }, done); - } else { - ret instanceof Error ? done(ret) : done(null, ret); - } - } -} - -/** - * Is `value` a generator? + * @example {"name": "valid.md"} * - * @param {Mixed} value - * @return {Boolean} - * @api private - */ - -function generator(value) { - return value - && value.constructor - && 'GeneratorFunction' == value.constructor.name; -} - - -/** - * Is `value` a promise? + * [example domain]: http://example.com "Example Domain" * - * @param {Mixed} value - * @return {Boolean} - * @api private - */ - -function promise(value) { - return value && 'function' == typeof value.then; -} - -var unifiedLintRule = factory$6; - -function factory$6(id, rule) { - var parts = id.split(':'); - var source = parts[0]; - var ruleId = parts[1]; - var fn = wrapped_1(rule); - - /* istanbul ignore if - possibly useful if externalised later. */ - if (!ruleId) { - ruleId = source; - source = null; - } - - attacher.displayName = id; - - return attacher - - function attacher(raw) { - var config = coerce(ruleId, raw); - var severity = config[0]; - var options = config[1]; - var fatal = severity === 2; - - return severity ? transformer : undefined - - function transformer(tree, file, next) { - var index = file.messages.length; - - fn(tree, file, options, done); - - function done(err) { - var messages = file.messages; - var message; - - /* Add the error, if not already properly added. */ - /* istanbul ignore if - only happens for incorrect plugins */ - if (err && messages.indexOf(err) === -1) { - try { - file.fail(err); - } catch (err) {} - } - - while (index < messages.length) { - message = messages[index]; - message.ruleId = ruleId; - message.source = source; - message.fatal = fatal; - - index++; - } - - next(); - } - } - } -} - -/* Coerce a value to a severity--options tuple. */ -function coerce(name, value) { - var def = 1; - var result; - var level; - - /* istanbul ignore if - Handled by unified in v6.0.0 */ - if (typeof value === 'boolean') { - result = [value]; - } else if (value == null) { - result = [def]; - } else if ( - typeof value === 'object' && - (typeof value[0] === 'number' || - typeof value[0] === 'boolean' || - typeof value[0] === 'string') - ) { - result = value.concat(); - } else { - result = [1, value]; - } - - level = result[0]; - - if (typeof level === 'boolean') { - level = level ? 1 : 0; - } else if (typeof level === 'string') { - if (level === 'off') { - level = 0; - } else if (level === 'on' || level === 'warn') { - level = 1; - } else if (level === 'error') { - level = 2; - } else { - level = 1; - result = [level, result]; - } - } - - if (level < 0 || level > 2) { - throw new Error( - 'Invalid severity `' + - level + - '` for `' + - name + - '`, ' + - 'expected 0, 1, or 2' - ) - } - - result[0] = level; - - return result -} - -var unistUtilPosition = createCommonjsModule(function (module, exports) { -var position = exports; - -position.start = factory('start'); -position.end = factory('end'); - -/* Factory to get a `type` point in the positional info of a node. */ -function factory(type) { - point.displayName = type; - - return point - - /* Get a point in `node.position` at a bound `type`. */ - function point(node) { - var point = (node && node.position && node.position[type]) || {}; - - return { - line: point.line || null, - column: point.column || null, - offset: isNaN(point.offset) ? null : point.offset - } - } -} -}); - -/* Expose. */ -var unistUtilGenerated = generated; - -/* Detect if a node was available in the original document. */ -function generated(node) { - var position = optional(optional(node).position); - var start = optional(position.start); - var end = optional(position.end); - - return !start.line || !start.column || !end.line || !end.column -} - -/* Return `value` if it’s an object, an empty object - * otherwise. */ -function optional(value) { - return value && typeof value === 'object' ? value : {} -} - -var remarkLintCheckboxContentIndent = unifiedLintRule( - 'remark-lint:checkbox-content-indent', - checkboxContentIndent -); - -var start = unistUtilPosition.start; -var end = unistUtilPosition.end; - -var reason = 'Checkboxes should be followed by a single character'; - -function checkboxContentIndent(tree, file) { - var contents = String(file); - var location = vfileLocation(file); - - unistUtilVisit(tree, 'listItem', visitor); - - function visitor(node) { - var initial; - var final; - var value; - - /* Exit early for items without checkbox. */ - if (typeof node.checked !== 'boolean' || unistUtilGenerated(node)) { - return - } - - initial = start(node).offset; - /* istanbul ignore next - hard to test, couldn’t find a case. */ - final = (node.children.length ? start(node.children[0]) : end(node)).offset; + * @example {"name": "invalid.md", "label": "input"} + * + * [example····domain]: http://example.com "Example Domain" + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-1:57: Do not use consecutive white-space in definition labels + */ - while (/[^\S\n]/.test(contents.charAt(final))) { - final++; - } - /* For a checkbox to be parsed, it must be followed - * by a white space. */ - value = contents.slice(initial, final); - value = value.slice(value.indexOf(']') + 1); - if (value.length !== 1) { - file.message(reason, { - start: location.toPosition(final - value.length + 1), - end: location.toPosition(final) - }); - } - } -} +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var remarkLintDefinitionSpacing = unifiedLintRule('remark-lint:definition-spacing', definitionSpacing); +module.exports = rule('remark-lint:definition-spacing', definitionSpacing) -var label$2 = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; -var reason$1 = 'Do not use consecutive white-space in definition labels'; +var label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/ +var reason = 'Do not use consecutive white-space in definition labels' function definitionSpacing(tree, file) { - var contents = String(file); + var contents = String(file) - unistUtilVisit(tree, ['definition', 'footnoteDefinition'], validate); + visit(tree, ['definition', 'footnoteDefinition'], validate) function validate(node) { - var start = unistUtilPosition.start(node).offset; - var end = unistUtilPosition.end(node).offset; + var start = position.start(node).offset + var end = position.end(node).offset if ( - !unistUtilGenerated(node) && - /[ \t\n]{2,}/.test(contents.slice(start, end).match(label$2)[1]) + !generated(node) && + /[ \t\n]{2,}/.test(contents.slice(start, end).match(label)[1]) ) { - file.message(reason$1, node); + file.message(reason, node) } } } -var remarkLintFencedCodeFlag = unifiedLintRule('remark-lint:fenced-code-flag', fencedCodeFlag); -var start$1 = unistUtilPosition.start; -var end$1 = unistUtilPosition.end; +/***/ }), +/* 314 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-flag + * @fileoverview + * Check fenced code-block flags. + * + * Options: `Array.` or `Object`, optional. + * + * Providing an array is as passing `{flags: Array}`. + * + * The object can have an array of `'flags'` which are deemed valid. + * In addition it can have the property `allowEmpty` (`boolean`, default: + * `false`) which signifies whether or not to warn for fenced code-blocks + * without language flags. + * + * @example {"name": "valid.md"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "invalid.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-3:4: Missing code-language flag + * + * @example {"name": "valid.md", "setting": {"allowEmpty": true}} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "invalid.md", "setting": {"allowEmpty": false}, "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "invalid.md", "setting": {"allowEmpty": false}, "label": "output"} + * + * 1:1-3:4: Missing code-language flag + * + * @example {"name": "valid.md", "setting": ["alpha"]} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "invalid.md", "setting": ["charlie"], "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "invalid.md", "setting": ["charlie"], "label": "output"} + * + * 1:1-3:4: Invalid code-language flag + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var fence$2 = /^ {0,3}([~`])\1{2,}/; -var reasonInvalid = 'Invalid code-language flag'; -var reasonMissing = 'Missing code-language flag'; +module.exports = rule('remark-lint:fenced-code-flag', fencedCodeFlag) + +var start = position.start +var end = position.end + +var fence = /^ {0,3}([~`])\1{2,}/ +var reasonInvalid = 'Invalid code-language flag' +var reasonMissing = 'Missing code-language flag' function fencedCodeFlag(tree, file, pref) { - var contents = String(file); - var allowEmpty = false; - var flags = []; + var contents = String(file) + var allowEmpty = false + var flags = [] if (typeof pref === 'object' && !('length' in pref)) { - allowEmpty = Boolean(pref.allowEmpty); - pref = pref.flags; + allowEmpty = Boolean(pref.allowEmpty) + pref = pref.flags } if (typeof pref === 'object' && 'length' in pref) { - flags = String(pref).split(','); + flags = String(pref).split(',') } - unistUtilVisit(tree, 'code', visitor); + visit(tree, 'code', visitor) function visitor(node) { - var value; + var value - if (!unistUtilGenerated(node)) { + if (!generated(node)) { if (node.lang) { if (flags.length !== 0 && flags.indexOf(node.lang) === -1) { - file.message(reasonInvalid, node); + file.message(reasonInvalid, node) } } else { - value = contents.slice(start$1(node).offset, end$1(node).offset); + value = contents.slice(start(node).offset, end(node).offset) - if (!allowEmpty && fence$2.test(value)) { - file.message(reasonMissing, node); + if (!allowEmpty && fence.test(value)) { + file.message(reasonMissing, node) } } } } } -var remarkLintFinalDefinition = unifiedLintRule('remark-lint:final-definition', finalDefinition); -var start$2 = unistUtilPosition.start; +/***/ }), +/* 315 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-definition + * @fileoverview + * Warn when definitions are not placed at the end of the file. + * + * @example {"name": "valid.md"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * @example {"name": "invalid.md", "label": "input"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * Another paragraph. + * + * @example {"name": "invalid.md", "label": "output"} + * + * 3:1-3:47: Move definitions to the end of the file (after the node at line `5`) + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:final-definition', finalDefinition) + +var start = position.start function finalDefinition(tree, file) { - var last = null; + var last = null - unistUtilVisit(tree, visitor, true); + visit(tree, visitor, true) function visitor(node) { - var line = start$2(node).line; + var line = start(node).line /* Ignore generated nodes. */ - if (node.type === 'root' || unistUtilGenerated(node)) { + if (node.type === 'root' || generated(node)) { return } @@ -31997,581 +36534,253 @@ function finalDefinition(tree, file) { last + '`)', node - ); + ) } } else if (last === null) { - last = line; + last = line } } } -var remarkLintFinalNewline = unifiedLintRule('remark-lint:final-newline', finalNewline); - -function finalNewline(tree, file) { - var contents = String(file); - var last = contents.length - 1; - - if (last > -1 && contents.charAt(last) !== '\n') { - file.message('Missing newline character at end of file'); - } -} - -var remarkLintHardBreakSpaces = unifiedLintRule('remark-lint:hard-break-spaces', hardBreakSpaces); -var reason$2 = 'Use two spaces for hard line breaks'; +/***/ }), +/* 316 */ +/***/ (function(module, exports, __webpack_require__) { -function hardBreakSpaces(tree, file) { - var contents = String(file); - - unistUtilVisit(tree, 'break', visitor); +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-newline + * @fileoverview + * Warn when a newline at the end of a file is missing. Empty files are allowed. + * + * See [StackExchange](http://unix.stackexchange.com/questions/18743) for why. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * always adds a final newline to files. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * ## Example + * + * ##### `valid.md` + * + * ###### In + * + * Note: `␊` represents LF. + * + * ```markdown + * Alpha␊ + * ``` + * + * ###### Out + * + * No messages. + * + * ##### `invalid.md` + * + * ###### In + * + * Note: The below file does not have a final newline. + * + * ```markdown + * Bravo + * ``` + * + * ###### Out + * + * ```text + * 1:1: Missing newline character at end of file + * ``` + */ - function visitor(node) { - var value; - if (!unistUtilGenerated(node)) { - value = contents - .slice(unistUtilPosition.start(node).offset, unistUtilPosition.end(node).offset) - .split('\n', 1)[0] - .replace(/\r$/, ''); - if (value.length > 2) { - file.message(reason$2, node); - } - } - } -} - -const addendum = "addenda"; -const aircraft = "aircraft"; -const alga = "algae"; -const alumna = "alumnae"; -const alumnus = "alumni"; -const amoeba = "amoebae"; -const analysis = "analyses"; -const antenna = "antennae"; -const antithesis = "antitheses"; -const apex = "apices"; -const appendix = "appendices"; -const automaton = "automata"; -const axis = "axes"; -const bacillus = "bacilli"; -const bacterium = "bacteria"; -const barracks = "barracks"; -const basis = "bases"; -const beau = "beaux"; -const bison = "bison"; -const buffalo = "buffalo"; -const bureau = "bureaus"; -const cactus = "cacti"; -const calf = "calves"; -const carp = "carp"; -const census = "censuses"; -const chassis = "chassis"; -const cherub = "cherubim"; -const child = "children"; -const cod = "cod"; -const codex = "codices"; -const concerto = "concerti"; -const corpus = "corpora"; -const crisis = "crises"; -const criterion = "criteria"; -const curriculum = "curricula"; -const datum = "data"; -const deer = "deer"; -const diagnosis = "diagnoses"; -const die$1 = "dice"; -const dwarf = "dwarfs"; -const echo = "echoes"; -const elf = "elves"; -const elk = "elk"; -const ellipsis = "ellipses"; -const embargo = "embargoes"; -const emphasis$4 = "emphases"; -const erratum = "errata"; -const fez = "fezes"; -const firmware = "firmware"; -const fish = "fish"; -const focus = "foci"; -const foot = "feet"; -const formula = "formulae"; -const fungus = "fungi"; -const gallows = "gallows"; -const genus = "genera"; -const goose = "geese"; -const graffito = "graffiti"; -const grouse = "grouse"; -const half$1 = "halves"; -const hero = "heroes"; -const hoof = "hooves"; -const hovercraft = "hovercraft"; -const hypothesis = "hypotheses"; -const index$6 = "indices"; -const kakapo = "kakapo"; -const knife = "knives"; -const larva = "larvae"; -const leaf = "leaves"; -const libretto = "libretti"; -const life = "lives"; -const loaf = "loaves"; -const locus = "loci"; -const louse = "lice"; -const man = "men"; -const matrix = "matrices"; -const means = "means"; -const medium = "media"; -const memorandum = "memoranda"; -const millennium = "millennia"; -const minutia = "minutiae"; -const moose = "moose"; -const mouse = "mice"; -const nebula = "nebulae"; -const nemesis = "nemeses"; -const neurosis = "neuroses"; -const news = "news"; -const nucleus = "nuclei"; -const oasis = "oases"; -const offspring = "offspring"; -const opus = "opera"; -const ovum = "ova"; -const ox = "oxen"; -const paralysis = "paralyses"; -const parenthesis = "parentheses"; -const person = "people"; -const phenomenon = "phenomena"; -const phylum = "phyla"; -const pike = "pike"; -const polyhedron = "polyhedra"; -const potato = "potatoes"; -const prognosis = "prognoses"; -const quiz = "quizzes"; -const radius = "radii"; -const referendum = "referenda"; -const salmon = "salmon"; -const scarf = "scarves"; -const self$1 = "selves"; -const series = "series"; -const sheep = "sheep"; -const shelf = "shelves"; -const shrimp = "shrimp"; -const spacecraft = "spacecraft"; -const species = "species"; -const spectrum = "spectra"; -const squid = "squid"; -const stimulus = "stimuli"; -const stratum = "strata"; -const swine = "swine"; -const syllabus = "syllabi"; -const symposium = "symposia"; -const synopsis = "synopses"; -const synthesis = "syntheses"; -const tableau = "tableaus"; -const that = "those"; -const thesis = "theses"; -const thief = "thieves"; -const tomato = "tomatoes"; -const tooth = "teeth"; -const trout = "trout"; -const tuna = "tuna"; -const vertebra = "vertebrae"; -const vertex = "vertices"; -const veto = "vetoes"; -const vita = "vitae"; -const vortex = "vortices"; -const watercraft = "watercraft"; -const wharf = "wharves"; -const wife = "wives"; -const wolf = "wolves"; -const woman = "women"; -var irregularPlurals = { - addendum: addendum, - aircraft: aircraft, - alga: alga, - alumna: alumna, - alumnus: alumnus, - amoeba: amoeba, - analysis: analysis, - antenna: antenna, - antithesis: antithesis, - apex: apex, - appendix: appendix, - automaton: automaton, - axis: axis, - bacillus: bacillus, - bacterium: bacterium, - barracks: barracks, - basis: basis, - beau: beau, - bison: bison, - buffalo: buffalo, - bureau: bureau, - cactus: cactus, - calf: calf, - carp: carp, - census: census, - chassis: chassis, - cherub: cherub, - child: child, - cod: cod, - codex: codex, - concerto: concerto, - corpus: corpus, - crisis: crisis, - criterion: criterion, - curriculum: curriculum, - datum: datum, - deer: deer, - diagnosis: diagnosis, - die: die$1, - dwarf: dwarf, - echo: echo, - elf: elf, - elk: elk, - ellipsis: ellipsis, - embargo: embargo, - emphasis: emphasis$4, - erratum: erratum, - fez: fez, - firmware: firmware, - fish: fish, - focus: focus, - foot: foot, - formula: formula, - fungus: fungus, - gallows: gallows, - genus: genus, - goose: goose, - graffito: graffito, - grouse: grouse, - half: half$1, - hero: hero, - hoof: hoof, - hovercraft: hovercraft, - hypothesis: hypothesis, - index: index$6, - kakapo: kakapo, - knife: knife, - larva: larva, - leaf: leaf, - libretto: libretto, - life: life, - loaf: loaf, - locus: locus, - louse: louse, - man: man, - matrix: matrix, - means: means, - medium: medium, - memorandum: memorandum, - millennium: millennium, - minutia: minutia, - moose: moose, - mouse: mouse, - nebula: nebula, - nemesis: nemesis, - neurosis: neurosis, - news: news, - nucleus: nucleus, - oasis: oasis, - offspring: offspring, - opus: opus, - ovum: ovum, - ox: ox, - paralysis: paralysis, - parenthesis: parenthesis, - person: person, - phenomenon: phenomenon, - phylum: phylum, - pike: pike, - polyhedron: polyhedron, - potato: potato, - prognosis: prognosis, - quiz: quiz, - radius: radius, - referendum: referendum, - salmon: salmon, - scarf: scarf, - self: self$1, - series: series, - sheep: sheep, - shelf: shelf, - shrimp: shrimp, - spacecraft: spacecraft, - species: species, - spectrum: spectrum, - squid: squid, - stimulus: stimulus, - stratum: stratum, - swine: swine, - syllabus: syllabus, - symposium: symposium, - synopsis: synopsis, - synthesis: synthesis, - tableau: tableau, - that: that, - thesis: thesis, - thief: thief, - tomato: tomato, - tooth: tooth, - trout: trout, - tuna: tuna, - vertebra: vertebra, - vertex: vertex, - veto: veto, - vita: vita, - vortex: vortex, - watercraft: watercraft, - wharf: wharf, - wife: wife, - wolf: wolf, - woman: woman, - "château": "châteaus", - "faux pas": "faux pas", - "this": "these" -}; +var rule = __webpack_require__(0) -var irregularPlurals$1 = Object.freeze({ - addendum: addendum, - aircraft: aircraft, - alga: alga, - alumna: alumna, - alumnus: alumnus, - amoeba: amoeba, - analysis: analysis, - antenna: antenna, - antithesis: antithesis, - apex: apex, - appendix: appendix, - automaton: automaton, - axis: axis, - bacillus: bacillus, - bacterium: bacterium, - barracks: barracks, - basis: basis, - beau: beau, - bison: bison, - buffalo: buffalo, - bureau: bureau, - cactus: cactus, - calf: calf, - carp: carp, - census: census, - chassis: chassis, - cherub: cherub, - child: child, - cod: cod, - codex: codex, - concerto: concerto, - corpus: corpus, - crisis: crisis, - criterion: criterion, - curriculum: curriculum, - datum: datum, - deer: deer, - diagnosis: diagnosis, - die: die$1, - dwarf: dwarf, - echo: echo, - elf: elf, - elk: elk, - ellipsis: ellipsis, - embargo: embargo, - emphasis: emphasis$4, - erratum: erratum, - fez: fez, - firmware: firmware, - fish: fish, - focus: focus, - foot: foot, - formula: formula, - fungus: fungus, - gallows: gallows, - genus: genus, - goose: goose, - graffito: graffito, - grouse: grouse, - half: half$1, - hero: hero, - hoof: hoof, - hovercraft: hovercraft, - hypothesis: hypothesis, - index: index$6, - kakapo: kakapo, - knife: knife, - larva: larva, - leaf: leaf, - libretto: libretto, - life: life, - loaf: loaf, - locus: locus, - louse: louse, - man: man, - matrix: matrix, - means: means, - medium: medium, - memorandum: memorandum, - millennium: millennium, - minutia: minutia, - moose: moose, - mouse: mouse, - nebula: nebula, - nemesis: nemesis, - neurosis: neurosis, - news: news, - nucleus: nucleus, - oasis: oasis, - offspring: offspring, - opus: opus, - ovum: ovum, - ox: ox, - paralysis: paralysis, - parenthesis: parenthesis, - person: person, - phenomenon: phenomenon, - phylum: phylum, - pike: pike, - polyhedron: polyhedron, - potato: potato, - prognosis: prognosis, - quiz: quiz, - radius: radius, - referendum: referendum, - salmon: salmon, - scarf: scarf, - self: self$1, - series: series, - sheep: sheep, - shelf: shelf, - shrimp: shrimp, - spacecraft: spacecraft, - species: species, - spectrum: spectrum, - squid: squid, - stimulus: stimulus, - stratum: stratum, - swine: swine, - syllabus: syllabus, - symposium: symposium, - synopsis: synopsis, - synthesis: synthesis, - tableau: tableau, - that: that, - thesis: thesis, - thief: thief, - tomato: tomato, - tooth: tooth, - trout: trout, - tuna: tuna, - vertebra: vertebra, - vertex: vertex, - veto: veto, - vita: vita, - vortex: vortex, - watercraft: watercraft, - wharf: wharf, - wife: wife, - wolf: wolf, - woman: woman, - default: irregularPlurals -}); +module.exports = rule('remark-lint:final-newline', finalNewline) -var irregularPlurals$2 = ( irregularPlurals$1 && irregularPlurals ) || irregularPlurals$1; +function finalNewline(tree, file) { + var contents = String(file) + var last = contents.length - 1 -var irregularPlurals_1 = createCommonjsModule(function (module) { -const map = new Map(); -// TODO: Use Object.entries when targeting Node.js 8 -for (const key of Object.keys(irregularPlurals$2)) { - map.set(key, irregularPlurals$2[key]); + if (last > -1 && contents.charAt(last) !== '\n') { + file.message('Missing newline character at end of file') + } } -// Ensure nobody can modify each others Map -Object.defineProperty(module, 'exports', { - get() { - return map; - } -}); -}); -var plur = createCommonjsModule(function (module) { -module.exports = (word, plural, count) => { - if (typeof plural === 'number') { - count = plural; - } +/***/ }), +/* 317 */ +/***/ (function(module, exports, __webpack_require__) { - if (irregularPlurals_1.has(word.toLowerCase())) { - plural = irregularPlurals_1.get(word.toLowerCase()); +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-indent + * @fileoverview + * Warn when the spacing between a list item’s bullet and its content + * violates a given style. + * + * Options: `'tab-size'`, `'mixed'`, or `'space'`, default: `'tab-size'`. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * uses `'tab-size'` (named `'tab'` there) by default to ensure markdown is + * seen the same way across vendors. This can be configured with the + * [`listItemIndent`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionslistitemindent) + * option. This rule’s `'space'` option is named `'1'` there. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * *···List + * ····item. + * + * Paragraph. + * + * 11.·List + * ····item. + * + * Paragraph. + * + * *···List + * ····item. + * + * *···List + * ····item. + * + * @example {"name": "valid.md", "setting": "mixed"} + * + * *·List item. + * + * Paragraph. + * + * 11.·List item + * + * Paragraph. + * + * *···List + * ····item. + * + * *···List + * ····item. + * + * @example {"name": "valid.md", "setting": "space"} + * + * *·List item. + * + * Paragraph. + * + * 11.·List item + * + * Paragraph. + * + * *·List + * ··item. + * + * *·List + * ··item. + * + * @example {"name": "invalid.md", "setting": "space", "label": "input"} + * + * *···List + * ····item. + * + * @example {"name": "invalid.md", "setting": "space", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "invalid.md", "setting": "tab-size", "label": "input"} + * + * *·List + * ··item. + * + * @example {"name": "invalid.md", "setting": "tab-size", "label": "output"} + * + * 1:3: Incorrect list-item indent: add 2 spaces + * + * @example {"name": "invalid.md", "setting": "mixed", "label": "input"} + * + * *···List item. + * + * @example {"name": "invalid.md", "setting": "mixed", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "invalid.md", "setting": "invalid", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid list-item indent style `invalid`: use either `'tab-size'`, `'space'`, or `'mixed'` + */ - const firstLetter = word.charAt(0); - const isFirstLetterUpperCase = firstLetter === firstLetter.toUpperCase(); - if (isFirstLetterUpperCase) { - plural = firstLetter.toUpperCase() + plural.slice(1); - } - const isWholeWordUpperCase = word === word.toUpperCase(); - if (isWholeWordUpperCase) { - plural = plural.toUpperCase(); - } - } else if (typeof plural !== 'string') { - plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's') - .replace(/i?e?s$/i, m => { - const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase(); - return isTailLowerCase ? m.toLowerCase() : m.toUpperCase(); - }); - } - return Math.abs(count) === 1 ? word : plural; -}; -}); +var rule = __webpack_require__(0) +var plural = __webpack_require__(31) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var remarkLintListItemIndent = unifiedLintRule('remark-lint:list-item-indent', listItemIndent); +module.exports = rule('remark-lint:list-item-indent', listItemIndent) -var start$3 = unistUtilPosition.start; +var start = position.start -var styles = {'tab-size': true, mixed: true, space: true}; +var styles = {'tab-size': true, mixed: true, space: true} function listItemIndent(tree, file, pref) { - var contents = String(file); + var contents = String(file) - pref = typeof pref === 'string' ? pref : 'tab-size'; + pref = typeof pref === 'string' ? pref : 'tab-size' if (styles[pref] !== true) { file.fail( 'Invalid list-item indent style `' + pref + "`: use either `'tab-size'`, `'space'`, or `'mixed'`" - ); + ) } - unistUtilVisit(tree, 'list', visitor); + visit(tree, 'list', visitor) function visitor(node) { - var spread = node.spread || node.loose; + var spread = node.spread || node.loose - if (!unistUtilGenerated(node)) { - node.children.forEach(visitItem); + if (!generated(node)) { + node.children.forEach(visitItem) } function visitItem(item) { - var head = item.children[0]; - var final = start$3(head); - var marker; - var bulletSize; - var style; - var diff; - var reason; + var head = item.children[0] + var final = start(head) + var marker + var bulletSize + var style + var diff + var reason marker = contents - .slice(start$3(item).offset, final.offset) - .replace(/\[[x ]?]\s*$/i, ''); + .slice(start(item).offset, final.offset) + .replace(/\[[x ]?]\s*$/i, '') - bulletSize = marker.trimRight().length; + bulletSize = marker.trimRight().length style = pref === 'tab-size' || (pref === 'mixed' && spread) ? Math.ceil(bulletSize / 4) * 4 - : bulletSize + 1; + : bulletSize + 1 if (marker.length !== style) { - diff = style - marker.length; + diff = style - marker.length reason = 'Incorrect list-item indent: ' + @@ -32579,39 +36788,171 @@ function listItemIndent(tree, file, pref) { ' ' + Math.abs(diff) + ' ' + - plur('space', diff); + plural('space', diff) - file.message(reason, final); + file.message(reason, final) } } } } -var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); -var start$4 = unistUtilPosition.start; -var end$2 = unistUtilPosition.end; +/***/ }), +/* 318 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { +const irregularPlurals = __webpack_require__(319); + +const map = new Map(); +// TODO: Use Object.entries when targeting Node.js 8 +for (const key of Object.keys(irregularPlurals)) { + map.set(key, irregularPlurals[key]); +} + +// Ensure nobody can modify each others Map +Object.defineProperty(module, 'exports', { + get() { + return map; + } +}); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(46)(module))) + +/***/ }), +/* 319 */ +/***/ (function(module) { + +module.exports = {"addendum":"addenda","aircraft":"aircraft","alga":"algae","alumna":"alumnae","alumnus":"alumni","amoeba":"amoebae","analysis":"analyses","antenna":"antennae","antithesis":"antitheses","apex":"apices","appendix":"appendices","automaton":"automata","axis":"axes","bacillus":"bacilli","bacterium":"bacteria","barracks":"barracks","basis":"bases","beau":"beaux","bison":"bison","buffalo":"buffalo","bureau":"bureaus","cactus":"cacti","calf":"calves","carp":"carp","census":"censuses","chassis":"chassis","cherub":"cherubim","child":"children","château":"châteaus","cod":"cod","codex":"codices","concerto":"concerti","corpus":"corpora","crisis":"crises","criterion":"criteria","curriculum":"curricula","datum":"data","deer":"deer","diagnosis":"diagnoses","die":"dice","dwarf":"dwarfs","echo":"echoes","elf":"elves","elk":"elk","ellipsis":"ellipses","embargo":"embargoes","emphasis":"emphases","erratum":"errata","faux pas":"faux pas","fez":"fezes","firmware":"firmware","fish":"fish","focus":"foci","foot":"feet","formula":"formulae","fungus":"fungi","gallows":"gallows","genus":"genera","goose":"geese","graffito":"graffiti","grouse":"grouse","half":"halves","hero":"heroes","hoof":"hooves","hovercraft":"hovercraft","hypothesis":"hypotheses","index":"indices","kakapo":"kakapo","knife":"knives","larva":"larvae","leaf":"leaves","libretto":"libretti","life":"lives","loaf":"loaves","locus":"loci","louse":"lice","man":"men","matrix":"matrices","means":"means","medium":"media","memorandum":"memoranda","millennium":"millennia","minutia":"minutiae","moose":"moose","mouse":"mice","nebula":"nebulae","nemesis":"nemeses","neurosis":"neuroses","news":"news","nucleus":"nuclei","oasis":"oases","offspring":"offspring","opus":"opera","ovum":"ova","ox":"oxen","paralysis":"paralyses","parenthesis":"parentheses","person":"people","phenomenon":"phenomena","phylum":"phyla","pike":"pike","polyhedron":"polyhedra","potato":"potatoes","prognosis":"prognoses","quiz":"quizzes","radius":"radii","referendum":"referenda","salmon":"salmon","scarf":"scarves","self":"selves","series":"series","sheep":"sheep","shelf":"shelves","shrimp":"shrimp","spacecraft":"spacecraft","species":"species","spectrum":"spectra","squid":"squid","stimulus":"stimuli","stratum":"strata","swine":"swine","syllabus":"syllabi","symposium":"symposia","synopsis":"synopses","synthesis":"syntheses","tableau":"tableaus","that":"those","thesis":"theses","thief":"thieves","this":"these","tomato":"tomatoes","tooth":"teeth","trout":"trout","tuna":"tuna","vertebra":"vertebrae","vertex":"vertices","veto":"vetoes","vita":"vitae","vortex":"vortices","watercraft":"watercraft","wharf":"wharves","wife":"wives","wolf":"wolves","woman":"women"}; + +/***/ }), +/* 320 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module maximum-line-length + * @fileoverview + * Warn when lines are too long. + * + * Options: `number`, default: `80`. + * + * Ignores nodes that cannot be wrapped, such as headings, tables, + * code, and definitions. + * + * Ignores images, links, and inline code if they start before the wrap, end + * after the wrap, and there’s no white-space after them. + * + * @example {"name": "valid.md", "config": {"positionless": true}} + * + * This line is simply not toooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * This is also fine: + * + * + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` + * + * [foo](http://this-long-url-with-a-long-domain-is-valid.co.uk/a-long-path?query=variables) + * + * + * + * ![foo](http://this-long-url-with-a-long-domain-is-valid.co.uk/a-long-path?query=variables) + * + * | An | exception | is | line | length | in | long | tables | because | those | can’t | just | + * | -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | + * | be | helped | | | | | | | | | | . | + * + * The following is also fine, because there is no white-space. + * + * . + * + * In addition, definitions are also fine: + * + * [foo]: + * + * @example {"name": "invalid.md", "setting": 80, "label": "input", "config": {"positionless": true}} + * + * This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one. + * + * And this one is also very wrong: because the link starts aaaaaaafter the column: + * + * and such. + * + * And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()` + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such. + * + * @example {"name": "invalid.md", "setting": 80, "label": "output", "config": {"positionless": true}} + * + * 4:86: Line must be at most 80 characters + * 6:99: Line must be at most 80 characters + * 8:97: Line must be at most 80 characters + * 10:97: Line must be at most 80 characters + * 12:99: Line must be at most 80 characters + * + * @example {"name": "valid-mixed-line-endings.md", "setting": 10, "config": {"positionless": true}} + * + * 0123456789␍␊ + * 0123456789␊ + * 01234␍␊ + * 01234␊ + * + * @example {"name": "invalid-mixed-line-endings.md", "setting": 10, "label": "input", "config": {"positionless": true}} + * + * 012345678901␍␊ + * 012345678901␊ + * 01234567890␍␊ + * 01234567890␊ + * + * @example {"name": "invalid-mixed-line-endings.md", "setting": 10, "label": "output", "config": {"positionless": true}} + * + * 1:13: Line must be at most 10 characters + * 2:13: Line must be at most 10 characters + * 3:12: Line must be at most 10 characters + * 4:12: Line must be at most 10 characters + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:maximum-line-length', maximumLineLength) + +var start = position.start +var end = position.end function maximumLineLength(tree, file, pref) { - var style = typeof pref === 'number' && !isNaN(pref) ? pref : 80; - var content = String(file); - var lines = content.split(/\r?\n/); - var length = lines.length; - var index = -1; - var lineLength; + var style = typeof pref === 'number' && !isNaN(pref) ? pref : 80 + var content = String(file) + var lines = content.split(/\r?\n/) + var length = lines.length + var index = -1 + var lineLength - unistUtilVisit(tree, ['heading', 'table', 'code', 'definition'], ignore); - unistUtilVisit(tree, ['link', 'image', 'inlineCode'], inline); + visit(tree, ['heading', 'table', 'code', 'definition'], ignore) + visit(tree, ['link', 'image', 'inlineCode'], inline) /* Iterate over every line, and warn for violating lines. */ while (++index < length) { - lineLength = lines[index].length; + lineLength = lines[index].length if (lineLength > style) { file.message('Line must be at most ' + style + ' characters', { line: index + 1, column: lineLength + 1 - }); + }) } } @@ -32619,17 +36960,17 @@ function maximumLineLength(tree, file, pref) { * the wrap. However, when they do, and there’s white-space after it, they * are not whitelisted. */ function inline(node, pos, parent) { - var next = parent.children[pos + 1]; - var initial; - var final; + var next = parent.children[pos + 1] + var initial + var final /* istanbul ignore if - Nothing to whitelist when generated. */ - if (unistUtilGenerated(node)) { + if (generated(node)) { return } - initial = start$4(node); - final = end$2(node); + initial = start(node) + final = end(node) /* No whitelisting when starting after the border, or ending before it. */ if (initial.column > style || final.column < style) { @@ -32640,124 +36981,197 @@ function maximumLineLength(tree, file, pref) { * the link. */ if ( next && - start$4(next).line === initial.line && + start(next).line === initial.line && (!next.value || /^(.+?[ \t].+?)/.test(next.value)) ) { return } - whitelist(initial.line - 1, final.line); + whitelist(initial.line - 1, final.line) } function ignore(node) { /* istanbul ignore else - Hard to test, as we only run this case on `position: true` */ - if (!unistUtilGenerated(node)) { - whitelist(start$4(node).line - 1, end$2(node).line); + if (!generated(node)) { + whitelist(start(node).line - 1, end(node).line) } } /* Whitelist from `initial` to `final`, zero-based. */ function whitelist(initial, final) { while (initial < final) { - lines[initial++] = ''; + lines[initial++] = '' } } } -var mdastUtilToString = toString$6; -/* Get the text content of a node. If the node itself - * does not expose plain-text fields, `toString` will - * recursivly try its children. */ -function toString$6(node) { - return ( - valueOf$1(node) || - (node.children && node.children.map(toString$6).join('')) || - '' - ) -} +/***/ }), +/* 321 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-auto-link-without-protocol + * @fileoverview + * Warn for angle-bracketed links without protocol. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * adds a protocol where needed. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * + * + * + * Most markdown vendors don’t recognize the following as a link: + * + * + * @example {"name": "invalid.md", "label": "input"} + * + * + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-1:14: All automatic links must start with a protocol + */ -/* Get the value of `node`. Checks, `value`, - * `alt`, and `title`, in that order. */ -function valueOf$1(node) { - return ( - (node && node.value ? node.value : node.alt ? node.alt : node.title) || '' - ) -} -var remarkLintNoAutoLinkWithoutProtocol = unifiedLintRule( + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) +var toString = __webpack_require__(45) + +module.exports = rule( 'remark-lint:no-auto-link-without-protocol', noAutoLinkWithoutProtocol -); +) -var start$5 = unistUtilPosition.start; -var end$3 = unistUtilPosition.end; +var start = position.start +var end = position.end /* Protocol expression. See: * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var protocol$2 = /^[a-z][a-z+.-]+:\/?/i; +var protocol = /^[a-z][a-z+.-]+:\/?/i -var reason$3 = 'All automatic links must start with a protocol'; +var reason = 'All automatic links must start with a protocol' function noAutoLinkWithoutProtocol(tree, file) { - unistUtilVisit(tree, 'link', visitor); + visit(tree, 'link', visitor) function visitor(node) { - var children; + var children - if (!unistUtilGenerated(node)) { - children = node.children; + if (!generated(node)) { + children = node.children if ( - start$5(node).column === start$5(children[0]).column - 1 && - end$3(node).column === end$3(children[children.length - 1]).column + 1 && - !protocol$2.test(mdastUtilToString(node)) + start(node).column === start(children[0]).column - 1 && + end(node).column === end(children[children.length - 1]).column + 1 && + !protocol.test(toString(node)) ) { - file.message(reason$3, node); + file.message(reason, node) } } } } -var remarkLintNoBlockquoteWithoutMarker = unifiedLintRule( + +/***/ }), +/* 322 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-blockquote-without-marker + * @fileoverview + * Warn when blank lines without markers (`>`) are found in a blockquote. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * adds markers to every line in a blockquote. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * > Foo... + * > + * > ...Bar. + * + * @example {"name": "invalid.md", "label": "input"} + * + * > Foo... + * + * > ...Bar. + * + * @example {"name": "invalid.md", "label": "output"} + * + * 2:1: Missing marker in blockquote + */ + + + +var rule = __webpack_require__(0) +var vfileLocation = __webpack_require__(19) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule( 'remark-lint:no-blockquote-without-marker', noBlockquoteWithoutMarker -); +) -var reason$4 = 'Missing marker in blockquote'; +var reason = 'Missing marker in blockquote' function noBlockquoteWithoutMarker(tree, file) { - var contents = String(file); - var location = vfileLocation(file); - var last = contents.length; + var contents = String(file) + var location = vfileLocation(file) + var last = contents.length - unistUtilVisit(tree, 'blockquote', visitor); + visit(tree, 'blockquote', visitor) function visitor(node) { - var indent = node.position && node.position.indent; - var start; - var length; - var index; - var line; - var offset; - var character; - var pos; - - if (unistUtilGenerated(node) || !indent || indent.length === 0) { + var indent = node.position && node.position.indent + var start + var length + var index + var line + var offset + var character + var pos + + if (generated(node) || !indent || indent.length === 0) { return } - start = unistUtilPosition.start(node).line; - length = indent.length; - index = -1; + start = position.start(node).line + length = indent.length + index = -1 while (++index < length) { - line = start + index + 1; - pos = {line: line, column: indent[index]}; - offset = location.toOffset(pos) - 1; + line = start + index + 1 + pos = {line: line, column: indent[index]} + offset = location.toOffset(pos) - 1 while (++offset < last) { - character = contents.charAt(offset); + character = contents.charAt(offset) if (character === '>') { break @@ -32765,7 +37179,7 @@ function noBlockquoteWithoutMarker(tree, file) { /* istanbul ignore else - just for safety */ if (character !== ' ' && character !== '\t') { - file.message(reason$4, pos); + file.message(reason, pos) break } } @@ -32773,159 +37187,316 @@ function noBlockquoteWithoutMarker(tree, file) { } } -var remarkLintNoDuplicateDefinitions = unifiedLintRule( + +/***/ }), +/* 323 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-duplicate-definitions + * @fileoverview + * Warn when duplicate definitions are found. + * + * @example {"name": "valid.md"} + * + * [foo]: bar + * [baz]: qux + * + * @example {"name": "invalid.md", "label": "input"} + * + * [foo]: bar + * [foo]: qux + * + * @example {"name": "invalid.md", "label": "output"} + * + * 2:1-2:11: Do not use definitions with the same identifier (1:1) + */ + + + +var rule = __webpack_require__(0) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) +var stringify = __webpack_require__(27) +var visit = __webpack_require__(1) + +module.exports = rule( 'remark-lint:no-duplicate-definitions', noDuplicateDefinitions -); +) -var reason$5 = 'Do not use definitions with the same identifier'; +var reason = 'Do not use definitions with the same identifier' function noDuplicateDefinitions(tree, file) { - var map = {}; + var map = {} - unistUtilVisit(tree, ['definition', 'footnoteDefinition'], validate); + visit(tree, ['definition', 'footnoteDefinition'], validate) function validate(node) { - var identifier; - var duplicate; + var identifier + var duplicate - if (!unistUtilGenerated(node)) { - identifier = node.identifier; - duplicate = map[identifier]; + if (!generated(node)) { + identifier = node.identifier + duplicate = map[identifier] if (duplicate && duplicate.type) { file.message( - reason$5 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')', + reason + ' (' + stringify(position.start(duplicate)) + ')', node - ); + ) } - map[identifier] = node; + map[identifier] = node } } } -var remarkLintNoFileNameArticles = unifiedLintRule('remark-lint:no-file-name-articles', noFileNameArticles); + +/***/ }), +/* 324 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-articles + * @fileoverview + * Warn when file name start with an article. + * + * @example {"name": "title.md"} + * + * @example {"name": "a-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `a` + * + * @example {"name": "the-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `the` + * + * @example {"name": "teh-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `teh` + * + * @example {"name": "an-article.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `an` + */ + + + +var rule = __webpack_require__(0) + +module.exports = rule('remark-lint:no-file-name-articles', noFileNameArticles) function noFileNameArticles(tree, file) { - var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i); + var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i) if (match) { - file.message('Do not start file names with `' + match[0] + '`'); + file.message('Do not start file names with `' + match[0] + '`') } } -var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( + +/***/ }), +/* 325 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-consecutive-dashes + * @fileoverview + * Warn when file names contain consecutive dashes. + * + * @example {"name": "plug-ins.md"} + * + * @example {"name": "plug--ins.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use consecutive dashes in a file name + */ + + + +var rule = __webpack_require__(0) + +module.exports = rule( 'remark-lint:no-file-name-consecutive-dashes', noFileNameConsecutiveDashes -); +) -var reason$6 = 'Do not use consecutive dashes in a file name'; +var reason = 'Do not use consecutive dashes in a file name' function noFileNameConsecutiveDashes(tree, file) { if (file.stem && /-{2,}/.test(file.stem)) { - file.message(reason$6); + file.message(reason) } } -var remarkLintNoFileNameOuterDashes = unifiedLintRule( + +/***/ }), +/* 326 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-outer-dashes + * @fileoverview + * Warn when file names contain initial or final dashes. + * + * @example {"name": "readme.md"} + * + * @example {"name": "-readme.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + * + * @example {"name": "readme-.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + */ + + + +var rule = __webpack_require__(0) + +module.exports = rule( 'remark-lint:no-file-name-outer-dashes', noFileNameOuterDashes -); +) -var reason$7 = 'Do not use initial or final dashes in a file name'; +var reason = 'Do not use initial or final dashes in a file name' function noFileNameOuterDashes(tree, file) { if (file.stem && /^-|-$/.test(file.stem)) { - file.message(reason$7); + file.message(reason) } } -var mdastUtilHeadingStyle = style; - -function style(node, relative) { - var last = node.children[node.children.length - 1]; - var depth = node.depth; - var pos = node && node.position && node.position.end; - var final = last && last.position && last.position.end; - - if (!pos) { - return null - } - - /* This can only occur for `'atx'` and `'atx-closed'` - * headings. This might incorrectly match `'atx'` - * headings with lots of trailing white space as an - * `'atx-closed'` heading. */ - if (!last) { - if (pos.column - 1 <= depth * 2) { - return consolidate(depth, relative) - } - return 'atx-closed' - } +/***/ }), +/* 327 */ +/***/ (function(module, exports, __webpack_require__) { - if (final.line + 1 === pos.line) { - return 'setext' - } +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-content-indent + * @fileoverview + * Warn when a heading’s content is indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all unneeded padding around a heading’s content. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * #·Foo + * + * ## Bar·## + * + * ##·Baz + * + * Setext headings are not affected. + * + * Baz + * === + * + * @example {"name": "invalid.md", "label": "input"} + * + * #··Foo + * + * ## Bar··## + * + * ##··Baz + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:4: Remove 1 space before this heading’s content + * 3:7: Remove 1 space after this heading’s content + * 5:7: Remove 1 space before this heading’s content + * + * @example {"name": "empty-heading.md"} + * + * #·· + * + * @example {"name": "tight.md", "config":{"pedantic":true}, "label": "input"} + * + * In pedantic mode, headings without spacing can also be detected: + * + * ##No spacing left, too much right··## + * + * @example {"name": "tight.md", "label": "output"} + * + * 3:3: Add 1 space before this heading’s content + * 3:34: Remove 1 space after this heading’s content + */ - if (final.column + depth < pos.column) { - return 'atx-closed' - } - return consolidate(depth, relative) -} -/* Get the probable style of an atx-heading, depending on - * preferred style. */ -function consolidate(depth, relative) { - return depth < 3 - ? 'atx' - : relative === 'atx' || relative === 'setext' - ? relative - : null -} +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var style = __webpack_require__(94) +var plural = __webpack_require__(31) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var remarkLintNoHeadingContentIndent = unifiedLintRule( +module.exports = rule( 'remark-lint:no-heading-content-indent', noHeadingContentIndent -); +) -var start$6 = unistUtilPosition.start; -var end$4 = unistUtilPosition.end; +var start = position.start +var end = position.end function noHeadingContentIndent(tree, file) { - var contents = String(file); + var contents = String(file) - unistUtilVisit(tree, 'heading', visitor); + visit(tree, 'heading', visitor) function visitor(node) { - var depth; - var children; - var type; - var head; - var initial; - var final; - var diff; - var index; - var char; - var reason; - - if (unistUtilGenerated(node)) { + var depth + var children + var type + var head + var initial + var final + var diff + var index + var char + var reason + + if (generated(node)) { return } - depth = node.depth; - children = node.children; - type = mdastUtilHeadingStyle(node, 'atx'); + depth = node.depth + children = node.children + type = style(node, 'atx') if (type === 'atx' || type === 'atx-closed') { - initial = start$6(node); - index = initial.offset; - char = contents.charAt(index); + initial = start(node) + index = initial.offset + char = contents.charAt(index) while (char && char !== '#') { - char = contents.charAt(++index); + char = contents.charAt(++index) } /* istanbul ignore if - CR/LF bug: remarkjs/remark#195. */ @@ -32933,15 +37504,15 @@ function noHeadingContentIndent(tree, file) { return } - index = depth + (index - initial.offset); - head = start$6(children[0]).column; + index = depth + (index - initial.offset) + head = start(children[0]).column /* Ignore empty headings. */ if (!head) { return } - diff = head - initial.column - 1 - index; + diff = head - initial.column - 1 - index if (diff) { reason = @@ -32949,10 +37520,10 @@ function noHeadingContentIndent(tree, file) { ' ' + Math.abs(diff) + ' ' + - plur('space', diff) + - ' before this heading’s content'; + plural('space', diff) + + ' before this heading’s content' - file.message(reason, start$6(children[0])); + file.message(reason, start(children[0])) } } @@ -32960,123 +37531,319 @@ function noHeadingContentIndent(tree, file) { * between their content and the final hashes, * thus, there is no `add x spaces`. */ if (type === 'atx-closed') { - final = end$4(children[children.length - 1]); - diff = end$4(node).column - final.column - 1 - depth; + final = end(children[children.length - 1]) + diff = end(node).column - final.column - 1 - depth if (diff) { reason = 'Remove ' + diff + ' ' + - plur('space', diff) + - ' after this heading’s content'; + plural('space', diff) + + ' after this heading’s content' - file.message(reason, final); + file.message(reason, final) } } } } -var remarkLintNoHeadingIndent = unifiedLintRule('remark-lint:no-heading-indent', noHeadingIndent); -var start$7 = unistUtilPosition.start; +/***/ }), +/* 328 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-indent + * @fileoverview + * Warn when a heading is indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all unneeded indentation around headings. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * #·Hello world + * + * Foo + * ----- + * + * #·Hello world·# + * + * Bar + * ===== + * + * @example {"name": "invalid.md", "label": "input"} + * + * ···# Hello world + * + * ·Foo + * ----- + * + * ·# Hello world # + * + * ···Bar + * ===== + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:4: Remove 3 spaces before this heading + * 3:2: Remove 1 space before this heading + * 6:2: Remove 1 space before this heading + * 8:4: Remove 3 spaces before this heading + */ + + + +var rule = __webpack_require__(0) +var plural = __webpack_require__(31) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:no-heading-indent', noHeadingIndent) + +var start = position.start function noHeadingIndent(tree, file) { - var contents = String(file); - var length = contents.length; + var contents = String(file) + var length = contents.length - unistUtilVisit(tree, 'heading', visitor); + visit(tree, 'heading', visitor) function visitor(node) { - var initial; - var begin; - var index; - var character; - var diff; + var initial + var begin + var index + var character + var diff - if (unistUtilGenerated(node)) { + if (generated(node)) { return } - initial = start$7(node); - begin = initial.offset; - index = begin - 1; + initial = start(node) + begin = initial.offset + index = begin - 1 while (++index < length) { - character = contents.charAt(index); + character = contents.charAt(index) if (character !== ' ' && character !== '\t') { break } } - diff = index - begin; + diff = index - begin if (diff) { file.message( - 'Remove ' + diff + ' ' + plur('space', diff) + ' before this heading', + 'Remove ' + diff + ' ' + plural('space', diff) + ' before this heading', { line: initial.line, column: initial.column + diff } - ); + ) } } } -var remarkLintNoInlinePadding = unifiedLintRule('remark-lint:no-inline-padding', noInlinePadding); + +/***/ }), +/* 329 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-inline-padding + * @fileoverview + * Warn when inline nodes are padded with spaces between their markers and + * content. + * + * Warns for emphasis, strong, delete, images, and links. + * + * @example {"name": "valid.md"} + * + * Alpha, *bravo*, _charlie_, [delta](http://echo.fox/trot) + * + * @example {"name": "invalid.md", "label": "input"} + * + * Alpha, * bravo *, _ charlie _, [ delta ](http://echo.fox/trot) + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:8-1:17: Don’t pad `emphasis` with inner spaces + * 1:19-1:30: Don’t pad `emphasis` with inner spaces + * 1:32-1:63: Don’t pad `link` with inner spaces + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var generated = __webpack_require__(2) +var toString = __webpack_require__(45) + +module.exports = rule('remark-lint:no-inline-padding', noInlinePadding) function noInlinePadding(tree, file) { - unistUtilVisit(tree, ['emphasis', 'strong', 'delete', 'image', 'link'], visitor); + visit(tree, ['emphasis', 'strong', 'delete', 'image', 'link'], visitor) function visitor(node) { - var contents; + var contents - if (!unistUtilGenerated(node)) { - contents = mdastUtilToString(node); + if (!generated(node)) { + contents = toString(node) if ( contents.charAt(0) === ' ' || contents.charAt(contents.length - 1) === ' ' ) { - file.message('Don’t pad `' + node.type + '` with inner spaces', node); + file.message('Don’t pad `' + node.type + '` with inner spaces', node) } } } } -var start$8 = unistUtilPosition.start; + +/***/ }), +/* 330 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-multiple-toplevel-headings + * @fileoverview + * Warn when multiple top-level headings are used. + * + * Options: `number`, default: `1`. + * + * @example {"name": "valid.md", "setting": 1} + * + * # Foo + * + * ## Bar + * + * @example {"name": "invalid.md", "setting": 1, "label": "input"} + * + * # Foo + * + * # Bar + * + * @example {"name": "invalid.md", "setting": 1, "label": "output"} + * + * 3:1-3:6: Don’t use multiple top level headings (1:1) + */ + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var start = __webpack_require__(3).start +var generated = __webpack_require__(2) +var stringify = __webpack_require__(27) -var remarkLintNoMultipleToplevelHeadings = unifiedLintRule( +module.exports = rule( 'remark-lint:no-multiple-toplevel-headings', noMultipleToplevelHeadings -); +) function noMultipleToplevelHeadings(tree, file, pref) { - var style = pref ? pref : 1; - var duplicate; + var style = pref ? pref : 1 + var duplicate - unistUtilVisit(tree, 'heading', visitor); + visit(tree, 'heading', visitor) function visitor(node) { - if (!unistUtilGenerated(node) && node.depth === style) { + if (!generated(node) && node.depth === style) { if (duplicate) { file.message( 'Don’t use multiple top level headings (' + duplicate + ')', node - ); + ) } else { - duplicate = unistUtilStringifyPosition(start$8(node)); + duplicate = stringify(start(node)) } } } } -var remarkLintNoShellDollars = unifiedLintRule('remark-lint:no-shell-dollars', noShellDollars); -var reason$8 = 'Do not use dollar signs before shell-commands'; +/***/ }), +/* 331 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shell-dollars + * @fileoverview + * Warn when shell code is prefixed by dollar-characters. + * + * Ignores indented code blocks and fenced code blocks without language flag. + * + * @example {"name": "valid.md"} + * + * ```sh + * echo a + * echo a > file + * ``` + * + * ```zsh + * $ echo a + * a + * $ echo a > file + * ``` + * + * Some empty code: + * + * ```command + * ``` + * + * It’s fine to use dollars in non-shell code. + * + * ```js + * $('div').remove(); + * ``` + * + * @example {"name": "invalid.md", "label": "input"} + * + * ```bash + * $ echo a + * $ echo a > file + * ``` + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-4:4: Do not use dollar signs before shell-commands + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:no-shell-dollars', noShellDollars) + +var reason = 'Do not use dollar signs before shell-commands' /* List of shell script file extensions (also used as code * flags for syntax highlighting on GitHub): @@ -33093,102 +37860,268 @@ var flags = [ 'tmux', 'tool', 'zsh' -]; +] function noShellDollars(tree, file) { - unistUtilVisit(tree, 'code', visitor); + visit(tree, 'code', visitor) function visitor(node) { - var lines; - var line; - var length; - var index; + var lines + var line + var length + var index /* Check both known shell-code and unknown code. */ - if (!unistUtilGenerated(node) && node.lang && flags.indexOf(node.lang) !== -1) { - lines = node.value.split('\n'); - length = lines.length; - index = -1; + if (!generated(node) && node.lang && flags.indexOf(node.lang) !== -1) { + lines = node.value.split('\n') + length = lines.length + index = -1 if (length <= 1) { return } while (++index < length) { - line = lines[index]; + line = lines[index] if (line.trim() && !line.match(/^\s*\$\s*/)) { return } } - file.message(reason$8, node); - } - } -} + file.message(reason, node) + } + } +} + + +/***/ }), +/* 332 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shortcut-reference-image + * @fileoverview + * Warn when shortcut reference images are used. + * + * Shortcut references render as images when a definition is found, and as + * plain text without definition. Sometimes, you don’t intend to create an + * image from the reference, but this rule still warns anyway. In that case, + * you can escape the reference like so: `!\[foo]`. + * + * @example {"name": "valid.md"} + * + * ![foo][] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "invalid.md", "label": "input"} + * + * ![foo] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-1:7: Use the trailing [] on reference images + */ + -var remarkLintNoShortcutReferenceImage = unifiedLintRule( + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var generated = __webpack_require__(2) + +module.exports = rule( 'remark-lint:no-shortcut-reference-image', noShortcutReferenceImage -); +) -var reason$9 = 'Use the trailing [] on reference images'; +var reason = 'Use the trailing [] on reference images' function noShortcutReferenceImage(tree, file) { - unistUtilVisit(tree, 'imageReference', visitor); + visit(tree, 'imageReference', visitor) function visitor(node) { - if (!unistUtilGenerated(node) && node.referenceType === 'shortcut') { - file.message(reason$9, node); + if (!generated(node) && node.referenceType === 'shortcut') { + file.message(reason, node) } } } -var remarkLintNoTableIndentation = unifiedLintRule('remark-lint:no-table-indentation', noTableIndentation); -var reason$10 = 'Do not indent table rows'; +/***/ }), +/* 333 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-table-indentation + * @fileoverview + * Warn when tables are indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all unneeded indentation before tables. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * Paragraph. + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "invalid.md", "label": "input"} + * + * Paragraph. + * + * ···| A | B | + * ···| ----- | ----- | + * ···| Alpha | Bravo | + * + * @example {"name": "invalid.md", "label": "output"} + * + * 3:1-3:21: Do not indent table rows + * 5:1-5:21: Do not indent table rows + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:no-table-indentation', noTableIndentation) + +var reason = 'Do not indent table rows' function noTableIndentation(tree, file) { - var contents = String(file); + var contents = String(file) - unistUtilVisit(tree, 'table', visitor); + visit(tree, 'table', visitor) function visitor(node) { - if (!unistUtilGenerated(node)) { - node.children.forEach(each); + if (!generated(node)) { + node.children.forEach(each) } - return unistUtilVisit.SKIP + return visit.SKIP } function each(row) { var fence = contents.slice( - unistUtilPosition.start(row).offset, - unistUtilPosition.start(row.children[0]).offset - ); + position.start(row).offset, + position.start(row.children[0]).offset + ) if (fence.indexOf('|') > 1) { - file.message(reason$10, row); + file.message(reason, row) } } } -var remarkLintNoTabs = unifiedLintRule('remark-lint:no-tabs', noTabs); -var reason$11 = 'Use spaces instead of hard-tabs'; +/***/ }), +/* 334 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-tabs + * @fileoverview + * Warn when hard tabs are used instead of spaces. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * uses spaces where tabs are used for indentation, but retains tabs used in + * content. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * Foo Bar + * + * ····Foo + * + * @example {"name": "invalid.md", "label": "input", "config": {"positionless": true}} + * + * »Here's one before a code block. + * + * Here's a tab:», and here is another:». + * + * And this is in `inline»code`. + * + * >»This is in a block quote. + * + * *»And... + * + * »1.»in a list. + * + * And this is a tab as the last character.» + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1: Use spaces instead of hard-tabs + * 3:14: Use spaces instead of hard-tabs + * 3:37: Use spaces instead of hard-tabs + * 5:23: Use spaces instead of hard-tabs + * 7:2: Use spaces instead of hard-tabs + * 9:2: Use spaces instead of hard-tabs + * 11:1: Use spaces instead of hard-tabs + * 11:4: Use spaces instead of hard-tabs + * 13:41: Use spaces instead of hard-tabs + */ + + + +var rule = __webpack_require__(0) +var location = __webpack_require__(19) + +module.exports = rule('remark-lint:no-tabs', noTabs) + +var reason = 'Use spaces instead of hard-tabs' function noTabs(tree, file) { - var content = String(file); - var position = vfileLocation(file).toPosition; - var index = content.indexOf('\t'); + var content = String(file) + var position = location(file).toPosition + var index = content.indexOf('\t') while (index !== -1) { - file.message(reason$11, position(index)); - index = content.indexOf('\t', index + 1); + file.message(reason, position(index)) + index = content.indexOf('\t', index + 1) } } -var remarkLintNoTrailingSpaces = unifiedLintRule('remark-lint:no-trailing-spaces', noTrailingSpaces); + +/***/ }), +/* 335 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var rule = __webpack_require__(0); + +module.exports = rule('remark-lint:no-trailing-spaces', noTrailingSpaces); /** * Lines that are just space characters are not present in @@ -33211,149 +38144,363 @@ function noTrailingSpaces(ast, file) { } } -var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions); -var reason$12 = 'Found unused definition'; +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module no-unused-definitions + * @fileoverview + * Warn when unused definitions are found. + * + * @example {"name": "valid.md"} + * + * [foo][] + * + * [foo]: https://example.com + * + * @example {"name": "invalid.md", "label": "input"} + * + * [bar]: https://example.com + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-1:27: Found unused definition + */ + + + +var rule = __webpack_require__(0) +var generated = __webpack_require__(2) +var visit = __webpack_require__(1) + +module.exports = rule('remark-lint:no-unused-definitions', noUnusedDefinitions) + +var reason = 'Found unused definition' function noUnusedDefinitions(tree, file) { - var map = {}; - var identifier; - var entry; + var map = {} + var identifier + var entry - unistUtilVisit(tree, ['definition', 'footnoteDefinition'], find); - unistUtilVisit(tree, ['imageReference', 'linkReference', 'footnoteReference'], mark); + visit(tree, ['definition', 'footnoteDefinition'], find) + visit(tree, ['imageReference', 'linkReference', 'footnoteReference'], mark) for (identifier in map) { - entry = map[identifier]; + entry = map[identifier] if (!entry.used) { - file.message(reason$12, entry.node); + file.message(reason, entry.node) } } function find(node) { - if (!unistUtilGenerated(node)) { - map[node.identifier.toUpperCase()] = {node: node, used: false}; + if (!generated(node)) { + map[node.identifier.toUpperCase()] = {node: node, used: false} } } function mark(node) { - var info = map[node.identifier.toUpperCase()]; + var info = map[node.identifier.toUpperCase()] - if (!unistUtilGenerated(node) && info) { - info.used = true; + if (!generated(node) && info) { + info.used = true } } } -var rule$1 = unifiedLintRule; + +/***/ }), +/* 337 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module rule-style + * @fileoverview + * Warn when the horizontal rules violate a given or detected style. + * + * Options: `string`, either a valid markdown rule, or `'consistent'`, + * default: `'consistent'`. + * + * `'consistent'` detects the first used rule style and warns when subsequent + * rules use different styles. + * + * Note: horizontal rules are also called “thematic break”. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * has three settings that define how rules are created: + * + * * [`rule`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrule) + * (default: `*`) — Marker to use + * * [`ruleRepetition`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulerepetition) + * (default: `3`) — Number of markers to use + * * [`ruleSpaces`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulespaces) + * (default: `true`) — Whether to pad markers with spaces + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md", "setting": "* * *"} + * + * * * * + * + * * * * + * + * @example {"name": "valid.md", "setting": "_______"} + * + * _______ + * + * _______ + * + * @example {"name": "invalid.md", "label": "input"} + * + * *** + * + * * * * + * + * @example {"name": "invalid.md", "label": "output"} + * + * 3:1-3:6: Rules should use `***` + * + * @example {"name": "invalid.md", "label": "output", "setting": "!!!", "config": {"positionless": true}} + * + * 1:1: Invalid preferred rule-style: provide a valid markdown rule, or `'consistent'` + */ +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var remarkLintRuleStyle = rule$1('remark-lint:rule-style', ruleStyle); +module.exports = rule('remark-lint:rule-style', ruleStyle) -var start$9 = unistUtilPosition.start; -var end$5 = unistUtilPosition.end; +var start = position.start +var end = position.end function ruleStyle(tree, file, pref) { - var contents = String(file); + var contents = String(file) - pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null if (pref !== null && /[^-_* ]/.test(pref)) { file.fail( "Invalid preferred rule-style: provide a valid markdown rule, or `'consistent'`" - ); + ) } - unistUtilVisit(tree, 'thematicBreak', visitor); + visit(tree, 'thematicBreak', visitor) function visitor(node) { - var initial = start$9(node).offset; - var final = end$5(node).offset; - var rule; + var initial = start(node).offset + var final = end(node).offset + var rule - if (!unistUtilGenerated(node)) { - rule = contents.slice(initial, final); + if (!generated(node)) { + rule = contents.slice(initial, final) if (pref) { if (rule !== pref) { - file.message('Rules should use `' + pref + '`', node); + file.message('Rules should use `' + pref + '`', node) } } else { - pref = rule; + pref = rule } } } } -var remarkLintTablePipes = unifiedLintRule('remark-lint:table-pipes', tablePipes); -var start$10 = unistUtilPosition.start; -var end$6 = unistUtilPosition.end; +/***/ }), +/* 338 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-pipes + * @fileoverview + * Warn when table rows are not fenced with pipes. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * creates fenced rows with initial and final pipes by default. Pass + * [`looseTable: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsloosetable) + * to not use row fences. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "invalid.md", "label": "input"} + * + * A | B + * ----- | ----- + * Alpha | Bravo + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1: Missing initial pipe in table fence + * 1:10: Missing final pipe in table fence + * 3:1: Missing initial pipe in table fence + * 3:14: Missing final pipe in table fence + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:table-pipes', tablePipes) + +var start = position.start +var end = position.end -var reasonStart = 'Missing initial pipe in table fence'; -var reasonEnd = 'Missing final pipe in table fence'; +var reasonStart = 'Missing initial pipe in table fence' +var reasonEnd = 'Missing final pipe in table fence' function tablePipes(tree, file) { - var contents = String(file); + var contents = String(file) - unistUtilVisit(tree, 'table', visitor); + visit(tree, 'table', visitor) function visitor(node) { - var rows = node.children; - var length = rows.length; - var index = -1; - var row; - var cells; - var head; - var tail; - var initial; - var final; + var rows = node.children + var length = rows.length + var index = -1 + var row + var cells + var head + var tail + var initial + var final while (++index < length) { - row = rows[index]; + row = rows[index] - if (!unistUtilGenerated(row)) { - cells = row.children; - head = cells[0]; - tail = cells[cells.length - 1]; - initial = contents.slice(start$10(row).offset, start$10(head).offset); - final = contents.slice(end$6(tail).offset, end$6(row).offset); + if (!generated(row)) { + cells = row.children + head = cells[0] + tail = cells[cells.length - 1] + initial = contents.slice(start(row).offset, start(head).offset) + final = contents.slice(end(tail).offset, end(row).offset) if (initial.indexOf('|') === -1) { - file.message(reasonStart, start$10(row)); + file.message(reasonStart, start(row)) } if (final.indexOf('|') === -1) { - file.message(reasonEnd, end$6(row)); + file.message(reasonEnd, end(row)) } } } } } -var remarkLintBlockquoteIndentation = unifiedLintRule( + +/***/ }), +/* 339 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module blockquote-indentation + * @fileoverview + * Warn when blockquotes are indented too much or too little. + * + * Options: `number` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used indentation and will warn when + * other blockquotes use a different indentation. + * + * @example {"name": "valid.md", "setting": 4} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "valid.md", "setting": 2} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "invalid.md", "label": "input"} + * + * > Hello + * + * Paragraph. + * + * > World + * + * Paragraph. + * + * > World + * + * @example {"name": "invalid.md", "label": "output"} + * + * 5:3: Remove 1 space between blockquote and content + * 9:3: Add 1 space between blockquote and content + */ + + + +var rule = __webpack_require__(0) +var plural = __webpack_require__(31) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) +var toString = __webpack_require__(45) + +module.exports = rule( 'remark-lint:blockquote-indentation', blockquoteIndentation -); +) function blockquoteIndentation(tree, file, pref) { - pref = typeof pref === 'number' && !isNaN(pref) ? pref : null; + pref = typeof pref === 'number' && !isNaN(pref) ? pref : null - unistUtilVisit(tree, 'blockquote', visitor); + visit(tree, 'blockquote', visitor) function visitor(node) { - var diff; - var reason; + var diff + var reason - if (unistUtilGenerated(node) || node.children.length === 0) { + if (generated(node) || node.children.length === 0) { return } if (pref) { - diff = pref - check$3(node); + diff = pref - check(node) if (diff !== 0) { reason = @@ -33361,53 +38508,137 @@ function blockquoteIndentation(tree, file, pref) { ' ' + Math.abs(diff) + ' ' + - plur('space', diff) + - ' between blockquote and content'; + plural('space', diff) + + ' between blockquote and content' - file.message(reason, unistUtilPosition.start(node.children[0])); + file.message(reason, position.start(node.children[0])) } } else { - pref = check$3(node); + pref = check(node) } } } -function check$3(node) { - var head = node.children[0]; - var indentation = unistUtilPosition.start(head).column - unistUtilPosition.start(node).column; - var padding = mdastUtilToString(head).match(/^ +/); +function check(node) { + var head = node.children[0] + var indentation = position.start(head).column - position.start(node).column + var padding = toString(head).match(/^ +/) if (padding) { - indentation += padding[0].length; + indentation += padding[0].length } return indentation } -var remarkLintCheckboxCharacterStyle = unifiedLintRule( + +/***/ }), +/* 340 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-character-style + * @fileoverview + * Warn when list item checkboxes violate a given style. + * + * Options: `Object` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used checked and unchecked checkbox + * styles and warns when subsequent checkboxes use different styles. + * + * Styles can also be passed in like so: + * + * ```js + * { checked: 'x', unchecked: ' ' } + * ``` + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats checked checkboxes using `x` and unchecked checkboxes as ` `. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md", "setting": {"checked": "x"}} + * + * - [x] List item + * - [x] List item + * + * @example {"name": "valid.md", "setting": {"checked": "X"}} + * + * - [X] List item + * - [X] List item + * + * @example {"name": "valid.md", "setting": {"unchecked": " "}} + * + * - [ ] List item + * - [ ] List item + * - [ ]·· + * - [ ] + * + * @example {"name": "valid.md", "setting": {"unchecked": "\t"}} + * + * - [»] List item + * - [»] List item + * + * @example {"name": "invalid.md", "label": "input"} + * + * - [x] List item + * - [X] List item + * - [ ] List item + * - [»] List item + * + * @example {"name": "invalid.md", "label": "output"} + * + * 2:4-2:5: Checked checkboxes should use `x` as a marker + * 4:4-4:5: Unchecked checkboxes should use ` ` as a marker + * + * @example {"setting": {"unchecked": "!"}, "name": "invalid.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid unchecked checkbox marker `!`: use either `'\t'`, or `' '` + * + * @example {"setting": {"checked": "!"}, "name": "invalid.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid checked checkbox marker `!`: use either `'x'`, or `'X'` + */ + + + +var rule = __webpack_require__(0) +var vfileLocation = __webpack_require__(19) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule( 'remark-lint:checkbox-character-style', checkboxCharacterStyle -); +) -var start$11 = unistUtilPosition.start; -var end$7 = unistUtilPosition.end; +var start = position.start +var end = position.end -var checked = {x: true, X: true}; -var unchecked = {' ': true, '\t': true}; -var types = {true: 'checked', false: 'unchecked'}; +var checked = {x: true, X: true} +var unchecked = {' ': true, '\t': true} +var types = {true: 'checked', false: 'unchecked'} function checkboxCharacterStyle(tree, file, pref) { - var contents = String(file); - var location = vfileLocation(file); + var contents = String(file) + var location = vfileLocation(file) - pref = typeof pref === 'object' ? pref : {}; + pref = typeof pref === 'object' ? pref : {} if (pref.unchecked && unchecked[pref.unchecked] !== true) { file.fail( 'Invalid unchecked checkbox marker `' + pref.unchecked + "`: use either `'\\t'`, or `' '`" - ); + ) } if (pref.checked && checked[pref.checked] !== true) { @@ -33415,38 +38646,38 @@ function checkboxCharacterStyle(tree, file, pref) { 'Invalid checked checkbox marker `' + pref.checked + "`: use either `'x'`, or `'X'`" - ); + ) } - unistUtilVisit(tree, 'listItem', visitor); + visit(tree, 'listItem', visitor) function visitor(node) { - var type; - var initial; - var final; - var value; - var style; - var character; - var reason; + var type + var initial + var final + var value + var style + var character + var reason /* Exit early for items without checkbox. */ - if (typeof node.checked !== 'boolean' || unistUtilGenerated(node)) { + if (typeof node.checked !== 'boolean' || generated(node)) { return } - type = types[node.checked]; - initial = start$11(node).offset; - final = (node.children.length ? start$11(node.children[0]) : end$7(node)).offset; + type = types[node.checked] + initial = start(node).offset + final = (node.children.length ? start(node.children[0]) : end(node)).offset /* For a checkbox to be parsed, it must be followed by a white space. */ value = contents .slice(initial, final) .trimRight() - .slice(0, -1); + .slice(0, -1) /* The checkbox character is behind a square bracket. */ - character = value.charAt(value.length - 1); - style = pref[type]; + character = value.charAt(value.length - 1) + style = pref[type] if (style) { if (character !== style) { @@ -33455,99 +38686,286 @@ function checkboxCharacterStyle(tree, file, pref) { type.slice(1) + ' checkboxes should use `' + style + - '` as a marker'; + '` as a marker' file.message(reason, { start: location.toPosition(initial + value.length - 1), end: location.toPosition(initial + value.length) - }); + }) } } else { - pref[type] = character; + pref[type] = character } } } -var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', codeBlockStyle); -var start$12 = unistUtilPosition.start; -var end$8 = unistUtilPosition.end; +/***/ }), +/* 341 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module code-block-style + * @fileoverview + * Warn when code-blocks do not adhere to a given style. + * + * Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + * + * `'consistent'` detects the first used code-block style and warns when + * subsequent code-blocks uses different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats code blocks using a fence if they have a language flag and + * indentation if not. Pass + * [`fences: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfences) + * to always use fences for code blocks. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "indented", "name": "valid.md"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "indented", "name": "invalid.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "indented", "name": "invalid.md", "label": "output"} + * + * 1:1-3:4: Code blocks should be indented + * 7:1-9:4: Code blocks should be indented + * + * @example {"setting": "fenced", "name": "valid.md"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "fenced", "name": "invalid.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "fenced", "name": "invalid.md", "label": "output"} + * + * 1:1-1:13: Code blocks should be fenced + * 5:1-5:13: Code blocks should be fenced + * + * @example {"name": "invalid.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"name": "invalid.md", "label": "output"} + * + * 5:1-7:4: Code blocks should be indented + * + * @example {"setting": "invalid", "name": "invalid.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid code block style `invalid`: use either `'consistent'`, `'fenced'`, or `'indented'` + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:code-block-style', codeBlockStyle) -var styles$1 = {null: true, fenced: true, indented: true}; +var start = position.start +var end = position.end + +var styles = {null: true, fenced: true, indented: true} function codeBlockStyle(tree, file, pref) { - var contents = String(file); + var contents = String(file) - pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null - if (styles$1[pref] !== true) { + if (styles[pref] !== true) { file.fail( 'Invalid code block style `' + pref + "`: use either `'consistent'`, `'fenced'`, or `'indented'`" - ); + ) } - unistUtilVisit(tree, 'code', visitor); + visit(tree, 'code', visitor) function visitor(node) { - var current = check(node); + var current = check(node) if (current) { if (!pref) { - pref = current; + pref = current } else if (pref !== current) { - file.message('Code blocks should be ' + pref, node); + file.message('Code blocks should be ' + pref, node) } } } - /* Get the style of `node`. */ - function check(node) { - var initial = start$12(node).offset; - var final = end$8(node).offset; + /* Get the style of `node`. */ + function check(node) { + var initial = start(node).offset + var final = end(node).offset + + if (generated(node)) { + return null + } + + return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final)) + ? 'fenced' + : 'indented' + } +} + + +/***/ }), +/* 342 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-marker + * @fileoverview + * Warn for violating fenced code markers. + * + * Options: `` '`' ``, `'~'`, or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used fenced code marker style and warns + * when subsequent fenced code-blocks use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats fences using a backtick (`` '`' ``) by default. Pass + * [`fence: '~'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfence) + * to use tildes instead. + * + * See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "valid.md"} + * + * Indented code blocks are not affected by this rule: + * + * bravo(); + * + * @example {"name": "valid.md", "setting": "`"} + * + * ```alpha + * bravo(); + * ``` + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "valid.md", "setting": "~"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "invalid.md", "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "invalid.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use ` as a marker + * + * @example {"name": "invalid.md", "setting": "!", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid fenced code marker `!`: use either `'consistent'`, `` '`' ``, or `'~'` + */ + - if (unistUtilGenerated(node)) { - return null - } - return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final)) - ? 'fenced' - : 'indented' - } -} +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) -var remarkLintFencedCodeMarker = unifiedLintRule('remark-lint:fenced-code-marker', fencedCodeMarker); +module.exports = rule('remark-lint:fenced-code-marker', fencedCodeMarker) var markers = { '`': true, '~': true, null: true -}; +} function fencedCodeMarker(tree, file, pref) { - var contents = String(file); + var contents = String(file) - pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null if (markers[pref] !== true) { file.fail( 'Invalid fenced code marker `' + pref + "`: use either `'consistent'`, `` '`' ``, or `'~'`" - ); + ) } - unistUtilVisit(tree, 'code', visitor); + visit(tree, 'code', visitor) function visitor(node) { - var marker; + var marker - if (!unistUtilGenerated(node)) { + if (!generated(node)) { marker = contents - .substr(unistUtilPosition.start(node).offset, 4) + .substr(position.start(node).offset, 4) .trimLeft() - .charAt(0); + .charAt(0) /* Ignore unfenced code blocks. */ if (markers[marker] === true) { @@ -33556,86 +38974,301 @@ function fencedCodeMarker(tree, file, pref) { file.message( 'Fenced code should use ' + pref + ' as a marker', node - ); + ) } } else { - pref = marker; + pref = marker } } } } } -var remarkLintFileExtension = unifiedLintRule('remark-lint:file-extension', fileExtension); + +/***/ }), +/* 343 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module file-extension + * @fileoverview + * Warn when the file extension differ from the preferred extension. + * + * Does not warn when given documents have no file extensions (such as + * `AUTHORS` or `LICENSE`). + * + * Options: `string`, default: `'md'` — Expected file extension. + * + * @example {"name": "readme.md"} + * + * @example {"name": "readme"} + * + * @example {"name": "readme.mkd", "label": "output", "config": {"positionless": true}} + * + * 1:1: Invalid extension: use `md` + * + * @example {"name": "readme.mkd", "setting": "mkd"} + */ + + + +var rule = __webpack_require__(0) + +module.exports = rule('remark-lint:file-extension', fileExtension) function fileExtension(tree, file, pref) { - var ext = file.extname; + var ext = file.extname - pref = typeof pref === 'string' ? pref : 'md'; + pref = typeof pref === 'string' ? pref : 'md' if (ext && ext.slice(1) !== pref) { - file.message('Invalid extension: use `' + pref + '`'); + file.message('Invalid extension: use `' + pref + '`') } } -var remarkLintFirstHeadingLevel = unifiedLintRule('remark-lint:first-heading-level', firstHeadingLevel); -var re$3 = /An HTML heading is also seen by this rule. + * + * @example {"name": "valid-delayed.md"} + * + * You can use markdown content before the heading. + * + *
    Or non-heading HTML
    + * + *

    So the first heading, be it HTML or markdown, is checked

    + * + * @example {"name": "invalid.md", "label": "input"} + * + * ## Bravo + * + * Paragraph. + * + * @example {"name": "invalid.md", "label": "output"} + * + * 1:1-1:9: First heading level should be `1` + * + * @example {"name": "invalid-html.md", "label": "input"} + * + *

    Charlie

    + * + * Paragraph. + * + * @example {"name": "invalid-html.md", "label": "output"} + * + * 1:1-1:17: First heading level should be `1` + * + * @example {"name": "valid.md", "setting": 2} + * + * ## Delta + * + * Paragraph. + * + * @example {"name": "valid-html.md", "setting": 2} + * + *

    Echo

    + * + * Paragraph. + * + * @example {"name": "invalid.md", "setting": 2, "label": "input"} + * + * # Foxtrot + * + * Paragraph. + * + * @example {"name": "invalid.md", "setting": 2, "label": "output"} + * + * 1:1-1:10: First heading level should be `2` + * + * @example {"name": "invalid-html.md", "setting": 2, "label": "input"} + * + *

    Golf

    + * + * Paragraph. + * + * @example {"name": "invalid-html.md", "setting": 2, "label": "output"} + * + * 1:1-1:14: First heading level should be `2` + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:first-heading-level', firstHeadingLevel) + +var re = / + * + * | | Alpha | Bravo| + * | ------ | ----- | ---: | + * | Charlie| | Echo| + * + * @example {"name": "empty.md", "label": "output", "setting": "padded"} + * + * 3:25: Cell should be padded + * 5:10: Cell should be padded + * 5:25: Cell should be padded + * + * @example {"name": "missing-body.md", "setting": "padded"} + * + * + * + * | Alpha | Bravo | Charlie | + * | ----- | -------- | ------- | + * | Delta | + * | Echo | Foxtrott | + */ + + + +var rule = __webpack_require__(0) +var visit = __webpack_require__(1) +var position = __webpack_require__(3) +var generated = __webpack_require__(2) + +module.exports = rule('remark-lint:table-cell-padding', tableCellPadding) -var styles$2 = {null: true, padded: true, compact: true}; +var start = position.start +var end = position.end + +var styles = {null: true, padded: true, compact: true} function tableCellPadding(tree, file, pref) { - var contents = String(file); + var contents = String(file) - pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null - if (styles$2[pref] !== true) { - file.fail('Invalid table-cell-padding style `' + pref + '`'); + if (styles[pref] !== true) { + file.fail('Invalid table-cell-padding style `' + pref + '`') } - unistUtilVisit(tree, 'table', visitor); + visit(tree, 'table', visitor) function visitor(node) { - var rows = node.children; - var sizes = new Array(node.align.length); - var length = unistUtilGenerated(node) ? -1 : rows.length; - var index = -1; - var entries = []; - var style; - var row; - var cells; - var column; - var cellCount; - var cell; - var next; - var fence; - var pos; - var entry; - var final; + var rows = node.children + var sizes = new Array(node.align.length) + var length = generated(node) ? -1 : rows.length + var index = -1 + var entries = [] + var style + var row + var cells + var column + var cellCount + var cell + var next + var fence + var pos + var entry + var final /* Check rows. */ while (++index < length) { - row = rows[index]; - cells = row.children; - cellCount = cells.length; - column = -2; /* Start without a first cell */ - next = null; - final = undefined; + row = rows[index] + cells = row.children + cellCount = cells.length + column = -2 /* Start without a first cell */ + next = null + final = undefined /* Check fences (before, between, and after cells) */ while (++column < cellCount) { - cell = next; - next = cells[column + 1]; + cell = next + next = cells[column + 1] fence = contents.slice( - cell ? end$9(cell).offset : start$13(row).offset, - next ? start$13(next).offset : end$9(row).offset - ); + cell ? end(cell).offset : start(row).offset, + next ? start(next).offset : end(row).offset + ) - pos = fence.indexOf('|'); + pos = fence.indexOf('|') if (cell && cell.children.length !== 0 && final !== undefined) { - entries.push({node: cell, start: final, end: pos, index: column}); + entries.push({node: cell, start: final, end: pos, index: column}) /* Detect max space per column. */ - sizes[column] = Math.max(sizes[column] || 0, size(cell)); + sizes[column] = Math.max(sizes[column] || 0, size(cell)) } else { - final = undefined; + final = undefined } if (next && next.children.length !== 0) { - final = fence.length - pos - 1; + final = fence.length - pos - 1 } else { - final = undefined; + final = undefined } } } if (pref) { - style = pref === 'padded' ? 1 : 0; + style = pref === 'padded' ? 1 : 0 } else { - style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1; + style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1 } - index = -1; - length = entries.length; + index = -1 + length = entries.length while (++index < length) { - entry = entries[index]; - checkSide('start', entry, style, sizes); - checkSide('end', entry, style, sizes); + entry = entries[index] + checkSide('start', entry, style, sizes) + checkSide('end', entry, style, sizes) } - return unistUtilVisit.SKIP + return visit.SKIP } function checkSide(side, entry, style, sizes) { - var cell = entry.node; - var spacing = entry[side]; - var index = entry.index; - var reason; + var cell = entry.node + var spacing = entry[side] + var index = entry.index + var reason if (spacing === undefined || spacing === style) { return } - reason = 'Cell should be '; + reason = 'Cell should be ' if (style === 0) { - reason += 'compact'; + reason += 'compact' /* Ignore every cell except the biggest in the column. */ if (size(cell) < sizes[index]) { return } } else { - reason += 'padded'; + reason += 'padded' if (spacing > style) { - reason += ' with 1 space, not ' + spacing; + reason += ' with 1 space, not ' + spacing /* May be right or center aligned. */ if (size(cell) < sizes[index]) { @@ -33822,103 +39687,15 @@ function tableCellPadding(tree, file, pref) { } } - file.message(reason, cell.position[side]); + file.message(reason, cell.position[side]) } } function size(node) { - return end$9(node).offset - start$13(node).offset -} - -var plugins$1 = [ - remarkLint, - remarkLintCheckboxContentIndent, - remarkLintDefinitionSpacing, - remarkLintFencedCodeFlag, - remarkLintFinalDefinition, - remarkLintFinalNewline, - remarkLintHardBreakSpaces, - remarkLintHardBreakSpaces, - [ - remarkLintListItemIndent, - 'space' - ], - remarkLintMaximumLineLength, - remarkLintNoAutoLinkWithoutProtocol, - remarkLintNoBlockquoteWithoutMarker, - remarkLintNoDuplicateDefinitions, - remarkLintNoFileNameArticles, - remarkLintNoFileNameConsecutiveDashes, - remarkLintNoFileNameOuterDashes, - remarkLintNoHeadingContentIndent, - remarkLintNoHeadingIndent, - remarkLintNoInlinePadding, - remarkLintNoMultipleToplevelHeadings, - remarkLintNoShellDollars, - remarkLintNoShortcutReferenceImage, - remarkLintNoTableIndentation, - remarkLintNoTabs, - remarkLintNoTrailingSpaces, - remarkLintNoUnusedDefinitions, - remarkLintRuleStyle, - remarkLintTablePipes, - [remarkLintBlockquoteIndentation, 2], - [ - remarkLintCheckboxCharacterStyle, - { - 'checked': 'x', 'unchecked': ' ' - } - ], - [remarkLintCodeBlockStyle, 'fenced'], - [remarkLintFencedCodeMarker, '`'], - [remarkLintFileExtension, 'md'], - [remarkLintFirstHeadingLevel, 1], - [remarkLintHeadingStyle, 'atx'], - [ - remarkLintProhibitedStrings, - [ - { no: 'Github', yes: 'GitHub' }, - { no: 'Javascript', yes: 'JavaScript' }, - { no: 'Node.JS', yes: 'Node.js' }, - { no: 'v8', yes: 'V8' } - ] - ], - [remarkLintStrongMarker, '*'], - [remarkLintTableCellPadding, 'padded'] -]; - -var remarkPresetLintNode = { - plugins: plugins$1 -}; - -var proc = ( _package$1 && _package ) || _package$1; - -var cli = ( _package$3 && _package$2 ) || _package$3; - -const { plugins: plugins$2 } = remarkPresetLintNode; - -const args = { - processor: remark, - name: proc.name, - description: cli.description, - version: [ - proc.name + ': ' + proc.version, - cli.name + ': ' + cli.version - ].join(', '), - ignoreName: '.' + proc.name + 'ignore', - extensions: markdownExtensions$2 -}; -const config = options_1(process.argv.slice(2), args); -config.detectConfig = false; -config.plugins = plugins$2; - -lib$2(config, function done(err, code) { - if (err) console.error(err); - process.exit(code); -}); - -var cliEntry = { + return end(node).offset - start(node).offset +} -}; -module.exports = cliEntry; +/***/ }) +/******/ ]); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index 41a5a3085fda46..76d9f87bf9b31f 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -4,10 +4,10 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "@zeit/ncc": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.2.0.tgz", + "integrity": "sha512-82ffMF5FkrPyJ1Ofho6kcr3UJ5+EWo5jDnLGdMAZ0CkNPTzoVOXhS4qD1KflspsKaZOCrzIZryF7PpklHoBZ7Q==", "dev": true }, "ansi-regex": { @@ -181,12 +181,6 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, - "builtin-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-2.0.0.tgz", - "integrity": "sha512-3U5kUA5VPsRUA3nofm/BXX7GVHKfxz0hOBAPxXrIvHzlDRkQVqEn6yi8QJegxl4LzOHLdvb7XF5dVawa/VVYBg==", - "dev": true - }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -425,12 +419,6 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, - "estree-walker": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.2.tgz", - "integrity": "sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig==", - "dev": true - }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -463,57 +451,6 @@ } } }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "^2.1.0" - }, - "dependencies": { - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -605,12 +542,6 @@ "format": "^0.2.2" } }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -642,15 +573,6 @@ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, "format": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", @@ -1149,42 +1071,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -1367,26 +1253,11 @@ } } }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, "is-empty": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-empty/-/is-empty-1.2.0.tgz", "integrity": "sha1-3pu1snhzigWgsJpX4ftNSjQan2s=" }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -1420,12 +1291,6 @@ "resolved": "https://registry.npmjs.org/is-hidden/-/is-hidden-1.1.1.tgz", "integrity": "sha512-175UKecS8+U4hh2PSY0j4xnm2GKYzvSKnbh+naC93JjuBA7LgIo6YxlbcsSo6seFBdQO3RuIcH980yvqqD/2cA==" }, - "is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", - "dev": true - }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -1462,18 +1327,6 @@ "isobject": "^3.0.1" } }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, "is-whitespace-character": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz", @@ -1545,15 +1398,6 @@ "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.2.tgz", "integrity": "sha512-TmYTeEYxiAmSVdpbnQDXGtvYOIRsCMg89CVZzwzc2o7GFL1CjoiRPjH5ec0NFAVlAx3fVof9dX/t6KKRAo2OWA==" }, - "magic-string": { - "version": "0.22.5", - "resolved": "http://registry.npmjs.org/magic-string/-/magic-string-0.22.5.tgz", - "integrity": "sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w==", - "dev": true, - "requires": { - "vlq": "^0.2.2" - } - }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -1582,12 +1426,6 @@ "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.2.tgz", "integrity": "sha512-NcWuJFHDA8V3wkDgR/j4+gZx+YQwstPgfQDV8ndUeWWzta3dnDTBxpVzqS9lkmJAuV5YX35lmyojl6HO5JXAgw==" }, - "math-random": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", - "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", - "dev": true - }, "mdast-comment-marker": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.0.3.tgz", @@ -1751,16 +1589,6 @@ "isobject": "^3.0.0" } }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - } - }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -1779,7 +1607,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "parse-entities": { @@ -1795,35 +1623,6 @@ "is-hexadecimal": "^1.0.0" } }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -1845,15 +1644,9 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, - "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 - }, "plur": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/plur/-/plur-3.0.1.tgz", @@ -1867,36 +1660,11 @@ "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "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==" }, - "randomatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", - "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", - "dev": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -1932,15 +1700,6 @@ "readable-stream": "^2.0.2" } }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -2467,15 +2226,6 @@ "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" }, - "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": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2491,146 +2241,6 @@ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, - "rollup": { - "version": "0.55.5", - "resolved": "http://registry.npmjs.org/rollup/-/rollup-0.55.5.tgz", - "integrity": "sha512-2hke9NOy332kxvnmMQOgl7DHm94zihNyYJNd8ZLWo4U0EjFvjUkeWa0+ge+70bTg+mY0xJ7NUsf5kIhDtrGrtA==", - "dev": true - }, - "rollup-plugin-commonjs": { - "version": "8.4.1", - "resolved": "http://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.4.1.tgz", - "integrity": "sha512-mg+WuD+jlwoo8bJtW3Mvx7Tz6TsIdMsdhuvCnDMoyjh0oxsVgsjB/N0X984RJCWwc5IIiqNVJhXeeITcc73++A==", - "dev": true, - "requires": { - "acorn": "^5.2.1", - "estree-walker": "^0.5.0", - "magic-string": "^0.22.4", - "resolve": "^1.4.0", - "rollup-pluginutils": "^2.0.1" - } - }, - "rollup-plugin-json": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-2.3.1.tgz", - "integrity": "sha512-alQQQVPo2z9pl6LSK8QqyDlWwCH5KeE8YxgQv7fa/SeTxz+gQe36jBjcha7hQW68MrVh9Ms71EQaMZDAG3w2yw==", - "dev": true, - "requires": { - "rollup-pluginutils": "^2.0.1" - } - }, - "rollup-plugin-node-resolve": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz", - "integrity": "sha512-PJcd85dxfSBWih84ozRtBkB731OjXk0KnzN0oGp7WOWcarAFkVa71cV5hTJg2qpVsV2U8EUwrzHP3tvy9vS3qg==", - "dev": true, - "requires": { - "builtin-modules": "^2.0.0", - "is-module": "^1.0.0", - "resolve": "^1.1.6" - } - }, - "rollup-pluginutils": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz", - "integrity": "sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA==", - "dev": true, - "requires": { - "estree-walker": "^0.5.2", - "micromatch": "^2.3.11" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - } - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -2638,7 +2248,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -3381,12 +2991,6 @@ "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-1.1.1.tgz", "integrity": "sha512-dxUM6IYvGChHuwMT3dseyU5BHprNRXzAV0OHx1A769lVGsTiT50kU7BbpRFV+IE6oWmU+PwHdsTKfXhnDIRIgQ==" }, - "vlq": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", - "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", - "dev": true - }, "wrapped": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wrapped/-/wrapped-1.0.1.tgz", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 2efdb6404b3d2b..2dc99a64f231ee 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -3,10 +3,7 @@ "description": "remark packaged for node markdown linting", "version": "1.0.0", "devDependencies": { - "rollup": "^0.55.5", - "rollup-plugin-commonjs": "^8.0.2", - "rollup-plugin-json": "^2.3.1", - "rollup-plugin-node-resolve": "^3.4.0" + "@zeit/ncc": "^0.2.0" }, "dependencies": { "markdown-extensions": "^1.1.0", @@ -16,8 +13,9 @@ "unified-args": "^6.0.0", "unified-engine": "^5.1.0" }, + "main": "src/cli-entry.js", "scripts": { - "build": "rollup -c", - "build-node": "npm run build && cp dist/* .." + "build": "ncc build", + "build-node": "npm run build && cp dist/index.js ../lint-md.js" } } diff --git a/tools/node-lint-md-cli-rollup/rollup.config.js b/tools/node-lint-md-cli-rollup/rollup.config.js deleted file mode 100644 index dde544a41161d4..00000000000000 --- a/tools/node-lint-md-cli-rollup/rollup.config.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -const resolve = require('rollup-plugin-node-resolve'); -const commonjs = require('rollup-plugin-commonjs'); -const json = require('rollup-plugin-json'); - -module.exports = { - input: 'src/cli-entry.js', - output: { - file: 'dist/lint-md.js', - format: 'cjs', - sourcemap: false - }, - external: [ - 'stream', - 'path', - 'module', - 'util', - 'tty', - 'os', - 'fs', - 'events', - 'assert' - ], - plugins: [ - { - name: 'brute-replace', - transform(code, id) { - const normID = id.replace(__dirname, '').replace(/\\+/g, '/'); - if (normID === '/node_modules/concat-stream/index.js') { - return code.replace('\'readable-stream\'', '\'stream\''); - } - if (normID === '/node_modules/unified-args/lib/options.js') { - return code.replace('\'./schema\'', '\'./schema.json\''); - } - } - }, - json({ - preferConst: true - }), - resolve(), // tells Rollup how to find date-fns in node_modules - commonjs(), // converts date-fns to ES modules - ] -}; From 73786c854a8bb2f5c06211edd46029538a77b980 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 3 Dec 2018 16:22:09 -0500 Subject: [PATCH 305/316] buffer: remove checkNumberType() checkNumberType() was a very thin wrapper around validateNumber(). This commit removes checkNumberType() and used validateNumber() directly instead. PR-URL: https://github.com/nodejs/node/pull/24815 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater --- lib/internal/buffer.js | 62 ++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index 137ca64142bf62..d201924afa0502 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -26,7 +26,7 @@ float32Array[0] = -1; // 0xBF800000 const bigEndian = uInt8Float32Array[3] === 0; function checkBounds(buf, offset, byteLength) { - checkNumberType(offset); + validateNumber(offset, 'offset'); if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); } @@ -38,13 +38,9 @@ function checkInt(value, min, max, buf, offset, byteLength) { checkBounds(buf, offset, byteLength); } -function checkNumberType(value, type) { - validateNumber(value, type || 'offset'); -} - function boundsError(value, length, type) { if (Math.floor(value) !== value) { - checkNumberType(value, type); + validateNumber(value, type); throw new ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); } @@ -77,7 +73,7 @@ function readUIntLE(offset, byteLength) { } function readUInt48LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 5]; if (first === undefined || last === undefined) @@ -91,7 +87,7 @@ function readUInt48LE(buf, offset = 0) { } function readUInt40LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 4]; if (first === undefined || last === undefined) @@ -105,7 +101,7 @@ function readUInt40LE(buf, offset = 0) { } function readUInt32LE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -118,7 +114,7 @@ function readUInt32LE(offset = 0) { } function readUInt24LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 2]; if (first === undefined || last === undefined) @@ -128,7 +124,7 @@ function readUInt24LE(buf, offset = 0) { } function readUInt16LE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 1]; if (first === undefined || last === undefined) @@ -138,7 +134,7 @@ function readUInt16LE(offset = 0) { } function readUInt8(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const val = this[offset]; if (val === undefined) boundsError(offset, this.length - 1); @@ -166,7 +162,7 @@ function readUIntBE(offset, byteLength) { } function readUInt48BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 5]; if (first === undefined || last === undefined) @@ -180,7 +176,7 @@ function readUInt48BE(buf, offset = 0) { } function readUInt40BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 4]; if (first === undefined || last === undefined) @@ -194,7 +190,7 @@ function readUInt40BE(buf, offset = 0) { } function readUInt32BE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -207,7 +203,7 @@ function readUInt32BE(offset = 0) { } function readUInt24BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 2]; if (first === undefined || last === undefined) @@ -217,7 +213,7 @@ function readUInt24BE(buf, offset = 0) { } function readUInt16BE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 1]; if (first === undefined || last === undefined) @@ -246,7 +242,7 @@ function readIntLE(offset, byteLength) { } function readInt48LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 5]; if (first === undefined || last === undefined) @@ -261,7 +257,7 @@ function readInt48LE(buf, offset = 0) { } function readInt40LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 4]; if (first === undefined || last === undefined) @@ -275,7 +271,7 @@ function readInt40LE(buf, offset = 0) { } function readInt32LE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -288,7 +284,7 @@ function readInt32LE(offset = 0) { } function readInt24LE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 2]; if (first === undefined || last === undefined) @@ -299,7 +295,7 @@ function readInt24LE(buf, offset = 0) { } function readInt16LE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 1]; if (first === undefined || last === undefined) @@ -310,7 +306,7 @@ function readInt16LE(offset = 0) { } function readInt8(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const val = this[offset]; if (val === undefined) boundsError(offset, this.length - 1); @@ -338,7 +334,7 @@ function readIntBE(offset, byteLength) { } function readInt48BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 5]; if (first === undefined || last === undefined) @@ -353,7 +349,7 @@ function readInt48BE(buf, offset = 0) { } function readInt40BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 4]; if (first === undefined || last === undefined) @@ -367,7 +363,7 @@ function readInt40BE(buf, offset = 0) { } function readInt32BE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -380,7 +376,7 @@ function readInt32BE(offset = 0) { } function readInt24BE(buf, offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = buf[offset]; const last = buf[offset + 2]; if (first === undefined || last === undefined) @@ -391,7 +387,7 @@ function readInt24BE(buf, offset = 0) { } function readInt16BE(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 1]; if (first === undefined || last === undefined) @@ -403,7 +399,7 @@ function readInt16BE(offset = 0) { // Read floats function readFloatBackwards(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -417,7 +413,7 @@ function readFloatBackwards(offset = 0) { } function readFloatForwards(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 3]; if (first === undefined || last === undefined) @@ -431,7 +427,7 @@ function readFloatForwards(offset = 0) { } function readDoubleBackwards(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 7]; if (first === undefined || last === undefined) @@ -449,7 +445,7 @@ function readDoubleBackwards(offset = 0) { } function readDoubleForwards(offset = 0) { - checkNumberType(offset); + validateNumber(offset, 'offset'); const first = this[offset]; const last = this[offset + 7]; if (first === undefined || last === undefined) @@ -563,7 +559,7 @@ function writeUInt16LE(value, offset = 0) { function writeU_Int8(buf, value, offset, min, max) { value = +value; // `checkInt()` can not be used here because it checks two entries. - checkNumberType(offset); + validateNumber(offset, 'offset'); if (value > max || value < min) { throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value); } From d800998161e423613fa8cb95bbdda720ef472de9 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 5 Dec 2018 10:44:37 +0100 Subject: [PATCH 306/316] doc: list all versions WHATWG URL api was added PR-URL: https://github.com/nodejs/node/pull/24847 Reviewed-By: Luigi Pinca Reviewed-By: Sam Roberts Reviewed-By: Vse Mozhet Byt --- doc/api/url.md | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 04abdf69b021ed..ae53c98778238e 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -73,7 +73,9 @@ const myURL = ### Class: URL * `obj` {Object} An object representing a collection of key-value pairs @@ -627,7 +633,9 @@ console.log(params.toString()); #### Constructor: new URLSearchParams(iterable) * `iterable` {Iterable} An iterable object whose elements are key-value pairs @@ -785,7 +793,9 @@ console.log(params.toString()); #### urlSearchParams.sort() Sort all existing name-value pairs in-place by their names. Sorting is done @@ -836,7 +846,9 @@ for (const [name, value] of params) { ### url.domainToASCII(domain) * `domain` {string} @@ -859,7 +871,9 @@ console.log(url.domainToASCII('xn--iñvalid.com')); ### url.domainToUnicode(domain) * `domain` {string} @@ -881,6 +895,9 @@ console.log(url.domainToUnicode('xn--iñvalid.com')); ``` ### url.fileURLToPath(url) + * `url` {URL | string} The file URL string or URL object to convert to a path. * Returns: {string} The fully-resolved platform-specific Node.js file path. @@ -942,6 +959,9 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false })); ``` ### url.pathToFileURL(path) + * `path` {string} The path to convert to a File URL. * Returns: {URL} The file URL object. From 5a1fb1e66333ec6d32dd72072375fd3c0dcdd546 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 3 Dec 2018 15:06:52 +0100 Subject: [PATCH 307/316] doc: mention util depth default change This was missed when reverting a former commit. To make sure the history is kept in place, this just adds a new entry to state the revert. PR-URL: https://github.com/nodejs/node/pull/24805 Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau --- doc/api/util.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/util.md b/doc/api/util.md index d071b216ab32bd..2823c46cbb8c65 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -375,6 +375,9 @@ stream.write('With ES6'); + +Chooses an HTTP parser library. Available values are: + +- `llhttp` for https://llhttp.org/ +- `legacy` for https://github.com/nodejs/http-parser + +The default is `legacy`, unless otherwise specified when building Node.js. + +This flag exists to aid in experimentation with the internal implementation of +the Node.js http parser. +This flag is likely to become a no-op and removed at some point in the future. + ### `--icu-data-dir=file` Chooses an HTTP parser library. Available values are: diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 644dd3b15cae4e..01ec28e63ca4d9 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -601,7 +601,7 @@ changes: pr-url: https://github.com/nodejs/node/pull/13623 description: The `recvBufferSize` and `sendBufferSize` options are supported now. - - version: REPLACEME + - version: v11.4.0 pr-url: https://github.com/nodejs/node/pull/23798 description: The `ipv6Only` option is supported. --> diff --git a/doc/api/errors.md b/doc/api/errors.md index 75d0f368ca7c2d..1c16e05de84ac2 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1882,7 +1882,7 @@ Creation of a [`zlib`][] object failed due to incorrect configuration. ### HPE_HEADER_OVERFLOW diff --git a/doc/api/net.md b/doc/api/net.md index e634ef4bf30781..4243d68f879b92 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -253,7 +253,7 @@ Listening on a file descriptor is not supported on Windows. diff --git a/doc/api/readline.md b/doc/api/readline.md index 17640ae1702619..41e1da0a6aa53d 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -311,7 +311,7 @@ The `rl.write()` method will write the data to the `readline` `Interface`'s ### rl\[Symbol.asyncIterator\]() > Stability: 1 - Experimental diff --git a/doc/api/stream.md b/doc/api/stream.md index 81f3823f44c5b0..5441cb03724d05 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -465,7 +465,7 @@ See also: [`writable.cork()`][]. ##### writable.writable * {boolean} @@ -1024,7 +1024,7 @@ been emitted will return `null`. No runtime error will be raised. ##### readable.readable * {boolean} diff --git a/doc/api/tls.md b/doc/api/tls.md index 4481b1ac2c6b7a..89f0021d740111 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -651,7 +651,7 @@ certificate. #### Certificate Object @@ -1054,7 +1054,7 @@ argument.