diff --git a/.eslintignore b/.eslintignore index 1ca60626119fd3..80959ce611ee58 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ +node_modules lib/internal/v8.js lib/internal/v8_prof_polyfill.js lib/punycode.js @@ -6,8 +7,8 @@ test/es-module/test-esm-dynamic-import.js test/fixtures test/message/esm_display_syntax_error.mjs tools/icu -tools/remark-* -node_modules +tools/lint-md.js +tools/node-lint-md-cli-rollup/dist benchmark/tmp doc/**/*.js !.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 9c3a78d81cd27a..8347d066ed22ec 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -156,8 +156,13 @@ module.exports = { ], /* eslint-disable max-len */ // If this list is modified, please copy the change to lib/.eslintrc.yaml + // and test/.eslintrc.yaml. 'no-restricted-syntax': [ 'error', + { + selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.2.type='Literal']", + message: 'Do not use a literal for the third argument of assert.deepStrictEqual()' + }, { selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']", message: 'Please replace `assert.doesNotThrow()` and add a comment next to the code instead.' @@ -166,6 +171,10 @@ module.exports = { selector: "CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]", message: 'assert.rejects() must be invoked with at least two arguments.', }, + { + selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.2.type='Literal']", + message: 'Do not use a literal for the third argument of assert.strictEqual()' + }, { selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])", message: 'Use an object as second argument of assert.throws()', diff --git a/.gitignore b/.gitignore index 9d6096cf929203..d60603514c801f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ !.gitkeep !.mailmap !.nycrc -!.remarkrc !.travis.yml core @@ -114,8 +113,6 @@ tools/doc/node_modules tools/clang-format/node_modules # test artifacts -tools/remark-cli/node_modules -tools/remark-preset-lint-node/node_modules icu_config.gypi *.tap diff --git a/.mailmap b/.mailmap index 0fffffad9eaf34..f5462dbb992482 100644 --- a/.mailmap +++ b/.mailmap @@ -131,6 +131,7 @@ Gabriel de Perthuis Gareth Ellis Garwah Lam Geoffrey Bugaisky gbugaisky +Gerhard Stoebich Gibson Fahnestock Gil Pedersen Graham Fairweather Xotic750 @@ -204,6 +205,7 @@ Jérémy Lal Juan Sebastian Velez Posada Kai Sasaki Lewuathe Karl Skomski +Kat Marchán Kathy Truong k3kathy Kazuyuki Yamada Keith M Wesolowski @@ -233,10 +235,12 @@ Marti Martz Martial James Jefferson Martijn Schrage Oblosys Masato Ohba -Matheus Marchini -Matheus Marchini +Matheus Marchini +Matheus Marchini +Matheus Marchini Matt Lang matt-in-a-hat Matt Reed matthewreed26 +Matteo Collina Matthias Bastian piepmatz Mathias Buus Mathias Pettersson @@ -363,6 +367,7 @@ Tadashi SAWADA Takahiro ANDO Tarun Batra Tarun Ted Young +Teppei Sato Thomas Hunter II Thomas Lee Thomas Reggi @@ -390,7 +395,8 @@ Vladimir de Turckheim vsemozhetbyt Vse Mozhet Byt Wang Xinyong Weijia Wang <381152119@qq.com> -Weijia Wang <381152119@qq.com> starkewang +Weijia Wang <381152119@qq.com> +Weijia Wang <381152119@qq.com> Wei-Wei Wu Willi Eggeling Will Hayslett diff --git a/.remarkrc b/.remarkrc deleted file mode 100644 index 34400ece0dc648..00000000000000 --- a/.remarkrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - "./tools/remark-preset-lint-node/" - ] -} diff --git a/AUTHORS b/AUTHORS index db2e74f250823e..299800b059fe21 100644 --- a/AUTHORS +++ b/AUTHORS @@ -650,7 +650,7 @@ Micleusanu Nicu Alejandro Oviedo Garcia Ben Burns Julian Duque -teppeis +Teppei Sato Rudi Cilibrasi Tim Ruffles CGavrila @@ -754,14 +754,14 @@ Felipe Batista Rebecca Turner Tyler Anton João Reis -Kat Marchán +Kat Marchán Ryan Petschek Pierre Inglebert Ivan Yan Sangmin Yoon Mark Plomer Phillip Johnsen -Matteo Collina +Matteo Collina jomo Gireesh Punathil Lucien Greathouse @@ -1432,23 +1432,25 @@ Ahmad Nassri Tom Atkinson Tobias Nießen Joseph Gentle +Arunesh Chandra +Gabriel Schulhof +Ian Halliday +Sampson Gao +Taylor Woll Zero King Raphael Okon JR McEntee Lovell Fuller Jason Marsh Vinay Hiremath -Gabriel Schulhof alejandro dave-k Steven Uppinder Chugh Karl Cheng -Taylor Woll Tarun Batra Nao YONASHIRO Christopher Luke -Sampson Gao John Paul Bamberg Cody Deckard Fabio Campinho @@ -1488,7 +1490,7 @@ Madara Uchiha Gil Tayar Glenn Schlereth Artur G Vieira -Flarna +Gerhard Stoebich Sreepurna Jasti Rafael Fragoso Andrei Cioromila @@ -1658,6 +1660,8 @@ Piotr Mionskowski Cyril Lakech Eduard Bondarenko Adina Shanholtz +Guy Bedford +Jan Krems Miguel Martins Yury Popov George Bezerra @@ -1670,7 +1674,6 @@ Alex Gresnel <31708810+agresnel@users.noreply.github.com> Will Young Martijn Schrage Halil İbrahim Şener -Guy Bedford Antoine Amara Mani Maghsoudlou Bartek Szczepański @@ -1884,7 +1887,6 @@ Ashish Kaila c0b <14798161+c0b@users.noreply.github.com> Damian Alec Perkins -Teppei Sato Jinwoo Lee Peter Marton Erwin W. Ramadhan @@ -1982,7 +1984,7 @@ Pierre-Loic Doulcet Fran Herrero Francois KY suman-mitra -Matheus Marchini +Matheus Marchini neta Whien Chiahao Lin @@ -2154,9 +2156,7 @@ Nick Filatov Jesse Gorzinski Pieter Mees Malcolm White -Gerhard Stoebich Matei Copot -ikasumiwt Gurin, Sebastian Indranil Dasgupta Harry Sarson @@ -2187,7 +2187,6 @@ Kyle Martin Denis Fäcke Daylor Yanes Carrie Coxwell -BeniCheni Masashi Hirano Brandon Ruggles Allen Yonghuang Wang @@ -2218,6 +2217,7 @@ Abhimanyu Vashisht Sagir Khan Kael Zhang Unknown +Krzysztof Taborski Blaine Bublitz Shailesh Shekhawat Davis Okoth @@ -2236,5 +2236,86 @@ Shelley Vohr Deepjyoti Mondal Brett Kiefer Kevin Thomas +ZaneHannanAU +Fernando Doglio +Renée Kooi +Jo Colina +itaysabato +Victor Belozyorov +Joonas Rouhiainen +GauthamBanasandra +Hugo Josefson +Sam Ruby +Haroon Khan +Developer Davo +Jacek Pospychała +MaleDong +iwko +Sohail Rajdev +Niicck +Denys Otrishko +Sergey Zelenov +Travis Fischer +Dominic Farolino +Octavian Soldea +XhmikosR +AdityaSrivast +Javier Gonzalez +RidgeA +Ryuichi Sakagami +hectorcoronado +Petras <15868923+kimberlake@users.noreply.github.com> +Kevin Lacabane <5239883+klacabane@users.noreply.github.com> +Simionescu, Radu +mariotsi +prayag21 <10997858+prayag21@users.noreply.github.com> +Bruno Pinho +Anto Aravinth +Helio Frota <00hf11@gmail.com> +Tim Ruffles +Jacob Page +sagulati +conectado +Vitor Bruno de Oliveira Barth +cclauss +James Ide +MaleDong +bhavayAnand9 +Brandon Lee <40652534+brandonlwt@users.noreply.github.com> +Oryan Moshe +Michael Sommer +Eugene Y. Q. Shen +Rishabh Singh +Marco Levrero +Ouyang Yadong +yahavfuchs +Thomas Leah +Musa Hamwala +James Bromwell +Jeremy Apthorp +Eugen Cazacu <32613393+oygen87@users.noreply.github.com> +James Bromwell <943160+thw0rted@users.noreply.github.com> +Csaba Palfi +Ryan Petrich +Andreas Girgensohn +Caleb Sander +Dzmitry_Prudnikau +Ian McKellar +Jennifer Bland +Kyle Fuller +ZYSzys +Neeraj Laad +Scott Van Gilder +Yaniv Friedensohn +Lars-Magnus Skog +Lucas Woo +Troels Liebe Bentsen +pranshuchittora +lakamsani +Chris White +Ben Newman +Szymon Marczak +Tessei Kameyama +Chakravarthy S M -# Generated by tools/update-authors.sh +# Generated by tools/update-authors.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 007d9ae0579761..8287ff65ad25c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,8 @@ release. -10.10.0
+10.11.0
+10.10.0
10.9.0
10.8.0
10.7.0
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 478908c8b1d023..c073c07a7f0996 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -21,6 +21,7 @@ - [When Breaking Changes Actually Break Things](#when-breaking-changes-actually-break-things) - [Reverting commits](#reverting-commits) - [Introducing New Modules](#introducing-new-modules) + - [Additions to N-API](#additions-to-n-api) - [Deprecations](#deprecations) - [Involving the TSC](#involving-the-tsc) * [Landing Pull Requests](#landing-pull-requests) @@ -411,6 +412,18 @@ For new modules that involve significant effort, non-trivial additions to Node.js or significant new capabilities, an [Enhancement Proposal][] is recommended but not required. +### Additions to N-API + +N-API provides an ABI stable API that we will have to support in future +versions without the usual option to modify or remove existing APIs on +SemVer boundaries. Therefore, additions need to be managed carefully. + +This +[guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api.md) +outlines the requirements and principles that we should follow when +approving and landing new N-API APIs (any additions to `node_api.h` and +`node_api_types.h`). + ### Deprecations [_Deprecation_][] is "the discouragement of use of some … feature … or practice, diff --git a/LICENSE b/LICENSE index 923c20d7897801..b19517094f64db 100644 --- a/LICENSE +++ b/LICENSE @@ -1277,32 +1277,6 @@ The externally maintained libraries used by Node.js are: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -- remark-cli, located at tools/remark-cli, is licensed as follows: - """ - (The MIT License) - - Copyright (c) 2014-2016 Titus Wormer - Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) - - 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. - """ - - node-inspect, located at deps/node-inspect, is licensed as follows: """ Copyright Node.js contributors. All rights reserved. diff --git a/Makefile b/Makefile index 7f9a57804b7760..5fc2bb0c58f553 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ config.gypi $(PYTHON) tools/gyp_node.py -f make -config.gypi: configure +config.gypi: configure configure.py @if [ -x config.status ]; then \ ./config.status; \ else \ @@ -615,6 +615,13 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json)) apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) +tools/doc/node_modules: tools/doc/package.json +ifeq ($(node_use_openssl),true) + cd tools/doc && $(call available-node,$(run-npm-ci)) +else + @echo "Skipping tools/doc/node_modules (no crypto)" +endif + .PHONY: doc-only doc-only: tools/doc/node_modules \ $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary. @@ -932,8 +939,6 @@ $(TARBALL): release-only $(NODE_EXE) doc $(RM) -r $(TARNAME)/tools/osx-* $(RM) -r $(TARNAME)/tools/osx-pkg.pmdoc $(RM) -r $(TARNAME)/tools/pkgsrc - $(RM) -r $(TARNAME)/tools/remark-cli - $(RM) -r $(TARNAME)/tools/remark-preset-lint-node find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs $(RM) find $(TARNAME)/ -type l | xargs $(RM) # annoying on windows tar -cf $(TARNAME).tar $(TARNAME) @@ -1055,72 +1060,48 @@ bench-addons-clean: $(RM) -r benchmark/napi/function_call/build $(RM) -r benchmark/napi/function_args/build +.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 run build-node + .PHONY: lint-md-clean lint-md-clean: - $(RM) -r tools/remark-cli/node_modules - $(RM) -r tools/remark-preset-lint-node/node_modules + $(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 -tools/remark-cli/node_modules: tools/remark-cli/package.json - @echo "Markdown linter: installing remark-cli into tools/" - @cd tools/remark-cli && $(call available-node,$(run-npm-ci)) - -tools/remark-preset-lint-node/node_modules: \ - tools/remark-preset-lint-node/package.json - @echo "Markdown linter: installing remark-preset-lint-node into tools/" - @cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-ci)) - .PHONY: lint-md-build -lint-md-build: tools/remark-cli/node_modules \ - tools/doc/node_modules \ - tools/remark-preset-lint-node/node_modules - -tools/doc/node_modules: tools/doc/package.json -ifeq ($(node_use_openssl),true) - cd tools/doc && $(call available-node,$(run-npm-ci)) -else - @echo "Skipping tools/doc/node_modules (no crypto)" -endif - -.PHONY: lint-md -ifneq ("","$(wildcard tools/remark-cli/node_modules/)") +lint-md-build: + $(warning "Deprecated no-op target 'lint-md-build'") LINT_MD_DOC_FILES = $(shell ls doc/*.md doc/**/*.md) -run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) +run-lint-doc-md = tools/lint-md.js -q -f $(LINT_MD_DOC_FILES) # Lint all changed markdown files under doc/ tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) -ifeq ($(node_use_openssl),true) @echo "Running Markdown linter on docs..." - @$(call available-node,$(run-lint-doc-md)) - @touch $@ -else - @echo "Skipping Markdown linter on docs (no crypto)" -endif + $(call available-node,$(run-lint-doc-md)) + touch $@ LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu LINT_MD_ROOT_DOCS := $(wildcard *.md) LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ - -not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS) -run-lint-misc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_MISC_FILES) + -not -path '*node_modules*' -not -path 'test/fixtures/*' -name '*.md') \ + $(LINT_MD_ROOT_DOCS) +run-lint-misc-md = tools/lint-md.js -q -f $(LINT_MD_MISC_FILES) # Lint other changed markdown files maintained by us tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES) -ifeq ($(node_use_openssl),true) @echo "Running Markdown linter on misc docs..." - @$(call available-node,$(run-lint-misc-md)) - @touch $@ -else - @echo "Skipping Markdown linter on misc docs (no crypto)" -endif + $(call available-node,$(run-lint-misc-md)) + touch $@ tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp +.PHONY: lint-md # Lints the markdown documents maintained by us in the codebase. lint-md: | tools/.mdlintstamp -else -lint-md: - @echo "The markdown linter is not installed." - @echo "To install (requires internet access) run: $ make lint-md-build" -endif + LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools diff --git a/README.md b/README.md index 21e7d2fa2ddc44..15cbb2133351f3 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,8 @@ For more information about the governance of the Node.js project, see * [addaleax](https://github.com/addaleax) - **Anna Henningsen** <anna@addaleax.net> (she/her) +* [apapirovski](https://github.com/apapirovski) - +**Anatoli Papirovski** <apapirovski@mac.com> (he/him) * [ChALkeR](https://github.com/ChALkeR) - **Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) * [cjihrig](https://github.com/cjihrig) - @@ -247,6 +249,8 @@ For more information about the governance of the Node.js project, see **Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) * [Fishrock123](https://github.com/Fishrock123) - **Jeremiah Senkpiel** <fishrock123@rocketmail.com> +* [gabrielschulhof](https://github.com/gabrielschulhof) - +**Gabriel Schulhof** <gabriel.schulhof@intel.com> * [gibfahn](https://github.com/gibfahn) - **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) * [jasnell](https://github.com/jasnell) - @@ -329,6 +333,8 @@ For more information about the governance of the Node.js project, see **Benedikt Meurer** <benedikt.meurer@gmail.com> * [bnoordhuis](https://github.com/bnoordhuis) - **Ben Noordhuis** <info@bnoordhuis.nl> +* [boneskull](https://github.com/boneskull) - +**Christopher Hiller** <boneskull@boneskull.com> (he/him) * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <brendan.ashworth@me.com> * [BridgeAR](https://github.com/BridgeAR) - @@ -444,7 +450,7 @@ For more information about the governance of the Node.js project, see * [misterdjules](https://github.com/misterdjules) - **Julien Gilli** <jgilli@nodejs.org> * [mmarchini](https://github.com/mmarchini) - -**Matheus Marchini** <matheus@sthima.com> +**Matheus Marchini** <mat@mmarchini.me> * [MoonBall](https://github.com/MoonBall) - **Chen Gang** <gangc.cxy@foxmail.com> * [mscdex](https://github.com/mscdex) - diff --git a/common.gypi b/common.gypi index c2f4b1778a12d0..e9e05049dbb265 100644 --- a/common.gypi +++ b/common.gypi @@ -29,7 +29,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.24', + 'v8_embedder_string': '-node.28', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, @@ -148,9 +148,9 @@ 'MinimalRebuild': 'false', 'OmitFramePointers': 'false', 'BasicRuntimeChecks': 3, # /RTC1 + 'MultiProcessorCompilation': 'true', 'AdditionalOptions': [ '/bigobj', # prevent error C1128 in VS2015 - '/MP', # compile across multiple CPUs ], }, 'VCLinkerTool': { @@ -245,8 +245,8 @@ 'EnableFunctionLevelLinking': 'true', 'EnableIntrinsicFunctions': 'true', 'RuntimeTypeInfo': 'false', + 'MultiProcessorCompilation': 'true', 'AdditionalOptions': [ - '/MP', # compile across multiple CPUs ], } } @@ -259,23 +259,11 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'StringPooling': 'true', # pool string literals - 'DebugInformationFormat': 3, # Generate a PDB + 'DebugInformationFormat': 1, # /Z7 embed info in .obj files 'WarningLevel': 3, 'BufferSecurityCheck': 'true', 'ExceptionHandling': 0, # /EHsc 'SuppressStartupBanner': 'true', - # Disable warnings: - # - "C4251: class needs to have dll-interface" - # - "C4275: non-DLL-interface used as base for DLL-interface" - # Over 10k of these warnings are generated when compiling node, - # originating from v8.h. Most of them are false positives. - # See also: https://github.com/nodejs/node/pull/15570 - # TODO: re-enable when Visual Studio fixes these upstream. - # - # - "C4267: conversion from 'size_t' to 'int'" - # Many any originate from our dependencies, and their sheer number - # drowns out other, more legitimate warnings. - 'DisableSpecificWarnings': ['4251', '4275', '4267'], 'WarnAsError': 'false', }, 'VCLinkerTool': { @@ -306,7 +294,20 @@ 'SuppressStartupBanner': 'true', }, }, - 'msvs_disabled_warnings': [4351, 4355, 4800], + # Disable warnings: + # - "C4251: class needs to have dll-interface" + # - "C4275: non-DLL-interface used as base for DLL-interface" + # Over 10k of these warnings are generated when compiling node, + # originating from v8.h. Most of them are false positives. + # See also: https://github.com/nodejs/node/pull/15570 + # TODO: re-enable when Visual Studio fixes these upstream. + # + # - "C4267: conversion from 'size_t' to 'int'" + # Many any originate from our dependencies, and their sheer number + # drowns out other, more legitimate warnings. + # - "C4244: conversion from 'type1' to 'type2', possible loss of data" + # Ususaly safe. Disable for `dep`, enable for `src` + 'msvs_disabled_warnings': [4351, 4355, 4800, 4251, 4275, 4244, 4267], 'conditions': [ ['asan == 1 and OS != "mac"', { 'cflags+': [ diff --git a/configure b/configure index 332071345f4487..495d0e8848860c 100755 --- a/configure +++ b/configure @@ -25,1591 +25,4 @@ if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7): sys.stderr.write('\n') sys.exit(1) -import errno -import optparse -import os -import pipes -import pprint -import re -import shlex -import subprocess -import shutil -import string - -# If not run from node/, cd to node/. -os.chdir(os.path.dirname(__file__) or '.') - -original_argv = sys.argv[1:] - -# gcc and g++ as defaults matches what GYP's Makefile generator does, -# except on OS X. -CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') -CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'g++') - -sys.path.insert(0, os.path.join('tools', 'gyp', 'pylib')) -from gyp.common import GetFlavor - -# imports in tools/configure.d -sys.path.insert(0, os.path.join('tools', 'configure.d')) -import nodedownload - -# imports in tools/ -sys.path.insert(0, 'tools') -import getmoduleversion -from gyp_node import run_gyp - -# imports in deps/v8/tools/node -sys.path.insert(0, os.path.join('deps', 'v8', 'tools', 'node')) -from fetch_deps import FetchDeps - -# parse our options -parser = optparse.OptionParser() - -valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', - 'android', 'aix', 'cloudabi') -valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', - 'ppc64', 'x32','x64', 'x86', 'x86_64', 's390', 's390x') -valid_arm_float_abi = ('soft', 'softfp', 'hard') -valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon') -valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx') -valid_mips_fpu = ('fp32', 'fp64', 'fpxx') -valid_mips_float_abi = ('soft', 'hard') -valid_intl_modes = ('none', 'small-icu', 'full-icu', 'system-icu') - -# create option groups -shared_optgroup = optparse.OptionGroup(parser, "Shared libraries", - "Flags that allows you to control whether you want to build against " - "built-in dependencies or its shared representations. If necessary, " - "provide multiple libraries with comma.") -intl_optgroup = optparse.OptionGroup(parser, "Internationalization", - "Flags that lets you enable i18n features in Node.js as well as which " - "library you want to build against.") -http2_optgroup = optparse.OptionGroup(parser, "HTTP2", - "Flags that allows you to control HTTP2 features in Node.js") - -# Options should be in alphabetical order but keep --prefix at the top, -# that's arguably the one people will be looking for most. -parser.add_option('--prefix', - action='store', - dest='prefix', - default='/usr/local', - help='select the install prefix [default: %default]') - -parser.add_option('--coverage', - action='store_true', - dest='coverage', - help='Build node with code coverage enabled') - -parser.add_option('--debug', - action='store_true', - dest='debug', - help='also build debug build') - -parser.add_option('--dest-cpu', - action='store', - dest='dest_cpu', - choices=valid_arch, - help='CPU architecture to build for ({0})'.format(', '.join(valid_arch))) - -parser.add_option('--cross-compiling', - action='store_true', - dest='cross_compiling', - default=None, - help='force build to be considered as cross compiled') -parser.add_option('--no-cross-compiling', - action='store_false', - dest='cross_compiling', - default=None, - help='force build to be considered as NOT cross compiled') - -parser.add_option('--dest-os', - action='store', - dest='dest_os', - choices=valid_os, - help='operating system to build for ({0})'.format(', '.join(valid_os))) - -parser.add_option('--gdb', - action='store_true', - dest='gdb', - help='add gdb support') - -parser.add_option('--no-ifaddrs', - action='store_true', - dest='no_ifaddrs', - help='use on deprecated SunOS systems that do not support ifaddrs.h') - -parser.add_option("--fully-static", - action="store_true", - dest="fully_static", - help="Generate an executable without external dynamic libraries. This " - "will not work on OSX when using the default compilation environment") - -parser.add_option("--partly-static", - action="store_true", - dest="partly_static", - help="Generate an executable with libgcc and libstdc++ libraries. This " - "will not work on OSX when using the default compilation environment") - -parser.add_option("--enable-vtune-profiling", - action="store_true", - dest="enable_vtune_profiling", - help="Enable profiling support for Intel VTune profiler to profile " - "JavaScript code executed in nodejs. This feature is only available " - "for x32, x86, and x64 architectures.") - -parser.add_option("--enable-lto", - action="store_true", - dest="enable_lto", - help="Enable compiling with lto of a binary. This feature is only available " - "on linux with gcc and g++.") - -parser.add_option("--link-module", - action="append", - dest="linked_module", - help="Path to a JS file to be bundled in the binary as a builtin. " - "This module will be referenced by path without extension; " - "e.g. /root/x/y.js will be referenced via require('root/x/y'). " - "Can be used multiple times") - -parser.add_option("--openssl-no-asm", - action="store_true", - dest="openssl_no_asm", - help="Do not build optimized assembly for OpenSSL") - -parser.add_option('--openssl-fips', - action='store', - dest='openssl_fips', - help='Build OpenSSL using FIPS canister .o file in supplied folder') - -parser.add_option('--openssl-use-def-ca-store', - action='store_true', - dest='use_openssl_ca_store', - help='Use OpenSSL supplied CA store instead of compiled-in Mozilla CA copy.') - -parser.add_option('--openssl-system-ca-path', - action='store', - dest='openssl_system_ca_path', - help='Use the specified path to system CA (PEM format) in addition to ' - 'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.') - -shared_optgroup.add_option('--shared-http-parser', - action='store_true', - dest='shared_http_parser', - help='link to a shared http_parser DLL instead of static linking') - -shared_optgroup.add_option('--shared-http-parser-includes', - action='store', - dest='shared_http_parser_includes', - help='directory containing http_parser header files') - -shared_optgroup.add_option('--shared-http-parser-libname', - action='store', - dest='shared_http_parser_libname', - default='http_parser', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-http-parser-libpath', - action='store', - dest='shared_http_parser_libpath', - help='a directory to search for the shared http_parser DLL') - -shared_optgroup.add_option('--shared-libuv', - action='store_true', - dest='shared_libuv', - help='link to a shared libuv DLL instead of static linking') - -shared_optgroup.add_option('--shared-libuv-includes', - action='store', - dest='shared_libuv_includes', - help='directory containing libuv header files') - -shared_optgroup.add_option('--shared-libuv-libname', - action='store', - dest='shared_libuv_libname', - default='uv', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-libuv-libpath', - action='store', - dest='shared_libuv_libpath', - help='a directory to search for the shared libuv DLL') - -shared_optgroup.add_option('--shared-nghttp2', - action='store_true', - dest='shared_nghttp2', - help='link to a shared nghttp2 DLL instead of static linking') - -shared_optgroup.add_option('--shared-nghttp2-includes', - action='store', - dest='shared_nghttp2_includes', - help='directory containing nghttp2 header files') - -shared_optgroup.add_option('--shared-nghttp2-libname', - action='store', - dest='shared_nghttp2_libname', - default='nghttp2', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-nghttp2-libpath', - action='store', - dest='shared_nghttp2_libpath', - help='a directory to search for the shared nghttp2 DLLs') - -shared_optgroup.add_option('--shared-openssl', - action='store_true', - dest='shared_openssl', - help='link to a shared OpenSSl DLL instead of static linking') - -shared_optgroup.add_option('--shared-openssl-includes', - action='store', - dest='shared_openssl_includes', - help='directory containing OpenSSL header files') - -shared_optgroup.add_option('--shared-openssl-libname', - action='store', - dest='shared_openssl_libname', - default='crypto,ssl', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-openssl-libpath', - action='store', - dest='shared_openssl_libpath', - help='a directory to search for the shared OpenSSL DLLs') - -shared_optgroup.add_option('--shared-zlib', - action='store_true', - dest='shared_zlib', - help='link to a shared zlib DLL instead of static linking') - -shared_optgroup.add_option('--shared-zlib-includes', - action='store', - dest='shared_zlib_includes', - help='directory containing zlib header files') - -shared_optgroup.add_option('--shared-zlib-libname', - action='store', - dest='shared_zlib_libname', - default='z', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-zlib-libpath', - action='store', - dest='shared_zlib_libpath', - help='a directory to search for the shared zlib DLL') - -shared_optgroup.add_option('--shared-cares', - action='store_true', - dest='shared_libcares', - help='link to a shared cares DLL instead of static linking') - -shared_optgroup.add_option('--shared-cares-includes', - action='store', - dest='shared_libcares_includes', - help='directory containing cares header files') - -shared_optgroup.add_option('--shared-cares-libname', - action='store', - dest='shared_libcares_libname', - default='cares', - help='alternative lib name to link to [default: %default]') - -shared_optgroup.add_option('--shared-cares-libpath', - action='store', - dest='shared_libcares_libpath', - help='a directory to search for the shared cares DLL') - -parser.add_option_group(shared_optgroup) - -parser.add_option('--systemtap-includes', - action='store', - dest='systemtap_includes', - help='directory containing systemtap header files') - -parser.add_option('--tag', - action='store', - dest='tag', - help='custom build tag') - -parser.add_option('--release-urlbase', - action='store', - dest='release_urlbase', - help='Provide a custom URL prefix for the `process.release` properties ' - '`sourceUrl` and `headersUrl`. When compiling a release build, this ' - 'will default to https://nodejs.org/download/release/') - -parser.add_option('--enable-d8', - action='store_true', - dest='enable_d8', - help=optparse.SUPPRESS_HELP) # Unsupported, undocumented. - -parser.add_option('--enable-trace-maps', - action='store_true', - dest='trace_maps', - help='Enable the --trace-maps flag in V8 (use at your own risk)') - -parser.add_option('--v8-options', - action='store', - dest='v8_options', - help='v8 options to pass, see `node --v8-options` for examples.') - -parser.add_option('--with-arm-float-abi', - action='store', - dest='arm_float_abi', - choices=valid_arm_float_abi, - help='specifies which floating-point ABI to use ({0}).'.format( - ', '.join(valid_arm_float_abi))) - -parser.add_option('--with-arm-fpu', - action='store', - dest='arm_fpu', - choices=valid_arm_fpu, - help='ARM FPU mode ({0}) [default: %default]'.format( - ', '.join(valid_arm_fpu))) - -parser.add_option('--with-mips-arch-variant', - action='store', - dest='mips_arch_variant', - default='r2', - choices=valid_mips_arch, - help='MIPS arch variant ({0}) [default: %default]'.format( - ', '.join(valid_mips_arch))) - -parser.add_option('--with-mips-fpu-mode', - action='store', - dest='mips_fpu_mode', - default='fp32', - choices=valid_mips_fpu, - help='MIPS FPU mode ({0}) [default: %default]'.format( - ', '.join(valid_mips_fpu))) - -parser.add_option('--with-mips-float-abi', - action='store', - dest='mips_float_abi', - default='hard', - choices=valid_mips_float_abi, - help='MIPS floating-point ABI ({0}) [default: %default]'.format( - ', '.join(valid_mips_float_abi))) - -parser.add_option('--with-dtrace', - action='store_true', - dest='with_dtrace', - help='build with DTrace (default is true on sunos and darwin)') - -parser.add_option('--with-etw', - action='store_true', - dest='with_etw', - help='build with ETW (default is true on Windows)') - -intl_optgroup.add_option('--with-intl', - action='store', - dest='with_intl', - default='small-icu', - choices=valid_intl_modes, - help='Intl mode (valid choices: {0}) [default: %default]'.format( - ', '.join(valid_intl_modes))) - -intl_optgroup.add_option('--without-intl', - action='store_const', - dest='with_intl', - const='none', - help='Disable Intl, same as --with-intl=none (disables inspector)') - -intl_optgroup.add_option('--with-icu-path', - action='store', - dest='with_icu_path', - help='Path to icu.gyp (ICU i18n, Chromium version only.)') - -icu_default_locales='root,en' - -intl_optgroup.add_option('--with-icu-locales', - action='store', - dest='with_icu_locales', - default=icu_default_locales, - help='Comma-separated list of locales for "small-icu". "root" is assumed. ' - '[default: %default]') - -intl_optgroup.add_option('--with-icu-source', - action='store', - dest='with_icu_source', - help='Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.') - -parser.add_option('--with-ltcg', - action='store_true', - dest='with_ltcg', - help='Use Link Time Code Generation. This feature is only available on Windows.') - -parser.add_option('--with-pch', - action='store_true', - dest='with_pch', - help='Use Precompiled Headers (only available on Windows).') - -intl_optgroup.add_option('--download', - action='store', - dest='download_list', - help=nodedownload.help()) - -intl_optgroup.add_option('--download-path', - action='store', - dest='download_path', - default='deps', - help='Download directory [default: %default]') - -parser.add_option_group(intl_optgroup) - -parser.add_option('--debug-lib', - action='store_true', - dest='node_debug_lib', - help='build lib with DCHECK macros') - -http2_optgroup.add_option('--debug-nghttp2', - action='store_true', - dest='debug_nghttp2', - help='build nghttp2 with DEBUGBUILD (default is false)') - -parser.add_option_group(http2_optgroup) - -parser.add_option('--with-perfctr', - action='store_true', - dest='with_perfctr', - help='build with performance counters (default is true on Windows)') - -parser.add_option('--without-dtrace', - action='store_true', - dest='without_dtrace', - help='build without DTrace') - -parser.add_option('--without-etw', - action='store_true', - dest='without_etw', - help='build without ETW') - -parser.add_option('--without-npm', - action='store_true', - dest='without_npm', - help='do not install the bundled npm (package manager)') - -parser.add_option('--without-perfctr', - action='store_true', - dest='without_perfctr', - help='build without performance counters') - -# Dummy option for backwards compatibility -parser.add_option('--with-snapshot', - action='store_true', - dest='unused_with_snapshot', - help=optparse.SUPPRESS_HELP) - -parser.add_option('--without-snapshot', - action='store_true', - dest='without_snapshot', - help=optparse.SUPPRESS_HELP) - -parser.add_option('--code-cache-path', - action='store', - dest='code_cache_path', - help='Use a file generated by tools/generate_code_cache.js to compile the' - ' code cache for builtin modules into the binary') - -parser.add_option('--without-ssl', - action='store_true', - dest='without_ssl', - help='build without SSL (disables crypto, https, inspector, etc.)') - -parser.add_option('--without-node-options', - action='store_true', - dest='without_node_options', - help='build without NODE_OPTIONS support') - -parser.add_option('--ninja', - action='store_true', - dest='use_ninja', - help='generate build files for use with Ninja') - -parser.add_option('--enable-asan', - action='store_true', - dest='enable_asan', - help='build with asan') - -parser.add_option('--enable-static', - action='store_true', - dest='enable_static', - help='build as static library') - -parser.add_option('--no-browser-globals', - action='store_true', - dest='no_browser_globals', - help='do not export browser globals like setTimeout, console, etc. ' + - '(This mode is not officially supported for regular applications)') - -parser.add_option('--without-inspector', - action='store_true', - dest='without_inspector', - help='disable the V8 inspector protocol') - -parser.add_option('--shared', - action='store_true', - dest='shared', - help='compile shared library for embedding node in another project. ' + - '(This mode is not officially supported for regular applications)') - -parser.add_option('--without-v8-platform', - action='store_true', - dest='without_v8_platform', - default=False, - help='do not initialize v8 platform during node.js startup. ' + - '(This mode is not officially supported for regular applications)') - -parser.add_option('--without-bundled-v8', - action='store_true', - dest='without_bundled_v8', - default=False, - help='do not use V8 includes from the bundled deps folder. ' + - '(This mode is not officially supported for regular applications)') - -parser.add_option('--build-v8-with-gn', - action='store_true', - dest='build_v8_with_gn', - default=False, - help='build V8 using GN instead of gyp') - -# Create compile_commands.json in out/Debug and out/Release. -parser.add_option('-C', - action='store_true', - dest='compile_commands_json', - help=optparse.SUPPRESS_HELP) - -(options, args) = parser.parse_args() - -# Expand ~ in the install prefix now, it gets written to multiple files. -options.prefix = os.path.expanduser(options.prefix or '') - -# set up auto-download list -auto_downloads = nodedownload.parse(options.download_list) - - -def error(msg): - prefix = '\033[1m\033[31mERROR\033[0m' if os.isatty(1) else 'ERROR' - print('%s: %s' % (prefix, msg)) - sys.exit(1) - -def warn(msg): - warn.warned = True - prefix = '\033[1m\033[93mWARNING\033[0m' if os.isatty(1) else 'WARNING' - print('%s: %s' % (prefix, msg)) - -# track if warnings occurred -warn.warned = False - -def b(value): - """Returns the string 'true' if value is truthy, 'false' otherwise.""" - if value: - return 'true' - else: - return 'false' - - -def pkg_config(pkg): - pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') - retval = () - for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']: - try: - proc = subprocess.Popen( - shlex.split(pkg_config) + ['--silence-errors', flag, pkg], - stdout=subprocess.PIPE) - 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. - retval += (val,) - return retval - - -def try_check_compiler(cc, lang): - try: - proc = subprocess.Popen(shlex.split(cc) + ['-E', '-P', '-x', lang, '-'], - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - except OSError: - return (False, False, '', '') - - proc.stdin.write('__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ ' - '__clang_major__ __clang_minor__ __clang_patchlevel__') - - values = (proc.communicate()[0].split() + ['0'] * 7)[0:7] - is_clang = values[0] == '1' - gcc_version = tuple(values[1:1+3]) - clang_version = tuple(values[4:4+3]) - - return (True, is_clang, clang_version, gcc_version) - - -# -# The version of asm compiler is needed for building openssl asm files. -# See deps/openssl/openssl.gypi for detail. -# Commands and regular expressions to obtain its version number are taken from -# https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129 -# -def get_version_helper(cc, regexp): - try: - proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE, - stderr=subprocess.PIPE, stdout=subprocess.PIPE) - except OSError: - error('''No acceptable C compiler found! - - Please make sure you have a C compiler installed on your system and/or - consider adjusting the CC environment variable if you installed - it in a non-standard prefix.''') - - match = re.search(regexp, proc.communicate()[1]) - - if match: - return match.group(2) - else: - return '0' - -def get_nasm_version(asm): - try: - proc = subprocess.Popen(shlex.split(asm) + ['-v'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE, - stdout=subprocess.PIPE) - except OSError: - warn('''No acceptable ASM compiler found! - Please make sure you have installed NASM from http://www.nasm.us - and refer BUILDING.md.''') - return '0' - - match = re.match(r"NASM version ([2-9]\.[0-9][0-9]+)", - proc.communicate()[0]) - - if match: - return match.group(1) - else: - return '0' - -def get_llvm_version(cc): - return get_version_helper( - cc, r"(^(?:FreeBSD )?clang version|based on LLVM) ([3-9]\.[0-9]+)") - -def get_xcode_version(cc): - return get_version_helper( - cc, r"(^Apple LLVM version) ([0-9]+\.[0-9]+)") - -def get_gas_version(cc): - try: - custom_env = os.environ.copy() - custom_env["LC_ALL"] = "C" - proc = subprocess.Popen(shlex.split(cc) + ['-Wa,-v', '-c', '-o', - '/dev/null', '-x', - 'assembler', '/dev/null'], - stdin=subprocess.PIPE, stderr=subprocess.PIPE, - stdout=subprocess.PIPE, env=custom_env) - except OSError: - error('''No acceptable C compiler found! - - Please make sure you have a C compiler installed on your system and/or - consider adjusting the CC environment variable if you installed - it in a non-standard prefix.''') - - gas_ret = proc.communicate()[1] - match = re.match(r"GNU assembler version ([2-9]\.[0-9]+)", gas_ret) - - if match: - return match.group(1) - else: - warn('Could not recognize `gas`: ' + gas_ret) - return '0' - -# Note: Apple clang self-reports as clang 4.2.0 and gcc 4.2.1. It passes -# the version check more by accident than anything else but a more rigorous -# check involves checking the build number against a whitelist. I'm not -# quite prepared to go that far yet. -def check_compiler(o): - if sys.platform == 'win32': - if not options.openssl_no_asm: - nasm_version = get_nasm_version('nasm') - o['variables']['nasm_version'] = nasm_version - if nasm_version == 0: - o['variables']['openssl_no_asm'] = 1 - return - - ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++') - if not ok: - warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX) - elif clang_version < (3, 4, 2) if is_clang else gcc_version < (4, 9, 4): - warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX) - - ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c') - if not ok: - warn('failed to autodetect C compiler version (CC=%s)' % CC) - elif not is_clang and gcc_version < (4, 2, 0): - # clang 3.2 is a little white lie because any clang version will probably - # do for the C bits. However, we might as well encourage people to upgrade - # to a version that is not completely ancient. - warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC) - - o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0 - - # Need xcode_version or gas_version when openssl asm files are compiled. - if options.without_ssl or options.openssl_no_asm or options.shared_openssl: - return - - if is_clang: - if sys.platform == 'darwin': - o['variables']['xcode_version'] = get_xcode_version(CC) - else: - o['variables']['gas_version'] = get_gas_version(CC) - - -def cc_macros(cc=None): - """Checks predefined macros using the C compiler command.""" - - try: - p = subprocess.Popen(shlex.split(cc or CC) + ['-dM', '-E', '-'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - except OSError: - error('''No acceptable C compiler found! - - Please make sure you have a C compiler installed on your system and/or - consider adjusting the CC environment variable if you installed - it in a non-standard prefix.''') - - p.stdin.write('\n') - out = p.communicate()[0] - - out = str(out).split('\n') - - k = {} - for line in out: - lst = shlex.split(line) - if len(lst) > 2: - key = lst[1] - val = lst[2] - k[key] = val - return k - - -def is_arch_armv7(): - """Check for ARMv7 instructions""" - cc_macros_cache = cc_macros() - return cc_macros_cache.get('__ARM_ARCH') == '7' - - -def is_arch_armv6(): - """Check for ARMv6 instructions""" - cc_macros_cache = cc_macros() - return cc_macros_cache.get('__ARM_ARCH') == '6' - - -def is_arm_hard_float_abi(): - """Check for hardfloat or softfloat eabi on ARM""" - # GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify - # the Floating Point ABI used (PCS stands for Procedure Call Standard). - # We use these as well as a couple of other defines to statically determine - # what FP ABI used. - - return '__ARM_PCS_VFP' in cc_macros() - - -def host_arch_cc(): - """Host architecture check using the CC command.""" - - if sys.platform.startswith('aix'): - # we only support gcc at this point and the default on AIX - # would be xlc so hard code gcc - k = cc_macros('gcc') - else: - k = cc_macros(os.environ.get('CC_host')) - - matchup = { - '__aarch64__' : 'arm64', - '__arm__' : 'arm', - '__i386__' : 'ia32', - '__MIPSEL__' : 'mipsel', - '__mips__' : 'mips', - '__PPC64__' : 'ppc64', - '__PPC__' : 'ppc64', - '__x86_64__' : 'x64', - '__s390__' : 's390', - '__s390x__' : 's390x', - } - - rtn = 'ia32' # default - - for i in matchup: - if i in k and k[i] != '0': - rtn = matchup[i] - if rtn != 's390': - break - - if rtn == 'mipsel' and '_LP64' in k: - rtn = 'mips64el' - - return rtn - - -def host_arch_win(): - """Host architecture check using environ vars (better way to do this?)""" - - observed_arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86') - arch = os.environ.get('PROCESSOR_ARCHITEW6432', observed_arch) - - matchup = { - 'AMD64' : 'x64', - 'x86' : 'ia32', - 'arm' : 'arm', - 'mips' : 'mips', - } - - return matchup.get(arch, 'ia32') - - -def configure_arm(o): - if options.arm_float_abi: - arm_float_abi = options.arm_float_abi - elif is_arm_hard_float_abi(): - arm_float_abi = 'hard' - else: - arm_float_abi = 'default' - - arm_fpu = 'vfp' - - if is_arch_armv7(): - arm_fpu = 'vfpv3' - o['variables']['arm_version'] = '7' - else: - o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default' - - o['variables']['arm_thumb'] = 0 # -marm - o['variables']['arm_float_abi'] = arm_float_abi - - if options.dest_os == 'android': - arm_fpu = 'vfpv3' - o['variables']['arm_version'] = '7' - - o['variables']['arm_fpu'] = options.arm_fpu or arm_fpu - - -def configure_mips(o): - can_use_fpu_instructions = (options.mips_float_abi != 'soft') - o['variables']['v8_can_use_fpu_instructions'] = b(can_use_fpu_instructions) - o['variables']['v8_use_mips_abi_hardfloat'] = b(can_use_fpu_instructions) - o['variables']['mips_arch_variant'] = options.mips_arch_variant - o['variables']['mips_fpu_mode'] = options.mips_fpu_mode - - -def configure_node(o): - if options.dest_os == 'android': - o['variables']['OS'] = 'android' - o['variables']['node_prefix'] = options.prefix - o['variables']['node_install_npm'] = b(not options.without_npm) - o['default_configuration'] = 'Debug' if options.debug else 'Release' - - host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc() - target_arch = options.dest_cpu or host_arch - # ia32 is preferred by the build tools (GYP) over x86 even if we prefer the latter - # the Makefile resets this to x86 afterward - if target_arch == 'x86': - target_arch = 'ia32' - # x86_64 is common across linuxes, allow it as an alias for x64 - if target_arch == 'x86_64': - target_arch = 'x64' - o['variables']['host_arch'] = host_arch - o['variables']['target_arch'] = target_arch - o['variables']['node_byteorder'] = sys.byteorder - - cross_compiling = (options.cross_compiling - if options.cross_compiling is not None - else target_arch != host_arch) - want_snapshots = not options.without_snapshot - o['variables']['want_separate_host_toolset'] = int( - cross_compiling and want_snapshots) - - if target_arch == 'arm': - configure_arm(o) - elif target_arch in ('mips', 'mipsel', 'mips64el'): - configure_mips(o) - - if flavor == 'aix': - o['variables']['node_target_type'] = 'static_library' - - if target_arch in ('x86', 'x64', 'ia32', 'x32'): - o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) - elif options.enable_vtune_profiling: - raise Exception( - 'The VTune profiler for JavaScript is only supported on x32, x86, and x64 ' - 'architectures.') - else: - o['variables']['node_enable_v8_vtunejit'] = 'false' - - if flavor != 'linux' and (options.enable_lto): - raise Exception( - 'The lto option is supported only on linux.') - - if flavor == 'linux': - if options.enable_lto: - version_checked = (5, 4, 1) - for compiler in [(CC, 'c'), (CXX, 'c++')]: - ok, is_clang, clang_version, compiler_version = \ - try_check_compiler(compiler[0], compiler[1]) - compiler_version_num = tuple(map(int, compiler_version)) - if is_clang or compiler_version_num < version_checked: - version_checked_str = ".".join(map(str, version_checked)) - raise Exception( - 'The option --enable-lto is supported for gcc and gxx %s' - ' or newer only.' % (version_checked_str)) - - o['variables']['enable_lto'] = b(options.enable_lto) - - if flavor in ('solaris', 'mac', 'linux', 'freebsd'): - use_dtrace = not options.without_dtrace - # Don't enable by default on linux and freebsd - if flavor in ('linux', 'freebsd'): - use_dtrace = options.with_dtrace - - if flavor == 'linux': - if options.systemtap_includes: - o['include_dirs'] += [options.systemtap_includes] - o['variables']['node_use_dtrace'] = b(use_dtrace) - elif options.with_dtrace: - raise Exception( - 'DTrace is currently only supported on SunOS, MacOS or Linux systems.') - else: - o['variables']['node_use_dtrace'] = 'false' - - if options.no_ifaddrs: - o['defines'] += ['SUNOS_NO_IFADDRS'] - - # By default, enable ETW on Windows. - if flavor == 'win': - o['variables']['node_use_etw'] = b(not options.without_etw) - elif options.with_etw: - raise Exception('ETW is only supported on Windows.') - else: - o['variables']['node_use_etw'] = 'false' - - # By default, enable Performance counters on Windows. - if flavor == 'win': - o['variables']['node_use_perfctr'] = b(not options.without_perfctr) - elif options.with_perfctr: - raise Exception('Performance counter is only supported on Windows.') - else: - o['variables']['node_use_perfctr'] = 'false' - - o['variables']['node_with_ltcg'] = b(options.with_ltcg) - if flavor != 'win' and options.with_ltcg: - raise Exception('Link Time Code Generation is only supported on Windows.') - - if flavor == 'win': - o['variables']['node_use_pch'] = b(options.with_pch) - else: - o['variables']['node_use_pch'] = 'false' - - if options.tag: - o['variables']['node_tag'] = '-' + options.tag - else: - o['variables']['node_tag'] = '' - - o['variables']['node_release_urlbase'] = options.release_urlbase or '' - - if options.v8_options: - o['variables']['node_v8_options'] = options.v8_options.replace('"', '\\"') - - if options.enable_static: - o['variables']['node_target_type'] = 'static_library' - - o['variables']['node_debug_lib'] = b(options.node_debug_lib) - - if options.debug_nghttp2: - o['variables']['debug_nghttp2'] = 1 - else: - o['variables']['debug_nghttp2'] = 'false' - - o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) - if options.code_cache_path: - o['variables']['node_code_cache_path'] = options.code_cache_path - o['variables']['node_shared'] = b(options.shared) - node_module_version = getmoduleversion.get_version() - - if sys.platform == 'darwin': - shlib_suffix = '%s.dylib' - elif sys.platform.startswith('aix'): - shlib_suffix = '%s.a' - else: - shlib_suffix = 'so.%s' - - shlib_suffix %= node_module_version - o['variables']['node_module_version'] = int(node_module_version) - o['variables']['shlib_suffix'] = shlib_suffix - - if options.linked_module: - o['variables']['library_files'] = options.linked_module - - o['variables']['asan'] = int(options.enable_asan or 0) - - if options.coverage: - o['variables']['coverage'] = 'true' - else: - o['variables']['coverage'] = 'false' - - if options.shared: - o['variables']['node_target_type'] = 'shared_library' - elif options.enable_static: - o['variables']['node_target_type'] = 'static_library' - else: - o['variables']['node_target_type'] = 'executable' - -def configure_library(lib, output): - shared_lib = 'shared_' + lib - output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) - - if getattr(options, shared_lib): - (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) - - if options.__dict__[shared_lib + '_includes']: - output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] - elif pkg_cflags: - output['include_dirs'] += ( - filter(None, map(str.strip, pkg_cflags.split('-I')))) - - # libpath needs to be provided ahead libraries - if options.__dict__[shared_lib + '_libpath']: - if flavor == 'win': - if 'msvs_settings' not in output: - output['msvs_settings'] = { 'VCLinkerTool': { 'AdditionalOptions': [] } } - output['msvs_settings']['VCLinkerTool']['AdditionalOptions'] += [ - '/LIBPATH:%s' % options.__dict__[shared_lib + '_libpath']] - else: - output['libraries'] += [ - '-L%s' % options.__dict__[shared_lib + '_libpath']] - elif pkg_libpath: - output['libraries'] += [pkg_libpath] - - default_libs = getattr(options, shared_lib + '_libname') - default_libs = map('-l{0}'.format, default_libs.split(',')) - - if default_libs: - output['libraries'] += default_libs - elif pkg_libs: - output['libraries'] += pkg_libs.split() - - -def configure_v8(o): - o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0 - o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. - o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds. - o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. - o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. - o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' - o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 - o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) - o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) - o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 - o['variables']['node_enable_d8'] = b(options.enable_d8) - # Unconditionally force typed arrays to allocate outside the v8 heap. This - # is to prevent memory pointers from being moved around that are returned by - # Buffer::Data(). - o['variables']['v8_typed_array_max_size_in_heap'] = 0 - if options.enable_d8: - o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp. - if options.without_bundled_v8 and options.enable_d8: - raise Exception('--enable-d8 is incompatible with --without-bundled-v8.') - if options.without_bundled_v8 and options.build_v8_with_gn: - raise Exception( - '--build-v8-with-gn is incompatible with --without-bundled-v8.') - if options.build_v8_with_gn: - v8_path = os.path.join('deps', 'v8') - print('Fetching dependencies to build V8 with GN') - options.build_v8_with_gn = FetchDeps(v8_path) - o['variables']['build_v8_with_gn'] = b(options.build_v8_with_gn) - - -def configure_openssl(o): - variables = o['variables'] - variables['node_use_openssl'] = b(not options.without_ssl) - variables['node_shared_openssl'] = b(options.shared_openssl) - variables['openssl_no_asm'] = 1 if options.openssl_no_asm else 0 - variables['openssl_fips'] = '' - - if options.without_ssl: - def without_ssl_error(option): - error('--without-ssl is incompatible with %s' % option) - if options.shared_openssl: - without_ssl_error('--shared-openssl') - if options.openssl_no_asm: - without_ssl_error('--openssl-no-asm') - if options.openssl_fips: - without_ssl_error('--openssl-fips') - return - - if options.use_openssl_ca_store: - o['defines'] += ['NODE_OPENSSL_CERT_STORE'] - if options.openssl_system_ca_path: - variables['openssl_system_ca_path'] = options.openssl_system_ca_path - variables['node_without_node_options'] = b(options.without_node_options) - if options.without_node_options: - o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] - - if not options.shared_openssl and not options.openssl_no_asm: - is_x86 = 'x64' in variables['target_arch'] or 'ia32' in variables['target_arch'] - - # supported asm compiler for AVX2. See https://github.com/openssl/openssl/ - # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69 - openssl110_asm_supported = \ - ('gas_version' in variables and float(variables['gas_version']) >= 2.23) or \ - ('xcode_version' in variables and float(variables['xcode_version']) >= 5.0) or \ - ('llvm_version' in variables and float(variables['llvm_version']) >= 3.3) or \ - ('nasm_version' in variables and float(variables['nasm_version']) >= 2.10) - - if is_x86 and not openssl110_asm_supported: - error('''Did not find a new enough assembler, install one or build with - --openssl-no-asm. - Please refer to BUILDING.md''') - - elif options.openssl_no_asm: - warn('''--openssl-no-asm will result in binaries that do not take advantage - of modern CPU cryptographic instructions and will therefore be slower. - Please refer to BUILDING.md''') - - if options.openssl_no_asm and options.shared_openssl: - error('--openssl-no-asm is incompatible with --shared-openssl') - - if options.openssl_fips: - error('FIPS is not supported in this version of Node.js') - - configure_library('openssl', o) - - -def configure_static(o): - if options.fully_static or options.partly_static: - if flavor == 'mac': - print("Generation of static executable will not work on OSX " - "when using the default compilation environment") - return - - if options.fully_static: - o['libraries'] += ['-static'] - elif options.partly_static: - o['libraries'] += ['-static-libgcc', '-static-libstdc++'] - if options.enable_asan: - o['libraries'] += ['-static-libasan'] - - -def write(filename, data): - filename = filename - print('creating %s' % filename) - f = open(filename, 'w+') - f.write(data) - -do_not_edit = '# Do not edit. Generated by the configure script.\n' - -def glob_to_var(dir_base, dir_sub, patch_dir): - list = [] - dir_all = '%s/%s' % (dir_base, dir_sub) - files = os.walk(dir_all) - for ent in files: - (path, dirs, files) = ent - for file in files: - if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'): - # srcfile uses "slash" as dir separator as its output is consumed by gyp - srcfile = '%s/%s' % (dir_sub, file) - if patch_dir: - patchfile = '%s/%s/%s' % (dir_base, patch_dir, file) - if os.path.isfile(patchfile): - srcfile = '%s/%s' % (patch_dir, file) - print('Using version-specific floating patch %s' % patchfile) - list.append(srcfile) - break - return list - -def configure_intl(o): - icus = [ - { - 'url': 'https://sourceforge.net/projects/icu/files/ICU4C/62.1/icu4c-62_1-src.zip', - 'md5': '408854f7b9b58311b68fab4b4dfc80be', - }, - ] - def icu_download(path): - # download ICU, if needed - if not os.access(options.download_path, os.W_OK): - error('''Cannot write to desired download path. - Either create it or verify permissions.''') - for icu in icus: - url = icu['url'] - md5 = icu['md5'] - local = url.split('/')[-1] - targetfile = os.path.join(options.download_path, local) - if not os.path.isfile(targetfile): - if nodedownload.candownload(auto_downloads, "icu"): - nodedownload.retrievefile(url, targetfile) - else: - print('Re-using existing %s' % targetfile) - if os.path.isfile(targetfile): - print('Checking file integrity with MD5:\r') - gotmd5 = nodedownload.md5sum(targetfile) - print('MD5: %s %s' % (gotmd5, targetfile)) - if (md5 == gotmd5): - return targetfile - else: - print('Expected: %s *MISMATCH*' % md5) - print('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile) - return None - icu_config = { - 'variables': {} - } - icu_config_name = 'icu_config.gypi' - def write_config(data, name): - return - - # write an empty file to start with - write(icu_config_name, do_not_edit + - pprint.pformat(icu_config, indent=2) + '\n') - - # always set icu_small, node.gyp depends on it being defined. - o['variables']['icu_small'] = b(False) - - with_intl = options.with_intl - with_icu_source = options.with_icu_source - have_icu_path = bool(options.with_icu_path) - if have_icu_path and with_intl != 'none': - error('Cannot specify both --with-icu-path and --with-intl') - elif have_icu_path: - # Chromium .gyp mode: --with-icu-path - o['variables']['v8_enable_i18n_support'] = 1 - # use the .gyp given - o['variables']['icu_gyp_path'] = options.with_icu_path - return - # --with-intl= - # set the default - if with_intl in (None, 'none'): - o['variables']['v8_enable_i18n_support'] = 0 - return # no Intl - elif with_intl == 'small-icu': - # small ICU (English only) - o['variables']['v8_enable_i18n_support'] = 1 - o['variables']['icu_small'] = b(True) - locs = set(options.with_icu_locales.split(',')) - locs.add('root') # must have root - o['variables']['icu_locales'] = string.join(locs,',') - # We will check a bit later if we can use the canned deps/icu-small - elif with_intl == 'full-icu': - # full ICU - o['variables']['v8_enable_i18n_support'] = 1 - elif with_intl == 'system-icu': - # ICU from pkg-config. - o['variables']['v8_enable_i18n_support'] = 1 - pkgicu = pkg_config('icu-i18n') - 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 - # libpath provides linker path which may contain spaces - if libpath: - o['libraries'] += [libpath] - # safe to split, cannot contain spaces - o['libraries'] += libs.split() - if cflags: - o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I'))) - # use the "system" .gyp - o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp' - return - - # this is just the 'deps' dir. Used for unpacking. - icu_parent_path = 'deps' - - # The full path to the ICU source directory. Should not include './'. - icu_full_path = 'deps/icu' - - # icu-tmp is used to download and unpack the ICU tarball. - icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp') - - # canned ICU. see tools/icu/README.md to update. - canned_icu_dir = 'deps/icu-small' - - # We can use 'deps/icu-small' - pre-canned ICU *iff* - # - with_intl == small-icu (the default!) - # - with_icu_locales == 'root,en' (the default!) - # - deps/icu-small exists! - # - with_icu_source is unset (i.e. no other ICU was specified) - # (Note that this is the *DEFAULT CASE*.) - # - # This is *roughly* equivalent to - # $ configure --with-intl=small-icu --with-icu-source=deps/icu-small - # .. Except that we avoid copying icu-small over to deps/icu. - # In this default case, deps/icu is ignored, although make clean will - # still harmlessly remove deps/icu. - - # are we using default locales? - using_default_locales = ( options.with_icu_locales == icu_default_locales ) - - # make sure the canned ICU really exists - canned_icu_available = os.path.isdir(canned_icu_dir) - - if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available: - # OK- we can use the canned ICU. - icu_config['variables']['icu_small_canned'] = 1 - icu_full_path = canned_icu_dir - - # --with-icu-source processing - # now, check that they didn't pass --with-icu-source=deps/icu - elif with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source): - print('Ignoring redundant --with-icu-source=%s' % with_icu_source) - with_icu_source = None - # if with_icu_source is still set, try to use it. - if with_icu_source: - if os.path.isdir(icu_full_path): - print('Deleting old ICU source: %s' % icu_full_path) - shutil.rmtree(icu_full_path) - # now, what path was given? - if os.path.isdir(with_icu_source): - # it's a path. Copy it. - print('%s -> %s' % (with_icu_source, icu_full_path)) - shutil.copytree(with_icu_source, icu_full_path) - else: - # could be file or URL. - # Set up temporary area - if os.path.isdir(icu_tmp_path): - shutil.rmtree(icu_tmp_path) - os.mkdir(icu_tmp_path) - icu_tarball = None - if os.path.isfile(with_icu_source): - # it's a file. Try to unpack it. - icu_tarball = with_icu_source - else: - # Can we download it? - local = os.path.join(icu_tmp_path, with_icu_source.split('/')[-1]) # local part - icu_tarball = nodedownload.retrievefile(with_icu_source, local) - # continue with "icu_tarball" - nodedownload.unpack(icu_tarball, icu_tmp_path) - # Did it unpack correctly? Should contain 'icu' - tmp_icu = os.path.join(icu_tmp_path, 'icu') - if os.path.isdir(tmp_icu): - os.rename(tmp_icu, icu_full_path) - shutil.rmtree(icu_tmp_path) - else: - shutil.rmtree(icu_tmp_path) - error('--with-icu-source=%s did not result in an "icu" dir.' % \ - with_icu_source) - - # ICU mode. (icu-generic.gyp) - o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp' - # ICU source dir relative to tools/icu (for .gyp file) - o['variables']['icu_path'] = icu_full_path - if not os.path.isdir(icu_full_path): - print('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path) - # can we download (or find) a zipfile? - localzip = icu_download(icu_full_path) - if localzip: - nodedownload.unpack(localzip, icu_parent_path) - if not os.path.isdir(icu_full_path): - error('''Cannot build Intl without ICU in %s. - Fix, or disable with "--with-intl=none"''' % icu_full_path) - else: - print('* Using ICU in %s' % icu_full_path) - # Now, what version of ICU is it? We just need the "major", such as 54. - # uvernum.h contains it as a #define. - uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h') - if not os.path.isfile(uvernum_h): - error('Could not load %s - is ICU installed?' % uvernum_h) - icu_ver_major = None - matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*' - match_version = re.compile(matchVerExp) - for line in open(uvernum_h).readlines(): - m = match_version.match(line) - if m: - icu_ver_major = m.group(1) - if not icu_ver_major: - error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) - icu_endianness = sys.byteorder[0]; - o['variables']['icu_ver_major'] = icu_ver_major - o['variables']['icu_endianness'] = icu_endianness - icu_data_file_l = 'icudt%s%s.dat' % (icu_ver_major, 'l') - icu_data_file = 'icudt%s%s.dat' % (icu_ver_major, icu_endianness) - # relative to configure - icu_data_path = os.path.join(icu_full_path, - 'source/data/in', - icu_data_file_l) - # relative to dep.. - icu_data_in = os.path.join('..','..', icu_full_path, 'source/data/in', icu_data_file_l) - if not os.path.isfile(icu_data_path) and icu_endianness != 'l': - # use host endianness - icu_data_path = os.path.join(icu_full_path, - 'source/data/in', - icu_data_file) - # relative to dep.. - icu_data_in = os.path.join('..', icu_full_path, 'source/data/in', - icu_data_file) - # this is the input '.dat' file to use .. icudt*.dat - # may be little-endian if from a icu-project.org tarball - o['variables']['icu_data_in'] = icu_data_in - if not os.path.isfile(icu_data_path): - # .. and we're not about to build it from .gyp! - error('''ICU prebuilt data file %s does not exist. - See the README.md.''' % icu_data_path) - # map from variable name to subdirs - icu_src = { - 'stubdata': 'stubdata', - 'common': 'common', - 'i18n': 'i18n', - 'tools': 'tools/toolutil', - 'genccode': 'tools/genccode', - 'genrb': 'tools/genrb', - 'icupkg': 'tools/icupkg', - } - # this creates a variable icu_src_XXX for each of the subdirs - # with a list of the src files to use - for i in icu_src: - var = 'icu_src_%s' % i - path = '../../%s/source/%s' % (icu_full_path, icu_src[i]) - icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) ) - # write updated icu_config.gypi with a bunch of paths - write(icu_config_name, do_not_edit + - pprint.pformat(icu_config, indent=2) + '\n') - return # end of configure_intl - -def configure_inspector(o): - disable_inspector = (options.without_inspector or - options.with_intl in (None, 'none') or - options.without_ssl) - o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1 - - -def make_bin_override(): - if sys.platform == 'win32': - raise Exception('make_bin_override should not be called on win32.') - # If the system python is not the python we are running (which should be - # python 2), then create a directory with a symlink called `python` to our - # sys.executable. This directory will be prefixed to the PATH, so that - # other tools that shell out to `python` will use the appropriate python - - which_python = which('python') - if (which_python and - os.path.realpath(which_python) == os.path.realpath(sys.executable)): - return - - bin_override = os.path.abspath('out/tools/bin') - try: - os.makedirs(bin_override) - except OSError as e: - if e.errno != errno.EEXIST: raise e - - python_link = os.path.join(bin_override, 'python') - try: - os.unlink(python_link) - except OSError as e: - if e.errno != errno.ENOENT: raise e - os.symlink(sys.executable, python_link) - - # We need to set the environment right now so that when gyp (in run_gyp) - # shells out, it finds the right python (specifically at - # https://github.com/nodejs/node/blob/d82e107/deps/v8/gypfiles/toolchain.gypi#L43) - os.environ['PATH'] = bin_override + ':' + os.environ['PATH'] - - return bin_override - -output = { - 'variables': {}, - 'include_dirs': [], - 'libraries': [], - 'defines': [], - 'cflags': [], -} - -# Print a warning when the compiler is too old. -check_compiler(output) - -# determine the "flavor" (operating system) we're building for, -# leveraging gyp's GetFlavor function -flavor_params = {} -if (options.dest_os): - flavor_params['flavor'] = options.dest_os -flavor = GetFlavor(flavor_params) - -configure_node(output) -configure_library('zlib', output) -configure_library('http_parser', output) -configure_library('libuv', output) -configure_library('libcares', output) -configure_library('nghttp2', output) -# stay backwards compatible with shared cares builds -output['variables']['node_shared_cares'] = \ - output['variables'].pop('node_shared_libcares') -configure_v8(output) -configure_openssl(output) -configure_intl(output) -configure_static(output) -configure_inspector(output) - -# variables should be a root level element, -# move everything else to target_defaults -variables = output['variables'] -del output['variables'] - -# make_global_settings for special FIPS linking -# should not be used to compile modules in node-gyp -config_fips = { 'make_global_settings' : [] } -if 'make_fips_settings' in output: - config_fips['make_global_settings'] = output['make_fips_settings'] - del output['make_fips_settings'] - write('config_fips.gypi', do_not_edit + - pprint.pformat(config_fips, indent=2) + '\n') - -# make_global_settings should be a root level element too -if 'make_global_settings' in output: - make_global_settings = output['make_global_settings'] - del output['make_global_settings'] -else: - make_global_settings = False - -output = { - 'variables': variables, - 'target_defaults': output, -} -if make_global_settings: - output['make_global_settings'] = make_global_settings - -pprint.pprint(output, indent=2) - -write('config.gypi', do_not_edit + - pprint.pformat(output, indent=2) + '\n') - -write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + - ' '.join([pipes.quote(arg) for arg in original_argv]) + '\n') -os.chmod('config.status', 0o775) - -config = { - 'BUILDTYPE': 'Debug' if options.debug else 'Release', - 'PYTHON': sys.executable, - 'NODE_TARGET_TYPE': variables['node_target_type'], -} - -if options.prefix: - config['PREFIX'] = options.prefix - -config = '\n'.join(map('='.join, config.iteritems())) + '\n' - -# On Windows there's no reason to search for a different python binary. -bin_override = None if sys.platform == 'win32' else make_bin_override() -if bin_override: - config = 'export PATH:=' + bin_override + ':$(PATH)\n' + config - -write('config.mk', do_not_edit + config) - -gyp_args = ['--no-parallel'] - -if options.use_ninja: - gyp_args += ['-f', 'ninja'] -elif flavor == 'win' and sys.platform != 'msys': - gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] -else: - gyp_args += ['-f', 'make-' + flavor] - -if options.compile_commands_json: - gyp_args += ['-f', 'compile_commands_json'] - -gyp_args += args - -if warn.warned: - warn('warnings were emitted in the configure phase') - -run_gyp(gyp_args) +import configure diff --git a/configure.py b/configure.py new file mode 100755 index 00000000000000..11f7bad38a3d7f --- /dev/null +++ b/configure.py @@ -0,0 +1,1606 @@ +import sys +import errno +import optparse +import os +import pipes +import pprint +import re +import shlex +import subprocess +import shutil +import string +from distutils.spawn import find_executable as which + +# If not run from node/, cd to node/. +os.chdir(os.path.dirname(__file__) or '.') + +original_argv = sys.argv[1:] + +# gcc and g++ as defaults matches what GYP's Makefile generator does, +# except on OS X. +CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') +CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'g++') + +sys.path.insert(0, os.path.join('tools', 'gyp', 'pylib')) +from gyp.common import GetFlavor + +# imports in tools/configure.d +sys.path.insert(0, os.path.join('tools', 'configure.d')) +import nodedownload + +# imports in tools/ +sys.path.insert(0, 'tools') +import getmoduleversion +from gyp_node import run_gyp + +# imports in deps/v8/tools/node +sys.path.insert(0, os.path.join('deps', 'v8', 'tools', 'node')) +from fetch_deps import FetchDeps + +# parse our options +parser = optparse.OptionParser() + +valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', + 'android', 'aix', 'cloudabi') +valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', + 'ppc64', 'x32','x64', 'x86', 'x86_64', 's390', 's390x') +valid_arm_float_abi = ('soft', 'softfp', 'hard') +valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon') +valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx') +valid_mips_fpu = ('fp32', 'fp64', 'fpxx') +valid_mips_float_abi = ('soft', 'hard') +valid_intl_modes = ('none', 'small-icu', 'full-icu', 'system-icu') + +# create option groups +shared_optgroup = optparse.OptionGroup(parser, "Shared libraries", + "Flags that allows you to control whether you want to build against " + "built-in dependencies or its shared representations. If necessary, " + "provide multiple libraries with comma.") +intl_optgroup = optparse.OptionGroup(parser, "Internationalization", + "Flags that lets you enable i18n features in Node.js as well as which " + "library you want to build against.") +http2_optgroup = optparse.OptionGroup(parser, "HTTP2", + "Flags that allows you to control HTTP2 features in Node.js") + +# Options should be in alphabetical order but keep --prefix at the top, +# that's arguably the one people will be looking for most. +parser.add_option('--prefix', + action='store', + dest='prefix', + default='/usr/local', + help='select the install prefix [default: %default]') + +parser.add_option('--coverage', + action='store_true', + dest='coverage', + help='Build node with code coverage enabled') + +parser.add_option('--debug', + action='store_true', + dest='debug', + help='also build debug build') + +parser.add_option('--dest-cpu', + action='store', + dest='dest_cpu', + choices=valid_arch, + help='CPU architecture to build for ({0})'.format(', '.join(valid_arch))) + +parser.add_option('--cross-compiling', + action='store_true', + dest='cross_compiling', + default=None, + help='force build to be considered as cross compiled') +parser.add_option('--no-cross-compiling', + action='store_false', + dest='cross_compiling', + default=None, + help='force build to be considered as NOT cross compiled') + +parser.add_option('--dest-os', + action='store', + dest='dest_os', + choices=valid_os, + help='operating system to build for ({0})'.format(', '.join(valid_os))) + +parser.add_option('--gdb', + action='store_true', + dest='gdb', + help='add gdb support') + +parser.add_option('--no-ifaddrs', + action='store_true', + dest='no_ifaddrs', + help='use on deprecated SunOS systems that do not support ifaddrs.h') + +parser.add_option("--fully-static", + action="store_true", + dest="fully_static", + help="Generate an executable without external dynamic libraries. This " + "will not work on OSX when using the default compilation environment") + +parser.add_option("--partly-static", + action="store_true", + dest="partly_static", + help="Generate an executable with libgcc and libstdc++ libraries. This " + "will not work on OSX when using the default compilation environment") + +parser.add_option("--enable-vtune-profiling", + action="store_true", + dest="enable_vtune_profiling", + help="Enable profiling support for Intel VTune profiler to profile " + "JavaScript code executed in nodejs. This feature is only available " + "for x32, x86, and x64 architectures.") + +parser.add_option("--enable-lto", + action="store_true", + dest="enable_lto", + help="Enable compiling with lto of a binary. This feature is only available " + "on linux with gcc and g++.") + +parser.add_option("--link-module", + action="append", + dest="linked_module", + help="Path to a JS file to be bundled in the binary as a builtin. " + "This module will be referenced by path without extension; " + "e.g. /root/x/y.js will be referenced via require('root/x/y'). " + "Can be used multiple times") + +parser.add_option("--openssl-no-asm", + action="store_true", + dest="openssl_no_asm", + help="Do not build optimized assembly for OpenSSL") + +parser.add_option('--openssl-fips', + action='store', + dest='openssl_fips', + help='Build OpenSSL using FIPS canister .o file in supplied folder') + +parser.add_option('--openssl-use-def-ca-store', + action='store_true', + dest='use_openssl_ca_store', + help='Use OpenSSL supplied CA store instead of compiled-in Mozilla CA copy.') + +parser.add_option('--openssl-system-ca-path', + action='store', + dest='openssl_system_ca_path', + help='Use the specified path to system CA (PEM format) in addition to ' + 'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.') + +shared_optgroup.add_option('--shared-http-parser', + action='store_true', + dest='shared_http_parser', + help='link to a shared http_parser DLL instead of static linking') + +shared_optgroup.add_option('--shared-http-parser-includes', + action='store', + dest='shared_http_parser_includes', + help='directory containing http_parser header files') + +shared_optgroup.add_option('--shared-http-parser-libname', + action='store', + dest='shared_http_parser_libname', + default='http_parser', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-http-parser-libpath', + action='store', + dest='shared_http_parser_libpath', + help='a directory to search for the shared http_parser DLL') + +shared_optgroup.add_option('--shared-libuv', + action='store_true', + dest='shared_libuv', + help='link to a shared libuv DLL instead of static linking') + +shared_optgroup.add_option('--shared-libuv-includes', + action='store', + dest='shared_libuv_includes', + help='directory containing libuv header files') + +shared_optgroup.add_option('--shared-libuv-libname', + action='store', + dest='shared_libuv_libname', + default='uv', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-libuv-libpath', + action='store', + dest='shared_libuv_libpath', + help='a directory to search for the shared libuv DLL') + +shared_optgroup.add_option('--shared-nghttp2', + action='store_true', + dest='shared_nghttp2', + help='link to a shared nghttp2 DLL instead of static linking') + +shared_optgroup.add_option('--shared-nghttp2-includes', + action='store', + dest='shared_nghttp2_includes', + help='directory containing nghttp2 header files') + +shared_optgroup.add_option('--shared-nghttp2-libname', + action='store', + dest='shared_nghttp2_libname', + default='nghttp2', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-nghttp2-libpath', + action='store', + dest='shared_nghttp2_libpath', + help='a directory to search for the shared nghttp2 DLLs') + +shared_optgroup.add_option('--shared-openssl', + action='store_true', + dest='shared_openssl', + help='link to a shared OpenSSl DLL instead of static linking') + +shared_optgroup.add_option('--shared-openssl-includes', + action='store', + dest='shared_openssl_includes', + help='directory containing OpenSSL header files') + +shared_optgroup.add_option('--shared-openssl-libname', + action='store', + dest='shared_openssl_libname', + default='crypto,ssl', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-openssl-libpath', + action='store', + dest='shared_openssl_libpath', + help='a directory to search for the shared OpenSSL DLLs') + +shared_optgroup.add_option('--shared-zlib', + action='store_true', + dest='shared_zlib', + help='link to a shared zlib DLL instead of static linking') + +shared_optgroup.add_option('--shared-zlib-includes', + action='store', + dest='shared_zlib_includes', + help='directory containing zlib header files') + +shared_optgroup.add_option('--shared-zlib-libname', + action='store', + dest='shared_zlib_libname', + default='z', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-zlib-libpath', + action='store', + dest='shared_zlib_libpath', + help='a directory to search for the shared zlib DLL') + +shared_optgroup.add_option('--shared-cares', + action='store_true', + dest='shared_libcares', + help='link to a shared cares DLL instead of static linking') + +shared_optgroup.add_option('--shared-cares-includes', + action='store', + dest='shared_libcares_includes', + help='directory containing cares header files') + +shared_optgroup.add_option('--shared-cares-libname', + action='store', + dest='shared_libcares_libname', + default='cares', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-cares-libpath', + action='store', + dest='shared_libcares_libpath', + help='a directory to search for the shared cares DLL') + +parser.add_option_group(shared_optgroup) + +parser.add_option('--systemtap-includes', + action='store', + dest='systemtap_includes', + help='directory containing systemtap header files') + +parser.add_option('--tag', + action='store', + dest='tag', + help='custom build tag') + +parser.add_option('--release-urlbase', + action='store', + dest='release_urlbase', + help='Provide a custom URL prefix for the `process.release` properties ' + '`sourceUrl` and `headersUrl`. When compiling a release build, this ' + 'will default to https://nodejs.org/download/release/') + +parser.add_option('--enable-d8', + action='store_true', + dest='enable_d8', + help=optparse.SUPPRESS_HELP) # Unsupported, undocumented. + +parser.add_option('--enable-trace-maps', + action='store_true', + dest='trace_maps', + help='Enable the --trace-maps flag in V8 (use at your own risk)') + +parser.add_option('--v8-options', + action='store', + dest='v8_options', + help='v8 options to pass, see `node --v8-options` for examples.') + +parser.add_option('--with-arm-float-abi', + action='store', + dest='arm_float_abi', + choices=valid_arm_float_abi, + help='specifies which floating-point ABI to use ({0}).'.format( + ', '.join(valid_arm_float_abi))) + +parser.add_option('--with-arm-fpu', + action='store', + dest='arm_fpu', + choices=valid_arm_fpu, + help='ARM FPU mode ({0}) [default: %default]'.format( + ', '.join(valid_arm_fpu))) + +parser.add_option('--with-mips-arch-variant', + action='store', + dest='mips_arch_variant', + default='r2', + choices=valid_mips_arch, + help='MIPS arch variant ({0}) [default: %default]'.format( + ', '.join(valid_mips_arch))) + +parser.add_option('--with-mips-fpu-mode', + action='store', + dest='mips_fpu_mode', + default='fp32', + choices=valid_mips_fpu, + help='MIPS FPU mode ({0}) [default: %default]'.format( + ', '.join(valid_mips_fpu))) + +parser.add_option('--with-mips-float-abi', + action='store', + dest='mips_float_abi', + default='hard', + choices=valid_mips_float_abi, + help='MIPS floating-point ABI ({0}) [default: %default]'.format( + ', '.join(valid_mips_float_abi))) + +parser.add_option('--with-dtrace', + action='store_true', + dest='with_dtrace', + help='build with DTrace (default is true on sunos and darwin)') + +parser.add_option('--with-etw', + action='store_true', + dest='with_etw', + help='build with ETW (default is true on Windows)') + +intl_optgroup.add_option('--with-intl', + action='store', + dest='with_intl', + default='small-icu', + choices=valid_intl_modes, + help='Intl mode (valid choices: {0}) [default: %default]'.format( + ', '.join(valid_intl_modes))) + +intl_optgroup.add_option('--without-intl', + action='store_const', + dest='with_intl', + const='none', + help='Disable Intl, same as --with-intl=none (disables inspector)') + +intl_optgroup.add_option('--with-icu-path', + action='store', + dest='with_icu_path', + help='Path to icu.gyp (ICU i18n, Chromium version only.)') + +icu_default_locales='root,en' + +intl_optgroup.add_option('--with-icu-locales', + action='store', + dest='with_icu_locales', + default=icu_default_locales, + help='Comma-separated list of locales for "small-icu". "root" is assumed. ' + '[default: %default]') + +intl_optgroup.add_option('--with-icu-source', + action='store', + dest='with_icu_source', + help='Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.') + +parser.add_option('--with-ltcg', + action='store_true', + dest='with_ltcg', + help='Use Link Time Code Generation. This feature is only available on Windows.') + +parser.add_option('--with-pch', + action='store_true', + dest='with_pch', + help='Use Precompiled Headers (only available on Windows).') + +intl_optgroup.add_option('--download', + action='store', + dest='download_list', + help=nodedownload.help()) + +intl_optgroup.add_option('--download-path', + action='store', + dest='download_path', + default='deps', + help='Download directory [default: %default]') + +parser.add_option_group(intl_optgroup) + +parser.add_option('--debug-lib', + action='store_true', + dest='node_debug_lib', + help='build lib with DCHECK macros') + +http2_optgroup.add_option('--debug-nghttp2', + action='store_true', + dest='debug_nghttp2', + help='build nghttp2 with DEBUGBUILD (default is false)') + +parser.add_option_group(http2_optgroup) + +parser.add_option('--with-perfctr', + action='store_true', + dest='with_perfctr', + help='build with performance counters (default is true on Windows)') + +parser.add_option('--without-dtrace', + action='store_true', + dest='without_dtrace', + help='build without DTrace') + +parser.add_option('--without-etw', + action='store_true', + dest='without_etw', + help='build without ETW') + +parser.add_option('--without-npm', + action='store_true', + dest='without_npm', + help='do not install the bundled npm (package manager)') + +parser.add_option('--without-perfctr', + action='store_true', + dest='without_perfctr', + help='build without performance counters') + +# Dummy option for backwards compatibility +parser.add_option('--with-snapshot', + action='store_true', + dest='unused_with_snapshot', + help=optparse.SUPPRESS_HELP) + +parser.add_option('--without-snapshot', + action='store_true', + dest='without_snapshot', + help=optparse.SUPPRESS_HELP) + +parser.add_option('--code-cache-path', + action='store', + dest='code_cache_path', + help='Use a file generated by tools/generate_code_cache.js to compile the' + ' code cache for builtin modules into the binary') + +parser.add_option('--without-ssl', + action='store_true', + dest='without_ssl', + help='build without SSL (disables crypto, https, inspector, etc.)') + +parser.add_option('--without-node-options', + action='store_true', + dest='without_node_options', + help='build without NODE_OPTIONS support') + +parser.add_option('--ninja', + action='store_true', + dest='use_ninja', + help='generate build files for use with Ninja') + +parser.add_option('--enable-asan', + action='store_true', + dest='enable_asan', + help='build with asan') + +parser.add_option('--enable-static', + action='store_true', + dest='enable_static', + help='build as static library') + +parser.add_option('--no-browser-globals', + action='store_true', + dest='no_browser_globals', + help='do not export browser globals like setTimeout, console, etc. ' + + '(This mode is not officially supported for regular applications)') + +parser.add_option('--without-inspector', + action='store_true', + dest='without_inspector', + help='disable the V8 inspector protocol') + +parser.add_option('--shared', + action='store_true', + dest='shared', + help='compile shared library for embedding node in another project. ' + + '(This mode is not officially supported for regular applications)') + +parser.add_option('--without-v8-platform', + action='store_true', + dest='without_v8_platform', + default=False, + help='do not initialize v8 platform during node.js startup. ' + + '(This mode is not officially supported for regular applications)') + +parser.add_option('--without-bundled-v8', + action='store_true', + dest='without_bundled_v8', + default=False, + help='do not use V8 includes from the bundled deps folder. ' + + '(This mode is not officially supported for regular applications)') + +parser.add_option('--build-v8-with-gn', + action='store_true', + dest='build_v8_with_gn', + default=False, + help='build V8 using GN instead of gyp') + +parser.add_option('--verbose', + action='store_true', + dest='verbose', + default=False, + help='get more output from this script') + +# Create compile_commands.json in out/Debug and out/Release. +parser.add_option('-C', + action='store_true', + dest='compile_commands_json', + help=optparse.SUPPRESS_HELP) + +(options, args) = parser.parse_args() + +# Expand ~ in the install prefix now, it gets written to multiple files. +options.prefix = os.path.expanduser(options.prefix or '') + +# set up auto-download list +auto_downloads = nodedownload.parse(options.download_list) + + +def error(msg): + prefix = '\033[1m\033[31mERROR\033[0m' if os.isatty(1) else 'ERROR' + print('%s: %s' % (prefix, msg)) + sys.exit(1) + +def warn(msg): + warn.warned = True + prefix = '\033[1m\033[93mWARNING\033[0m' if os.isatty(1) else 'WARNING' + print('%s: %s' % (prefix, msg)) + +# track if warnings occurred +warn.warned = False + +def print_verbose(x): + if not options.verbose: + return + if type(x) is str: + print x + else: + pprint.pprint(x, indent=2) + +def b(value): + """Returns the string 'true' if value is truthy, 'false' otherwise.""" + if value: + return 'true' + else: + return 'false' + + +def pkg_config(pkg): + pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') + retval = () + for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']: + try: + proc = subprocess.Popen( + shlex.split(pkg_config) + ['--silence-errors', flag, pkg], + stdout=subprocess.PIPE) + 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. + retval += (val,) + return retval + + +def try_check_compiler(cc, lang): + try: + proc = subprocess.Popen(shlex.split(cc) + ['-E', '-P', '-x', lang, '-'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + except OSError: + return (False, False, '', '') + + proc.stdin.write('__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ ' + '__clang_major__ __clang_minor__ __clang_patchlevel__') + + values = (proc.communicate()[0].split() + ['0'] * 7)[0:7] + is_clang = values[0] == '1' + gcc_version = tuple(values[1:1+3]) + clang_version = tuple(values[4:4+3]) + + return (True, is_clang, clang_version, gcc_version) + + +# +# The version of asm compiler is needed for building openssl asm files. +# See deps/openssl/openssl.gypi for detail. +# Commands and regular expressions to obtain its version number are taken from +# https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129 +# +def get_version_helper(cc, regexp): + try: + proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE, + stderr=subprocess.PIPE, stdout=subprocess.PIPE) + except OSError: + error('''No acceptable C compiler found! + + Please make sure you have a C compiler installed on your system and/or + consider adjusting the CC environment variable if you installed + it in a non-standard prefix.''') + + match = re.search(regexp, proc.communicate()[1]) + + if match: + return match.group(2) + else: + return '0' + +def get_nasm_version(asm): + try: + proc = subprocess.Popen(shlex.split(asm) + ['-v'], + stdin=subprocess.PIPE, stderr=subprocess.PIPE, + stdout=subprocess.PIPE) + except OSError: + warn('''No acceptable ASM compiler found! + Please make sure you have installed NASM from http://www.nasm.us + and refer BUILDING.md.''') + return '0' + + match = re.match(r"NASM version ([2-9]\.[0-9][0-9]+)", + proc.communicate()[0]) + + if match: + return match.group(1) + else: + return '0' + +def get_llvm_version(cc): + return get_version_helper( + cc, r"(^(?:FreeBSD )?clang version|based on LLVM) ([3-9]\.[0-9]+)") + +def get_xcode_version(cc): + return get_version_helper( + cc, r"(^Apple LLVM version) ([0-9]+\.[0-9]+)") + +def get_gas_version(cc): + try: + custom_env = os.environ.copy() + custom_env["LC_ALL"] = "C" + proc = subprocess.Popen(shlex.split(cc) + ['-Wa,-v', '-c', '-o', + '/dev/null', '-x', + 'assembler', '/dev/null'], + stdin=subprocess.PIPE, stderr=subprocess.PIPE, + stdout=subprocess.PIPE, env=custom_env) + except OSError: + error('''No acceptable C compiler found! + + Please make sure you have a C compiler installed on your system and/or + consider adjusting the CC environment variable if you installed + it in a non-standard prefix.''') + + gas_ret = proc.communicate()[1] + match = re.match(r"GNU assembler version ([2-9]\.[0-9]+)", gas_ret) + + if match: + return match.group(1) + else: + warn('Could not recognize `gas`: ' + gas_ret) + return '0' + +# Note: Apple clang self-reports as clang 4.2.0 and gcc 4.2.1. It passes +# the version check more by accident than anything else but a more rigorous +# check involves checking the build number against a whitelist. I'm not +# quite prepared to go that far yet. +def check_compiler(o): + if sys.platform == 'win32': + if not options.openssl_no_asm: + nasm_version = get_nasm_version('nasm') + o['variables']['nasm_version'] = nasm_version + if nasm_version == 0: + o['variables']['openssl_no_asm'] = 1 + return + + ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++') + if not ok: + warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX) + elif clang_version < (3, 4, 2) if is_clang else gcc_version < (4, 9, 4): + warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX) + + ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c') + if not ok: + warn('failed to autodetect C compiler version (CC=%s)' % CC) + elif not is_clang and gcc_version < (4, 2, 0): + # clang 3.2 is a little white lie because any clang version will probably + # do for the C bits. However, we might as well encourage people to upgrade + # to a version that is not completely ancient. + warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC) + + o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0 + + # Need xcode_version or gas_version when openssl asm files are compiled. + if options.without_ssl or options.openssl_no_asm or options.shared_openssl: + return + + if is_clang: + if sys.platform == 'darwin': + o['variables']['xcode_version'] = get_xcode_version(CC) + else: + o['variables']['gas_version'] = get_gas_version(CC) + + +def cc_macros(cc=None): + """Checks predefined macros using the C compiler command.""" + + try: + p = subprocess.Popen(shlex.split(cc or CC) + ['-dM', '-E', '-'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except OSError: + error('''No acceptable C compiler found! + + Please make sure you have a C compiler installed on your system and/or + consider adjusting the CC environment variable if you installed + it in a non-standard prefix.''') + + p.stdin.write('\n') + out = p.communicate()[0] + + out = str(out).split('\n') + + k = {} + for line in out: + lst = shlex.split(line) + if len(lst) > 2: + key = lst[1] + val = lst[2] + k[key] = val + return k + + +def is_arch_armv7(): + """Check for ARMv7 instructions""" + cc_macros_cache = cc_macros() + return cc_macros_cache.get('__ARM_ARCH') == '7' + + +def is_arch_armv6(): + """Check for ARMv6 instructions""" + cc_macros_cache = cc_macros() + return cc_macros_cache.get('__ARM_ARCH') == '6' + + +def is_arm_hard_float_abi(): + """Check for hardfloat or softfloat eabi on ARM""" + # GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify + # the Floating Point ABI used (PCS stands for Procedure Call Standard). + # We use these as well as a couple of other defines to statically determine + # what FP ABI used. + + return '__ARM_PCS_VFP' in cc_macros() + + +def host_arch_cc(): + """Host architecture check using the CC command.""" + + if sys.platform.startswith('aix'): + # we only support gcc at this point and the default on AIX + # would be xlc so hard code gcc + k = cc_macros('gcc') + else: + k = cc_macros(os.environ.get('CC_host')) + + matchup = { + '__aarch64__' : 'arm64', + '__arm__' : 'arm', + '__i386__' : 'ia32', + '__MIPSEL__' : 'mipsel', + '__mips__' : 'mips', + '__PPC64__' : 'ppc64', + '__PPC__' : 'ppc64', + '__x86_64__' : 'x64', + '__s390__' : 's390', + '__s390x__' : 's390x', + } + + rtn = 'ia32' # default + + for i in matchup: + if i in k and k[i] != '0': + rtn = matchup[i] + if rtn != 's390': + break + + if rtn == 'mipsel' and '_LP64' in k: + rtn = 'mips64el' + + return rtn + + +def host_arch_win(): + """Host architecture check using environ vars (better way to do this?)""" + + observed_arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86') + arch = os.environ.get('PROCESSOR_ARCHITEW6432', observed_arch) + + matchup = { + 'AMD64' : 'x64', + 'x86' : 'ia32', + 'arm' : 'arm', + 'mips' : 'mips', + } + + return matchup.get(arch, 'ia32') + + +def configure_arm(o): + if options.arm_float_abi: + arm_float_abi = options.arm_float_abi + elif is_arm_hard_float_abi(): + arm_float_abi = 'hard' + else: + arm_float_abi = 'default' + + arm_fpu = 'vfp' + + if is_arch_armv7(): + arm_fpu = 'vfpv3' + o['variables']['arm_version'] = '7' + else: + o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default' + + o['variables']['arm_thumb'] = 0 # -marm + o['variables']['arm_float_abi'] = arm_float_abi + + if options.dest_os == 'android': + arm_fpu = 'vfpv3' + o['variables']['arm_version'] = '7' + + o['variables']['arm_fpu'] = options.arm_fpu or arm_fpu + + +def configure_mips(o): + can_use_fpu_instructions = (options.mips_float_abi != 'soft') + o['variables']['v8_can_use_fpu_instructions'] = b(can_use_fpu_instructions) + o['variables']['v8_use_mips_abi_hardfloat'] = b(can_use_fpu_instructions) + o['variables']['mips_arch_variant'] = options.mips_arch_variant + o['variables']['mips_fpu_mode'] = options.mips_fpu_mode + + +def configure_node(o): + if options.dest_os == 'android': + o['variables']['OS'] = 'android' + o['variables']['node_prefix'] = options.prefix + o['variables']['node_install_npm'] = b(not options.without_npm) + o['default_configuration'] = 'Debug' if options.debug else 'Release' + + host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc() + target_arch = options.dest_cpu or host_arch + # ia32 is preferred by the build tools (GYP) over x86 even if we prefer the latter + # the Makefile resets this to x86 afterward + if target_arch == 'x86': + target_arch = 'ia32' + # x86_64 is common across linuxes, allow it as an alias for x64 + if target_arch == 'x86_64': + target_arch = 'x64' + o['variables']['host_arch'] = host_arch + o['variables']['target_arch'] = target_arch + o['variables']['node_byteorder'] = sys.byteorder + + cross_compiling = (options.cross_compiling + if options.cross_compiling is not None + else target_arch != host_arch) + want_snapshots = not options.without_snapshot + o['variables']['want_separate_host_toolset'] = int( + cross_compiling and want_snapshots) + + if target_arch == 'arm': + configure_arm(o) + elif target_arch in ('mips', 'mipsel', 'mips64el'): + configure_mips(o) + + if flavor == 'aix': + o['variables']['node_target_type'] = 'static_library' + + if target_arch in ('x86', 'x64', 'ia32', 'x32'): + o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) + elif options.enable_vtune_profiling: + raise Exception( + 'The VTune profiler for JavaScript is only supported on x32, x86, and x64 ' + 'architectures.') + else: + o['variables']['node_enable_v8_vtunejit'] = 'false' + + if flavor != 'linux' and (options.enable_lto): + raise Exception( + 'The lto option is supported only on linux.') + + if flavor == 'linux': + if options.enable_lto: + version_checked = (5, 4, 1) + for compiler in [(CC, 'c'), (CXX, 'c++')]: + ok, is_clang, clang_version, compiler_version = \ + try_check_compiler(compiler[0], compiler[1]) + compiler_version_num = tuple(map(int, compiler_version)) + if is_clang or compiler_version_num < version_checked: + version_checked_str = ".".join(map(str, version_checked)) + raise Exception( + 'The option --enable-lto is supported for gcc and gxx %s' + ' or newer only.' % (version_checked_str)) + + o['variables']['enable_lto'] = b(options.enable_lto) + + if flavor in ('solaris', 'mac', 'linux', 'freebsd'): + use_dtrace = not options.without_dtrace + # Don't enable by default on linux and freebsd + if flavor in ('linux', 'freebsd'): + use_dtrace = options.with_dtrace + + if flavor == 'linux': + if options.systemtap_includes: + o['include_dirs'] += [options.systemtap_includes] + o['variables']['node_use_dtrace'] = b(use_dtrace) + elif options.with_dtrace: + raise Exception( + 'DTrace is currently only supported on SunOS, MacOS or Linux systems.') + else: + o['variables']['node_use_dtrace'] = 'false' + + if options.no_ifaddrs: + o['defines'] += ['SUNOS_NO_IFADDRS'] + + # By default, enable ETW on Windows. + if flavor == 'win': + o['variables']['node_use_etw'] = b(not options.without_etw) + elif options.with_etw: + raise Exception('ETW is only supported on Windows.') + else: + o['variables']['node_use_etw'] = 'false' + + # By default, enable Performance counters on Windows. + if flavor == 'win': + o['variables']['node_use_perfctr'] = b(not options.without_perfctr) + elif options.with_perfctr: + raise Exception('Performance counter is only supported on Windows.') + else: + o['variables']['node_use_perfctr'] = 'false' + + o['variables']['node_with_ltcg'] = b(options.with_ltcg) + if flavor != 'win' and options.with_ltcg: + raise Exception('Link Time Code Generation is only supported on Windows.') + + if flavor == 'win': + o['variables']['node_use_pch'] = b(options.with_pch) + else: + o['variables']['node_use_pch'] = 'false' + + if options.tag: + o['variables']['node_tag'] = '-' + options.tag + else: + o['variables']['node_tag'] = '' + + o['variables']['node_release_urlbase'] = options.release_urlbase or '' + + if options.v8_options: + o['variables']['node_v8_options'] = options.v8_options.replace('"', '\\"') + + if options.enable_static: + o['variables']['node_target_type'] = 'static_library' + + o['variables']['node_debug_lib'] = b(options.node_debug_lib) + + if options.debug_nghttp2: + o['variables']['debug_nghttp2'] = 1 + else: + o['variables']['debug_nghttp2'] = 'false' + + o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) + if options.code_cache_path: + o['variables']['node_code_cache_path'] = options.code_cache_path + o['variables']['node_shared'] = b(options.shared) + node_module_version = getmoduleversion.get_version() + + if sys.platform == 'darwin': + shlib_suffix = '%s.dylib' + elif sys.platform.startswith('aix'): + shlib_suffix = '%s.a' + else: + shlib_suffix = 'so.%s' + + shlib_suffix %= node_module_version + o['variables']['node_module_version'] = int(node_module_version) + o['variables']['shlib_suffix'] = shlib_suffix + + if options.linked_module: + o['variables']['library_files'] = options.linked_module + + o['variables']['asan'] = int(options.enable_asan or 0) + + if options.coverage: + o['variables']['coverage'] = 'true' + else: + o['variables']['coverage'] = 'false' + + if options.shared: + o['variables']['node_target_type'] = 'shared_library' + elif options.enable_static: + o['variables']['node_target_type'] = 'static_library' + else: + o['variables']['node_target_type'] = 'executable' + +def configure_library(lib, output): + shared_lib = 'shared_' + lib + output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) + + if getattr(options, shared_lib): + (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) + + if options.__dict__[shared_lib + '_includes']: + output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] + elif pkg_cflags: + output['include_dirs'] += ( + filter(None, map(str.strip, pkg_cflags.split('-I')))) + + # libpath needs to be provided ahead libraries + if options.__dict__[shared_lib + '_libpath']: + if flavor == 'win': + if 'msvs_settings' not in output: + output['msvs_settings'] = { 'VCLinkerTool': { 'AdditionalOptions': [] } } + output['msvs_settings']['VCLinkerTool']['AdditionalOptions'] += [ + '/LIBPATH:%s' % options.__dict__[shared_lib + '_libpath']] + else: + output['libraries'] += [ + '-L%s' % options.__dict__[shared_lib + '_libpath']] + elif pkg_libpath: + output['libraries'] += [pkg_libpath] + + default_libs = getattr(options, shared_lib + '_libname') + default_libs = map('-l{0}'.format, default_libs.split(',')) + + if default_libs: + output['libraries'] += default_libs + elif pkg_libs: + output['libraries'] += pkg_libs.split() + + +def configure_v8(o): + o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0 + o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. + o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds. + o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. + o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks. + o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' + o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 + o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) + o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) + o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 + o['variables']['node_enable_d8'] = b(options.enable_d8) + # Unconditionally force typed arrays to allocate outside the v8 heap. This + # is to prevent memory pointers from being moved around that are returned by + # Buffer::Data(). + o['variables']['v8_typed_array_max_size_in_heap'] = 0 + if options.enable_d8: + o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp. + if options.without_bundled_v8 and options.enable_d8: + raise Exception('--enable-d8 is incompatible with --without-bundled-v8.') + if options.without_bundled_v8 and options.build_v8_with_gn: + raise Exception( + '--build-v8-with-gn is incompatible with --without-bundled-v8.') + if options.build_v8_with_gn: + v8_path = os.path.join('deps', 'v8') + print('Fetching dependencies to build V8 with GN') + options.build_v8_with_gn = FetchDeps(v8_path) + o['variables']['build_v8_with_gn'] = b(options.build_v8_with_gn) + + +def configure_openssl(o): + variables = o['variables'] + variables['node_use_openssl'] = b(not options.without_ssl) + variables['node_shared_openssl'] = b(options.shared_openssl) + variables['openssl_no_asm'] = 1 if options.openssl_no_asm else 0 + variables['openssl_fips'] = '' + + if options.without_ssl: + def without_ssl_error(option): + error('--without-ssl is incompatible with %s' % option) + if options.shared_openssl: + without_ssl_error('--shared-openssl') + if options.openssl_no_asm: + without_ssl_error('--openssl-no-asm') + if options.openssl_fips: + without_ssl_error('--openssl-fips') + return + + if options.use_openssl_ca_store: + o['defines'] += ['NODE_OPENSSL_CERT_STORE'] + if options.openssl_system_ca_path: + variables['openssl_system_ca_path'] = options.openssl_system_ca_path + variables['node_without_node_options'] = b(options.without_node_options) + if options.without_node_options: + o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] + + if not options.shared_openssl and not options.openssl_no_asm: + is_x86 = 'x64' in variables['target_arch'] or 'ia32' in variables['target_arch'] + + # supported asm compiler for AVX2. See https://github.com/openssl/openssl/ + # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69 + openssl110_asm_supported = \ + ('gas_version' in variables and float(variables['gas_version']) >= 2.23) or \ + ('xcode_version' in variables and float(variables['xcode_version']) >= 5.0) or \ + ('llvm_version' in variables and float(variables['llvm_version']) >= 3.3) or \ + ('nasm_version' in variables and float(variables['nasm_version']) >= 2.10) + + if is_x86 and not openssl110_asm_supported: + error('''Did not find a new enough assembler, install one or build with + --openssl-no-asm. + Please refer to BUILDING.md''') + + elif options.openssl_no_asm: + warn('''--openssl-no-asm will result in binaries that do not take advantage + of modern CPU cryptographic instructions and will therefore be slower. + Please refer to BUILDING.md''') + + if options.openssl_no_asm and options.shared_openssl: + error('--openssl-no-asm is incompatible with --shared-openssl') + + if options.openssl_fips: + error('FIPS is not supported in this version of Node.js') + + configure_library('openssl', o) + + +def configure_static(o): + if options.fully_static or options.partly_static: + if flavor == 'mac': + warn("Generation of static executable will not work on OSX " + "when using the default compilation environment") + return + + if options.fully_static: + o['libraries'] += ['-static'] + elif options.partly_static: + o['libraries'] += ['-static-libgcc', '-static-libstdc++'] + if options.enable_asan: + o['libraries'] += ['-static-libasan'] + + +def write(filename, data): + filename = filename + print_verbose('creating %s' % filename) + with open(filename, 'w+') as f: + f.write(data) + +do_not_edit = '# Do not edit. Generated by the configure script.\n' + +def glob_to_var(dir_base, dir_sub, patch_dir): + list = [] + dir_all = '%s/%s' % (dir_base, dir_sub) + files = os.walk(dir_all) + for ent in files: + (path, dirs, files) = ent + for file in files: + if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'): + # srcfile uses "slash" as dir separator as its output is consumed by gyp + srcfile = '%s/%s' % (dir_sub, file) + if patch_dir: + patchfile = '%s/%s/%s' % (dir_base, patch_dir, file) + if os.path.isfile(patchfile): + srcfile = '%s/%s' % (patch_dir, file) + warn('Using floating patch "%s" from "%s"' % (patchfile, dir_base)) + list.append(srcfile) + break + return list + +def configure_intl(o): + icus = [ + { + 'url': 'https://sourceforge.net/projects/icu/files/ICU4C/62.1/icu4c-62_1-src.zip', + 'md5': '408854f7b9b58311b68fab4b4dfc80be', + }, + ] + def icu_download(path): + # download ICU, if needed + if not os.access(options.download_path, os.W_OK): + error('''Cannot write to desired download path. + Either create it or verify permissions.''') + for icu in icus: + url = icu['url'] + md5 = icu['md5'] + local = url.split('/')[-1] + targetfile = os.path.join(options.download_path, local) + if not os.path.isfile(targetfile): + if nodedownload.candownload(auto_downloads, "icu"): + nodedownload.retrievefile(url, targetfile) + else: + print('Re-using existing %s' % targetfile) + if os.path.isfile(targetfile): + print('Checking file integrity with MD5:\r') + gotmd5 = nodedownload.md5sum(targetfile) + print('MD5: %s %s' % (gotmd5, targetfile)) + if (md5 == gotmd5): + return targetfile + else: + error('Expected: %s *MISMATCH*' % md5) + error('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile) + return None + icu_config = { + 'variables': {} + } + icu_config_name = 'icu_config.gypi' + def write_config(data, name): + return + + # write an empty file to start with + write(icu_config_name, do_not_edit + + pprint.pformat(icu_config, indent=2) + '\n') + + # always set icu_small, node.gyp depends on it being defined. + o['variables']['icu_small'] = b(False) + + with_intl = options.with_intl + with_icu_source = options.with_icu_source + have_icu_path = bool(options.with_icu_path) + if have_icu_path and with_intl != 'none': + error('Cannot specify both --with-icu-path and --with-intl') + elif have_icu_path: + # Chromium .gyp mode: --with-icu-path + o['variables']['v8_enable_i18n_support'] = 1 + # use the .gyp given + o['variables']['icu_gyp_path'] = options.with_icu_path + return + # --with-intl= + # set the default + if with_intl in (None, 'none'): + o['variables']['v8_enable_i18n_support'] = 0 + return # no Intl + elif with_intl == 'small-icu': + # small ICU (English only) + o['variables']['v8_enable_i18n_support'] = 1 + o['variables']['icu_small'] = b(True) + locs = set(options.with_icu_locales.split(',')) + locs.add('root') # must have root + o['variables']['icu_locales'] = string.join(locs,',') + # We will check a bit later if we can use the canned deps/icu-small + elif with_intl == 'full-icu': + # full ICU + o['variables']['v8_enable_i18n_support'] = 1 + elif with_intl == 'system-icu': + # ICU from pkg-config. + o['variables']['v8_enable_i18n_support'] = 1 + pkgicu = pkg_config('icu-i18n') + 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 + # libpath provides linker path which may contain spaces + if libpath: + o['libraries'] += [libpath] + # safe to split, cannot contain spaces + o['libraries'] += libs.split() + if cflags: + o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I'))) + # use the "system" .gyp + o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp' + return + + # this is just the 'deps' dir. Used for unpacking. + icu_parent_path = 'deps' + + # The full path to the ICU source directory. Should not include './'. + icu_full_path = 'deps/icu' + + # icu-tmp is used to download and unpack the ICU tarball. + icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp') + + # canned ICU. see tools/icu/README.md to update. + canned_icu_dir = 'deps/icu-small' + + # We can use 'deps/icu-small' - pre-canned ICU *iff* + # - with_intl == small-icu (the default!) + # - with_icu_locales == 'root,en' (the default!) + # - deps/icu-small exists! + # - with_icu_source is unset (i.e. no other ICU was specified) + # (Note that this is the *DEFAULT CASE*.) + # + # This is *roughly* equivalent to + # $ configure --with-intl=small-icu --with-icu-source=deps/icu-small + # .. Except that we avoid copying icu-small over to deps/icu. + # In this default case, deps/icu is ignored, although make clean will + # still harmlessly remove deps/icu. + + # are we using default locales? + using_default_locales = ( options.with_icu_locales == icu_default_locales ) + + # make sure the canned ICU really exists + canned_icu_available = os.path.isdir(canned_icu_dir) + + if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available: + # OK- we can use the canned ICU. + icu_config['variables']['icu_small_canned'] = 1 + icu_full_path = canned_icu_dir + + # --with-icu-source processing + # now, check that they didn't pass --with-icu-source=deps/icu + elif with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source): + warn('Ignoring redundant --with-icu-source=%s' % with_icu_source) + with_icu_source = None + # if with_icu_source is still set, try to use it. + if with_icu_source: + if os.path.isdir(icu_full_path): + print('Deleting old ICU source: %s' % icu_full_path) + shutil.rmtree(icu_full_path) + # now, what path was given? + if os.path.isdir(with_icu_source): + # it's a path. Copy it. + print('%s -> %s' % (with_icu_source, icu_full_path)) + shutil.copytree(with_icu_source, icu_full_path) + else: + # could be file or URL. + # Set up temporary area + if os.path.isdir(icu_tmp_path): + shutil.rmtree(icu_tmp_path) + os.mkdir(icu_tmp_path) + icu_tarball = None + if os.path.isfile(with_icu_source): + # it's a file. Try to unpack it. + icu_tarball = with_icu_source + else: + # Can we download it? + local = os.path.join(icu_tmp_path, with_icu_source.split('/')[-1]) # local part + icu_tarball = nodedownload.retrievefile(with_icu_source, local) + # continue with "icu_tarball" + nodedownload.unpack(icu_tarball, icu_tmp_path) + # Did it unpack correctly? Should contain 'icu' + tmp_icu = os.path.join(icu_tmp_path, 'icu') + if os.path.isdir(tmp_icu): + os.rename(tmp_icu, icu_full_path) + shutil.rmtree(icu_tmp_path) + else: + shutil.rmtree(icu_tmp_path) + error('--with-icu-source=%s did not result in an "icu" dir.' % \ + with_icu_source) + + # ICU mode. (icu-generic.gyp) + o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp' + # ICU source dir relative to tools/icu (for .gyp file) + o['variables']['icu_path'] = icu_full_path + if not os.path.isdir(icu_full_path): + warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path) + # can we download (or find) a zipfile? + localzip = icu_download(icu_full_path) + if localzip: + nodedownload.unpack(localzip, icu_parent_path) + if not os.path.isdir(icu_full_path): + error('''Cannot build Intl without ICU in %s. + Fix, or disable with "--with-intl=none"''' % icu_full_path) + else: + print_verbose('* Using ICU in %s' % icu_full_path) + # Now, what version of ICU is it? We just need the "major", such as 54. + # uvernum.h contains it as a #define. + uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h') + if not os.path.isfile(uvernum_h): + error('Could not load %s - is ICU installed?' % uvernum_h) + icu_ver_major = None + matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*' + match_version = re.compile(matchVerExp) + for line in open(uvernum_h).readlines(): + m = match_version.match(line) + if m: + icu_ver_major = m.group(1) + if not icu_ver_major: + error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) + icu_endianness = sys.byteorder[0]; + o['variables']['icu_ver_major'] = icu_ver_major + o['variables']['icu_endianness'] = icu_endianness + icu_data_file_l = 'icudt%s%s.dat' % (icu_ver_major, 'l') + icu_data_file = 'icudt%s%s.dat' % (icu_ver_major, icu_endianness) + # relative to configure + icu_data_path = os.path.join(icu_full_path, + 'source/data/in', + icu_data_file_l) + # relative to dep.. + icu_data_in = os.path.join('..','..', icu_full_path, 'source/data/in', icu_data_file_l) + if not os.path.isfile(icu_data_path) and icu_endianness != 'l': + # use host endianness + icu_data_path = os.path.join(icu_full_path, + 'source/data/in', + icu_data_file) + # relative to dep.. + icu_data_in = os.path.join('..', icu_full_path, 'source/data/in', + icu_data_file) + # this is the input '.dat' file to use .. icudt*.dat + # may be little-endian if from a icu-project.org tarball + o['variables']['icu_data_in'] = icu_data_in + if not os.path.isfile(icu_data_path): + # .. and we're not about to build it from .gyp! + error('''ICU prebuilt data file %s does not exist. + See the README.md.''' % icu_data_path) + # map from variable name to subdirs + icu_src = { + 'stubdata': 'stubdata', + 'common': 'common', + 'i18n': 'i18n', + 'tools': 'tools/toolutil', + 'genccode': 'tools/genccode', + 'genrb': 'tools/genrb', + 'icupkg': 'tools/icupkg', + } + # this creates a variable icu_src_XXX for each of the subdirs + # with a list of the src files to use + for i in icu_src: + var = 'icu_src_%s' % i + path = '../../%s/source/%s' % (icu_full_path, icu_src[i]) + icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) ) + # write updated icu_config.gypi with a bunch of paths + write(icu_config_name, do_not_edit + + pprint.pformat(icu_config, indent=2) + '\n') + return # end of configure_intl + +def configure_inspector(o): + disable_inspector = (options.without_inspector or + options.with_intl in (None, 'none') or + options.without_ssl) + o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1 + + +def make_bin_override(): + if sys.platform == 'win32': + raise Exception('make_bin_override should not be called on win32.') + # If the system python is not the python we are running (which should be + # python 2), then create a directory with a symlink called `python` to our + # sys.executable. This directory will be prefixed to the PATH, so that + # other tools that shell out to `python` will use the appropriate python + + which_python = which('python') + if (which_python and + os.path.realpath(which_python) == os.path.realpath(sys.executable)): + return + + bin_override = os.path.abspath('out/tools/bin') + try: + os.makedirs(bin_override) + except OSError as e: + if e.errno != errno.EEXIST: raise e + + python_link = os.path.join(bin_override, 'python') + try: + os.unlink(python_link) + except OSError as e: + if e.errno != errno.ENOENT: raise e + os.symlink(sys.executable, python_link) + + # We need to set the environment right now so that when gyp (in run_gyp) + # shells out, it finds the right python (specifically at + # https://github.com/nodejs/node/blob/d82e107/deps/v8/gypfiles/toolchain.gypi#L43) + os.environ['PATH'] = bin_override + ':' + os.environ['PATH'] + + return bin_override + +output = { + 'variables': {}, + 'include_dirs': [], + 'libraries': [], + 'defines': [], + 'cflags': [], +} + +# Print a warning when the compiler is too old. +check_compiler(output) + +# determine the "flavor" (operating system) we're building for, +# leveraging gyp's GetFlavor function +flavor_params = {} +if (options.dest_os): + flavor_params['flavor'] = options.dest_os +flavor = GetFlavor(flavor_params) + +configure_node(output) +configure_library('zlib', output) +configure_library('http_parser', output) +configure_library('libuv', output) +configure_library('libcares', output) +configure_library('nghttp2', output) +# stay backwards compatible with shared cares builds +output['variables']['node_shared_cares'] = \ + output['variables'].pop('node_shared_libcares') +configure_v8(output) +configure_openssl(output) +configure_intl(output) +configure_static(output) +configure_inspector(output) + +# variables should be a root level element, +# move everything else to target_defaults +variables = output['variables'] +del output['variables'] + +# make_global_settings for special FIPS linking +# should not be used to compile modules in node-gyp +config_fips = { 'make_global_settings' : [] } +if 'make_fips_settings' in output: + config_fips['make_global_settings'] = output['make_fips_settings'] + del output['make_fips_settings'] + write('config_fips.gypi', do_not_edit + + pprint.pformat(config_fips, indent=2) + '\n') + +# make_global_settings should be a root level element too +if 'make_global_settings' in output: + make_global_settings = output['make_global_settings'] + del output['make_global_settings'] +else: + make_global_settings = False + +output = { + 'variables': variables, + 'target_defaults': output, +} +if make_global_settings: + output['make_global_settings'] = make_global_settings + +print_verbose(output) + +write('config.gypi', do_not_edit + + pprint.pformat(output, indent=2) + '\n') + +write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + + ' '.join([pipes.quote(arg) for arg in original_argv]) + '\n') +os.chmod('config.status', 0o775) + +config = { + 'BUILDTYPE': 'Debug' if options.debug else 'Release', + 'PYTHON': sys.executable, + 'NODE_TARGET_TYPE': variables['node_target_type'], +} + +if options.prefix: + config['PREFIX'] = options.prefix + +config = '\n'.join(map('='.join, config.iteritems())) + '\n' + +# On Windows there's no reason to search for a different python binary. +bin_override = None if sys.platform == 'win32' else make_bin_override() +if bin_override: + config = 'export PATH:=' + bin_override + ':$(PATH)\n' + config + +write('config.mk', do_not_edit + config) + +gyp_args = ['--no-parallel'] + +if options.use_ninja: + gyp_args += ['-f', 'ninja'] +elif flavor == 'win' and sys.platform != 'msys': + gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] +else: + gyp_args += ['-f', 'make-' + flavor] + +if options.compile_commands_json: + gyp_args += ['-f', 'compile_commands_json'] + +# pass the leftover positional arguments to GYP +gyp_args += args + +if warn.warned and not options.verbose: + warn('warnings were emitted in the configure phase') + +print_verbose("running: \n " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args)) +run_gyp(gyp_args) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index e52b5742f595ac..f0ded3542ce86a 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 8 #define V8_BUILD_NUMBER 275 -#define V8_PATCH_LEVEL 30 +#define V8_PATCH_LEVEL 32 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/field-type.cc b/deps/v8/src/field-type.cc index 3b51095323c06b..2eebebe3d616ea 100644 --- a/deps/v8/src/field-type.cc +++ b/deps/v8/src/field-type.cc @@ -78,6 +78,7 @@ void FieldType::PrintTo(std::ostream& os) { os << "None"; } else { DCHECK(IsClass()); + HandleScope scope(Map::cast(this)->GetIsolate()); os << "Class(" << static_cast(*AsClass()) << ")"; } } diff --git a/deps/v8/src/flag-definitions.h b/deps/v8/src/flag-definitions.h index f5d724c8e9cc80..e8226006df48b0 100644 --- a/deps/v8/src/flag-definitions.h +++ b/deps/v8/src/flag-definitions.h @@ -1211,6 +1211,9 @@ DEFINE_BOOL(log_function_events, false, DEFINE_BOOL(prof, false, "Log statistical profiling information (implies --log-code).") +DEFINE_BOOL(detailed_line_info, true, + "Always generate detailed line information for CPU profiling.") + #if defined(ANDROID) // Phones and tablets have processors that are much slower than desktop // and laptop computers for which current heuristics are tuned. diff --git a/deps/v8/src/isolate.cc b/deps/v8/src/isolate.cc index 0e457df4d1a97d..0bdfef5e81b319 100644 --- a/deps/v8/src/isolate.cc +++ b/deps/v8/src/isolate.cc @@ -1661,8 +1661,17 @@ void Isolate::PrintCurrentStackTrace(FILE* out) { Handle receiver(frame->receiver(), this); Handle function(frame->function(), this); - Handle code(AbstractCode::cast(frame->LookupCode()), this); - const int offset = static_cast(frame->pc() - code->InstructionStart()); + Handle code; + int offset; + if (frame->is_interpreted()) { + InterpretedFrame* interpreted_frame = InterpretedFrame::cast(frame); + code = handle(AbstractCode::cast(interpreted_frame->GetBytecodeArray()), + this); + offset = interpreted_frame->GetBytecodeOffset(); + } else { + code = handle(AbstractCode::cast(frame->LookupCode()), this); + offset = static_cast(frame->pc() - code->InstructionStart()); + } JSStackFrame site(this, receiver, function, code, offset); Handle line = site.ToString().ToHandleChecked(); @@ -3285,6 +3294,10 @@ bool Isolate::use_optimizer() { !is_precise_count_code_coverage() && !is_block_count_code_coverage(); } +bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const { + return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info; +} + bool Isolate::NeedsSourcePositionsForProfiling() const { return FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || FLAG_turbo_profiling || FLAG_perf_prof || is_profiling() || diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index 69ec1f1853149a..672bfef6359188 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -1022,6 +1022,8 @@ class Isolate : private HiddenFactory { bool NeedsSourcePositionsForProfiling() const; + bool NeedsDetailedOptimizedCodeLineInfo() const; + bool is_best_effort_code_coverage() const { return code_coverage_mode() == debug::Coverage::kBestEffort; } diff --git a/deps/v8/src/libplatform/tracing/tracing-controller.cc b/deps/v8/src/libplatform/tracing/tracing-controller.cc index b4aa7baf724d4f..e0a6a1234c5970 100644 --- a/deps/v8/src/libplatform/tracing/tracing-controller.cc +++ b/deps/v8/src/libplatform/tracing/tracing-controller.cc @@ -63,13 +63,15 @@ uint64_t TracingController::AddTraceEvent( const uint64_t* arg_values, std::unique_ptr* arg_convertables, unsigned int flags) { - uint64_t handle; - TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); - if (trace_object) { - trace_object->Initialize( - phase, category_enabled_flag, name, scope, id, bind_id, num_args, - arg_names, arg_types, arg_values, arg_convertables, flags, - CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds()); + uint64_t handle = 0; + if (mode_ != DISABLED) { + TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); + if (trace_object) { + trace_object->Initialize( + phase, category_enabled_flag, name, scope, id, bind_id, num_args, + arg_names, arg_types, arg_values, arg_convertables, flags, + CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds()); + } } return handle; } @@ -81,13 +83,15 @@ uint64_t TracingController::AddTraceEventWithTimestamp( const uint64_t* arg_values, std::unique_ptr* arg_convertables, unsigned int flags, int64_t timestamp) { - uint64_t handle; - TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); - if (trace_object) { - trace_object->Initialize(phase, category_enabled_flag, name, scope, id, - bind_id, num_args, arg_names, arg_types, - arg_values, arg_convertables, flags, timestamp, - CurrentCpuTimestampMicroseconds()); + uint64_t handle = 0; + if (mode_ != DISABLED) { + TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle); + if (trace_object) { + trace_object->Initialize(phase, category_enabled_flag, name, scope, id, + bind_id, num_args, arg_names, arg_types, + arg_values, arg_convertables, flags, timestamp, + CurrentCpuTimestampMicroseconds()); + } } return handle; } diff --git a/deps/v8/src/optimized-compilation-info.cc b/deps/v8/src/optimized-compilation-info.cc index c20ba677fcaf2d..dc932a1c041e45 100644 --- a/deps/v8/src/optimized-compilation-info.cc +++ b/deps/v8/src/optimized-compilation-info.cc @@ -39,7 +39,7 @@ OptimizedCompilationInfo::OptimizedCompilationInfo( // Collect source positions for optimized code when profiling or if debugger // is active, to be able to get more precise source positions at the price of // more memory consumption. - if (isolate->NeedsSourcePositionsForProfiling()) { + if (isolate->NeedsDetailedOptimizedCodeLineInfo()) { MarkAsSourcePositionsEnabled(); } diff --git a/deps/v8/src/ppc/macro-assembler-ppc.cc b/deps/v8/src/ppc/macro-assembler-ppc.cc index 2c0df5e5c450e5..160ce33530e891 100644 --- a/deps/v8/src/ppc/macro-assembler-ppc.cc +++ b/deps/v8/src/ppc/macro-assembler-ppc.cc @@ -2944,10 +2944,14 @@ void TurboAssembler::SwapP(Register src, MemOperand dst, Register scratch) { void TurboAssembler::SwapP(MemOperand src, MemOperand dst, Register scratch_0, Register scratch_1) { - if (src.ra() != r0) DCHECK(!AreAliased(src.ra(), scratch_0, scratch_1)); - if (src.rb() != r0) DCHECK(!AreAliased(src.rb(), scratch_0, scratch_1)); - if (dst.ra() != r0) DCHECK(!AreAliased(dst.ra(), scratch_0, scratch_1)); - if (dst.rb() != r0) DCHECK(!AreAliased(dst.rb(), scratch_0, scratch_1)); + if (src.ra() != r0 && src.ra().is_valid()) + DCHECK(!AreAliased(src.ra(), scratch_0, scratch_1)); + if (src.rb() != r0 && src.rb().is_valid()) + DCHECK(!AreAliased(src.rb(), scratch_0, scratch_1)); + if (dst.ra() != r0 && dst.ra().is_valid()) + DCHECK(!AreAliased(dst.ra(), scratch_0, scratch_1)); + if (dst.rb() != r0 && dst.rb().is_valid()) + DCHECK(!AreAliased(dst.rb(), scratch_0, scratch_1)); DCHECK(!AreAliased(scratch_0, scratch_1)); if (is_int16(src.offset()) || is_int16(dst.offset())) { if (!is_int16(src.offset())) { diff --git a/deps/v8/tools/release/create_release.py b/deps/v8/tools/release/create_release.py index e5c2114b1a0053..caee70308c3154 100755 --- a/deps/v8/tools/release/create_release.py +++ b/deps/v8/tools/release/create_release.py @@ -221,8 +221,7 @@ def RunStep(self): else: self.GitUpload(author=self._options.author, force=True, - bypass_hooks=True, - private=True) + bypass_hooks=True) cmd = "cl land --bypass-hooks -f" if self._options.dry_run: print "Dry run. Command:\ngit %s" % cmd diff --git a/deps/v8/tools/release/filter_build_files.py b/deps/v8/tools/release/filter_build_files.py index 7d3f22138aa64d..9cc66071081a67 100755 --- a/deps/v8/tools/release/filter_build_files.py +++ b/deps/v8/tools/release/filter_build_files.py @@ -35,7 +35,7 @@ LIBRARY_FILES = { 'android': ['*.a', '*.so'], 'linux': ['*.a', '*.so'], - 'mac': ['*.a', '*.so'], + 'mac': ['*.a', '*.so', '*.dylib'], 'win': ['*.lib', '*.dll'], } diff --git a/deps/v8/tools/release/git_recipes.py b/deps/v8/tools/release/git_recipes.py index 9deaee891b0f8a..f3ac16058c9b96 100644 --- a/deps/v8/tools/release/git_recipes.py +++ b/deps/v8/tools/release/git_recipes.py @@ -206,8 +206,8 @@ def GitApplyPatch(self, patch_file, reverse=False, **kwargs): self.Git(MakeArgs(args), **kwargs) def GitUpload(self, reviewer="", author="", force=False, cq=False, - cq_dry_run=False, bypass_hooks=False, cc="", private=False, - tbr_reviewer="", **kwargs): + cq_dry_run=False, bypass_hooks=False, cc="", tbr_reviewer="", + **kwargs): args = ["cl upload --send-mail"] if author: args += ["--email", Quoted(author)] @@ -226,8 +226,6 @@ def GitUpload(self, reviewer="", author="", force=False, cq=False, if cc: args += ["--cc", Quoted(cc)] args += ["--gerrit"] - if private: - args += ["--private"] # TODO(machenbach): Check output in forced mode. Verify that all required # base files were uploaded, if not retry. self.Git(MakeArgs(args), pipe=False, **kwargs) diff --git a/deps/v8/tools/release/test_scripts.py b/deps/v8/tools/release/test_scripts.py index 565b2b7c8f63b9..86326bfda2517f 100755 --- a/deps/v8/tools/release/test_scripts.py +++ b/deps/v8/tools/release/test_scripts.py @@ -934,7 +934,7 @@ def CheckVersionCommit(): Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", cb=CheckVersionCommit), Cmd("git cl upload --send-mail --email \"author@chromium.org\" " - "-f --bypass-hooks --gerrit --private", ""), + "-f --bypass-hooks --gerrit", ""), Cmd("git cl land --bypass-hooks -f", ""), Cmd("git fetch", ""), Cmd("git log -1 --format=%H --grep=" diff --git a/doc/api/addons.md b/doc/api/addons.md index 483f2ad27d7feb..5e06336a85a4a0 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -848,6 +848,13 @@ console.log(obj.plusOne()); // Prints: 13 ``` +The destructor for a wrapper object will run when the object is +garbage-collected. For destructor testing, there are command-line flags that +can be used to make it possible to force garbage collection. These flags are +provided by the underlying V8 JavaScript engine. They are subject to change +or removal at any time. They are not documented by Node.js or V8, and they +should never be used outside of testing. + ### Factory of wrapped objects Alternatively, it is possible to use a factory pattern to avoid explicitly diff --git a/doc/api/assert.md b/doc/api/assert.md index 71edf4c415e1ef..4800bed4e8239d 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -400,19 +400,19 @@ parameter is undefined, a default error message is assigned. If the `message` parameter is an instance of an [`Error`][] then it will be thrown instead of the `AssertionError`. -## assert.doesNotReject(block[, error][, message]) +## assert.doesNotReject(asyncFn[, error][, message]) -* `block` {Function|Promise} +* `asyncFn` {Function|Promise} * `error` {RegExp|Function} -* `message` {string|Error} +* `message` {string} -Awaits the `block` promise or, if `block` is a function, immediately calls the -function and awaits the returned promise to complete. It will then check that -the promise is not rejected. +Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately +calls the function and awaits the returned promise to complete. It will then +check that the promise is not rejected. -If `block` is a function and it throws an error synchronously, +If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If the function does not return a promise, `assert.doesNotReject()` will return a rejected `Promise` with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases @@ -447,7 +447,7 @@ assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) }); ``` -## assert.doesNotThrow(block[, error][, message]) +## assert.doesNotThrow(fn[, error][, message]) -* `block` {Function} +* `fn` {Function} * `error` {RegExp|Function} -* `message` {string|Error} +* `message` {string} -Asserts that the function `block` does not throw an error. +Asserts that the function `fn` does not throw an error. Please note: Using `assert.doesNotThrow()` is actually not useful because there is no benefit by catching an error and then rethrowing it. Instead, consider adding a comment next to the specific code path that should not throw and keep error messages as expressive as possible. -When `assert.doesNotThrow()` is called, it will immediately call the `block` +When `assert.doesNotThrow()` is called, it will immediately call the `fn` function. If an error is thrown and it is the same type as that specified by the `error` @@ -954,19 +954,19 @@ assert(0); // assert(0) ``` -## assert.rejects(block[, error][, message]) +## assert.rejects(asyncFn[, error][, message]) -* `block` {Function|Promise} +* `asyncFn` {Function|Promise} * `error` {RegExp|Function|Object|Error} -* `message` {string|Error} +* `message` {string} -Awaits the `block` promise or, if `block` is a function, immediately calls the -function and awaits the returned promise to complete. It will then check that -the promise is rejected. +Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately +calls the function and awaits the returned promise to complete. It will then +check that the promise is rejected. -If `block` is a function and it throws an error synchronously, +If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases the error @@ -981,7 +981,7 @@ each property will be tested for including the non-enumerable `message` and `name` properties. If specified, `message` will be the message provided by the `AssertionError` if -the block fails to reject. +the `asyncFn` fails to reject. ```js (async () => { @@ -1052,7 +1052,7 @@ If the values are not strictly equal, an `AssertionError` is thrown with a `message` parameter is an instance of an [`Error`][] then it will be thrown instead of the `AssertionError`. -## assert.throws(block[, error][, message]) +## assert.throws(fn[, error][, message]) -* `block` {Function} +* `fn` {Function} * `error` {RegExp|Function|Object|Error} -* `message` {string|Error} +* `message` {string} -Expects the function `block` to throw an error. +Expects the function `fn` to throw an error. If specified, `error` can be a [`Class`][], [`RegExp`][], a validation function, a validation object where each property will be tested for strict deep equality, @@ -1080,8 +1080,9 @@ equality including the non-enumerable `message` and `name` properties. When using an object, it is also possible to use a regular expression, when validating against a string property. See below for examples. -If specified, `message` will be the message provided by the `AssertionError` if -the block fails to throw. +If specified, `message` will be appended to the message provided by the +`AssertionError` if the `fn` call fails to throw or in case the error validation +fails. Custom validation object/error instance: @@ -1246,12 +1247,12 @@ second argument. This might lead to difficult-to-spot errors. [`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet [`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message [`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message -[`assert.doesNotThrow()`]: #assert_assert_doesnotthrow_block_error_message +[`assert.doesNotThrow()`]: #assert_assert_doesnotthrow_fn_error_message [`assert.notDeepStrictEqual()`]: #assert_assert_notdeepstrictequal_actual_expected_message [`assert.notStrictEqual()`]: #assert_assert_notstrictequal_actual_expected_message [`assert.ok()`]: #assert_assert_ok_value_message [`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message -[`assert.throws()`]: #assert_assert_throws_block_error_message +[`assert.throws()`]: #assert_assert_throws_fn_error_message [`strict mode`]: #assert_strict_mode [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring diff --git a/doc/api/cli.md b/doc/api/cli.md index 6b7d451d682d1c..8adb33efb7b06e 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -12,13 +12,13 @@ To view this documentation as a manual page in a terminal, run `man node`. `node [options] [V8 options] [script.js | -e "script" | -] [--] [arguments]` -`node debug [script.js | -e "script" | :] …` +`node inspect [script.js | -e "script" | :] …` `node --v8-options` Execute without arguments to start the [REPL][]. -_For more info about `node debug`, please see the [debugger][] documentation._ +_For more info about `node inspect`, please see the [debugger][] documentation._ ## Options diff --git a/doc/api/crypto.md b/doc/api/crypto.md index a027efba85e7df..2331af12aceae7 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1124,6 +1124,8 @@ changes: * `privateKey` {string | Object} - `key` {string} - `passphrase` {string} + - `padding` {integer} + - `saltLength` {integer} * `outputFormat` {string} * Returns: {Buffer | string} @@ -1806,6 +1808,9 @@ otherwise `err` will be `null`. By default, the successfully generated `derivedKey` will be passed to the callback as a [`Buffer`][]. An error will be thrown if any of the input arguments specify invalid values or types. +If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated +in a future version of Node.js. + The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete. @@ -1869,6 +1874,9 @@ applied to derive a key of the requested byte length (`keylen`) from the If an error occurs an `Error` will be thrown, otherwise the derived key will be returned as a [`Buffer`][]. +If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated +in a future version of Node.js. + The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete. @@ -1910,7 +1918,8 @@ added: v0.11.14 * `buffer` {Buffer | TypedArray | DataView} * Returns: {Buffer} A new `Buffer` with the decrypted content. -Decrypts `buffer` with `privateKey`. +Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using +the corresponding public key, for example using [`crypto.publicEncrypt()`][]. `privateKey` can be an object or a string. If `privateKey` is a string, it is treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. @@ -1928,7 +1937,8 @@ added: v1.1.0 * `buffer` {Buffer | TypedArray | DataView} * Returns: {Buffer} A new `Buffer` with the encrypted content. -Encrypts `buffer` with `privateKey`. +Encrypts `buffer` with `privateKey`. The returned data can be decrypted using +the corresponding public key, for example using [`crypto.publicDecrypt()`][]. `privateKey` can be an object or a string. If `privateKey` is a string, it is treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. @@ -1946,7 +1956,8 @@ added: v1.1.0 * `buffer` {Buffer | TypedArray | DataView} * Returns: {Buffer} A new `Buffer` with the decrypted content. -Decrypts `buffer` with `key`. +Decrypts `buffer` with `key`.`buffer` was previously encrypted using +the corresponding private key, for example using [`crypto.privateEncrypt()`][]. `key` can be an object or a string. If `key` is a string, it is treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. @@ -1969,7 +1980,8 @@ added: v0.11.14 * Returns: {Buffer} A new `Buffer` with the encrypted content. Encrypts the content of `buffer` with `key` and returns a new -[`Buffer`][] with encrypted content. +[`Buffer`][] with encrypted content. The returned data can be decrypted using +the corresponding private key, for example using [`crypto.privateDecrypt()`][]. `key` can be an object or a string. If `key` is a string, it is treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. @@ -2763,6 +2775,10 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. [`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options [`crypto.getCurves()`]: #crypto_crypto_getcurves [`crypto.getHashes()`]: #crypto_crypto_gethashes +[`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer +[`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer +[`crypto.publicDecrypt()`]: #crypto_crypto_publicdecrypt_key_buffer +[`crypto.publicEncrypt()`]: #crypto_crypto_publicencrypt_key_buffer [`crypto.randomBytes()`]: #crypto_crypto_randombytes_size_callback [`crypto.randomFill()`]: #crypto_crypto_randomfill_buffer_offset_size_callback [`crypto.scrypt()`]: #crypto_crypto_scrypt_password_salt_keylen_options_callback diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9c8bf5a64c6ebd..3e880a0cc68218 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -40,6 +40,17 @@ However, the deprecation identifier will not be modified. ### DEP0001: http.OutgoingMessage.prototype.flush + Type: Runtime @@ -48,6 +59,18 @@ The `OutgoingMessage.prototype.flush()` method is deprecated. Use ### DEP0002: require('\_linklist') + Type: End-of-Life @@ -55,6 +78,17 @@ The `_linklist` module is deprecated. Please use a userland alternative. ### DEP0003: \_writableState.buffer + Type: Runtime @@ -63,6 +97,20 @@ The `_writableState.buffer` property is deprecated. Use the ### DEP0004: CryptoStream.prototype.readyState + Type: End-of-Life @@ -70,6 +118,18 @@ The `CryptoStream.prototype.readyState` property was removed. ### DEP0005: Buffer() constructor + Type: Runtime (supports [`--pending-deprecation`][]) @@ -98,6 +158,18 @@ outside `node_modules` in order to better target developers, rather than users. ### DEP0006: child\_process options.customFds + Type: Runtime @@ -107,6 +179,21 @@ option should be used instead. ### DEP0007: Replace cluster worker.suicide with worker.exitedAfterDisconnect + Type: End-of-Life @@ -119,6 +206,15 @@ precisely describe the actual semantics and was unnecessarily emotion-laden. ### DEP0008: require('constants') + Type: Documentation-only @@ -129,6 +225,18 @@ to the `constants` property exposed by the relevant module. For instance, ### DEP0009: crypto.pbkdf2 without digest + Type: End-of-Life @@ -140,6 +248,17 @@ undefined `digest` will throw a `TypeError`. ### DEP0010: crypto.createCredentials + Type: Runtime @@ -148,6 +267,17 @@ The [`crypto.createCredentials()`][] API is deprecated. Please use ### DEP0011: crypto.Credentials + Type: Runtime @@ -156,6 +286,20 @@ instead. ### DEP0012: Domain.dispose + Type: End-of-Life @@ -164,6 +308,15 @@ explicitly via error event handlers set on the domain instead. ### DEP0013: fs asynchronous function without callback + Type: End-of-Life @@ -172,6 +325,23 @@ in Node.js 10.0.0 onwards. (See https://github.com/nodejs/node/pull/12562.) ### DEP0014: fs.read legacy String interface + Type: End-of-Life @@ -180,6 +350,23 @@ API as mentioned in the documentation instead. ### DEP0015: fs.readSync legacy String interface + Type: End-of-Life @@ -188,6 +375,15 @@ The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the ### DEP0016: GLOBAL/root + Type: Runtime @@ -196,6 +392,15 @@ and should no longer be used. ### DEP0017: Intl.v8BreakIterator + Type: End-of-Life @@ -204,6 +409,12 @@ See [`Intl.Segmenter`](https://github.com/tc39/proposal-intl-segmenter). ### DEP0018: Unhandled promise rejections + Type: Runtime @@ -213,6 +424,17 @@ code. ### DEP0019: require('.') resolved outside directory + Type: Runtime @@ -222,6 +444,17 @@ release. ### DEP0020: Server.connections + Type: Runtime @@ -230,6 +463,17 @@ The [`Server.connections`][] property is deprecated. Please use the ### DEP0021: Server.listenFD + Type: Runtime @@ -238,6 +482,12 @@ The `Server.listenFD()` method is deprecated. Please use ### DEP0022: os.tmpDir() + Type: Runtime @@ -245,6 +495,17 @@ The `os.tmpDir()` API is deprecated. Please use [`os.tmpdir()`][] instead. ### DEP0023: os.getNetworkInterfaces() + Type: Runtime @@ -253,14 +514,33 @@ The `os.getNetworkInterfaces()` method is deprecated. Please use the ### DEP0024: REPLServer.prototype.convertToContext() + Type: End-of-Life -The `REPLServer.prototype.convertToContext()` API is deprecated and should -not be used. +The `REPLServer.prototype.convertToContext()` API has been removed. ### DEP0025: require('sys') + Type: Runtime @@ -268,6 +548,17 @@ The `sys` module is deprecated. Please use the [`util`][] module instead. ### DEP0026: util.print() + Type: Runtime @@ -276,6 +567,17 @@ instead. ### DEP0027: util.puts() + Type: Runtime @@ -283,6 +585,17 @@ The [`util.puts()`][] API is deprecated. Please use [`console.log()`][] instead. ### DEP0028: util.debug() + Type: Runtime @@ -291,6 +604,17 @@ instead. ### DEP0029: util.error() + Type: Runtime @@ -299,6 +623,15 @@ instead. ### DEP0030: SlowBuffer + Type: Documentation-only @@ -307,6 +640,15 @@ The [`SlowBuffer`][] class is deprecated. Please use ### DEP0031: ecdh.setPublicKey() + Type: Documentation-only @@ -315,6 +657,17 @@ API is not useful. ### DEP0032: domain module + Type: Documentation-only @@ -322,6 +675,17 @@ The [`domain`][] module is deprecated and should not be used. ### DEP0033: EventEmitter.listenerCount() + Type: Documentation-only @@ -330,6 +694,17 @@ deprecated. Please use [`emitter.listenerCount(eventName)`][] instead. ### DEP0034: fs.exists(path, callback) + Type: Documentation-only @@ -338,6 +713,16 @@ The [`fs.exists(path, callback)`][] API is deprecated. Please use ### DEP0035: fs.lchmod(path, mode, callback) + Type: Documentation-only @@ -345,13 +730,74 @@ The [`fs.lchmod(path, mode, callback)`][] API is deprecated. ### DEP0036: fs.lchmodSync(path, mode) + Type: Documentation-only The [`fs.lchmodSync(path, mode)`][] API is deprecated. + +### DEP0037: fs.lchown(path, uid, gid, callback) + + +Type: Deprecation revoked + +The [`fs.lchown(path, uid, gid, callback)`][] API is deprecated. + + +### DEP0038: fs.lchownSync(path, uid, gid) + + +Type: Deprecation revoked + +The [`fs.lchownSync(path, uid, gid)`][] API is deprecated. + ### DEP0039: require.extensions + Type: Documentation-only @@ -359,6 +805,12 @@ The [`require.extensions`][] property is deprecated. ### DEP0040: punycode module + Type: Documentation-only @@ -367,6 +819,20 @@ instead. ### DEP0041: NODE\_REPL\_HISTORY\_FILE environment variable + Type: End-of-Life @@ -375,6 +841,20 @@ The `NODE_REPL_HISTORY_FILE` environment variable was removed. Please use ### DEP0042: tls.CryptoStream + Type: End-of-Life @@ -383,6 +863,26 @@ The [`tls.CryptoStream`][] class was removed. Please use ### DEP0043: tls.SecurePair + Type: Documentation-only @@ -391,6 +891,19 @@ The [`tls.SecurePair`][] class is deprecated. Please use ### DEP0044: util.isArray() + Type: Documentation-only @@ -399,6 +912,19 @@ instead. ### DEP0045: util.isBoolean() + Type: Documentation-only @@ -406,6 +932,19 @@ The [`util.isBoolean()`][] API is deprecated. ### DEP0046: util.isBuffer() + Type: Documentation-only @@ -414,6 +953,19 @@ The [`util.isBuffer()`][] API is deprecated. Please use ### DEP0047: util.isDate() + Type: Documentation-only @@ -421,6 +973,19 @@ The [`util.isDate()`][] API is deprecated. ### DEP0048: util.isError() + Type: Documentation-only @@ -428,6 +993,19 @@ The [`util.isError()`][] API is deprecated. ### DEP0049: util.isFunction() + Type: Documentation-only @@ -435,6 +1013,19 @@ The [`util.isFunction()`][] API is deprecated. ### DEP0050: util.isNull() + Type: Documentation-only @@ -442,6 +1033,19 @@ The [`util.isNull()`][] API is deprecated. ### DEP0051: util.isNullOrUndefined() + Type: Documentation-only @@ -449,6 +1053,19 @@ The [`util.isNullOrUndefined()`][] API is deprecated. ### DEP0052: util.isNumber() + Type: Documentation-only @@ -456,6 +1073,19 @@ The [`util.isNumber()`][] API is deprecated. ### DEP0053 util.isObject() + Type: Documentation-only @@ -463,6 +1093,19 @@ The [`util.isObject()`][] API is deprecated. ### DEP0054: util.isPrimitive() + Type: Documentation-only @@ -470,6 +1113,19 @@ The [`util.isPrimitive()`][] API is deprecated. ### DEP0055: util.isRegExp() + Type: Documentation-only @@ -477,6 +1133,19 @@ The [`util.isRegExp()`][] API is deprecated. ### DEP0056: util.isString() + Type: Documentation-only @@ -484,6 +1153,19 @@ The [`util.isString()`][] API is deprecated. ### DEP0057: util.isSymbol() + Type: Documentation-only @@ -491,6 +1173,19 @@ The [`util.isSymbol()`][] API is deprecated. ### DEP0058: util.isUndefined() + Type: Documentation-only @@ -498,6 +1193,15 @@ The [`util.isUndefined()`][] API is deprecated. ### DEP0059: util.log() + Type: Documentation-only @@ -505,6 +1209,15 @@ The [`util.log()`][] API is deprecated. ### DEP0060: util.\_extend() + Type: Documentation-only @@ -512,6 +1225,15 @@ The [`util._extend()`][] API is deprecated. ### DEP0061: fs.SyncWriteStream + Type: Runtime @@ -520,6 +1242,12 @@ API. No alternative API is available. Please use a userland alternative. ### DEP0062: node --debug + Type: Runtime @@ -529,6 +1257,12 @@ instead. ### DEP0063: ServerResponse.prototype.writeHeader() + Type: Documentation-only @@ -540,6 +1274,26 @@ officially supported API. ### DEP0064: tls.createSecurePair() + Type: Runtime @@ -548,6 +1302,15 @@ The `tls.createSecurePair()` API was deprecated in documentation in Node.js ### DEP0065: repl.REPL_MODE_MAGIC and NODE_REPL_MODE=magic + Type: End-of-Life @@ -562,6 +1325,12 @@ removed. Please use `sloppy` instead. ### DEP0066: outgoingMessage.\_headers, outgoingMessage.\_headerNames + Type: Documentation-only @@ -577,6 +1346,12 @@ were never documented as officially supported properties. ### DEP0067: OutgoingMessage.prototype.\_renderHeaders + Type: Documentation-only @@ -588,6 +1363,12 @@ an officially supported API. ### DEP0068: node debug + Type: Runtime @@ -596,6 +1377,18 @@ a V8-inspector based CLI debugger available through `node inspect`. ### DEP0069: vm.runInDebugContext(string) + Type: End-of-Life @@ -605,6 +1398,15 @@ DebugContext was an experimental API. ### DEP0070: async_hooks.currentId() + Type: End-of-Life @@ -615,6 +1417,15 @@ This change was made while `async_hooks` was an experimental API. ### DEP0071: async_hooks.triggerId() + Type: End-of-Life @@ -625,6 +1436,15 @@ This change was made while `async_hooks` was an experimental API. ### DEP0072: async_hooks.AsyncResource.triggerId() + Type: End-of-Life @@ -635,6 +1455,15 @@ This change was made while `async_hooks` was an experimental API. ### DEP0073: Several internal properties of net.Server + Type: End-of-Life @@ -646,6 +1475,12 @@ code, no replacement API is provided. ### DEP0074: REPLServer.bufferedCommand + Type: Runtime @@ -654,6 +1489,12 @@ The `REPLServer.bufferedCommand` property was deprecated in favor of ### DEP0075: REPLServer.parseREPLKeyword() + Type: Runtime @@ -661,6 +1502,15 @@ Type: Runtime ### DEP0076: tls.parseCertString() + Type: Runtime @@ -684,6 +1534,12 @@ difference is that `querystring.parse()` does url decoding: ### DEP0077: Module.\_debug() + Type: Runtime @@ -694,6 +1550,12 @@ supported API. ### DEP0078: REPLServer.turnOffEditorMode() + Type: Runtime @@ -701,6 +1563,15 @@ Type: Runtime ### DEP0079: Custom inspection function on Objects via .inspect() + Type: Runtime @@ -711,6 +1582,12 @@ may be specified. ### DEP0080: path.\_makeLong() + Type: Documentation-only @@ -720,6 +1597,12 @@ and replaced with an identical, public `path.toNamespacedPath()` method. ### DEP0081: fs.truncate() using a file descriptor + Type: Runtime @@ -729,6 +1612,12 @@ file descriptors. ### DEP0082: REPLServer.prototype.memory() + Type: Runtime @@ -737,6 +1626,12 @@ the `REPLServer` itself. Do not use this function. ### DEP0083: Disabling ECDH by setting ecdhCurve to false + Type: Runtime @@ -747,6 +1642,12 @@ the client. Use the `ciphers` parameter instead. ### DEP0084: requiring bundled internal dependencies + Type: Runtime @@ -778,6 +1679,17 @@ code modification is necessary if that is done. ### DEP0085: AsyncHooks Sensitive API + Type: End-of-Life @@ -787,6 +1699,17 @@ API instead. ### DEP0086: Remove runInAsyncIdScope + Type: End-of-Life @@ -796,6 +1719,14 @@ details. ### DEP0089: require('assert') + Type: Documentation-only @@ -805,6 +1736,12 @@ same as the legacy assert but it will always use strict equality checks. ### DEP0090: Invalid GCM authentication tag lengths + Type: Runtime @@ -817,6 +1754,12 @@ is not included in this list will be considered invalid in compliance with ### DEP0091: crypto.DEFAULT_ENCODING + Type: Runtime @@ -824,6 +1767,12 @@ The [`crypto.DEFAULT_ENCODING`][] property is deprecated. ### DEP0092: Top-level `this` bound to `module.exports` + Type: Documentation-only @@ -833,6 +1782,12 @@ or `module.exports` instead. ### DEP0093: crypto.fips is deprecated and replaced. + Type: Documentation-only @@ -841,6 +1796,12 @@ and `crypto.getFips()` instead. ### DEP0094: Using `assert.fail()` with more than one argument. + Type: Runtime @@ -850,6 +1811,12 @@ method. ### DEP0095: timers.enroll() + Type: Runtime @@ -858,6 +1825,12 @@ Type: Runtime ### DEP0096: timers.unenroll() + Type: Runtime @@ -866,6 +1839,12 @@ Type: Runtime ### DEP0097: MakeCallback with domain property + Type: Runtime @@ -875,6 +1854,15 @@ should start using the `async_context` variant of `MakeCallback` or ### DEP0098: AsyncHooks Embedder AsyncResource.emitBefore and AsyncResource.emitAfter APIs + Type: Runtime @@ -888,6 +1876,12 @@ https://github.com/nodejs/node/pull/18513 for more details. ### DEP0099: async context-unaware node::MakeCallback C++ APIs + Type: Compile-time @@ -897,6 +1891,14 @@ parameter. ### DEP0100: process.assert() + Type: Runtime @@ -906,6 +1908,12 @@ This was never a documented feature. ### DEP0101: --with-lttng + Type: End-of-Life @@ -913,6 +1921,12 @@ The `--with-lttng` compile-time option has been removed. ### DEP0102: Using `noAssert` in Buffer#(read|write) operations. + Type: End-of-Life @@ -922,6 +1936,15 @@ could lead to hard to find errors and crashes. ### DEP0103: process.binding('util').is[...] typechecks + Type: Documentation-only (supports [`--pending-deprecation`][]) @@ -933,6 +1956,12 @@ This deprecation has been superseded by the deprecation of the ### DEP0104: process.env string coercion + Type: Documentation-only (supports [`--pending-deprecation`][]) @@ -944,6 +1973,12 @@ assigning it to `process.env`. ### DEP0105: decipher.finaltol + Type: Runtime @@ -953,6 +1988,12 @@ is recommended to use [`decipher.final()`][] instead. ### DEP0106: crypto.createCipher and crypto.createDecipher + Type: Documentation-only @@ -965,6 +2006,12 @@ initialization vectors. It is recommended to derive a key using ### DEP0107: tls.convertNPNProtocols() + Type: Runtime @@ -973,6 +2020,12 @@ core and obsoleted by the removal of NPN (Next Protocol Negotiation) support. ### DEP0108: zlib.bytesRead + Type: Documentation-only @@ -983,6 +2036,12 @@ expose values under these names. ### DEP0110: vm.Script cached data + Type: Documentation-only @@ -991,6 +2050,12 @@ The `produceCachedData` option is deprecated. Use ### DEP0111: process.binding() + Type: Documentation-only @@ -1034,6 +2099,8 @@ only. Use of `process.binding()` by userland code is unsupported. [`fs.exists(path, callback)`]: fs.html#fs_fs_exists_path_callback [`fs.lchmod(path, mode, callback)`]: fs.html#fs_fs_lchmod_path_mode_callback [`fs.lchmodSync(path, mode)`]: fs.html#fs_fs_lchmodsync_path_mode +[`fs.lchown(path, uid, gid, callback)`]: fs.html#fs_fs_lchown_path_uid_gid_callback +[`fs.lchownSync(path, uid, gid)`]: fs.html#fs_fs_lchownsync_path_uid_gid [`fs.read()`]: fs.html#fs_fs_read_fd_buffer_offset_length_position_callback [`fs.readSync()`]: fs.html#fs_fs_readsync_fd_buffer_offset_length_position [`fs.stat()`]: fs.html#fs_fs_stat_path_options_callback diff --git a/doc/api/dns.md b/doc/api/dns.md index 1d988d8b574e23..cbe0e8628d71f7 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -1078,7 +1078,7 @@ implications for some applications, see the [`UV_THREADPOOL_SIZE`][] documentation for more information. Note that various networking APIs will call `dns.lookup()` internally to resolve -host names. If that is an issue, consider resolving the hostname to and address +host names. If that is an issue, consider resolving the hostname to an address using `dns.resolve()` and using the address instead of a host name. Also, some networking APIs (such as [`socket.connect()`][] and [`dgram.createSocket()`][]) allow the default resolver, `dns.lookup()`, to be replaced. diff --git a/doc/api/fs.md b/doc/api/fs.md index 25cb3fc7f87ee2..0ad94260516e2b 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2380,6 +2380,9 @@ a `Promise` for an `Object` with `bytesRead` and `buffer` properties. * `path` {string|Buffer|URL} * `options` {string|Object} * `encoding` {string} **Default:** `'utf8'` + * `withFileTypes` {boolean} **Default:** `false` * Returns: {Promise} Reads the contents of a directory then resolves the `Promise` with an array @@ -4179,6 +4190,9 @@ object with an `encoding` property specifying the character encoding to use for the filenames. If the `encoding` is set to `'buffer'`, the filenames returned will be passed as `Buffer` objects. +If `options.withFileTypes` is set to `true`, the resolved array will contain +[`fs.Dirent`][] objects. + ### fsPromises.readFile(path[, options]) + +* {boolean} + +Set the `true` if the `END_STREAM` flag was set in the request or response +HEADERS frame received, indicating that no additional data should be received +and the readable side of the `Http2Stream` will be closed. + #### http2stream.pending + +* `msecs` {number} **Default:** `120000` (2 minutes) +* `callback` {Function} +* Returns: {Http2Server} + +Used to set the timeout value for http2 server requests, +and sets a callback function that is called when there is no activity +on the `Http2Server` after `msecs` milliseconds. + +The given callback is registered as a listener on the `'timeout'` event. + +In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK` +error will be thrown. + ### Class: Http2SecureServer + +* `msecs` {number} **Default:** `120000` (2 minutes) +* `callback` {Function} +* Returns: {Http2SecureServer} + +Used to set the timeout value for http2 secure server requests, +and sets a callback function that is called when there is no activity +on the `Http2SecureServer` after `msecs` milliseconds. + +The given callback is registered as a listener on the `'timeout'` event. + +In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK` +error will be thrown. + ### http2.createServer(options[, onRequestHandler]) +```C +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); +``` + + - `[in] env`: The environment that the API is invoked under. + - `[in] js_object`: The JavaScript object to which the native data will be + attached. + - `[in] native_object`: The native data that will be attached to the JavaScript + object. + - `[in] finalize_cb`: Native callback that will be used to free the + native data when the JavaScript object is ready for garbage-collection. + - `[in] finalize_hint`: Optional contextual hint that is passed to the + finalize callback. + - `[out] result`: Optional reference to the JavaScript object. + +Returns `napi_ok` if the API succeeded. + +Adds a `napi_finalize` callback which will be called when the JavaScript object +in `js_object` is ready for garbage collection. This API is similar to +`napi_wrap()` except that +* the native data cannot be retrieved later using `napi_unwrap()`, +* nor can it be removed later using `napi_remove_wrap()`, and +* the API can be called multiple times with different data items in order to + attach each of them to the JavaScript object. + +*Caution*: The optional returned reference (if obtained) 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 may never +be invoked. Therefore, when obtaining a reference a finalize callback is also +required in order to enable correct disposal of the reference. + ## Simple Asynchronous Operations Addon modules often need to leverage async helpers from libuv as part of their @@ -4559,6 +4616,7 @@ This API may only be called from the main thread. [Working with JavaScript Values]: #n_api_working_with_javascript_values [Working with JavaScript Values - Abstract Operations]: #n_api_working_with_javascript_values_abstract_operations +[`napi_add_finalizer`]: #n_api_napi_add_finalizer [`napi_async_init`]: #n_api_napi_async_init [`napi_cancel_async_work`]: #n_api_napi_cancel_async_work [`napi_close_escapable_handle_scope`]: #n_api_napi_close_escapable_handle_scope diff --git a/doc/api/os.md b/doc/api/os.md index a0ff5e7ff17bf0..ad5736d7690016 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -371,6 +371,9 @@ priority classes, `priority` is mapped to one of six priority constants in mapping may cause the return value to be slightly different on Windows. To avoid confusion, it is recommended to set `priority` to one of the priority constants. +On Windows setting priority to `PRIORITY_HIGHEST` requires elevated user, +otherwise the set priority will be silently reduced to `PRIORITY_HIGH`. + ## os.tmpdir() -* `buffer` {Buffer} A `Buffer` containing the bytes to decode. +* `buffer` {Buffer|TypedArray|DataView} A `Buffer`, or `TypedArray`, or + `DataView` containing the bytes to decode. * Returns: {string} Returns any remaining input stored in the internal buffer as a string. Bytes @@ -79,10 +80,11 @@ changes: character instead of one for each individual byte. --> -* `buffer` {Buffer} A `Buffer` containing the bytes to decode. +* `buffer` {Buffer|TypedArray|DataView} A `Buffer`, or `TypedArray`, or + `DataView` containing the bytes to decode. * Returns: {string} Returns a decoded string, ensuring that any incomplete multibyte characters at -the end of the `Buffer` are omitted from the returned string and stored in an -internal buffer for the next call to `stringDecoder.write()` or -`stringDecoder.end()`. + the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the + returned string and stored in an internal buffer for the next call to + `stringDecoder.write()` or `stringDecoder.end()`. diff --git a/doc/api/util.md b/doc/api/util.md index e9336add6733d8..2b1e71100503d5 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1054,10 +1054,31 @@ by `new Boolean()`. ```js util.types.isBooleanObject(false); // Returns false util.types.isBooleanObject(true); // Returns false -util.types.isBooleanObject(new Boolean(false)); // Returns true -util.types.isBooleanObject(new Boolean(true)); // Returns true +util.types.isBooleanObject(new Boolean(false)); // Returns true +util.types.isBooleanObject(new Boolean(true)); // Returns true util.types.isBooleanObject(Boolean(false)); // Returns false -util.types.isBooleanObject(Boolean(true)); // Returns false +util.types.isBooleanObject(Boolean(true)); // Returns false +``` + +### util.types.isBoxedPrimitive(value) + + +* `value` {any} +* Returns: {boolean} + +Returns `true` if the value is any boxed primitive object, e.g. created +by `new Boolean()`, `new String()` or `Object(Symbol())`. + +For example: + +```js +util.types.isBoxedPrimitive(false); // Returns false +util.types.isBoxedPrimitive(new Boolean(false)); // Returns true +util.types.isBoxedPrimitive(Symbol('foo')); // Returns false +util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true +util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true ``` ### util.types.isDataView(value) diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index 572f5d1f14559e..04b836a947bddf 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -9,6 +9,7 @@ +10.11.0
10.10.0
10.9.0
10.8.0
@@ -38,6 +39,132 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2018-09-20, Version 10.11.0 (Current), @targos + +### Notable Changes + +* **fs** + * Fixed fsPromises.readdir `withFileTypes`. [#22832](https://github.com/nodejs/node/pull/22832) +* **http2** + * Added `http2stream.endAfterHeaders` property. [#22843](https://github.com/nodejs/node/pull/22843) +* **util** + * Added `util.types.isBoxedPrimitive(value)`. [#22620](https://github.com/nodejs/node/pull/22620) +* **Added new collaborators**: + * [boneskull](https://github.com/boneskull) - Christopher Hiller +* **The Technical Steering Committee has new members**: + * [apapirovski](https://github.com/apapirovski) - Anatoli Papirovski + * [gabrielschulhof](https://github.com/gabrielschulhof) - Gabriel Schulhof + +### Commits + +* [[`add1fcd301`](https://github.com/nodejs/node/commit/add1fcd301)] - **assert**: add default operator to `assert.fail()` (Ruben Bridgewater) [#22694](https://github.com/nodejs/node/pull/22694) +* [[`0015430b2c`](https://github.com/nodejs/node/commit/0015430b2c)] - **assert**: align argument names (Ruben Bridgewater) [#22760](https://github.com/nodejs/node/pull/22760) +* [[`3fcd54fe46`](https://github.com/nodejs/node/commit/3fcd54fe46)] - **build**: do not lint fixtures in make lint-md (Joyee Cheung) [#22549](https://github.com/nodejs/node/pull/22549) +* [[`84d498c044`](https://github.com/nodejs/node/commit/84d498c044)] - **build**: skip cctest on Windows shared lib build (Yihong Wang) [#21228](https://github.com/nodejs/node/pull/21228) +* [[`3ff425e7e9`](https://github.com/nodejs/node/commit/3ff425e7e9)] - **build**: remove /MP from default additonal options (William Skellenger) [#22661](https://github.com/nodejs/node/pull/22661) +* [[`a78a946648`](https://github.com/nodejs/node/commit/a78a946648)] - **build**: make doc generation work on Windows (Tobias Nießen) [#22749](https://github.com/nodejs/node/pull/22749) +* [[`5bae8b9728`](https://github.com/nodejs/node/commit/5bae8b9728)] - **build**: add `--verbose` to `./configure` (Refael Ackermann) [#22450](https://github.com/nodejs/node/pull/22450) +* [[`db10db9e18`](https://github.com/nodejs/node/commit/db10db9e18)] - **build**: move meta-shebang back to `configure` (Refael Ackermann) [#22450](https://github.com/nodejs/node/pull/22450) +* [[`db52f8f913`](https://github.com/nodejs/node/commit/db52f8f913)] - **build**: rename configure to configure.py (Refael Ackermann) [#22450](https://github.com/nodejs/node/pull/22450) +* [[`b4a79acd98`](https://github.com/nodejs/node/commit/b4a79acd98)] - **build,win**: exclude warning 4244 only for deps (Refael Ackermann) [#22698](https://github.com/nodejs/node/pull/22698) +* [[`dbe27d7c80`](https://github.com/nodejs/node/commit/dbe27d7c80)] - **build,win**: generate single PDB file per target (Refael Ackermann) [#22698](https://github.com/nodejs/node/pull/22698) +* [[`b3bc642d96`](https://github.com/nodejs/node/commit/b3bc642d96)] - **build,win**: WHOLEARCHIVE needs just lib name (Refael Ackermann) [#22698](https://github.com/nodejs/node/pull/22698) +* [[`624e516fb7`](https://github.com/nodejs/node/commit/624e516fb7)] - **crypto**: fix edge case in authenticated encryption (Tobias Nießen) [#22828](https://github.com/nodejs/node/pull/22828) +* [[`329ac60441`](https://github.com/nodejs/node/commit/329ac60441)] - **crypto**: remove unused scrypt validation parameter (Tobias Nießen) [#22902](https://github.com/nodejs/node/pull/22902) +* [[`9b58b79372`](https://github.com/nodejs/node/commit/9b58b79372)] - **crypto**: rename symbols to match guidelines (Tobias Nießen) [#22770](https://github.com/nodejs/node/pull/22770) +* [[`ff17b39008`](https://github.com/nodejs/node/commit/ff17b39008)] - **crypto**: fix public key encryption internals (Tobias Nießen) [#22780](https://github.com/nodejs/node/pull/22780) +* [[`566075967d`](https://github.com/nodejs/node/commit/566075967d)] - **deps**: cherry-pick 9a23bdd from upstream V8 (Daniel Beckert) [#22910](https://github.com/nodejs/node/pull/22910) +* [[`bb3292fd1f`](https://github.com/nodejs/node/commit/bb3292fd1f)] - **deps**: add missing HandleScope in FieldType::PrintTo (Yang Guo) [#22890](https://github.com/nodejs/node/pull/22890) +* [[`967fbebf47`](https://github.com/nodejs/node/commit/967fbebf47)] - **deps**: cherry-pick 2363cdf from upstream V8 (Ali Ijaz Sheikh) [#22812](https://github.com/nodejs/node/pull/22812) +* [[`e85aa19a82`](https://github.com/nodejs/node/commit/e85aa19a82)] - **deps**: patch V8 to 6.8.275.32 (Michaël Zasso) [#22682](https://github.com/nodejs/node/pull/22682) +* [[`6a333999cf`](https://github.com/nodejs/node/commit/6a333999cf)] - **deps**: backport detailed line info for CPU profiler (Peter Marshall) [#22688](https://github.com/nodejs/node/pull/22688) +* [[`6ed58457e2`](https://github.com/nodejs/node/commit/6ed58457e2)] - **doc**: explain how to invoke gc (isurusiri) [#20431](https://github.com/nodejs/node/pull/20431) +* [[`6e9f1d6d08`](https://github.com/nodejs/node/commit/6e9f1d6d08)] - **doc**: add boneskull as collaborator (Christopher Hiller) [#22917](https://github.com/nodejs/node/pull/22917) +* [[`f0679d9b24`](https://github.com/nodejs/node/commit/f0679d9b24)] - **doc**: update 6.x to 8.x in backporting wiki (Kamat, Trivikram) [#22879](https://github.com/nodejs/node/pull/22879) +* [[`5c5d881beb`](https://github.com/nodejs/node/commit/5c5d881beb)] - **doc**: improve asymmetric crypto docs (Anna Henningsen) [#22820](https://github.com/nodejs/node/pull/22820) +* [[`0873d0abfb`](https://github.com/nodejs/node/commit/0873d0abfb)] - **doc**: add missing options for crypto sign.sign() (Mohit kumar Bajoria) [#22824](https://github.com/nodejs/node/pull/22824) +* [[`08e427afea`](https://github.com/nodejs/node/commit/08e427afea)] - **doc**: add full deprecation history (Tobias Nießen) [#22766](https://github.com/nodejs/node/pull/22766) +* [[`ed142e1355`](https://github.com/nodejs/node/commit/ed142e1355)] - **doc**: add withFileTypes option to fsPromises.readdir (Bryan English) [#22833](https://github.com/nodejs/node/pull/22833) +* [[`8e8748c329`](https://github.com/nodejs/node/commit/8e8748c329)] - **doc**: fix typo in dns docs (Mohammed Essehemy) [#22866](https://github.com/nodejs/node/pull/22866) +* [[`cadb3606f8`](https://github.com/nodejs/node/commit/cadb3606f8)] - **doc**: update AUTHORS list (Anna Henningsen) [#22771](https://github.com/nodejs/node/pull/22771) +* [[`0c39fa4240`](https://github.com/nodejs/node/commit/0c39fa4240)] - **doc**: add reference to guide for N-API additions (Michael Dawson) [#22593](https://github.com/nodejs/node/pull/22593) +* [[`ef2a0bdc2e`](https://github.com/nodejs/node/commit/ef2a0bdc2e)] - **doc**: document http2 timeouts (Sagi Tsofan) [#22798](https://github.com/nodejs/node/pull/22798) +* [[`cf95b61ad5`](https://github.com/nodejs/node/commit/cf95b61ad5)] - **doc**: add gabrielschulhof to TSC (Rich Trott) [#22818](https://github.com/nodejs/node/pull/22818) +* [[`678673098f`](https://github.com/nodejs/node/commit/678673098f)] - **doc**: add history for withFileTypes in fs.readdir\[Sync\]() (Tien Do) [#22794](https://github.com/nodejs/node/pull/22794) +* [[`bda3311afe`](https://github.com/nodejs/node/commit/bda3311afe)] - **doc**: `node debug` → `node inspect` in CLI docs (Anna Henningsen) [#22774](https://github.com/nodejs/node/pull/22774) +* [[`9942117e6e`](https://github.com/nodejs/node/commit/9942117e6e)] - **doc**: update mmarchini's e-mail (Matheus Marchini) [#22776](https://github.com/nodejs/node/pull/22776) +* [[`6579d05b15`](https://github.com/nodejs/node/commit/6579d05b15)] - **doc**: fix description of DEP0024 (Tobias Nießen) [#22755](https://github.com/nodejs/node/pull/22755) +* [[`c1c78ca4eb`](https://github.com/nodejs/node/commit/c1c78ca4eb)] - **doc**: improve assert documentation (Ruben Bridgewater) [#22692](https://github.com/nodejs/node/pull/22692) +* [[`e5cdfb0856`](https://github.com/nodejs/node/commit/e5cdfb0856)] - **doc**: fix typo in CHANGELOG\_V10.md (Chakravarthy S M) [#22744](https://github.com/nodejs/node/pull/22744) +* [[`2b49b43f79`](https://github.com/nodejs/node/commit/2b49b43f79)] - **doc**: added symbols guidelines (Matteo Collina) [#22684](https://github.com/nodejs/node/pull/22684) +* [[`688d01c7be`](https://github.com/nodejs/node/commit/688d01c7be)] - **doc**: add warning to readline's close() method (cjihrig) [#22679](https://github.com/nodejs/node/pull/22679) +* [[`47acb78528`](https://github.com/nodejs/node/commit/47acb78528)] - **doc**: add apapirovski to TSC (Rich Trott) [#22717](https://github.com/nodejs/node/pull/22717) +* [[`5da1f0ca2c`](https://github.com/nodejs/node/commit/5da1f0ca2c)] - **doc, win**: improve os.setPriority documentation (Bartosz Sosnowski) [#22817](https://github.com/nodejs/node/pull/22817) +* [[`d69d06bbf7`](https://github.com/nodejs/node/commit/d69d06bbf7)] - **errors**: add useOriginalName to internal/errors (Joyee Cheung) [#22556](https://github.com/nodejs/node/pull/22556) +* [[`2cb01f0d12`](https://github.com/nodejs/node/commit/2cb01f0d12)] - **errors**: decapitalize PBKDF2 error (Tobias Nießen) [#22687](https://github.com/nodejs/node/pull/22687) +* [[`24a35f914a`](https://github.com/nodejs/node/commit/24a35f914a)] - **fs**: fix promisified fs.readdir withFileTypes (Anatoli Papirovski) [#22832](https://github.com/nodejs/node/pull/22832) +* [[`f0a40172a8`](https://github.com/nodejs/node/commit/f0a40172a8)] - **fs**: ensure readdir() callback is only called once (cjihrig) [#22793](https://github.com/nodejs/node/pull/22793) +* [[`790864bf9b`](https://github.com/nodejs/node/commit/790864bf9b)] - **(SEMVER-MINOR)** **http2**: add http2stream.endAfterHeaders property (James M Snell) [#22843](https://github.com/nodejs/node/pull/22843) +* [[`2abdbf4368`](https://github.com/nodejs/node/commit/2abdbf4368)] - **lib**: generate allowedNodeEnvironmentFlags lazily (Anna Henningsen) [#22638](https://github.com/nodejs/node/pull/22638) +* [[`49b59334d0`](https://github.com/nodejs/node/commit/49b59334d0)] - **lib**: simplify 'processChunkSync' (MaleDong) [#22802](https://github.com/nodejs/node/pull/22802) +* [[`e2b72c2ca3`](https://github.com/nodejs/node/commit/e2b72c2ca3)] - **lib**: remove unnecessary symbols (MaleDong) [#22455](https://github.com/nodejs/node/pull/22455) +* [[`25220f0ce1`](https://github.com/nodejs/node/commit/25220f0ce1)] - **lib,doc**: remove unused parameter, improve docs (MaleDong) [#22858](https://github.com/nodejs/node/pull/22858) +* [[`bb2bbc8ebe`](https://github.com/nodejs/node/commit/bb2bbc8ebe)] - **n-api**: add generic finalizer callback (Gabriel Schulhof) [#22244](https://github.com/nodejs/node/pull/22244) +* [[`4e3f1aef8d`](https://github.com/nodejs/node/commit/4e3f1aef8d)] - **net**: port isIPv6 to JS (Weijia Wang) [#22673](https://github.com/nodejs/node/pull/22673) +* [[`5c8495349a`](https://github.com/nodejs/node/commit/5c8495349a)] - **path**: remove unnecessary if statement (William Chargin) [#22273](https://github.com/nodejs/node/pull/22273) +* [[`4ab9d6f3db`](https://github.com/nodejs/node/commit/4ab9d6f3db)] - **process**: generate list of allowed env flags programmatically (Anna Henningsen) [#22638](https://github.com/nodejs/node/pull/22638) +* [[`5d5c3fab25`](https://github.com/nodejs/node/commit/5d5c3fab25)] - **src**: refactor `Environment::GetCurrent()` usage (Anna Henningsen) [#22819](https://github.com/nodejs/node/pull/22819) +* [[`5a494aed8c`](https://github.com/nodejs/node/commit/5a494aed8c)] - **src**: move no\_async\_hooks\_checks to env (Daniel Bevenius) [#22784](https://github.com/nodejs/node/pull/22784) +* [[`bc076120f3`](https://github.com/nodejs/node/commit/bc076120f3)] - **src**: fix `--prof-process` CLI argument handling (Anna Henningsen) [#22790](https://github.com/nodejs/node/pull/22790) +* [[`7e4f29f201`](https://github.com/nodejs/node/commit/7e4f29f201)] - **src**: move DebugPortGetter/Setter to node\_process.cc (James M Snell) [#22758](https://github.com/nodejs/node/pull/22758) +* [[`1d3a63f079`](https://github.com/nodejs/node/commit/1d3a63f079)] - **src**: move getActiveResources/Handles to node\_process.cc (James M Snell) [#22758](https://github.com/nodejs/node/pull/22758) +* [[`0c3242862a`](https://github.com/nodejs/node/commit/0c3242862a)] - **src**: make `FIXED\_ONE\_BYTE\_STRING` an inline fn (Anna Henningsen) [#22725](https://github.com/nodejs/node/pull/22725) +* [[`7fa5f54e6f`](https://github.com/nodejs/node/commit/7fa5f54e6f)] - **src**: remove trace\_sync\_io\_ from env (Daniel Bevenius) [#22726](https://github.com/nodejs/node/pull/22726) +* [[`c3c5141f68`](https://github.com/nodejs/node/commit/c3c5141f68)] - **src**: remove abort\_on\_uncaught\_exception node.cc (Daniel Bevenius) [#22724](https://github.com/nodejs/node/pull/22724) +* [[`44f1438b79`](https://github.com/nodejs/node/commit/44f1438b79)] - **src**: fix trace-event-file-pattern description (Andreas Madsen) [#22690](https://github.com/nodejs/node/pull/22690) +* [[`a10d03d4fe`](https://github.com/nodejs/node/commit/a10d03d4fe)] - **string_decoder**: support typed array or data view (Benjamin Chen) [#22562](https://github.com/nodejs/node/pull/22562) +* [[`ff6e4ea4bd`](https://github.com/nodejs/node/commit/ff6e4ea4bd)] - **test**: prepare test-assert for strictEqual linting (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`5a0632666b`](https://github.com/nodejs/node/commit/5a0632666b)] - **test**: remove string literal from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`5d4cbd7fa1`](https://github.com/nodejs/node/commit/5d4cbd7fa1)] - **test**: remove string literal from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`5316334955`](https://github.com/nodejs/node/commit/5316334955)] - **test**: remove string literal arg from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`59b6968fb6`](https://github.com/nodejs/node/commit/59b6968fb6)] - **test**: remove string literal message from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`266f1a9cd8`](https://github.com/nodejs/node/commit/266f1a9cd8)] - **test**: remove string literal from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`a5f7f1d985`](https://github.com/nodejs/node/commit/a5f7f1d985)] - **test**: refactor flag check (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`e5de225680`](https://github.com/nodejs/node/commit/e5de225680)] - **test**: simplify assertion in http2 tests (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`b31a4d0808`](https://github.com/nodejs/node/commit/b31a4d0808)] - **test**: improve assertion in test-inspector.js (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`b301a7b7ec`](https://github.com/nodejs/node/commit/b301a7b7ec)] - **test**: remove string literal message in assertions (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`a15bfdad78`](https://github.com/nodejs/node/commit/a15bfdad78)] - **test**: remove string literal message from assertion (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`e580a44ab6`](https://github.com/nodejs/node/commit/e580a44ab6)] - **test**: don't inspect values if not necessary (Ruben Bridgewater) [#22903](https://github.com/nodejs/node/pull/22903) +* [[`9e1f7366db`](https://github.com/nodejs/node/commit/9e1f7366db)] - **test**: minor refactor in common/index.js (James M Snell) [#22738](https://github.com/nodejs/node/pull/22738) +* [[`bd6b2ab21d`](https://github.com/nodejs/node/commit/bd6b2ab21d)] - **test**: checks on napi factory wrap’s finalization (Lucas Woo) [#22612](https://github.com/nodejs/node/pull/22612) +* [[`b1d667bca9`](https://github.com/nodejs/node/commit/b1d667bca9)] - **test**: refactor structure of common/index (James M Snell) [#22511](https://github.com/nodejs/node/pull/22511) +* [[`d5e9801d8d`](https://github.com/nodejs/node/commit/d5e9801d8d)] - **test**: remove string literal from deepStrictEqual (iliashkolyar) [#22742](https://github.com/nodejs/node/pull/22742) +* [[`649288bef6`](https://github.com/nodejs/node/commit/649288bef6)] - **test**: remove string argument to strictEqual() (Hariss096) [#22718](https://github.com/nodejs/node/pull/22718) +* [[`36666629f6`](https://github.com/nodejs/node/commit/36666629f6)] - **test**: replaces assert.throws() with common.expectsError() (Saud Khanzada) [#22689](https://github.com/nodejs/node/pull/22689) +* [[`13b8011589`](https://github.com/nodejs/node/commit/13b8011589)] - **test**: remove usage of deprecated V8 APIs in addons (Michaël Zasso) [#22704](https://github.com/nodejs/node/pull/22704) +* [[`1ce94164a5`](https://github.com/nodejs/node/commit/1ce94164a5)] - **test**: fix flaky addons/callback-scope/test-resolve-async (Anna Henningsen) [#22664](https://github.com/nodejs/node/pull/22664) +* [[`6367349a95`](https://github.com/nodejs/node/commit/6367349a95)] - **tools**: synchronize deepStrictEqual() message rules (Rich Trott) [#22887](https://github.com/nodejs/node/pull/22887) +* [[`8ffcb2d2ca`](https://github.com/nodejs/node/commit/8ffcb2d2ca)] - **tools**: prevent string literals in some assertions (Rich Trott) [#22849](https://github.com/nodejs/node/pull/22849) +* [[`4ff49ae81c`](https://github.com/nodejs/node/commit/4ff49ae81c)] - **tools**: merge custom cpplint with cpplint v1.3.0 (Christopher Hiller) [#22864](https://github.com/nodejs/node/pull/22864) +* [[`15a59bb2b2`](https://github.com/nodejs/node/commit/15a59bb2b2)] - **tools**: update ESLint to 5.6.0 (Rich Trott) [#22882](https://github.com/nodejs/node/pull/22882) +* [[`b2abeff43c`](https://github.com/nodejs/node/commit/b2abeff43c)] - **tools**: implement update-authors in JS (Anna Henningsen) [#22771](https://github.com/nodejs/node/pull/22771) +* [[`9564f7a123`](https://github.com/nodejs/node/commit/9564f7a123)] - **tools**: fix doc tool behavior for version arrays (Tobias Nießen) [#22766](https://github.com/nodejs/node/pull/22766) +* [[`d03ce9df05`](https://github.com/nodejs/node/commit/d03ce9df05)] - **tools**: use lint-md.js (Refael Ackermann) [#20109](https://github.com/nodejs/node/pull/20109) +* [[`22fefaeeeb`](https://github.com/nodejs/node/commit/22fefaeeeb)] - **tools**: `make lint-md-rollup` & checkin `lint-md.js` (Refael Ackermann) [#20109](https://github.com/nodejs/node/pull/20109) +* [[`350a3e17f5`](https://github.com/nodejs/node/commit/350a3e17f5)] - **tools**: relocate `remark-preset-lint-node` (Refael Ackermann) [#20109](https://github.com/nodejs/node/pull/20109) +* [[`25e1060ce4`](https://github.com/nodejs/node/commit/25e1060ce4)] - **tools**: update `node-lint-md-cli-rollup` (Refael Ackermann) [#20109](https://github.com/nodejs/node/pull/20109) +* [[`37b27a5604`](https://github.com/nodejs/node/commit/37b27a5604)] - **tools**: vendor in node-lint-md-cli-rollup (Refael Ackermann) [#20109](https://github.com/nodejs/node/pull/20109) +* [[`62d73042c6`](https://github.com/nodejs/node/commit/62d73042c6)] - **tools**: update eslint to v5.5.0 (Ruben Bridgewater) [#22720](https://github.com/nodejs/node/pull/22720) +* [[`a7e8949cb7`](https://github.com/nodejs/node/commit/a7e8949cb7)] - **tools**: add \[src\] links to child-process.html (Sam Ruby) [#22706](https://github.com/nodejs/node/pull/22706) +* [[`ca06e65b08`](https://github.com/nodejs/node/commit/ca06e65b08)] - **tools**: update dmn to 2.0.0 (Rich Trott) [#22733](https://github.com/nodejs/node/pull/22733) +* [[`649fcbba6f`](https://github.com/nodejs/node/commit/649fcbba6f)] - **tools,doc**: apilinks should handle root scenarios (Kyle Farnung) [#22721](https://github.com/nodejs/node/pull/22721) +* [[`0fc79d48f8`](https://github.com/nodejs/node/commit/0fc79d48f8)] - **tools,win**: fix find\_python error (Kyle Farnung) [#22797](https://github.com/nodejs/node/pull/22797) +* [[`aa05c8b117`](https://github.com/nodejs/node/commit/aa05c8b117)] - **trace_events**: avoid flusing uninitialized traces (Ali Ijaz Sheikh) [#22812](https://github.com/nodejs/node/pull/22812) +* [[`db7927683c`](https://github.com/nodejs/node/commit/db7927683c)] - **tracing**: remove shutdown-on-signal (Anna Henningsen) [#22734](https://github.com/nodejs/node/pull/22734) +* [[`8cfa88aa5c`](https://github.com/nodejs/node/commit/8cfa88aa5c)] - **(SEMVER-MINOR)** **util**: add util.types.isBoxedPrimitive (Ruben Bridgewater) [#22620](https://github.com/nodejs/node/pull/22620) +* [[`a96a8468d6`](https://github.com/nodejs/node/commit/a96a8468d6)] - **worker**: correct (de)initialization order (Anna Henningsen) [#22773](https://github.com/nodejs/node/pull/22773) + ## 2018-09-06, Version 10.10.0 (Current), @targos @@ -60,7 +187,7 @@ * The methods `fs.read`, `fs.readSync`, `fs.write`, `fs.writeSync`, `fs.writeFile` and `fs.writeFileSync` now all accept `TypedArray` and `DataView` objects. [#22150](https://github.com/nodejs/node/pull/22150) - * A new boolean option, `withFileTypes`, can be passed to to `fs.readdir` and + * A new boolean option, `withFileTypes`, can be passed to `fs.readdir` and `fs.readdirSync`. If set to true, the methods return an array of directory entries. These are objects that can be used to determine the type of each entry and filter them based on that without calling `fs.stat`. [#22020](https://github.com/nodejs/node/pull/22020) diff --git a/doc/guides/backporting-to-release-lines.md b/doc/guides/backporting-to-release-lines.md index 751df9137d2fc4..7dee8b0e640eed 100644 --- a/doc/guides/backporting-to-release-lines.md +++ b/doc/guides/backporting-to-release-lines.md @@ -26,8 +26,8 @@ commits be cherry-picked or backported. ## How to submit a backport pull request -For the following steps, let's assume that a backport is needed for the v6.x -release line. All commands will use the `v6.x-staging` branch as the target +For the following steps, let's assume that a backport is needed for the v8.x +release line. All commands will use the `v8.x-staging` branch as the target branch. In order to submit a backport pull request to another branch, simply replace that with the staging branch for the targeted release line. @@ -40,10 +40,10 @@ replace that with the staging branch for the targeted release line. # the origin remote points to your fork, and the upstream remote points # to git://github.com/nodejs/node cd $NODE_DIR -# If v6.x-staging is checked out `pull` should be used instead of `fetch` -git fetch upstream v6.x-staging:v6.x-staging -f +# If v8.x-staging is checked out `pull` should be used instead of `fetch` +git fetch upstream v8.x-staging:v8.x-staging -f # Assume we want to backport PR #10157 -git checkout -b backport-10157-to-v6.x v6.x-staging +git checkout -b backport-10157-to-v8.x v8.x-staging # Ensure there are no test artifacts from previous builds # Note that this command deletes all files and directories # not under revision control below the ./test directory. @@ -72,19 +72,19 @@ hint: and commit the result with 'git commit' 7. Make sure `make -j4 test` passes. 8. Push the changes to your fork 9. Open a pull request: - 1. Be sure to target the `v6.x-staging` branch in the pull request. + 1. Be sure to target the `v8.x-staging` branch in the pull request. 2. Include the backport target in the pull request title in the following - format — `[v6.x backport] `. - Example: `[v6.x backport] process: improve performance of nextTick` + format — `[v8.x backport] `. + Example: `[v8.x backport] process: improve performance of nextTick` 3. Check the checkbox labeled "Allow edits from maintainers". 4. In the description add a reference to the original PR 5. Run a [`node-test-pull-request`][] CI job (with `REBASE_ONTO` set to the default ``) 10. If during the review process conflicts arise, use the following to rebase: - `git pull --rebase upstream v6.x-staging` + `git pull --rebase upstream v8.x-staging` -After the PR lands replace the `backport-requested-v6.x` label on the original -PR with `backported-to-v6.x`. +After the PR lands replace the `backport-requested-v8.x` label on the original +PR with `backported-to-v8.x`. [Release Schedule]: https://github.com/nodejs/Release#release-schedule1 [Release Plan]: https://github.com/nodejs/Release#release-plan diff --git a/doc/guides/using-symbols.md b/doc/guides/using-symbols.md new file mode 100644 index 00000000000000..1e79e1a4e4b11c --- /dev/null +++ b/doc/guides/using-symbols.md @@ -0,0 +1,73 @@ +# Using global symbols + +ES6 introduced a new type: `Symbol`. This new type is _immutable_, and +it is often used for metaprogramming purposes, as it can be used as +property keys like string. There are two types of +symbols, local and global. +Symbol-keyed properties of an object are not included in the output of +`JSON.stringify()`, but the `util.inspect()` function includes them by +default. + +Learn more about symbols at +https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol. + +## `Symbol(string)` + +Symbols created via `Symbol(string)` are local to the caller function. +Note that `Symbol('hello') !== Symbol('hello')`. +For this reason, we often use them to simulate private fields, like so: + +```js +const kField = Symbol('kField'); + +console.log(kField === Symbol('kField')); // false + +class MyObject { + constructor() { + this[kField] = 'something'; + } +} + +module.exports.MyObject = MyObject; +``` + +Note that Symbols are not _fully private_, as the data could be accessed +anyway: + +```js +for (const s of Object.getOwnPropertySymbols(obj)) { + const desc = s.toString().replace(/Symbol\((.*)\)$/, '$1'); + if (desc === 'kField') { + console.log(obj[s]); // 'something' + } +} +``` + +Local symbols make it harder for developers to monkey patch/access +private fields, as they require more work than a property prefixed +with an `_`. Monkey patching private API that were not designed to be +monkey-patchable make maintaining and evolving Node.js harder, as private +properties are not documented and can change within a patch release. +Some extremely popular modules in the ecosystem monkey patch some +internals, making it impossible for us to update and improve those +areas without causing issues for a significant amount of users. + +## `Symbol.for` + +Symbols created with `Symbol.for(string)` are global and unique to the +same V8 Isolate. On the first call to `Symbol.for(string)` a symbol is +stored in a global registry and easily retrieved for every call of +`Symbol.for(string)`. However, this might cause problems when two module +authors use the same symbol +for different reasons. + +```js +const s = Symbol.for('hello'); +console.log(s === Symbol.for('hello')); +``` + +In the Node.js runtime we prefix all our global symbols with `nodejs.`, +e.g. `Symbol.for('nodejs.hello')`. + +Global symbols should be preferred when a developer-facing interface is +needed to allow behavior customization, i.e., metaprogramming. diff --git a/doc/node.1 b/doc/node.1 index e437cc2e2ae81b..8e6616ad969ecc 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -43,7 +43,7 @@ .Op Ar arguments ... . .Nm node -.Cm debug +.Cm inspect .Op Fl e Ar string | Ar script.js | Fl | Ar : .Ar ... . diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index e7cab0ad931b4d..a1a0b9490a9177 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -2,10 +2,14 @@ rules: no-restricted-syntax: # Config copied from .eslintrc.js - error + - selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.2.type='Literal']" + message: "Do not use a literal for the third argument of assert.deepStrictEqual()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']" message: "Please replace `assert.doesNotThrow()` and add a comment next to the code instead." - selector: "CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]" message: "assert.rejects() must be invoked with at least two arguments." + - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.2.type='Literal']" + message: "Do not use a literal for the third argument of assert.strictEqual()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])" message: "Use an object as second argument of assert.throws()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]" diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 07e2c41beec21b..2b9600f0fd6647 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -147,7 +147,7 @@ function Readable(options) { // Checking for a Stream.Duplex instance is faster here instead of inside // the ReadableState constructor, at least with V8 6.5 - const isDuplex = (this instanceof Stream.Duplex); + const isDuplex = this instanceof Stream.Duplex; this._readableState = new ReadableState(options, this, isDuplex); diff --git a/lib/assert.js b/lib/assert.js index 5a25e73a9dc1bc..69618862f2182c 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -86,8 +86,9 @@ function innerFail(obj) { function fail(actual, expected, message, operator, stackStartFn) { const argsLen = arguments.length; + let internalMessage; if (argsLen === 0) { - message = 'Failed'; + internalMessage = 'Failed'; } else if (argsLen === 1) { message = actual; actual = undefined; @@ -105,13 +106,23 @@ function fail(actual, expected, message, operator, stackStartFn) { operator = '!='; } - innerFail({ + if (message instanceof Error) throw message; + + const errArgs = { actual, expected, - message, - operator, + operator: operator === undefined ? 'fail' : operator, stackStartFn: stackStartFn || fail - }); + }; + if (message !== undefined) { + errArgs.message = message; + } + const err = new AssertionError(errArgs); + if (internalMessage) { + err.message = internalMessage; + err.generatedMessage = true; + } + throw err; } assert.fail = fail; @@ -557,12 +568,12 @@ function expectedException(actual, expected, msg) { return expected.call({}, actual) === true; } -function getActual(block) { - if (typeof block !== 'function') { - throw new ERR_INVALID_ARG_TYPE('block', 'Function', block); +function getActual(fn) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn); } try { - block(); + fn(); } catch (e) { return e; } @@ -579,20 +590,21 @@ function checkIsPromise(obj) { typeof obj.catch === 'function'; } -async function waitForActual(block) { +async function waitForActual(promiseFn) { let resultPromise; - if (typeof block === 'function') { - // Return a rejected promise if `block` throws synchronously. - resultPromise = block(); + if (typeof promiseFn === 'function') { + // Return a rejected promise if `promiseFn` throws synchronously. + resultPromise = promiseFn(); // Fail in case no promise is returned. if (!checkIsPromise(resultPromise)) { throw new ERR_INVALID_RETURN_VALUE('instance of Promise', - 'block', resultPromise); + 'promiseFn', resultPromise); } - } else if (checkIsPromise(block)) { - resultPromise = block; + } else if (checkIsPromise(promiseFn)) { + resultPromise = promiseFn; } else { - throw new ERR_INVALID_ARG_TYPE('block', ['Function', 'Promise'], block); + throw new ERR_INVALID_ARG_TYPE( + 'promiseFn', ['Function', 'Promise'], promiseFn); } try { @@ -672,20 +684,20 @@ function expectsNoError(stackStartFn, actual, error, message) { throw actual; } -assert.throws = function throws(block, ...args) { - expectsError(throws, getActual(block), ...args); +assert.throws = function throws(promiseFn, ...args) { + expectsError(throws, getActual(promiseFn), ...args); }; -assert.rejects = async function rejects(block, ...args) { - expectsError(rejects, await waitForActual(block), ...args); +assert.rejects = async function rejects(promiseFn, ...args) { + expectsError(rejects, await waitForActual(promiseFn), ...args); }; -assert.doesNotThrow = function doesNotThrow(block, ...args) { - expectsNoError(doesNotThrow, getActual(block), ...args); +assert.doesNotThrow = function doesNotThrow(fn, ...args) { + expectsNoError(doesNotThrow, getActual(fn), ...args); }; -assert.doesNotReject = async function doesNotReject(block, ...args) { - expectsNoError(doesNotReject, await waitForActual(block), ...args); +assert.doesNotReject = async function doesNotReject(fn, ...args) { + expectsNoError(doesNotReject, await waitForActual(fn), ...args); }; assert.ifError = function ifError(err) { diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index c053266de77c78..daa7fd5cbc0b79 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -619,78 +619,134 @@ const has = Function.call.bind(Set.prototype.has); const test = Function.call.bind(RegExp.prototype.test); - const { - allowedV8EnvironmentFlags, - allowedNodeEnvironmentFlags - } = process.binding('config'); - - const trimLeadingDashes = (flag) => replace(flag, leadingDashesRegex, ''); - - // Save these for comparison against flags provided to - // process.allowedNodeEnvironmentFlags.has() which lack leading dashes. - // Avoid interference w/ user code by flattening `Set.prototype` into - // each object. - const [nodeFlags, v8Flags] = [ - allowedNodeEnvironmentFlags, allowedV8EnvironmentFlags - ].map((flags) => Object.defineProperties( - new Set(flags.map(trimLeadingDashes)), - Object.getOwnPropertyDescriptors(Set.prototype)) - ); - - class NodeEnvironmentFlagsSet extends Set { - constructor(...args) { - super(...args); - - // the super constructor consumes `add`, but - // disallow any future adds. - this.add = () => this; + const get = () => { + const { + getOptions, + types: { kV8Option }, + envSettings: { kAllowedInEnvironment } + } = internalBinding('options'); + const { options, aliases } = getOptions(); + + const allowedV8EnvironmentFlags = []; + const allowedNodeEnvironmentFlags = []; + for (const [name, info] of options) { + if (info.envVarSettings === kAllowedInEnvironment) { + if (info.type === kV8Option) { + allowedV8EnvironmentFlags.push(name); + } else { + allowedNodeEnvironmentFlags.push(name); + } + } } - delete() { - // noop, `Set` API compatible - return false; + for (const [ from, expansion ] of aliases) { + let isAccepted = true; + for (const to of expansion) { + if (!to.startsWith('-') || to === '--') continue; + const recursiveExpansion = aliases.get(to); + if (recursiveExpansion) { + if (recursiveExpansion[0] === to) + recursiveExpansion.splice(0, 1); + expansion.push(...recursiveExpansion); + continue; + } + isAccepted = options.get(to).envVarSettings === kAllowedInEnvironment; + if (!isAccepted) break; + } + if (isAccepted) { + let canonical = from; + if (canonical.endsWith('=')) + canonical = canonical.substr(0, canonical.length - 1); + if (canonical.endsWith(' ')) + canonical = canonical.substr(0, canonical.length - 4); + allowedNodeEnvironmentFlags.push(canonical); + } } - clear() { - // noop - } + const trimLeadingDashes = (flag) => replace(flag, leadingDashesRegex, ''); + + // Save these for comparison against flags provided to + // process.allowedNodeEnvironmentFlags.has() which lack leading dashes. + // Avoid interference w/ user code by flattening `Set.prototype` into + // each object. + const [nodeFlags, v8Flags] = [ + allowedNodeEnvironmentFlags, allowedV8EnvironmentFlags + ].map((flags) => Object.defineProperties( + new Set(flags.map(trimLeadingDashes)), + Object.getOwnPropertyDescriptors(Set.prototype)) + ); + + class NodeEnvironmentFlagsSet extends Set { + constructor(...args) { + super(...args); + + // the super constructor consumes `add`, but + // disallow any future adds. + this.add = () => this; + } + + delete() { + // noop, `Set` API compatible + return false; + } - has(key) { - // This will return `true` based on various possible - // permutations of a flag, including present/missing leading - // dash(es) and/or underscores-for-dashes in the case of V8-specific - // flags. Strips any values after `=`, inclusive. - if (typeof key === 'string') { - key = replace(key, trailingValuesRegex, ''); - if (test(leadingDashesRegex, key)) { - return has(this, key) || - has(v8Flags, - replace( + clear() { + // noop + } + + has(key) { + // This will return `true` based on various possible + // permutations of a flag, including present/missing leading + // dash(es) and/or underscores-for-dashes in the case of V8-specific + // flags. Strips any values after `=`, inclusive. + // TODO(addaleax): It might be more flexible to run the option parser + // on a dummy option set and see whether it rejects the argument or + // not. + if (typeof key === 'string') { + key = replace(key, trailingValuesRegex, ''); + if (test(leadingDashesRegex, key)) { + return has(this, key) || + has(v8Flags, replace( - key, - leadingDashesRegex, - '' - ), - replaceDashesRegex, - '_' - ) - ); + replace( + key, + leadingDashesRegex, + '' + ), + replaceDashesRegex, + '_' + ) + ); + } + return has(nodeFlags, key) || + has(v8Flags, replace(key, replaceDashesRegex, '_')); } - return has(nodeFlags, key) || - has(v8Flags, replace(key, replaceDashesRegex, '_')); + return false; } - return false; } - } - Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor); - Object.freeze(NodeEnvironmentFlagsSet.prototype); + Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor); + Object.freeze(NodeEnvironmentFlagsSet.prototype); + + return process.allowedNodeEnvironmentFlags = Object.freeze( + new NodeEnvironmentFlagsSet( + allowedNodeEnvironmentFlags.concat(allowedV8EnvironmentFlags) + )); + }; - process.allowedNodeEnvironmentFlags = Object.freeze( - new NodeEnvironmentFlagsSet( - allowedNodeEnvironmentFlags.concat(allowedV8EnvironmentFlags) - ) - ); + Object.defineProperty(process, 'allowedNodeEnvironmentFlags', { + get, + set(value) { + Object.defineProperty(this, 'allowedNodeEnvironmentFlags', { + value, + configurable: true, + enumerable: true, + writable: true + }); + }, + enumerable: true, + configurable: true + }); } startup(); diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js index 7127d4d7efb17a..9462c3048e8fdc 100644 --- a/lib/internal/crypto/hash.js +++ b/lib/internal/crypto/hash.js @@ -23,8 +23,8 @@ const { inherits } = require('util'); const { normalizeEncoding } = require('internal/util'); const { isArrayBufferView } = require('internal/util/types'); const LazyTransform = require('internal/streams/lazy_transform'); -const kState = Symbol('state'); -const kFinalized = Symbol('finalized'); +const kState = Symbol('kState'); +const kFinalized = Symbol('kFinalized'); function Hash(algorithm, options) { if (!(this instanceof Hash)) diff --git a/lib/internal/crypto/pbkdf2.js b/lib/internal/crypto/pbkdf2.js index 9cbfb3dc64211d..5b2d59eb759115 100644 --- a/lib/internal/crypto/pbkdf2.js +++ b/lib/internal/crypto/pbkdf2.js @@ -22,7 +22,7 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) { } ({ password, salt, iterations, keylen, digest } = - check(password, salt, iterations, keylen, digest, callback)); + check(password, salt, iterations, keylen, digest)); if (typeof callback !== 'function') throw new ERR_INVALID_CALLBACK(); @@ -42,7 +42,7 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) { function pbkdf2Sync(password, salt, iterations, keylen, digest) { ({ password, salt, iterations, keylen, digest } = - check(password, salt, iterations, keylen, digest, pbkdf2Sync)); + check(password, salt, iterations, keylen, digest)); const keybuf = Buffer.alloc(keylen); handleError(keybuf, password, salt, iterations, digest); const encoding = getDefaultEncoding(); @@ -50,7 +50,7 @@ function pbkdf2Sync(password, salt, iterations, keylen, digest) { return keybuf.toString(encoding); } -function check(password, salt, iterations, keylen, digest, callback) { +function check(password, salt, iterations, keylen, digest) { if (typeof digest !== 'string') { if (digest !== null) throw new ERR_INVALID_ARG_TYPE('digest', ['string', 'null'], digest); diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js index 68ae4f6f7d5385..c5dfc08cf353ae 100644 --- a/lib/internal/crypto/scrypt.js +++ b/lib/internal/crypto/scrypt.js @@ -70,7 +70,7 @@ function handleError(keybuf, password, salt, N, r, p, maxmem, wrap) { throw ex; // Scrypt operation failed, exception object contains details. } -function check(password, salt, keylen, options, callback) { +function check(password, salt, keylen, options) { if (_scrypt === undefined) throw new ERR_CRYPTO_SCRYPT_NOT_SUPPORTED(); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 87a412dbf8a8d8..8f438d343a10d6 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -151,6 +151,8 @@ function makeSystemErrorWithCode(key) { }; } +let useOriginalName = false; + function makeNodeErrorWithCode(Base, key) { return class NodeError extends Base { constructor(...args) { @@ -158,6 +160,9 @@ function makeNodeErrorWithCode(Base, key) { } get name() { + if (useOriginalName) { + return super.name; + } return `${super.name} [${key}]`; } @@ -439,7 +444,12 @@ module.exports = { getMessage, SystemError, codes, - E // This is exported only to facilitate testing. + // This is exported only to facilitate testing. + E, + // This allows us to tell the type of the errors without using + // instanceof, which is necessary in WPT harness. + get useOriginalName() { return useOriginalName; }, + set useOriginalName(value) { useOriginalName = value; } }; // To declare an error message, use the E(sym, val, def) function above. The sym @@ -503,8 +513,7 @@ E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error); E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error); E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError); E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error); -// TODO(bnoordhuis) Decapitalize: s/PBKDF2 Error/PBKDF2 error/ -E('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 Error', Error); +E('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 error', Error); E('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error); E('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error); // Switch to TypeError. The current implementation does not seem right. diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index f9750aa55a8b11..9ba4a1f8871830 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -299,7 +299,8 @@ async function readdir(path, options) { path = getPathFromURL(path); validatePath(path); const result = await binding.readdir(pathModule.toNamespacedPath(path), - options.encoding, !!options.withTypes, + options.encoding, + !!options.withFileTypes, kUsePromises); return options.withFileTypes ? getDirectoryEntriesPromise(path, result) : diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index c4a426996cf1a0..39f4c32906433a 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -10,6 +10,7 @@ const { ERR_OUT_OF_RANGE } = require('internal/errors').codes; const { isUint8Array, isArrayBufferView } = require('internal/util/types'); +const { once } = require('internal/util'); const pathModule = require('path'); const util = require('util'); const kType = Symbol('type'); @@ -123,6 +124,7 @@ function getDirents(path, [names, types], callback) { if (typeof callback == 'function') { const len = names.length; let toFinish = 0; + callback = once(callback); for (i = 0; i < len; i++) { const type = types[i]; if (type === UV_DIRENT_UNKNOWN) { diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 9c476ac5f3289d..e778402c42ef35 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -276,6 +276,8 @@ function onSessionHeaders(handle, id, cat, flags, headers) { } else { stream = new ClientHttp2Stream(session, handle, id, opts); } + if (endOfStream) + stream[kState].endAfterHeaders = true; process.nextTick(emit, session, 'stream', stream, obj, flags, headers); } else { let event; @@ -1548,7 +1550,8 @@ class Http2Stream extends Duplex { flags: STREAM_FLAGS_PENDING, rstCode: NGHTTP2_NO_ERROR, writeQueueSize: 0, - trailersReady: false + trailersReady: false, + endAfterHeaders: false }; this.on('pause', streamOnPause); @@ -1594,6 +1597,10 @@ class Http2Stream extends Duplex { return `Http2Stream ${util.format(obj)}`; } + get endAfterHeaders() { + return this[kState].endAfterHeaders; + } + get sentHeaders() { return this[kSentHeaders]; } diff --git a/lib/internal/net.js b/lib/internal/net.js index 78e155e055a820..d2b097573b918e 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -1,15 +1,33 @@ 'use strict'; const Buffer = require('buffer').Buffer; -const { isIPv6 } = process.binding('cares_wrap'); const { writeBuffer } = process.binding('fs'); const errors = require('internal/errors'); -const octet = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; -const re = new RegExp(`^${octet}[.]${octet}[.]${octet}[.]${octet}$`); +// IPv4 Segment +const v4Seg = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; +const v4Str = `(${v4Seg}[.]){3}${v4Seg}`; +const IPv4Reg = new RegExp(`^${v4Str}$`); + +// IPv6 Segment +const v6Seg = '(?:[0-9a-fA-F]{1,4})'; +const IPv6Reg = new RegExp('^(' + + `(?:${v6Seg}:){7}(?:${v6Seg}|:)|` + + `(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` + + `(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` + + `(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` + + `(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` + + `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` + + `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` + + `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` + +')(%[0-9a-zA-Z]{1,})?$'); function isIPv4(s) { - return re.test(s); + return IPv4Reg.test(s); +} + +function isIPv6(s) { + return IPv6Reg.test(s); } function isIP(s) { diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 849b3d39dbe25b..67b624262f3ff6 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -5,20 +5,12 @@ let eos; +const { once } = require('internal/util'); const { ERR_MISSING_ARGS, ERR_STREAM_DESTROYED } = require('internal/errors').codes; -function once(callback) { - let called = false; - return function(err) { - if (called) return; - called = true; - callback(err); - }; -} - function noop(err) { // Rethrow the error if it exists to avoid swallowing it if (err) throw err; diff --git a/lib/internal/util.js b/lib/internal/util.js index 03d83d49056f0d..a922276085f404 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -364,6 +364,15 @@ function isInsideNodeModules() { return false; } +function once(callback) { + let called = false; + return function(...args) { + if (called) return; + called = true; + callback(...args); + }; +} + module.exports = { assertCrypto, cachedResult, @@ -380,6 +389,7 @@ module.exports = { join, normalizeEncoding, objectToString, + once, promisify, spliceOne, removeColors, diff --git a/lib/path.js b/lib/path.js index 90129f1f52989e..c8d92f14af04de 100644 --- a/lib/path.js +++ b/lib/path.js @@ -77,18 +77,16 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { res.charCodeAt(res.length - 2) !== CHAR_DOT) { if (res.length > 2) { const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex !== res.length - 1) { - if (lastSlashIndex === -1) { - res = ''; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); } + lastSlash = i; + dots = 0; + continue; } else if (res.length === 2 || res.length === 1) { res = ''; lastSegmentLength = 0; diff --git a/lib/string_decoder.js b/lib/string_decoder.js index b32249ad9e5830..e5f396cab30d3b 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -73,7 +73,7 @@ StringDecoder.prototype.write = function write(buf) { return buf; if (!ArrayBuffer.isView(buf)) throw new ERR_INVALID_ARG_TYPE('buf', - ['Buffer', 'Uint8Array', 'ArrayBufferView'], + ['Buffer', 'TypedArray', 'DataView'], buf); return decode(this[kNativeDecoder], buf); }; diff --git a/lib/zlib.js b/lib/zlib.js index ca5f05884ad3c0..87e8641767669f 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -527,14 +527,12 @@ function processChunkSync(self, chunk, flushFlag) { } self.bytesWritten = inputRead; + _close(self); if (nread >= kMaxLength) { - _close(self); throw new ERR_BUFFER_TOO_LARGE(); } - _close(self); - if (nread === 0) return Buffer.alloc(0); diff --git a/node.gyp b/node.gyp index e4d361e89e2282..4477bf59f151d7 100644 --- a/node.gyp +++ b/node.gyp @@ -238,6 +238,11 @@ 'src', 'deps/v8/include', ], + + # - "C4244: conversion from 'type1' to 'type2', possible loss of data" + # Ususaly safe. Disable for `dep`, enable for `src` + 'msvs_disabled_warnings!': [4244], + 'conditions': [ [ 'node_intermediate_lib_type=="static_library" and ' 'node_shared=="true" and OS=="aix"', { @@ -260,8 +265,7 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalOptions': [ - '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\' - '<(node_core_target_name)<(STATIC_LIB_SUFFIX)', + '/WHOLEARCHIVE:<(node_core_target_name)<(STATIC_LIB_SUFFIX)', ], }, }, @@ -472,6 +476,11 @@ 'V8_DEPRECATION_WARNINGS=1', 'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"', ], + + # - "C4244: conversion from 'type1' to 'type2', possible loss of data" + # Ususaly safe. Disable for `dep`, enable for `src` + 'msvs_disabled_warnings!': [4244], + 'conditions': [ [ 'node_code_cache_path!=""', { 'sources': [ '<(node_code_cache_path)' ] @@ -992,6 +1001,10 @@ ['OS=="solaris"', { 'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ] }], + # Skip cctest while building shared lib node for Windows + [ 'OS=="win" and node_shared=="true"', { + 'type': 'none', + }], ], } ], # end targets diff --git a/node.gypi b/node.gypi index b1d7d7903354c1..77ab11ef435257 100644 --- a/node.gypi +++ b/node.gypi @@ -141,7 +141,7 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalOptions': [ - '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\zlib<(STATIC_LIB_SUFFIX)', + '/WHOLEARCHIVE:zlib<(STATIC_LIB_SUFFIX)', ], }, }, @@ -179,7 +179,7 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalOptions': [ - '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\libuv<(STATIC_LIB_SUFFIX)', + '/WHOLEARCHIVE:libuv<(STATIC_LIB_SUFFIX)', ], }, }, @@ -313,7 +313,7 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalOptions': [ - '/WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\<(openssl_product)', + '/WHOLEARCHIVE:<(openssl_product)', ], }, }, diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 7f2a0ece2f0055..a8a4601e76ec43 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -681,12 +681,16 @@ MaybeLocal AsyncWrap::MakeCallback(const Local cb, async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) { - return Environment::GetCurrent(isolate)->execution_async_id(); + Environment* env = Environment::GetCurrent(isolate); + if (env == nullptr) return -1; + return env->execution_async_id(); } async_id AsyncHooksGetTriggerAsyncId(Isolate* isolate) { - return Environment::GetCurrent(isolate)->trigger_async_id(); + Environment* env = Environment::GetCurrent(isolate); + if (env == nullptr) return -1; + return env->trigger_async_id(); } @@ -705,6 +709,7 @@ async_context EmitAsyncInit(Isolate* isolate, v8::Local name, async_id trigger_async_id) { Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // Initialize async context struct if (trigger_async_id == -1) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 94bb9413772dd0..4994e0d90a9cd0 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -61,6 +61,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) { PromiseRejectEvent event = message.GetEvent(); Environment* env = Environment::GetCurrent(isolate); + if (env == nullptr) return; Local callback; Local value; diff --git a/src/callback_scope.cc b/src/callback_scope.cc index 8b407474b333c6..9d0c4d5daf2627 100644 --- a/src/callback_scope.cc +++ b/src/callback_scope.cc @@ -43,6 +43,7 @@ InternalCallbackScope::InternalCallbackScope(Environment* env, object_(object), callback_scope_(env) { CHECK_IMPLIES(expect == kRequireResource, !object.IsEmpty()); + CHECK_NOT_NULL(env); if (!env->can_call_into_js()) { failed_ = true; diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 8fea040f329c41..a3de844d7ec97e 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1955,11 +1955,6 @@ int ParseIP(const char* ip, ParseIPResult* result = nullptr) { return 0; } -void IsIPv6(const FunctionCallbackInfo& args) { - node::Utf8Value ip(args.GetIsolate(), args[0]); - args.GetReturnValue().Set(6 == ParseIP(*ip)); -} - void CanonicalizeIP(const FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); node::Utf8Value ip(isolate, args[0]); @@ -2208,7 +2203,6 @@ void Initialize(Local target, env->SetMethod(target, "getaddrinfo", GetAddrInfo); env->SetMethod(target, "getnameinfo", GetNameInfo); - env->SetMethodNoSideEffect(target, "isIPv6", IsIPv6); env->SetMethodNoSideEffect(target, "canonicalizeIP", CanonicalizeIP); env->SetMethod(target, "strerror", StrError); diff --git a/src/env-inl.h b/src/env-inl.h index afca7a80ce0339..4e0a95ed424cd9 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -302,6 +302,15 @@ inline Environment* Environment::GetCurrent(v8::Isolate* isolate) { } inline Environment* Environment::GetCurrent(v8::Local context) { + if (UNLIKELY(context.IsEmpty() || + context->GetNumberOfEmbedderDataFields() < + ContextEmbedderIndex::kContextTag || + context->GetAlignedPointerFromEmbedderData( + ContextEmbedderIndex::kContextTag) != + Environment::kNodeContextTagPtr)) { + return nullptr; + } + return static_cast( context->GetAlignedPointerFromEmbedderData( ContextEmbedderIndex::kEnvironment)); @@ -416,15 +425,15 @@ inline void Environment::set_printed_error(bool value) { } inline void Environment::set_trace_sync_io(bool value) { - trace_sync_io_ = value; + options_->trace_sync_io = value; } inline bool Environment::abort_on_uncaught_exception() const { - return abort_on_uncaught_exception_; + return options_->abort_on_uncaught_exception; } inline void Environment::set_abort_on_uncaught_exception(bool value) { - abort_on_uncaught_exception_ = value; + options_->abort_on_uncaught_exception = value; } inline AliasedBuffer& diff --git a/src/env.cc b/src/env.cc index 4ddb714852f092..7356f04db38c95 100644 --- a/src/env.cc +++ b/src/env.cc @@ -113,7 +113,6 @@ Environment::Environment(IsolateData* isolate_data, tick_info_(context->GetIsolate()), timer_base_(uv_now(isolate_data->event_loop())), printed_error_(false), - trace_sync_io_(false), abort_on_uncaught_exception_(false), emit_env_nonstring_warning_(true), makecallback_cntr_(0), @@ -162,6 +161,9 @@ Environment::Environment(IsolateData* isolate_data, isolate()->GetHeapProfiler()->AddBuildEmbedderGraphCallback( BuildEmbedderGraph, this); + if (options_->no_force_async_hooks_checks) { + async_hooks_.no_force_checks(); + } } Environment::~Environment() { @@ -309,7 +311,7 @@ void Environment::StopProfilerIdleNotifier() { } void Environment::PrintSyncTrace() const { - if (!trace_sync_io_) + if (!options_->trace_sync_io) return; HandleScope handle_scope(isolate()); @@ -447,18 +449,9 @@ void Environment::EnvPromiseHook(v8::PromiseHookType type, v8::Local parent) { Local context = promise->CreationContext(); - // Grow the embedder data if necessary to make sure we are not out of bounds - // when reading the magic number. - context->SetAlignedPointerInEmbedderData( - ContextEmbedderIndex::kContextTagBoundary, nullptr); - int* magicNumberPtr = reinterpret_cast( - context->GetAlignedPointerFromEmbedderData( - ContextEmbedderIndex::kContextTag)); - if (magicNumberPtr != Environment::kNodeContextTagPtr) { - return; - } - Environment* env = Environment::GetCurrent(context); + if (env == nullptr) return; + for (const PromiseHookCallback& hook : env->promise_hooks_) { hook.cb_(type, promise, parent, hook.arg_); } diff --git a/src/env.h b/src/env.h index a0d9f714310515..ae88727822d3de 100644 --- a/src/env.h +++ b/src/env.h @@ -888,7 +888,6 @@ class Environment { TickInfo tick_info_; const uint64_t timer_base_; bool printed_error_; - bool trace_sync_io_; bool abort_on_uncaught_exception_; bool emit_env_nonstring_warning_; size_t makecallback_cntr_; diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 18b9e610750e93..54b7c4d01c6d3b 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -149,12 +149,11 @@ void CallAndPauseOnStart(const FunctionCallbackInfo& args) { } void InspectorConsoleCall(const FunctionCallbackInfo& info) { - Isolate* isolate = info.GetIsolate(); - HandleScope handle_scope(isolate); + Environment* env = Environment::GetCurrent(info); + Isolate* isolate = env->isolate(); Local context = isolate->GetCurrentContext(); CHECK_LT(2, info.Length()); SlicedArguments call_args(info, /* start */ 3); - Environment* env = Environment::GetCurrent(isolate); if (InspectorEnabled(env)) { Local inspector_method = info[0]; CHECK(inspector_method->IsFunction()); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index d584a5a3f9bc0d..5249ccb8dccd28 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -362,6 +362,7 @@ MaybeLocal ModuleWrap::ResolveCallback(Local context, Local specifier, Local referrer) { Environment* env = Environment::GetCurrent(context); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. Isolate* isolate = env->isolate(); if (env->module_map.count(referrer->GetIdentityHash()) == 0) { env->ThrowError("linking error, unknown module"); @@ -700,6 +701,7 @@ static MaybeLocal ImportModuleDynamically( Local specifier) { Isolate* iso = context->GetIsolate(); Environment* env = Environment::GetCurrent(context); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. v8::EscapableHandleScope handle_scope(iso); if (env->context() != context) { @@ -750,8 +752,8 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( void ModuleWrap::HostInitializeImportMetaObjectCallback( Local context, Local module, Local meta) { - Isolate* isolate = context->GetIsolate(); Environment* env = Environment::GetCurrent(context); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. ModuleWrap* module_wrap = GetFromModule(env, module); if (module_wrap == nullptr) { @@ -762,7 +764,7 @@ void ModuleWrap::HostInitializeImportMetaObjectCallback( Local callback = env->host_initialize_import_meta_object_callback(); Local args[] = { wrap, meta }; - callback->Call(context, Undefined(isolate), arraysize(args), args) + callback->Call(context, Undefined(env->isolate()), arraysize(args), args) .ToLocalChecked(); } diff --git a/src/node.cc b/src/node.cc index 51e97e0b8efadb..657822b68bad63 100644 --- a/src/node.cc +++ b/src/node.cc @@ -160,7 +160,6 @@ using v8::Object; using v8::ObjectTemplate; using v8::Promise; using v8::PropertyAttribute; -using v8::PropertyCallbackInfo; using v8::ReadOnly; using v8::Script; using v8::ScriptCompiler; @@ -183,9 +182,6 @@ static node_module* modlist_internal; static node_module* modlist_linked; static node_module* modlist_addon; -// TODO(addaleax): This should not be global. -static bool abort_on_uncaught_exception = false; - // Bit flag used to track security reverts (see node_revert.h) unsigned int reverted = 0; @@ -601,68 +597,6 @@ const char* signo_string(int signo) { } } -// These are all flags available for use with NODE_OPTIONS. -// -// Disallowed flags: -// These flags cause Node to do things other than run scripts: -// --version / -v -// --eval / -e -// --print / -p -// --check / -c -// --interactive / -i -// --prof-process -// --v8-options -// These flags are disallowed because security: -// --preserve-symlinks -const char* const environment_flags[] = { - // Node options, sorted in `node --help` order for ease of comparison. - "--enable-fips", - "--experimental-modules", - "--experimenatl-repl-await", - "--experimental-vm-modules", - "--experimental-worker", - "--force-fips", - "--icu-data-dir", - "--inspect", - "--inspect-brk", - "--inspect-port", - "--loader", - "--napi-modules", - "--no-deprecation", - "--no-force-async-hooks-checks", - "--no-warnings", - "--openssl-config", - "--pending-deprecation", - "--redirect-warnings", - "--require", - "--throw-deprecation", - "--tls-cipher-list", - "--trace-deprecation", - "--trace-event-categories", - "--trace-event-file-pattern", - "--trace-events-enabled", - "--trace-sync-io", - "--trace-warnings", - "--track-heap-objects", - "--use-bundled-ca", - "--use-openssl-ca", - "--v8-pool-size", - "--zero-fill-buffers", - "-r" -}; - - // V8 options (define with '_', which allows '-' or '_') -const char* const v8_environment_flags[] = { - "--abort_on_uncaught_exception", - "--max_old_space_size", - "--perf_basic_prof", - "--perf_prof", - "--stack_trace_limit", -}; - -int v8_environment_flags_count = arraysize(v8_environment_flags); -int environment_flags_count = arraysize(environment_flags); - // Look up environment variable unless running as setuid root. bool SafeGetenv(const char* key, std::string* text) { #if !defined(__CloudABI__) && !defined(_WIN32) @@ -696,7 +630,8 @@ namespace { bool ShouldAbortOnUncaughtException(Isolate* isolate) { HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); - return env->should_abort_on_uncaught_toggle()[0] && + return env != nullptr && + env->should_abort_on_uncaught_toggle()[0] && !env->inside_should_not_abort_on_uncaught_scope(); } @@ -705,6 +640,7 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) { void AddPromiseHook(Isolate* isolate, promise_hook_func fn, void* arg) { Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); env->AddPromiseHook(fn, arg); } @@ -712,6 +648,7 @@ void AddEnvironmentCleanupHook(Isolate* isolate, void (*fun)(void* arg), void* arg) { Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); env->AddCleanupHook(fun, arg); } @@ -720,6 +657,7 @@ void RemoveEnvironmentCleanupHook(Isolate* isolate, void (*fun)(void* arg), void* arg) { Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); env->RemoveCleanupHook(fun, arg); } @@ -804,6 +742,7 @@ MaybeLocal MakeCallback(Isolate* isolate, // Because of the AssignToContext() call in src/node_contextify.cc, // the two contexts need not be the same. Environment* env = Environment::GetCurrent(callback->CreationContext()); + CHECK_NOT_NULL(env); Context::Scope context_scope(env->context()); MaybeLocal ret = InternalMakeCallback(env, recv, callback, argc, argv, asyncContext); @@ -1105,61 +1044,6 @@ static MaybeLocal ExecuteString(Environment* env, } -static void GetActiveRequests(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - - Local ary = Array::New(args.GetIsolate()); - Local ctx = env->context(); - Local fn = env->push_values_to_array_function(); - Local argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; - size_t idx = 0; - - for (auto w : *env->req_wrap_queue()) { - if (w->persistent().IsEmpty()) - continue; - argv[idx] = w->GetOwner(); - if (++idx >= arraysize(argv)) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); - idx = 0; - } - } - - if (idx > 0) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); - } - - args.GetReturnValue().Set(ary); -} - - -// Non-static, friend of HandleWrap. Could have been a HandleWrap method but -// implemented here for consistency with GetActiveRequests(). -void GetActiveHandles(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - - Local ary = Array::New(env->isolate()); - Local ctx = env->context(); - Local fn = env->push_values_to_array_function(); - Local argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; - size_t idx = 0; - - for (auto w : *env->handle_wrap_queue()) { - if (!HandleWrap::HasRef(w)) - continue; - argv[idx] = w->GetOwner(); - if (++idx >= arraysize(argv)) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); - idx = 0; - } - } - if (idx > 0) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); - } - - args.GetReturnValue().Set(ary); -} - - NO_RETURN void Abort() { DumpBacktrace(stderr); fflush(stderr); @@ -1497,6 +1381,7 @@ void FatalException(Isolate* isolate, HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. Local process_object = env->process_object(); Local fatal_exception_string = env->fatal_exception_string(); Local fatal_exception_function = @@ -1722,7 +1607,7 @@ static void GetInternalBinding(const FunctionCallbackInfo& args) { } static void GetLinkedBinding(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args.GetIsolate()); + Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsString()); @@ -1791,32 +1676,6 @@ static Local GetFeatures(Environment* env) { return scope.Escape(obj); } - -static void DebugPortGetter(Local property, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Mutex::ScopedLock lock(process_mutex); - int port = env->options()->debug_options->port(); -#if HAVE_INSPECTOR - if (port == 0) { - if (auto io = env->inspector_agent()->io()) - port = io->port(); - } -#endif // HAVE_INSPECTOR - info.GetReturnValue().Set(port); -} - - -static void DebugPortSetter(Local property, - Local value, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Mutex::ScopedLock lock(process_mutex); - env->options()->debug_options->host_port.port = - value->Int32Value(env->context()).FromMaybe(0); -} - - static void DebugProcess(const FunctionCallbackInfo& args); static void DebugEnd(const FunctionCallbackInfo& args); @@ -2199,7 +2058,6 @@ void SetupProcessObject(Environment* env, void SignalExit(int signo) { uv_tty_reset_mode(); - v8_platform.StopTracingAgent(); #ifdef __FreeBSD__ // FreeBSD has a nasty bug, see RegisterSignalHandler for details struct sigaction sa; @@ -2669,7 +2527,7 @@ void ProcessArgv(std::vector* args, "--abort-on-uncaught-exception") != v8_args.end() || std::find(v8_args.begin(), v8_args.end(), "--abort_on_uncaught_exception") != v8_args.end()) { - abort_on_uncaught_exception = true; + env_opts->abort_on_uncaught_exception = true; } // TODO(bnoordhuis) Intercept --prof arguments and start the CPU profiler @@ -2853,10 +2711,13 @@ void RunAtExit(Environment* env) { uv_loop_t* GetCurrentEventLoop(Isolate* isolate) { HandleScope handle_scope(isolate); - auto context = isolate->GetCurrentContext(); + Local context = isolate->GetCurrentContext(); if (context.IsEmpty()) return nullptr; - return Environment::GetCurrent(context)->event_loop(); + Environment* env = Environment::GetCurrent(context); + if (env == nullptr) + return nullptr; + return env->event_loop(); } @@ -3044,14 +2905,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, return 12; // Signal internal error. } - env.set_abort_on_uncaught_exception(abort_on_uncaught_exception); - - // TODO(addaleax): Maybe access this option directly instead of setting - // a boolean member of Environment. Ditto below for trace_sync_io. - if (env.options()->no_force_async_hooks_checks) { - env.async_hooks()->no_force_checks(); - } - { Environment::AsyncCallbackScope callback_scope(&env); env.async_hooks()->push_async_ids(1, 0); @@ -3059,8 +2912,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, env.async_hooks()->pop_async_id(1); } - env.set_trace_sync_io(env.options()->trace_sync_io); - { SealHandleScope seal(isolate); bool more; diff --git a/src/node_api.cc b/src/node_api.cc index 22be3647ea86dd..3dd5b383310a03 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -946,7 +946,7 @@ class ThreadSafeFunction : public node::AsyncResource { return napi_ok; } - node::Environment::GetCurrent(env->isolate)->CloseHandle( + NodeEnv()->CloseHandle( reinterpret_cast(&async), [](uv_handle_t* handle) -> void { ThreadSafeFunction* ts_fn = @@ -1036,9 +1036,12 @@ class ThreadSafeFunction : public node::AsyncResource { } node::Environment* NodeEnv() { - // For some reason grabbing the Node.js environment requires a handle scope. + // Grabbing the Node.js environment requires a handle scope because it + // looks up fields on the current context. v8::HandleScope scope(env->isolate); - return node::Environment::GetCurrent(env->isolate); + node::Environment* node_env = node::Environment::GetCurrent(env->isolate); + CHECK_NOT_NULL(node_env); + return node_env; } void MaybeStartIdle() { @@ -1157,6 +1160,63 @@ class ThreadSafeFunction : public node::AsyncResource { 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); + + 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(); + + 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(isolate, reference)).FromJust()); + } + + return GET_RETURN_STATUS(env); +} + } // end of namespace v8impl // Intercepts the Node-V8 module registration callback. Converts parameters @@ -1177,7 +1237,9 @@ void napi_module_register_by_symbol(v8::Local exports, v8::Local context, napi_addon_register_func init) { if (init == nullptr) { - node::Environment::GetCurrent(context)->ThrowError( + node::Environment* node_env = node::Environment::GetCurrent(context); + CHECK_NOT_NULL(node_env); + node_env->ThrowError( "Module has no declared entry point."); return; } @@ -2173,11 +2235,11 @@ static napi_status set_error_code(napi_env env, } } name_string = v8::String::Concat( - isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, " [")); + 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, FIXED_ONE_BYTE_STRING(isolate, "]")); + isolate, name_string, node::FIXED_ONE_BYTE_STRING(isolate, "]")); set_maybe = err_object->Set(context, name_key, name_string); RETURN_STATUS_IF_FALSE(env, @@ -2859,41 +2921,12 @@ napi_status napi_wrap(napi_env env, napi_finalize finalize_cb, void* finalize_hint, napi_ref* result) { - NAPI_PREAMBLE(env); - CHECK_ARG(env, js_object); - - 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(); - - // 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); - - 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); - } - - CHECK(obj->SetPrivate(context, NAPI_PRIVATE_KEY(context, wrapper), - v8::External::New(isolate, reference)).FromJust()); - - return GET_RETURN_STATUS(env); + 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) { @@ -4138,3 +4171,17 @@ 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 1b2a392a0a0b1c..10a2c8ff3098be 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -695,6 +695,12 @@ NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, 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_buffer.cc b/src/node_buffer.cc index 465c42047911b0..dd285156b5644b 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -274,7 +274,9 @@ MaybeLocal New(Isolate* isolate, MaybeLocal New(Isolate* isolate, size_t length) { EscapableHandleScope handle_scope(isolate); Local obj; - if (Buffer::New(Environment::GetCurrent(isolate), length).ToLocal(&obj)) + Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. + if (Buffer::New(env, length).ToLocal(&obj)) return handle_scope.Escape(obj); return Local(); } @@ -316,6 +318,7 @@ MaybeLocal New(Environment* env, size_t length) { MaybeLocal Copy(Isolate* isolate, const char* data, size_t length) { EscapableHandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. Local obj; if (Buffer::Copy(env, data, length).ToLocal(&obj)) return handle_scope.Escape(obj); @@ -365,6 +368,7 @@ MaybeLocal New(Isolate* isolate, void* hint) { EscapableHandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. Local obj; if (Buffer::New(env, data, length, callback, hint).ToLocal(&obj)) return handle_scope.Escape(obj); @@ -403,6 +407,7 @@ MaybeLocal New(Environment* env, MaybeLocal New(Isolate* isolate, char* data, size_t length) { EscapableHandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Handle nullptr here. Local obj; if (Buffer::New(env, data, length).ToLocal(&obj)) return handle_scope.Escape(obj); diff --git a/src/node_config.cc b/src/node_config.cc index 080d8550665ad3..e9561be9d7f1fa 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -5,7 +5,6 @@ namespace node { -using v8::Array; using v8::Boolean; using v8::Context; using v8::Integer; @@ -137,22 +136,6 @@ static void Initialize(Local target, READONLY_PROPERTY(debug_options_obj, "inspectorEnabled", Boolean::New(isolate, debug_options->inspector_enabled)); - - Local environmentFlags = Array::New(env->isolate(), - environment_flags_count); - READONLY_PROPERTY(target, "allowedNodeEnvironmentFlags", environmentFlags); - for (int i = 0; i < environment_flags_count; ++i) { - environmentFlags->Set(i, OneByteString(env->isolate(), - environment_flags[i])); - } - - Local v8EnvironmentFlags = Array::New(env->isolate(), - v8_environment_flags_count); - READONLY_PROPERTY(target, "allowedV8EnvironmentFlags", v8EnvironmentFlags); - for (int i = 0; i < v8_environment_flags_count; ++i) { - v8EnvironmentFlags->Set(i, OneByteString(env->isolate(), - v8_environment_flags[i])); - } } // InitConfig } // namespace node diff --git a/src/node_context_data.h b/src/node_context_data.h index 61ab81523cea59..807ba56c7c69fb 100644 --- a/src/node_context_data.h +++ b/src/node_context_data.h @@ -25,16 +25,11 @@ namespace node { #define NODE_CONTEXT_TAG 35 #endif -#ifndef NODE_CONTEXT_TAG_BOUNDARY -#define NODE_CONTEXT_TAG_BOUNDARY 36 -#endif - enum ContextEmbedderIndex { kEnvironment = NODE_CONTEXT_EMBEDDER_DATA_INDEX, kSandboxObject = NODE_CONTEXT_SANDBOX_OBJECT_INDEX, kAllowWasmCodeGeneration = NODE_CONTEXT_ALLOW_WASM_CODE_GENERATION_INDEX, kContextTag = NODE_CONTEXT_TAG, - kContextTagBoundary = NODE_CONTEXT_TAG_BOUNDARY, }; } // namespace node diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 203d6b4aacfc17..b4a6aaa87dd075 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2891,6 +2891,10 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo& args) { return args.GetReturnValue().Set(false); } + // TODO(tniessen): Throw if the authentication tag has already been set. + if (cipher->auth_tag_state_ == kAuthTagPassedToOpenSSL) + return args.GetReturnValue().Set(true); + unsigned int tag_len = Buffer::Length(args[0]); const int mode = EVP_CIPHER_CTX_mode(cipher->ctx_.get()); if (mode == EVP_CIPH_GCM_MODE) { @@ -2923,6 +2927,7 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo& args) { // Note: we don't use std::min() here to work around a header conflict. cipher->auth_tag_len_ = tag_len; + cipher->auth_tag_state_ = kAuthTagKnown; if (cipher->auth_tag_len_ > sizeof(cipher->auth_tag_)) cipher->auth_tag_len_ = sizeof(cipher->auth_tag_); @@ -2934,14 +2939,14 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo& args) { bool CipherBase::MaybePassAuthTagToOpenSSL() { - if (!auth_tag_set_ && auth_tag_len_ != kNoAuthTagLength) { + if (auth_tag_state_ == kAuthTagKnown) { if (!EVP_CIPHER_CTX_ctrl(ctx_.get(), EVP_CTRL_AEAD_SET_TAG, auth_tag_len_, reinterpret_cast(auth_tag_))) { return false; } - auth_tag_set_ = true; + auth_tag_state_ = kAuthTagPassedToOpenSSL; } return true; } @@ -3890,7 +3895,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { bool r = Cipher( kbuf, klen, - args.Length() >= 3 && !args[2]->IsNull() ? *passphrase : nullptr, + args.Length() >= 4 && !args[3]->IsNull() ? *passphrase : nullptr, padding, reinterpret_cast(buf), len, diff --git a/src/node_crypto.h b/src/node_crypto.h index 86aa3ba4ba8395..1a93ae7a47e2cf 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -363,6 +363,11 @@ class CipherBase : public BaseObject { kErrorMessageSize, kErrorState }; + enum AuthTagState { + kAuthTagUnknown, + kAuthTagKnown, + kAuthTagPassedToOpenSSL + }; static const unsigned kNoAuthTagLength = static_cast(-1); void Init(const char* cipher_type, @@ -404,7 +409,7 @@ class CipherBase : public BaseObject { : BaseObject(env, wrap), ctx_(nullptr), kind_(kind), - auth_tag_set_(false), + auth_tag_state_(kAuthTagUnknown), auth_tag_len_(kNoAuthTagLength), pending_auth_failed_(false) { MakeWeak(); @@ -413,7 +418,7 @@ class CipherBase : public BaseObject { private: DeleteFnPtr ctx_; const CipherKind kind_; - bool auth_tag_set_; + AuthTagState auth_tag_state_; unsigned int auth_tag_len_; char auth_tag_[EVP_GCM_TLS_TAG_LEN]; bool pending_auth_failed_; diff --git a/src/node_file.cc b/src/node_file.cc index aff6f27682ad9d..1243cfd8340b95 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -431,7 +431,7 @@ void FSReqWrap::SetReturnValue(const FunctionCallbackInfo& args) { void NewFSReqWrap(const FunctionCallbackInfo& args) { CHECK(args.IsConstructCall()); - Environment* env = Environment::GetCurrent(args.GetIsolate()); + Environment* env = Environment::GetCurrent(args); new FSReqWrap(env, args.This(), args[0]->IsTrue()); } @@ -772,7 +772,7 @@ inline FSReqBase* GetReqWrap(Environment* env, Local value, } void Access(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args.GetIsolate()); + Environment* env = Environment::GetCurrent(args); HandleScope scope(env->isolate()); const int argc = args.Length(); @@ -2089,9 +2089,8 @@ void Initialize(Local target, StatWatcher::Initialize(env, target); - // Create FunctionTemplate for FSReqWrap - Local fst = - FunctionTemplate::New(env->isolate(), NewFSReqWrap); + // Create FunctionTemplate for FSReqCallback + Local fst = env->NewFunctionTemplate(NewFSReqWrap); fst->InstanceTemplate()->SetInternalFieldCount(1); AsyncWrap::AddWrapMethods(env, fst); Local wrapString = diff --git a/src/node_internals.h b/src/node_internals.h index 68bb156c042fcf..129cfddb46853f 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -180,11 +180,6 @@ extern bool v8_initialized; extern Mutex per_process_opts_mutex; extern std::shared_ptr per_process_opts; -extern const char* const environment_flags[]; -extern int environment_flags_count; -extern const char* const v8_environment_flags[]; -extern int v8_environment_flags_count; - // Forward declaration class Environment; @@ -506,7 +501,9 @@ class InternalCallbackScope { class ThreadPoolWork { public: - explicit inline ThreadPoolWork(Environment* env) : env_(env) {} + explicit inline ThreadPoolWork(Environment* env) : env_(env) { + CHECK_NOT_NULL(env); + } inline virtual ~ThreadPoolWork() = default; inline void ScheduleWork(); @@ -888,6 +885,8 @@ void Abort(const v8::FunctionCallbackInfo& args); void Chdir(const v8::FunctionCallbackInfo& args); void CPUUsage(const v8::FunctionCallbackInfo& args); void Cwd(const v8::FunctionCallbackInfo& args); +void GetActiveHandles(const v8::FunctionCallbackInfo& args); +void GetActiveRequests(const v8::FunctionCallbackInfo& args); void Hrtime(const v8::FunctionCallbackInfo& args); void HrtimeBigInt(const v8::FunctionCallbackInfo& args); void Kill(const v8::FunctionCallbackInfo& args); @@ -908,6 +907,11 @@ void EnvSetter(v8::Local property, void EnvQuery(v8::Local property, const v8::PropertyCallbackInfo& info); void EnvEnumerator(const v8::PropertyCallbackInfo& info); +void DebugPortGetter(v8::Local property, + const v8::PropertyCallbackInfo& info); +void DebugPortSetter(v8::Local property, + v8::Local value, + const v8::PropertyCallbackInfo& info); void GetParentProcessId(v8::Local property, const v8::PropertyCallbackInfo& info); diff --git a/src/node_options.cc b/src/node_options.cc index ae81ab96645695..46f529cff2e961 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -108,6 +108,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { AddOption("--prof-process", "process V8 profiler output generated using --prof", &EnvironmentOptions::prof_process); + // Options after --prof-process are passed through to the prof processor. + AddAlias("--prof-process", { "--prof-process", "--" }); AddOption("--redirect-warnings", "write warnings to file instead of stderr", &EnvironmentOptions::redirect_warnings, @@ -205,7 +207,7 @@ PerProcessOptionsParser::PerProcessOptionsParser() { kAllowedInEnvironment); AddOption("--trace-event-file-pattern", "Template string specifying the filepath for the trace-events " - "data, it supports ${rotation} and ${pid} log-rotation id.", + "data, it supports ${rotation} and ${pid}.", &PerProcessOptions::trace_event_file_pattern, kAllowedInEnvironment); AddAlias("--trace-events-enabled", { diff --git a/src/node_options.h b/src/node_options.h index 7891d550ae3dad..71615cf0839aa4 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -60,6 +60,7 @@ class DebugOptions { class EnvironmentOptions { public: std::shared_ptr debug_options { new DebugOptions() }; + bool abort_on_uncaught_exception = false; bool experimental_modules = false; bool experimental_repl_await = false; bool experimental_vm_modules = false; diff --git a/src/node_perf.cc b/src/node_perf.cc index cedb924e65eb98..828a1dd7ff4bde 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -310,6 +310,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); + CHECK_NOT_NULL(env); // TODO(addaleax): Verify that this is correct. Local context = env->context(); Local fn = args.Data().As(); size_t count = args.Length(); diff --git a/src/node_process.cc b/src/node_process.cc index 92618e12f7bd12..f6a5424f56547b 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -1,10 +1,16 @@ #include "node.h" #include "node_internals.h" +#include "base_object.h" +#include "base_object-inl.h" #include "env-inl.h" #include "util-inl.h" #include "uv.h" #include "v8.h" +#if HAVE_INSPECTOR +#include "inspector_io.h" +#endif + #include // PATH_MAX #include @@ -777,5 +783,83 @@ void GetParentProcessId(Local property, info.GetReturnValue().Set(Integer::New(info.GetIsolate(), uv_os_getppid())); } +void GetActiveRequests(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + + Local ary = Array::New(args.GetIsolate()); + Local ctx = env->context(); + Local fn = env->push_values_to_array_function(); + Local argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; + size_t idx = 0; + + for (auto w : *env->req_wrap_queue()) { + if (w->persistent().IsEmpty()) + continue; + argv[idx] = w->GetOwner(); + if (++idx >= arraysize(argv)) { + fn->Call(ctx, ary, idx, argv).ToLocalChecked(); + idx = 0; + } + } + + if (idx > 0) { + fn->Call(ctx, ary, idx, argv).ToLocalChecked(); + } + + args.GetReturnValue().Set(ary); +} + + +// Non-static, friend of HandleWrap. Could have been a HandleWrap method but +// implemented here for consistency with GetActiveRequests(). +void GetActiveHandles(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + + Local ary = Array::New(env->isolate()); + Local ctx = env->context(); + Local fn = env->push_values_to_array_function(); + Local argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; + size_t idx = 0; + + for (auto w : *env->handle_wrap_queue()) { + if (!HandleWrap::HasRef(w)) + continue; + argv[idx] = w->GetOwner(); + if (++idx >= arraysize(argv)) { + fn->Call(ctx, ary, idx, argv).ToLocalChecked(); + idx = 0; + } + } + if (idx > 0) { + fn->Call(ctx, ary, idx, argv).ToLocalChecked(); + } + + args.GetReturnValue().Set(ary); +} + +void DebugPortGetter(Local property, + const PropertyCallbackInfo& info) { + Environment* env = Environment::GetCurrent(info); + Mutex::ScopedLock lock(process_mutex); + int port = env->options()->debug_options->port(); +#if HAVE_INSPECTOR + if (port == 0) { + if (auto io = env->inspector_agent()->io()) + port = io->port(); + } +#endif // HAVE_INSPECTOR + info.GetReturnValue().Set(port); +} + + +void DebugPortSetter(Local property, + Local value, + const PropertyCallbackInfo& info) { + Environment* env = Environment::GetCurrent(info); + Mutex::ScopedLock lock(process_mutex); + env->options()->debug_options->host_port.port = + value->Int32Value(env->context()).FromMaybe(0); +} + } // namespace node diff --git a/src/node_types.cc b/src/node_types.cc index 4872491c924989..97f6ef4e28c13c 100644 --- a/src/node_types.cc +++ b/src/node_types.cc @@ -51,6 +51,15 @@ static void IsAnyArrayBuffer(const FunctionCallbackInfo& args) { args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer()); } +static void IsBoxedPrimitive(const FunctionCallbackInfo& args) { + args.GetReturnValue().Set( + args[0]->IsNumberObject() || + args[0]->IsStringObject() || + args[0]->IsBooleanObject() || + args[0]->IsBigIntObject() || + args[0]->IsSymbolObject()); +} + void InitializeTypes(Local target, Local unused, Local context) { @@ -63,6 +72,7 @@ void InitializeTypes(Local target, #undef V env->SetMethodNoSideEffect(target, "isAnyArrayBuffer", IsAnyArrayBuffer); + env->SetMethodNoSideEffect(target, "isBoxedPrimitive", IsBoxedPrimitive); } } // anonymous namespace diff --git a/src/node_version.h b/src/node_version.h index def1f2ceff1ee9..5572d43aa3e66a 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 10 -#define NODE_MINOR_VERSION 10 -#define NODE_PATCH_VERSION 1 +#define NODE_MINOR_VERSION 11 +#define NODE_PATCH_VERSION 0 #define NODE_VERSION_IS_LTS 0 #define NODE_VERSION_LTS_CODENAME "" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) diff --git a/src/node_worker.cc b/src/node_worker.cc index d70cb42dfff44a..fa192d1291ec84 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -71,14 +71,6 @@ Worker::Worker(Environment* env, Local wrap) CHECK_NE(isolate_, nullptr); CHECK_EQ(uv_loop_init(&loop_), 0); - thread_exit_async_.reset(new uv_async_t); - thread_exit_async_->data = this; - CHECK_EQ(uv_async_init(env->event_loop(), - thread_exit_async_.get(), - [](uv_async_t* handle) { - static_cast(handle->data)->OnThreadStopped(); - }), 0); - { // Enter an environment capable of executing code in the child Isolate // (and only in it). @@ -242,9 +234,6 @@ void Worker::Run() { DisposeIsolate(); - // Need to run the loop one more time to close the platform's uv_async_t - uv_run(&loop_, UV_RUN_ONCE); - { Mutex::ScopedLock lock(mutex_); CHECK(thread_exit_async_); @@ -256,6 +245,13 @@ void Worker::Run() { } void Worker::DisposeIsolate() { + if (env_) { + CHECK_NOT_NULL(isolate_); + Locker locker(isolate_); + Isolate::Scope isolate_scope(isolate_); + env_.reset(); + } + if (isolate_ == nullptr) return; @@ -331,12 +327,16 @@ Worker::~Worker() { CHECK(stopped_); CHECK(thread_joined_); CHECK_EQ(child_port_, nullptr); - CheckedUvLoopClose(&loop_); // This has most likely already happened within the worker thread -- this // is just in case Worker creation failed early. DisposeIsolate(); + // Need to run the loop one more time to close the platform's uv_async_t + uv_run(&loop_, UV_RUN_ONCE); + + CheckedUvLoopClose(&loop_); + Debug(this, "Worker %llu destroyed", thread_id_); } @@ -360,10 +360,19 @@ void Worker::StartThread(const FunctionCallbackInfo& args) { w->env()->add_sub_worker_context(w); w->stopped_ = false; + w->thread_joined_ = false; + + w->thread_exit_async_.reset(new uv_async_t); + w->thread_exit_async_->data = w; + CHECK_EQ(uv_async_init(w->env()->event_loop(), + w->thread_exit_async_.get(), + [](uv_async_t* handle) { + static_cast(handle->data)->OnThreadStopped(); + }), 0); + CHECK_EQ(uv_thread_create(&w->tid_, [](void* arg) { static_cast(arg)->Run(); }, static_cast(w)), 0); - w->thread_joined_ = false; } void Worker::StopThread(const FunctionCallbackInfo& args) { diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc index 70a0ad4b311610..3b7119f6d57f68 100644 --- a/src/tracing/node_trace_buffer.cc +++ b/src/tracing/node_trace_buffer.cc @@ -59,7 +59,13 @@ void InternalTraceBuffer::Flush(bool blocking) { for (size_t i = 0; i < total_chunks_; ++i) { auto& chunk = chunks_[i]; for (size_t j = 0; j < chunk->size(); ++j) { - agent_->AppendTraceEvent(chunk->GetEventAt(j)); + TraceObject* trace_event = chunk->GetEventAt(j); + // Another thread may have added a trace that is yet to be + // initialized. Skip such traces. + // https://github.com/nodejs/node/issues/21038. + if (trace_event->name()) { + agent_->AppendTraceEvent(trace_event); + } } } total_chunks_ = 0; diff --git a/src/util.h b/src/util.h index 057346a2d04fca..4036383dee92de 100644 --- a/src/util.h +++ b/src/util.h @@ -89,9 +89,6 @@ NO_RETURN void Abort(); NO_RETURN void Assert(const char* const (*args)[4]); void DumpBacktrace(FILE* fp); -#define FIXED_ONE_BYTE_STRING(isolate, string) \ - (node::OneByteString((isolate), (string), sizeof(string) - 1)) - #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ void operator=(const TypeName&) = delete; \ void operator=(TypeName&&) = delete; \ @@ -248,6 +245,15 @@ inline v8::Local OneByteString(v8::Isolate* isolate, const unsigned char* data, int length = -1); +// Used to be a macro, hence the uppercase name. +template +inline v8::Local FIXED_ONE_BYTE_STRING( + v8::Isolate* isolate, + const char(&data)[N]) { + return OneByteString(isolate, data, N - 1); +} + + // Swaps bytes in place. nbytes is the number of bytes to swap and must be a // multiple of the word size (checked by function). inline void SwapBytes16(char* data, size_t nbytes); diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 25026fec5a103a..63d2127d738597 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -23,10 +23,14 @@ rules: no-restricted-syntax: # Config copied from .eslintrc.js - error + - selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.2.type='Literal']" + message: "Do not use a literal for the third argument of assert.deepStrictEqual()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']" message: "Please replace `assert.doesNotThrow()` and add a comment next to the code instead." - selector: "CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]" message: "assert.rejects() must be invoked with at least two arguments." + - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.2.type='Literal']" + message: "Do not use a literal for the third argument of assert.strictEqual()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])" message: "Use an object as second argument of assert.throws()" - selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]" diff --git a/test/addons-napi/7_factory_wrap/binding.cc b/test/addons-napi/7_factory_wrap/binding.cc index d98132457875a1..e937516c894a90 100644 --- a/test/addons-napi/7_factory_wrap/binding.cc +++ b/test/addons-napi/7_factory_wrap/binding.cc @@ -15,9 +15,14 @@ napi_value CreateObject(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, MyObject::Init(env)); - NAPI_CALL(env, - // NOLINTNEXTLINE (readability/null_usage) - napi_create_function(env, "exports", -1, CreateObject, NULL, &exports)); + napi_property_descriptor descriptors[] = { + DECLARE_NAPI_GETTER("finalizeCount", MyObject::GetFinalizeCount), + DECLARE_NAPI_PROPERTY("createObject", CreateObject), + }; + + NAPI_CALL(env, napi_define_properties( + env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors)); + return exports; } diff --git a/test/addons-napi/7_factory_wrap/myobject.cc b/test/addons-napi/7_factory_wrap/myobject.cc index 4e1d79c1febc17..b7cc9c534f366a 100644 --- a/test/addons-napi/7_factory_wrap/myobject.cc +++ b/test/addons-napi/7_factory_wrap/myobject.cc @@ -1,6 +1,8 @@ #include "myobject.h" #include "../common.h" +static int finalize_count = 0; + MyObject::MyObject() : env_(nullptr), wrapper_(nullptr) {} MyObject::~MyObject() { napi_delete_reference(env_, wrapper_); } @@ -8,10 +10,17 @@ MyObject::~MyObject() { napi_delete_reference(env_, wrapper_); } void MyObject::Destructor(napi_env env, void* nativeObject, void* /*finalize_hint*/) { + ++finalize_count; MyObject* obj = static_cast(nativeObject); delete obj; } +napi_value MyObject::GetFinalizeCount(napi_env env, napi_callback_info info) { + napi_value result; + NAPI_CALL(env, napi_create_int32(env, finalize_count, &result)); + return result; +} + napi_ref MyObject::constructor; napi_status MyObject::Init(napi_env env) { diff --git a/test/addons-napi/7_factory_wrap/myobject.h b/test/addons-napi/7_factory_wrap/myobject.h index 28ca94d16e30dd..172fcd3ca49295 100644 --- a/test/addons-napi/7_factory_wrap/myobject.h +++ b/test/addons-napi/7_factory_wrap/myobject.h @@ -7,6 +7,7 @@ class MyObject { public: static napi_status Init(napi_env env); static void Destructor(napi_env env, void* nativeObject, void* finalize_hint); + static napi_value GetFinalizeCount(napi_env env, napi_callback_info info); static napi_status NewInstance(napi_env env, napi_value arg, napi_value* instance); diff --git a/test/addons-napi/7_factory_wrap/test.js b/test/addons-napi/7_factory_wrap/test.js index 20108e14b629bc..8aaf1b0ba91ee7 100644 --- a/test/addons-napi/7_factory_wrap/test.js +++ b/test/addons-napi/7_factory_wrap/test.js @@ -1,14 +1,25 @@ 'use strict'; +// Flags: --expose-gc + const common = require('../../common'); const assert = require('assert'); -const createObject = require(`./build/${common.buildType}/binding`); +const test = require(`./build/${common.buildType}/binding`); -const obj = createObject(10); -assert.strictEqual(obj.plusOne(), 11); -assert.strictEqual(obj.plusOne(), 12); -assert.strictEqual(obj.plusOne(), 13); +assert.strictEqual(test.finalizeCount, 0); +(() => { + const obj = test.createObject(10); + assert.strictEqual(obj.plusOne(), 11); + assert.strictEqual(obj.plusOne(), 12); + assert.strictEqual(obj.plusOne(), 13); +})(); +global.gc(); +assert.strictEqual(test.finalizeCount, 1); -const obj2 = createObject(20); -assert.strictEqual(obj2.plusOne(), 21); -assert.strictEqual(obj2.plusOne(), 22); -assert.strictEqual(obj2.plusOne(), 23); +(() => { + const obj2 = test.createObject(20); + assert.strictEqual(obj2.plusOne(), 21); + assert.strictEqual(obj2.plusOne(), 22); + assert.strictEqual(obj2.plusOne(), 23); +})(); +global.gc(); +assert.strictEqual(test.finalizeCount, 2); diff --git a/test/addons-napi/8_passing_wrapped/test.js b/test/addons-napi/8_passing_wrapped/test.js index 7793133f7750ba..525993c96d3bad 100644 --- a/test/addons-napi/8_passing_wrapped/test.js +++ b/test/addons-napi/8_passing_wrapped/test.js @@ -6,11 +6,12 @@ const assert = require('assert'); const addon = require(`./build/${common.buildType}/binding`); let obj1 = addon.createObject(10); -const obj2 = addon.createObject(20); +let obj2 = addon.createObject(20); const result = addon.add(obj1, obj2); assert.strictEqual(result, 30); // Make sure the native destructor gets called. obj1 = null; +obj2 = null; global.gc(); -assert.strictEqual(addon.finalizeCount(), 1); +assert.strictEqual(addon.finalizeCount(), 2); diff --git a/test/addons-napi/test_general/testFinalizer.js b/test/addons-napi/test_general/testFinalizer.js new file mode 100644 index 00000000000000..b440ed5e501ad8 --- /dev/null +++ b/test/addons-napi/test_general/testFinalizer.js @@ -0,0 +1,32 @@ +'use strict'; +// Flags: --expose-gc + +const common = require('../../common'); +const test_general = require(`./build/${common.buildType}/test_general`); +const assert = require('assert'); + +let finalized = {}; +const callback = common.mustCall(2); + +// Add two items to be finalized and ensure the callback is called for each. +test_general.addFinalizerOnly(finalized, callback); +test_general.addFinalizerOnly(finalized, callback); + +// Ensure attached items cannot be retrieved. +common.expectsError(() => test_general.unwrap(finalized), + { type: Error, message: 'Invalid argument' }); + +// Ensure attached items cannot be removed. +common.expectsError(() => test_general.removeWrap(finalized), + { type: Error, message: 'Invalid argument' }); +finalized = null; +global.gc(); + +// Add an item to an object that is already wrapped, and ensure that its +// finalizer as well as the wrap finalizer gets called. +let finalizeAndWrap = {}; +test_general.wrap(finalizeAndWrap); +test_general.addFinalizerOnly(finalizeAndWrap, common.mustCall()); +finalizeAndWrap = null; +global.gc(); +assert.strictEqual(test_general.derefItemWasCalled(), true); diff --git a/test/addons-napi/test_general/test_general.c b/test/addons-napi/test_general/test_general.c index 5a363d0b168f89..498aec4983c0c8 100644 --- a/test/addons-napi/test_general/test_general.c +++ b/test/addons-napi/test_general/test_general.c @@ -1,3 +1,4 @@ +#define NAPI_EXPERIMENTAL #include #include #include "../common.h" @@ -177,6 +178,17 @@ static napi_value wrap(napi_env env, napi_callback_info info) { return NULL; } +static napi_value unwrap(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value wrapped; + void* data; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &wrapped, NULL, NULL)); + NAPI_CALL(env, napi_unwrap(env, wrapped, &data)); + + return NULL; +} + static napi_value remove_wrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value wrapped; @@ -232,6 +244,33 @@ static napi_value testNapiRun(napi_env env, napi_callback_info info) { return result; } +static void finalizer_only_callback(napi_env env, void* data, void* hint) { + napi_ref js_cb_ref = data; + napi_value js_cb, undefined; + NAPI_CALL_RETURN_VOID(env, napi_get_reference_value(env, js_cb_ref, &js_cb)); + NAPI_CALL_RETURN_VOID(env, napi_get_undefined(env, &undefined)); + NAPI_CALL_RETURN_VOID(env, + napi_call_function(env, undefined, js_cb, 0, NULL, NULL)); + NAPI_CALL_RETURN_VOID(env, napi_delete_reference(env, js_cb_ref)); +} + +static napi_value add_finalizer_only(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value argv[2]; + napi_ref js_cb_ref; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); + NAPI_CALL(env, napi_create_reference(env, argv[1], 1, &js_cb_ref)); + NAPI_CALL(env, + napi_add_finalizer(env, + argv[0], + js_cb_ref, + finalizer_only_callback, + NULL, + NULL)); + return NULL; +} + static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("testStrictEquals", testStrictEquals), @@ -246,7 +285,9 @@ static napi_value Init(napi_env env, napi_value exports) { DECLARE_NAPI_PROPERTY("testNapiErrorCleanup", testNapiErrorCleanup), DECLARE_NAPI_PROPERTY("testNapiTypeof", testNapiTypeof), DECLARE_NAPI_PROPERTY("wrap", wrap), + DECLARE_NAPI_PROPERTY("unwrap", unwrap), DECLARE_NAPI_PROPERTY("removeWrap", remove_wrap), + DECLARE_NAPI_PROPERTY("addFinalizerOnly", add_finalizer_only), DECLARE_NAPI_PROPERTY("testFinalizeWrap", test_finalize_wrap), DECLARE_NAPI_PROPERTY("finalizeWasCalled", finalize_was_called), DECLARE_NAPI_PROPERTY("derefItemWasCalled", deref_item_was_called), diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index d4b74ed831f512..3a584a88a07bc9 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -73,7 +73,7 @@ void Method(const v8::FunctionCallbackInfo& args) { async_req* req = new async_req; req->req.data = req; - req->input = args[0]->IntegerValue(); + req->input = args[0].As()->Value(); req->output = 0; req->isolate = isolate; req->context = node::EmitAsyncInit(isolate, v8::Object::New(isolate), "test"); diff --git a/test/addons/buffer-free-callback/binding.cc b/test/addons/buffer-free-callback/binding.cc index 4075fef50dcb0b..64f3e031ad5da2 100644 --- a/test/addons/buffer-free-callback/binding.cc +++ b/test/addons/buffer-free-callback/binding.cc @@ -15,8 +15,8 @@ void Alloc(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); alive++; - uintptr_t alignment = args[1]->IntegerValue(); - uintptr_t offset = args[2]->IntegerValue(); + uintptr_t alignment = args[1].As()->Value(); + uintptr_t offset = args[2].As()->Value(); uintptr_t static_offset = reinterpret_cast(buf) % alignment; char* aligned = buf + (alignment - static_offset) + offset; @@ -24,7 +24,7 @@ void Alloc(const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(node::Buffer::New( isolate, aligned, - args[0]->IntegerValue(), + args[0].As()->Value(), FreeCallback, nullptr).ToLocalChecked()); } diff --git a/test/addons/callback-scope/test-resolve-async.js b/test/addons/callback-scope/test-resolve-async.js index 98e1910b49df7b..c2942397737359 100644 --- a/test/addons/callback-scope/test-resolve-async.js +++ b/test/addons/callback-scope/test-resolve-async.js @@ -4,7 +4,9 @@ const common = require('../../common'); const assert = require('assert'); const { testResolveAsync } = require(`./build/${common.buildType}/binding`); +// Checks that resolving promises from C++ works. + let called = false; testResolveAsync().then(() => { called = true; }); -setTimeout(() => { assert(called); }, common.platformTimeout(50)); +process.on('beforeExit', () => { assert(called); }); diff --git a/test/addons/stringbytes-external-exceed-max/binding.cc b/test/addons/stringbytes-external-exceed-max/binding.cc index 628a6b691376b3..573b505bdece94 100644 --- a/test/addons/stringbytes-external-exceed-max/binding.cc +++ b/test/addons/stringbytes-external-exceed-max/binding.cc @@ -4,7 +4,7 @@ void EnsureAllocation(const v8::FunctionCallbackInfo &args) { v8::Isolate* isolate = args.GetIsolate(); - uintptr_t size = args[0]->IntegerValue(); + uintptr_t size = args[0].As()->Value(); v8::Local success; void* buffer = malloc(size); diff --git a/test/async-hooks/test-async-await.js b/test/async-hooks/test-async-await.js index 7f88cd9b18176f..f5e886e9d50001 100644 --- a/test/async-hooks/test-async-await.js +++ b/test/async-hooks/test-async-await.js @@ -64,15 +64,15 @@ const timeout = common.platformTimeout(10); function checkPromisesInitState() { for (const initState of promisesInitState.values()) { - assert.strictEqual(initState, 'resolved', - 'promise initialized without being resolved'); + // Promise should not be initialized without being resolved. + assert.strictEqual(initState, 'resolved'); } } function checkPromisesExecutionState() { for (const executionState of promisesExecutionState.values()) { - assert.strictEqual(executionState, 'after', - 'mismatch between before and after hook calls'); + // Check for mismatch between before and after hook calls. + assert.strictEqual(executionState, 'after'); } } diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 07170ac267adea..fa0f94a5add9bd 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -70,6 +70,26 @@ TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) { EXPECT_TRUE(called_cb_2); } +TEST_F(EnvironmentTest, NonNodeJSContext) { + const v8::HandleScope handle_scope(isolate_); + const Argv argv; + Env test_env {handle_scope, argv}; + + EXPECT_EQ(node::Environment::GetCurrent(v8::Local()), nullptr); + + node::Environment* env = *test_env; + EXPECT_EQ(node::Environment::GetCurrent(isolate_), env); + EXPECT_EQ(node::Environment::GetCurrent(env->context()), env); + + v8::Local context = v8::Context::New(isolate_); + EXPECT_EQ(node::Environment::GetCurrent(context), nullptr); + EXPECT_EQ(node::Environment::GetCurrent(isolate_), env); + + v8::Context::Scope context_scope(context); + EXPECT_EQ(node::Environment::GetCurrent(context), nullptr); + EXPECT_EQ(node::Environment::GetCurrent(isolate_), nullptr); +} + static void at_exit_callback1(void* arg) { called_cb_1 = true; if (arg) { diff --git a/test/common/heap.js b/test/common/heap.js index a02de9a60651f4..bd8b588b4b0e1b 100644 --- a/test/common/heap.js +++ b/test/common/heap.js @@ -33,10 +33,17 @@ class State { (node) => [expectedChild.name, 'Node / ' + expectedChild.name] .includes(node.name); - assert(snapshot.some((node) => { + const hasChild = snapshot.some((node) => { return node.outgoingEdges.map((edge) => edge.toNode).some(check); - }), `expected to find child ${util.inspect(expectedChild)} ` + - `in ${util.inspect(snapshot)}`); + }); + // Don't use assert with a custom message here. Otherwise the + // inspection in the message is done eagerly and wastes a lot of CPU + // time. + if (!hasChild) { + throw new Error( + 'expected to find child ' + + `${util.inspect(expectedChild)} in ${util.inspect(snapshot)}`); + } } } } @@ -57,9 +64,15 @@ class State { node.value.constructor.name === expectedChild.name); }; - assert(graph.some((node) => node.edges.some(check)), - `expected to find child ${util.inspect(expectedChild)} ` + - `in ${util.inspect(snapshot)}`); + // Don't use assert with a custom message here. Otherwise the + // inspection in the message is done eagerly and wastes a lot of CPU + // time. + const hasChild = graph.some((node) => node.edges.some(check)); + if (!hasChild) { + throw new Error( + 'expected to find child ' + + `${util.inspect(expectedChild)} in ${util.inspect(snapshot)}`); + } } } } diff --git a/test/common/index.js b/test/common/index.js index d51cff54a6473e..0da37360bc4aa1 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -31,20 +31,15 @@ const util = require('util'); const Timer = process.binding('timer_wrap').Timer; const { fixturesDir } = require('./fixtures'); const tmpdir = require('./tmpdir'); +const { + bits, + hasIntl, + hasSmallICU +} = process.binding('config'); const noop = () => {}; -Object.defineProperty(exports, 'PORT', { - get: () => { - if (+process.env.TEST_PARALLEL) { - throw new Error('common.PORT cannot be used in a parallelized test'); - } - return +process.env.NODE_COMMON_PORT || 12346; - }, - enumerable: true -}); - -exports.isMainThread = (() => { +const isMainThread = (() => { try { return require('worker_threads').isMainThread; } catch { @@ -53,27 +48,28 @@ exports.isMainThread = (() => { } })(); -exports.isWindows = process.platform === 'win32'; -exports.isWOW64 = exports.isWindows && - (process.env.PROCESSOR_ARCHITEW6432 !== undefined); -exports.isAIX = process.platform === 'aix'; -exports.isLinuxPPCBE = (process.platform === 'linux') && - (process.arch === 'ppc64') && - (os.endianness() === 'BE'); -exports.isSunOS = process.platform === 'sunos'; -exports.isFreeBSD = process.platform === 'freebsd'; -exports.isOpenBSD = process.platform === 'openbsd'; -exports.isLinux = process.platform === 'linux'; -exports.isOSX = process.platform === 'darwin'; - -exports.enoughTestMem = os.totalmem() > 0x70000000; /* 1.75 Gb */ +const isWindows = process.platform === 'win32'; +const isWOW64 = isWindows && (process.env.PROCESSOR_ARCHITEW6432 !== undefined); +const isAIX = process.platform === 'aix'; +const isLinuxPPCBE = (process.platform === 'linux') && + (process.arch === 'ppc64') && + (os.endianness() === 'BE'); +const isSunOS = process.platform === 'sunos'; +const isFreeBSD = process.platform === 'freebsd'; +const isOpenBSD = process.platform === 'openbsd'; +const isLinux = process.platform === 'linux'; +const isOSX = process.platform === 'darwin'; + +const enoughTestMem = os.totalmem() > 0x70000000; /* 1.75 Gb */ const cpus = os.cpus(); -exports.enoughTestCpu = Array.isArray(cpus) && - (cpus.length > 1 || cpus[0].speed > 999); +const enoughTestCpu = Array.isArray(cpus) && + (cpus.length > 1 || cpus[0].speed > 999); + +const rootDir = isWindows ? 'c:\\' : '/'; -exports.rootDir = exports.isWindows ? 'c:\\' : '/'; +const buildType = process.config.target_defaults.default_configuration; -exports.buildType = process.config.target_defaults.default_configuration; +const hasCrypto = Boolean(process.versions.openssl); // If env var is set then enable async_hook hooks for all tests. if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) { @@ -126,9 +122,8 @@ let opensslCli = null; let inFreeBSDJail = null; let localhostIPv4 = null; -exports.localIPv6Hosts = ['localhost']; -if (exports.isLinux) { - exports.localIPv6Hosts = [ +const localIPv6Hosts = + isLinux ? [ // Debian/Ubuntu 'ip6-localhost', 'ip6-loopback', @@ -139,110 +134,32 @@ if (exports.isLinux) { // Typically universal 'localhost', - ]; -} - -Object.defineProperty(exports, 'inFreeBSDJail', { - get: function() { - if (inFreeBSDJail !== null) return inFreeBSDJail; - - if (exports.isFreeBSD && - execSync('sysctl -n security.jail.jailed').toString() === - '1\n') { - inFreeBSDJail = true; - } else { - inFreeBSDJail = false; - } - return inFreeBSDJail; - } -}); - -Object.defineProperty(exports, 'localhostIPv4', { - get: function() { - if (localhostIPv4 !== null) return localhostIPv4; - - if (exports.inFreeBSDJail) { - // Jailed network interfaces are a bit special - since we need to jump - // through loops, as well as this being an exception case, assume the - // user will provide this instead. - if (process.env.LOCALHOST) { - localhostIPv4 = process.env.LOCALHOST; - } else { - console.error('Looks like we\'re in a FreeBSD Jail. ' + - 'Please provide your default interface address ' + - 'as LOCALHOST or expect some tests to fail.'); - } - } - - if (localhostIPv4 === null) localhostIPv4 = '127.0.0.1'; - - return localhostIPv4; - } -}); + ] : [ 'localhost' ]; -Object.defineProperty(exports, 'localhostIPv6', { - get: () => '::1' -}); - -// opensslCli defined lazily to reduce overhead of spawnSync -Object.defineProperty(exports, 'opensslCli', { get: function() { - if (opensslCli !== null) return opensslCli; - - if (process.config.variables.node_shared_openssl) { - // use external command - opensslCli = 'openssl'; - } else { - // use command built from sources included in Node.js repository - opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli'); - } - - if (exports.isWindows) opensslCli += '.exe'; - - const opensslCmd = spawnSync(opensslCli, ['version']); - if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { - // openssl command cannot be executed - opensslCli = false; - } - return opensslCli; -}, enumerable: true }); - -Object.defineProperty(exports, 'hasCrypto', { - get: function() { - return Boolean(process.versions.openssl); - } -}); - -Object.defineProperty(exports, 'hasFipsCrypto', { - get: function() { - return exports.hasCrypto && require('crypto').fips; - } -}); - -{ +const PIPE = (() => { const localRelative = path.relative(process.cwd(), `${tmpdir.path}/`); - const pipePrefix = exports.isWindows ? '\\\\.\\pipe\\' : localRelative; + const pipePrefix = isWindows ? '\\\\.\\pipe\\' : localRelative; const pipeName = `node-test.${process.pid}.sock`; - exports.PIPE = path.join(pipePrefix, pipeName); -} + return path.join(pipePrefix, pipeName); +})(); -{ +const hasIPv6 = (() => { const iFaces = os.networkInterfaces(); - const re = exports.isWindows ? /Loopback Pseudo-Interface/ : /lo/; - exports.hasIPv6 = Object.keys(iFaces).some(function(name) { - return re.test(name) && iFaces[name].some(function(info) { - return info.family === 'IPv6'; - }); + const re = isWindows ? /Loopback Pseudo-Interface/ : /lo/; + return Object.keys(iFaces).some((name) => { + return re.test(name) && + iFaces[name].some(({ family }) => family === 'IPv6'); }); -} +})(); /* * Check that when running a test with * `$node --abort-on-uncaught-exception $file child` * the process aborts. */ -exports.childShouldThrowAndAbort = function() { +function childShouldThrowAndAbort() { let testCmd = ''; - if (!exports.isWindows) { + if (!isWindows) { // Do not create core files, as it can take a lot of disk space on // continuous testing and developers' machines testCmd += 'ulimit -c 0 && '; @@ -254,33 +171,33 @@ exports.childShouldThrowAndAbort = function() { const errMsg = 'Test should have aborted ' + `but instead exited with exit code ${exitCode}` + ` and signal ${signal}`; - assert(exports.nodeProcessAborted(exitCode, signal), errMsg); + assert(nodeProcessAborted(exitCode, signal), errMsg); }); -}; +} -exports.ddCommand = function(filename, kilobytes) { - if (exports.isWindows) { +function ddCommand(filename, kilobytes) { + if (isWindows) { const p = path.resolve(fixturesDir, 'create-file.js'); return `"${process.argv[0]}" "${p}" "${filename}" ${kilobytes * 1024}`; } else { return `dd if=/dev/zero of="${filename}" bs=1024 count=${kilobytes}`; } -}; +} -exports.pwdCommand = exports.isWindows ? +const pwdCommand = isWindows ? ['cmd.exe', ['/d', '/c', 'cd']] : ['pwd', []]; -exports.platformTimeout = function(ms) { +function platformTimeout(ms) { if (process.features.debug) ms = 2 * ms; if (global.__coverage__) ms = 4 * ms; - if (exports.isAIX) + if (isAIX) return 2 * ms; // default localhost speed is slower on AIX if (process.arch !== 'arm') @@ -295,7 +212,7 @@ exports.platformTimeout = function(ms) { return 2 * ms; // ARMv7 return ms; // ARMv8+ -}; +} let knownGlobals = [ Buffer, @@ -339,7 +256,6 @@ if (process.env.NODE_TEST_KNOWN_GLOBALS) { function allowGlobals(...whitelist) { knownGlobals = knownGlobals.concat(whitelist); } -exports.allowGlobals = allowGlobals; function leakedGlobals() { const leaked = []; @@ -356,7 +272,6 @@ function leakedGlobals() { return leaked; } } -exports.leakedGlobals = leakedGlobals; process.on('exit', function() { const leaked = leakedGlobals(); @@ -391,19 +306,19 @@ function runCallChecks(exitCode) { if (failed.length) process.exit(1); } -exports.mustCall = function(fn, exact) { +function mustCall(fn, exact) { return _mustCallInner(fn, exact, 'exact'); -}; +} -exports.mustCallAtLeast = function(fn, minimum) { +function mustCallAtLeast(fn, minimum) { return _mustCallInner(fn, minimum, 'minimum'); -}; +} -exports.mustCallAsync = function(fn, exact) { - return exports.mustCall((...args) => { - return Promise.resolve(fn(...args)).then(exports.mustCall((val) => val)); +function mustCallAsync(fn, exact) { + return mustCall((...args) => { + return Promise.resolve(fn(...args)).then(mustCall((val) => val)); }, exact); -}; +} function _mustCallInner(fn, criteria = 1, field) { if (process._exiting) @@ -436,27 +351,27 @@ function _mustCallInner(fn, criteria = 1, field) { }; } -exports.hasMultiLocalhost = function hasMultiLocalhost() { +function hasMultiLocalhost() { const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const t = new TCP(TCPConstants.SOCKET); const ret = t.bind('127.0.0.2', 0); t.close(); return ret === 0; -}; +} -exports.skipIfEslintMissing = function() { +function skipIfEslintMissing() { if (!fs.existsSync( path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint') )) { - exports.skip('missing ESLint'); + skip('missing ESLint'); } -}; +} -exports.canCreateSymLink = function() { +function canCreateSymLink() { // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. // On other platforms, creating symlinks shouldn't need admin privileges - if (exports.isWindows) { + if (isWindows) { // whoami.exe needs to be the one from System32 // If unix tools are in the path, they can shadow the one we want, // so use the full path while executing whoami @@ -472,9 +387,9 @@ exports.canCreateSymLink = function() { } // On non-Windows platforms, this always returns `true` return true; -}; +} -exports.getCallSite = function getCallSite(top) { +function getCallSite(top) { const originalStackFormatter = Error.prepareStackTrace; Error.prepareStackTrace = (err, stack) => `${stack[0].getFileName()}:${stack[0].getLineNumber()}`; @@ -484,29 +399,29 @@ exports.getCallSite = function getCallSite(top) { err.stack; Error.prepareStackTrace = originalStackFormatter; return err.stack; -}; +} -exports.mustNotCall = function(msg) { - const callSite = exports.getCallSite(exports.mustNotCall); +function mustNotCall(msg) { + const callSite = getCallSite(mustNotCall); return function mustNotCall() { assert.fail( `${msg || 'function should not have been called'} at ${callSite}`); }; -}; +} -exports.printSkipMessage = function(msg) { +function printSkipMessage(msg) { console.log(`1..0 # Skipped: ${msg}`); -}; +} -exports.skip = function(msg) { - exports.printSkipMessage(msg); +function skip(msg) { + printSkipMessage(msg); process.exit(0); -}; +} // Returns true if the exit code "exitCode" and/or signal name "signal" // represent the exit code and/or signal name of a node process that aborted, // false otherwise. -exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { +function nodeProcessAborted(exitCode, signal) { // Depending on the compiler used, node will exit with either // exit code 132 (SIGILL), 133 (SIGTRAP) or 134 (SIGABRT). let expectedExitCodes = [132, 133, 134]; @@ -523,7 +438,7 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { // which corresponds to exit code 3221225477 (0xC0000005) // (ii) Otherwise, _exit(134) which is called in place of abort() due to // raising SIGABRT exiting with ambiguous exit code '3' by default - if (exports.isWindows) + if (isWindows) expectedExitCodes = [0xC0000005, 134]; // When using --abort-on-uncaught-exception, V8 will use @@ -538,28 +453,26 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { } else { return expectedExitCodes.includes(exitCode); } -}; +} -exports.busyLoop = function busyLoop(time) { +function busyLoop(time) { const startTime = Timer.now(); const stopTime = startTime + time; while (Timer.now() < stopTime) {} -}; +} -exports.isAlive = function isAlive(pid) { +function isAlive(pid) { try { process.kill(pid, 'SIGCONT'); return true; } catch (e) { return false; } -}; - -exports.noWarnCode = undefined; +} -function expectWarning(name, expected) { +function _expectWarning(name, expected) { const map = new Map(expected); - return exports.mustCall((warning) => { + return mustCall((warning) => { assert.strictEqual(warning.name, name); assert.ok(map.has(warning.message), `unexpected error message: "${warning.message}"`); @@ -575,7 +488,7 @@ function expectWarningByName(name, expected, code) { if (typeof expected === 'string') { expected = [[expected, code]]; } - process.on('warning', expectWarning(name, expected)); + process.on('warning', _expectWarning(name, expected)); } function expectWarningByMap(warningMap) { @@ -592,7 +505,7 @@ function expectWarningByMap(warningMap) { } expected = [[expected[0], expected[1]]]; } - catchWarning[name] = expectWarning(name, expected); + catchWarning[name] = _expectWarning(name, expected); }); process.on('warning', (warning) => catchWarning[warning.name](warning)); } @@ -600,25 +513,13 @@ function expectWarningByMap(warningMap) { // accepts a warning name and description or array of descriptions or a map // of warning names to description(s) // ensures a warning is generated for each name/description pair -exports.expectWarning = function(nameOrMap, expected, code) { +function expectWarning(nameOrMap, expected, code) { if (typeof nameOrMap === 'string') { expectWarningByName(nameOrMap, expected, code); } else { expectWarningByMap(nameOrMap); } -}; - -Object.defineProperty(exports, 'hasIntl', { - get: function() { - return process.binding('config').hasIntl; - } -}); - -Object.defineProperty(exports, 'hasSmallICU', { - get: function() { - return process.binding('config').hasSmallICU; - } -}); +} class Comparison { constructor(obj, keys) { @@ -630,7 +531,7 @@ class Comparison { } // Useful for testing expected internal/error objects -exports.expectsError = function expectsError(fn, settings, exact) { +function expectsError(fn, settings, exact) { if (typeof fn !== 'function') { exact = settings; settings = fn; @@ -705,26 +606,26 @@ exports.expectsError = function expectsError(fn, settings, exact) { assert.throws(fn, innerFn); return; } - return exports.mustCall(innerFn, exact); -}; + return mustCall(innerFn, exact); +} -exports.skipIfInspectorDisabled = function skipIfInspectorDisabled() { +function skipIfInspectorDisabled() { if (process.config.variables.v8_enable_inspector === 0) { - exports.skip('V8 inspector is disabled'); + skip('V8 inspector is disabled'); } - if (!exports.isMainThread) { + if (!isMainThread) { // TODO(addaleax): Fix me. - exports.skip('V8 inspector is not available in Workers'); + skip('V8 inspector is not available in Workers'); } -}; +} -exports.skipIf32Bits = function skipIf32Bits() { - if (process.binding('config').bits < 64) { - exports.skip('The tested feature is not available in 32bit builds'); +function skipIf32Bits() { + if (bits < 64) { + skip('The tested feature is not available in 32bit builds'); } -}; +} -exports.getArrayBufferViews = function getArrayBufferViews(buf) { +function getArrayBufferViews(buf) { const { buffer, byteOffset, byteLength } = buf; const out = []; @@ -749,20 +650,20 @@ exports.getArrayBufferViews = function getArrayBufferViews(buf) { } } return out; -}; +} -exports.getBufferSources = function getBufferSources(buf) { - return [...exports.getArrayBufferViews(buf), new Uint8Array(buf).buffer]; -}; +function getBufferSources(buf) { + return [...getArrayBufferViews(buf), new Uint8Array(buf).buffer]; +} // Crash the process on unhandled rejections. const crashOnUnhandledRejection = (err) => { throw err; }; process.on('unhandledRejection', crashOnUnhandledRejection); -exports.disableCrashOnUnhandledRejection = function() { +function disableCrashOnUnhandledRejection() { process.removeListener('unhandledRejection', crashOnUnhandledRejection); -}; +} -exports.getTTYfd = function getTTYfd() { +function getTTYfd() { // Do our best to grab a tty fd. const tty = require('tty'); // Don't attempt fd 0 as it is not writable on Windows. @@ -777,9 +678,9 @@ exports.getTTYfd = function getTTYfd() { } } return ttyFd; -}; +} -exports.runWithInvalidFD = function(func) { +function runWithInvalidFD(func) { let fd = 1 << 30; // Get first known bad file descriptor. 1 << 30 is usually unlikely to // be an valid one. @@ -789,5 +690,126 @@ exports.runWithInvalidFD = function(func) { return func(fd); } - exports.printSkipMessage('Could not generate an invalid fd'); + printSkipMessage('Could not generate an invalid fd'); +} + +module.exports = { + allowGlobals, + buildType, + busyLoop, + canCreateSymLink, + childShouldThrowAndAbort, + ddCommand, + disableCrashOnUnhandledRejection, + enoughTestCpu, + enoughTestMem, + expectsError, + expectWarning, + getArrayBufferViews, + getBufferSources, + getCallSite, + getTTYfd, + hasIntl, + hasCrypto, + hasIPv6, + hasSmallICU, + hasMultiLocalhost, + isAIX, + isAlive, + isFreeBSD, + isLinux, + isLinuxPPCBE, + isMainThread, + isOpenBSD, + isOSX, + isSunOS, + isWindows, + isWOW64, + leakedGlobals, + localIPv6Hosts, + mustCall, + mustCallAsync, + mustCallAtLeast, + mustNotCall, + nodeProcessAborted, + noWarnCode: undefined, + PIPE, + platformTimeout, + printSkipMessage, + pwdCommand, + rootDir, + runWithInvalidFD, + skip, + skipIf32Bits, + skipIfEslintMissing, + skipIfInspectorDisabled, + + get localhostIPv6() { return '::1'; }, + + get hasFipsCrypto() { + return hasCrypto && require('crypto').fips; + }, + + get inFreeBSDJail() { + if (inFreeBSDJail !== null) return inFreeBSDJail; + + if (exports.isFreeBSD && + execSync('sysctl -n security.jail.jailed').toString() === '1\n') { + inFreeBSDJail = true; + } else { + inFreeBSDJail = false; + } + return inFreeBSDJail; + }, + + get localhostIPv4() { + if (localhostIPv4 !== null) return localhostIPv4; + + if (this.inFreeBSDJail) { + // Jailed network interfaces are a bit special - since we need to jump + // through loops, as well as this being an exception case, assume the + // user will provide this instead. + if (process.env.LOCALHOST) { + localhostIPv4 = process.env.LOCALHOST; + } else { + console.error('Looks like we\'re in a FreeBSD Jail. ' + + 'Please provide your default interface address ' + + 'as LOCALHOST or expect some tests to fail.'); + } + } + + if (localhostIPv4 === null) localhostIPv4 = '127.0.0.1'; + + return localhostIPv4; + }, + + // opensslCli defined lazily to reduce overhead of spawnSync + get opensslCli() { + if (opensslCli !== null) return opensslCli; + + if (process.config.variables.node_shared_openssl) { + // use external command + opensslCli = 'openssl'; + } else { + // use command built from sources included in Node.js repository + opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli'); + } + + if (exports.isWindows) opensslCli += '.exe'; + + const opensslCmd = spawnSync(opensslCli, ['version']); + if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { + // openssl command cannot be executed + opensslCli = false; + } + return opensslCli; + }, + + get PORT() { + if (+process.env.TEST_PARALLEL) { + throw new Error('common.PORT cannot be used in a parallelized test'); + } + return +process.env.NODE_COMMON_PORT || 12346; + } + }; diff --git a/test/common/index.mjs b/test/common/index.mjs index c8e6295b5ca1c6..e0842011c663c9 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -23,8 +23,6 @@ const { hasIPv6, childShouldThrowAndAbort, ddCommand, - spawnPwd, - spawnSyncPwd, platformTimeout, allowGlobals, leakedGlobals, @@ -75,8 +73,6 @@ export { hasIPv6, childShouldThrowAndAbort, ddCommand, - spawnPwd, - spawnSyncPwd, platformTimeout, allowGlobals, leakedGlobals, diff --git a/test/fixtures/apilinks/exports.js b/test/fixtures/apilinks/exports.js new file mode 100644 index 00000000000000..880fdf6c9dbe0d --- /dev/null +++ b/test/fixtures/apilinks/exports.js @@ -0,0 +1,13 @@ +'use strict'; + +// Support `exports` as an alternative to `module.exports`. + +function Buffer() {}; + +exports.Buffer = Buffer; +exports.fn1 = function fn1() {}; + +var fn2 = exports.fn2 = function() {}; + +function fn3() {}; +exports.fn3 = fn3; diff --git a/test/fixtures/apilinks/exports.json b/test/fixtures/apilinks/exports.json new file mode 100644 index 00000000000000..f17367a0fc8557 --- /dev/null +++ b/test/fixtures/apilinks/exports.json @@ -0,0 +1,6 @@ +{ + "exports.Buffer": "exports.js#L5", + "exports.fn1": "exports.js#L8", + "exports.fn2": "exports.js#L10", + "exports.fn3": "exports.js#L12" +} diff --git a/test/fixtures/apilinks/root.js b/test/fixtures/apilinks/root.js new file mode 100644 index 00000000000000..6cf9fee945ac24 --- /dev/null +++ b/test/fixtures/apilinks/root.js @@ -0,0 +1,10 @@ +'use strict'; + +// Set root member +let foo = true; +foo = false; + +// Return outside of function +if (!foo) { + return; +} diff --git a/test/fixtures/apilinks/root.json b/test/fixtures/apilinks/root.json new file mode 100644 index 00000000000000..2c63c0851048d8 --- /dev/null +++ b/test/fixtures/apilinks/root.json @@ -0,0 +1,2 @@ +{ +} diff --git a/test/internet/test-trace-events-dns.js b/test/internet/test-trace-events-dns.js index e1cfd6a597acca..9e5a0ccb026c1a 100644 --- a/test/internet/test-trace-events-dns.js +++ b/test/internet/test-trace-events-dns.js @@ -49,7 +49,12 @@ for (const tr in tests) { { encoding: 'utf8' }); // Make sure the operation is successful. - assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`); + // Don't use assert with a custom message here. Otherwise the + // inspection in the message is done eagerly and wastes a lot of CPU + // time. + if (proc.status !== 0) { + throw new Error(`${tr}:\n${util.inspect(proc)}`); + } const file = path.join(tmpdir.path, traceFile); diff --git a/test/parallel/test-assert-async.js b/test/parallel/test-assert-async.js index 30c9a741c6ab10..f148c7e3d84235 100644 --- a/test/parallel/test-assert-async.js +++ b/test/parallel/test-assert-async.js @@ -41,7 +41,7 @@ const promises = []; name: 'TypeError [ERR_INVALID_RETURN_VALUE]', code: 'ERR_INVALID_RETURN_VALUE', message: 'Expected instance of Promise to be returned ' + - 'from the "block" function but got type undefined.' + 'from the "promiseFn" function but got type undefined.' })); promise = assert.rejects(Promise.resolve(), common.mustNotCall()); @@ -62,7 +62,7 @@ promises.push(assert.rejects( assert.rejects('fail', {}), { code: 'ERR_INVALID_ARG_TYPE', - message: 'The "block" argument must be one of type ' + + message: 'The "promiseFn" argument must be one of type ' + 'Function or Promise. Received type string' } )); @@ -73,7 +73,7 @@ promises.push(assert.rejects( const promise = assert.doesNotReject(() => new Map(), common.mustNotCall()); promises.push(assert.rejects(promise, { message: 'Expected instance of Promise to be returned ' + - 'from the "block" function but got instance of Map.', + 'from the "promiseFn" function but got instance of Map.', code: 'ERR_INVALID_RETURN_VALUE', name: 'TypeError [ERR_INVALID_RETURN_VALUE]' })); @@ -116,7 +116,7 @@ promises.push(assert.rejects( assert.doesNotReject(123), { code: 'ERR_INVALID_ARG_TYPE', - message: 'The "block" argument must be one of type ' + + message: 'The "promiseFn" argument must be one of type ' + 'Function or Promise. Received type number' } )); diff --git a/test/parallel/test-assert-fail-deprecation.js b/test/parallel/test-assert-fail-deprecation.js index 68ebcd612d31df..97cba760e03836 100644 --- a/test/parallel/test-assert-fail-deprecation.js +++ b/test/parallel/test-assert-fail-deprecation.js @@ -19,7 +19,8 @@ assert.throws(() => { message: '\'first\' != \'second\'', operator: '!=', actual: 'first', - expected: 'second' + expected: 'second', + generatedMessage: true }); // Three args @@ -29,9 +30,10 @@ assert.throws(() => { code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', message: 'another custom message', - operator: undefined, + operator: 'fail', actual: 'ignored', - expected: 'ignored' + expected: 'ignored', + generatedMessage: false }); // Three args with custom Error diff --git a/test/parallel/test-assert-fail.js b/test/parallel/test-assert-fail.js index e8336e8f2169ef..4410cc85442707 100644 --- a/test/parallel/test-assert-fail.js +++ b/test/parallel/test-assert-fail.js @@ -10,9 +10,10 @@ assert.throws( code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', message: 'Failed', - operator: undefined, + operator: 'fail', actual: undefined, - expected: undefined + expected: undefined, + generatedMessage: true } ); @@ -23,9 +24,10 @@ assert.throws(() => { code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', message: 'custom message', - operator: undefined, + operator: 'fail', actual: undefined, - expected: undefined + expected: undefined, + generatedMessage: false }); // One arg = Error diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 0eebd7a872cace..257c7f5c06ebf7 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -304,11 +304,11 @@ try { } try { - assert.strictEqual(1, 2, 'oh no'); + assert.strictEqual(1, 2, 'oh no'); // eslint-disable-line no-restricted-syntax } catch (e) { assert.strictEqual(e.message, 'oh no'); - assert.strictEqual(e.generatedMessage, false, - 'Message incorrectly marked as generated'); + // Message should not be marked as generated. + assert.strictEqual(e.generatedMessage, false); } { @@ -341,15 +341,15 @@ try { } { - // Verify that throws() and doesNotThrow() throw on non-function block. - const testBlockTypeError = (method, block) => { + // Verify that throws() and doesNotThrow() throw on non-functions. + const testBlockTypeError = (method, fn) => { common.expectsError( - () => method(block), + () => method(fn), { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, - message: 'The "block" argument must be of type Function. Received ' + - `type ${typeof block}` + message: 'The "fn" argument must be of type Function. Received ' + + `type ${typeof fn}` } ); }; diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index f89e25fdbb2f92..023852b69a850a 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -75,16 +75,40 @@ new Buffer('', 'binary'); Buffer(0); // try to write a 0-length string beyond the end of b -assert.throws(() => b.write('', 2048), RangeError); +common.expectsError( + () => b.write('', 2048), + { + code: 'ERR_BUFFER_OUT_OF_BOUNDS', + type: RangeError + } +); // throw when writing to negative offset -assert.throws(() => b.write('a', -1), RangeError); +common.expectsError( + () => b.write('a', -1), + { + code: 'ERR_BUFFER_OUT_OF_BOUNDS', + type: RangeError + } +); // throw when writing past bounds from the pool -assert.throws(() => b.write('a', 2048), RangeError); +common.expectsError( + () => b.write('a', 2048), + { + code: 'ERR_BUFFER_OUT_OF_BOUNDS', + type: RangeError + } +); // throw when writing to negative offset -assert.throws(() => b.write('a', -1), RangeError); +common.expectsError( + () => b.write('a', -1), + { + code: 'ERR_BUFFER_OUT_OF_BOUNDS', + type: RangeError + } +); // try to copy 0 bytes worth of data into an empty buffer b.copy(Buffer.alloc(0), 0, 0, 0); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 4b2d8526ddb46e..dc19a7b2ab81ef 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -579,27 +579,35 @@ for (const test of TEST_CASES) { } // Test that the authentication tag can be set at any point before calling -// final() in GCM mode. +// final() in GCM or OCB mode. { const plain = Buffer.from('Hello world', 'utf8'); const key = Buffer.from('0123456789abcdef', 'utf8'); const iv = Buffer.from('0123456789ab', 'utf8'); - const cipher = crypto.createCipheriv('aes-128-gcm', key, iv); - const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]); - const authTag = cipher.getAuthTag(); - - for (const authTagBeforeUpdate of [true, false]) { - const decipher = crypto.createDecipheriv('aes-128-gcm', key, iv); - if (authTagBeforeUpdate) { - decipher.setAuthTag(authTag); - } - const resultUpdate = decipher.update(ciphertext); - if (!authTagBeforeUpdate) { - decipher.setAuthTag(authTag); + for (const mode of ['gcm', 'ocb']) { + for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) { + const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, { + authTagLength + }); + const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]); + const authTag = cipher.getAuthTag(); + + for (const authTagBeforeUpdate of [true, false]) { + const decipher = crypto.createDecipheriv(`aes-128-${mode}`, key, iv, { + authTagLength + }); + if (authTagBeforeUpdate) { + decipher.setAuthTag(authTag); + } + const resultUpdate = decipher.update(ciphertext); + if (!authTagBeforeUpdate) { + decipher.setAuthTag(authTag); + } + const resultFinal = decipher.final(); + const result = Buffer.concat([resultUpdate, resultFinal]); + assert(result.equals(plain)); + } } - const resultFinal = decipher.final(); - const result = Buffer.concat([resultUpdate, resultFinal]); - assert(result.equals(plain)); } } diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 3413bcffd8abe9..c9b54b9faf95ef 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -134,8 +134,8 @@ dns.lookup('example.com', common.mustCall((error, result, addressType) => { assert.strictEqual(tickValue, 1); assert.strictEqual(error.code, 'ENOENT'); const descriptor = Object.getOwnPropertyDescriptor(error, 'message'); - assert.strictEqual(descriptor.enumerable, - false, 'The error message should be non-enumerable'); + // The error message should be non-enumerable. + assert.strictEqual(descriptor.enumerable, false); })); // Make sure that the error callback is called diff --git a/test/parallel/test-dns-resolveany-bad-ancount.js b/test/parallel/test-dns-resolveany-bad-ancount.js index 4b13421b316aee..71fcbe03cd58f1 100644 --- a/test/parallel/test-dns-resolveany-bad-ancount.js +++ b/test/parallel/test-dns-resolveany-bad-ancount.js @@ -40,8 +40,8 @@ server.bind(0, common.mustCall(async () => { assert.strictEqual(err.syscall, 'queryAny'); assert.strictEqual(err.hostname, 'example.org'); const descriptor = Object.getOwnPropertyDescriptor(err, 'message'); - assert.strictEqual(descriptor.enumerable, - false, 'The error message should be non-enumerable'); + // The error message should be non-enumerable. + assert.strictEqual(descriptor.enumerable, false); server.close(); })); })); diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index 6bb64e6092bfc6..db16318a5cde0e 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -178,7 +178,7 @@ function run_test_3() { const run_test_4 = common.mustCall(function() { // Error: start must be >= zero - const block = () => { + const fn = () => { fs.createWriteStream(filepath, { start: -5, flags: 'r+' }); }; const err = { @@ -187,7 +187,7 @@ const run_test_4 = common.mustCall(function() { 'It must be >= 0. Received {start: -5}', type: RangeError }; - common.expectsError(block, err); + common.expectsError(fn, err); }); run_test_1(); diff --git a/test/parallel/test-fs-readdir-types.js b/test/parallel/test-fs-readdir-types.js index 75452895cc178e..0faaeb00dadeb1 100644 --- a/test/parallel/test-fs-readdir-types.js +++ b/test/parallel/test-fs-readdir-types.js @@ -57,6 +57,14 @@ fs.readdir(readdirDir, { assertDirents(dirents); })); +// Check the promisified version +assert.doesNotReject(async () => { + const dirents = await fs.promises.readdir(readdirDir, { + withFileTypes: true + }); + assertDirents(dirents); +}); + // Check for correct types when the binding returns unknowns const UNKNOWN = constants.UV_DIRENT_UNKNOWN; const oldReaddir = binding.readdir; diff --git a/test/parallel/test-fs-readfile.js b/test/parallel/test-fs-readfile.js index 118f2e43aab500..648bf692d1dcc8 100644 --- a/test/parallel/test-fs-readfile.js +++ b/test/parallel/test-fs-readfile.js @@ -54,6 +54,6 @@ for (const e of fileInfo) { fs.readFile(e.name, common.mustCall((err, buf) => { console.log(`Validating readFile on file ${e.name} of length ${e.len}`); assert.ifError(err); - assert.deepStrictEqual(buf, e.contents, 'Incorrect file contents'); + assert.deepStrictEqual(buf, e.contents); })); } diff --git a/test/parallel/test-http-information-processing.js b/test/parallel/test-http-information-processing.js index af589477f05dd1..43d1bdafdf4dd1 100644 --- a/test/parallel/test-http-information-processing.js +++ b/test/parallel/test-http-information-processing.js @@ -36,8 +36,8 @@ server.listen(0, function() { }); req.on('response', function(res) { - assert.strictEqual(countdown.remaining, 1, - 'Full response received before all 102 Processing'); + // Check that all 102 Processing received before full response received. + assert.strictEqual(countdown.remaining, 1); assert.strictEqual(200, res.statusCode, `Final status code was ${res.statusCode}, not 200.`); res.setEncoding('utf8'); diff --git a/test/parallel/test-http2-endafterheaders.js b/test/parallel/test-http2-endafterheaders.js new file mode 100644 index 00000000000000..429ffc3188452d --- /dev/null +++ b/test/parallel/test-http2-endafterheaders.js @@ -0,0 +1,50 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); +const http2 = require('http2'); +const Countdown = require('../common/countdown'); + +const server = http2.createServer(); +server.on('stream', common.mustCall((stream, headers) => { + const check = headers[':method'] === 'GET' ? true : false; + assert.strictEqual(stream.endAfterHeaders, check); + stream.on('data', common.mustNotCall()); + stream.on('end', common.mustCall()); + stream.respond(); + stream.end('ok'); +}, 2)); + +const countdown = new Countdown(2, () => server.close()); + +server.listen(0, common.mustCall(() => { + { + const client = http2.connect(`http://localhost:${server.address().port}`); + const req = client.request(); + + req.resume(); + req.on('response', common.mustCall(() => { + assert.strictEqual(req.endAfterHeaders, false); + })); + req.on('end', common.mustCall(() => { + client.close(); + countdown.dec(); + })); + } + { + const client = http2.connect(`http://localhost:${server.address().port}`); + const req = client.request({ ':method': 'POST' }); + + req.resume(); + req.end(); + req.on('response', common.mustCall(() => { + assert.strictEqual(req.endAfterHeaders, false); + })); + req.on('end', common.mustCall(() => { + client.close(); + countdown.dec(); + })); + } +})); diff --git a/test/parallel/test-internal-error-original-names.js b/test/parallel/test-internal-error-original-names.js new file mode 100644 index 00000000000000..195e39b199cd4c --- /dev/null +++ b/test/parallel/test-internal-error-original-names.js @@ -0,0 +1,35 @@ +// Flags: --expose-internals + +'use strict'; + +// This tests `internal/errors.useOriginalName` +// This testing feature is needed to allows us to assert the types of +// errors without using instanceof, which is necessary in WPT harness. +// Refs: https://github.com/nodejs/node/pull/22556 + +require('../common'); +const assert = require('assert'); +const errors = require('internal/errors'); + + +errors.E('TEST_ERROR_1', 'Error for testing purposes: %s', + Error); +{ + const err = new errors.codes.TEST_ERROR_1('test'); + assert(err instanceof Error); + assert.strictEqual(err.name, 'Error [TEST_ERROR_1]'); +} + +{ + errors.useOriginalName = true; + const err = new errors.codes.TEST_ERROR_1('test'); + assert(err instanceof Error); + assert.strictEqual(err.name, 'Error'); +} + +{ + errors.useOriginalName = false; + const err = new errors.codes.TEST_ERROR_1('test'); + assert(err instanceof Error); + assert.strictEqual(err.name, 'Error [TEST_ERROR_1]'); +} diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index db7a123f77b7ad..afdfc2ac615ad6 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -62,8 +62,8 @@ const net = require('net'); const hints = (dns.ADDRCONFIG | dns.V4MAPPED) + 42; const hintOptBlocks = doConnect([{ hints }], () => common.mustNotCall()); - for (const block of hintOptBlocks) { - common.expectsError(block, { + for (const fn of hintOptBlocks) { + common.expectsError(fn, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: /The value "\d+" is invalid for option "hints"/ @@ -136,38 +136,31 @@ function doConnect(args, getCb) { function syncFailToConnect(port, assertErr, optOnly) { if (!optOnly) { // connect(port, cb) and connect(port) - const portArgBlocks = doConnect([port], () => common.mustNotCall()); - for (const block of portArgBlocks) { - assert.throws(block, - assertErr, - `${block.name}(${port})`); + const portArgFunctions = doConnect([port], () => common.mustNotCall()); + for (const fn of portArgFunctions) { + assert.throws(fn, assertErr, `${fn.name}(${port})`); } // connect(port, host, cb) and connect(port, host) - const portHostArgBlocks = doConnect([port, 'localhost'], - () => common.mustNotCall()); - for (const block of portHostArgBlocks) { - assert.throws(block, - assertErr, - `${block.name}(${port}, 'localhost')`); + const portHostArgFunctions = doConnect([port, 'localhost'], + () => common.mustNotCall()); + for (const fn of portHostArgFunctions) { + assert.throws(fn, assertErr, `${fn.name}(${port}, 'localhost')`); } } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{ port }], - () => common.mustNotCall()); - for (const block of portOptBlocks) { - assert.throws(block, - assertErr, - `${block.name}({port: ${port}})`); + const portOptFunctions = doConnect([{ port }], () => common.mustNotCall()); + for (const fn of portOptFunctions) { + assert.throws(fn, assertErr, `${fn.name}({port: ${port}})`); } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], - () => common.mustNotCall()); - for (const block of portHostOptBlocks) { - assert.throws(block, + const portHostOptFunctions = doConnect([{ port: port, host: 'localhost' }], + () => common.mustNotCall()); + for (const fn of portHostOptFunctions) { + assert.throws(fn, assertErr, - `${block.name}({port: ${port}, host: 'localhost'})`); + `${fn.name}({port: ${port}, host: 'localhost'})`); } } @@ -175,28 +168,27 @@ function canConnect(port) { const noop = () => common.mustCall(); // connect(port, cb) and connect(port) - const portArgBlocks = doConnect([port], noop); - for (const block of portArgBlocks) { - block(); + const portArgFunctions = doConnect([port], noop); + for (const fn of portArgFunctions) { + fn(); } // connect(port, host, cb) and connect(port, host) - const portHostArgBlocks = doConnect([port, 'localhost'], noop); - for (const block of portHostArgBlocks) { - block(); + const portHostArgFunctions = doConnect([port, 'localhost'], noop); + for (const fn of portHostArgFunctions) { + fn(); } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{ port }], noop); - for (const block of portOptBlocks) { - block(); + const portOptFunctions = doConnect([{ port }], noop); + for (const fn of portOptFunctions) { + fn(); } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], - noop); - for (const block of portHostOptBlocks) { - block(); + const portHostOptFns = doConnect([{ port, host: 'localhost' }], noop); + for (const fn of portHostOptFns) { + fn(); } } @@ -208,21 +200,20 @@ function asyncFailToConnect(port) { const dont = () => common.mustNotCall(); // connect(port, cb) and connect(port) - const portArgBlocks = doConnect([port], dont); - for (const block of portArgBlocks) { - block().on('error', onError()); + const portArgFunctions = doConnect([port], dont); + for (const fn of portArgFunctions) { + fn().on('error', onError()); } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{ port }], dont); - for (const block of portOptBlocks) { - block().on('error', onError()); + const portOptFunctions = doConnect([{ port }], dont); + for (const fn of portOptFunctions) { + fn().on('error', onError()); } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], - dont); - for (const block of portHostOptBlocks) { - block().on('error', onError()); + const portHostOptFns = doConnect([{ port, host: 'localhost' }], dont); + for (const fn of portHostOptFns) { + fn().on('error', onError()); } } diff --git a/test/parallel/test-net-isipv4.js b/test/parallel/test-net-isipv4.js new file mode 100644 index 00000000000000..ec04505cedb27f --- /dev/null +++ b/test/parallel/test-net-isipv4.js @@ -0,0 +1,46 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const net = require('net'); + +const v4 = [ + '0.0.0.0', + '8.8.8.8', + '127.0.0.1', + '100.100.100.100', + '192.168.0.1', + '18.101.25.153', + '123.23.34.2', + '172.26.168.134', + '212.58.241.131', + '128.0.0.0', + '23.71.254.72', + '223.255.255.255', + '192.0.2.235', + '99.198.122.146', + '46.51.197.88', + '173.194.34.134' +]; + +const v4not = [ + '.100.100.100.100', + '100..100.100.100.', + '100.100.100.100.', + '999.999.999.999', + '256.256.256.256', + '256.100.100.100.100', + '123.123.123', + 'http://123.123.123', + '1000.2.3.4', + '999.2.3.4', + '0000000192.168.0.200', + '192.168.0.2000000000' +]; + +v4.forEach((ip) => { + assert.strictEqual(net.isIPv4(ip), true); +}); + +v4not.forEach((ip) => { + assert.strictEqual(net.isIPv4(ip), false); +}); diff --git a/test/parallel/test-net-isipv6.js b/test/parallel/test-net-isipv6.js new file mode 100644 index 00000000000000..7ba379c3bdd27e --- /dev/null +++ b/test/parallel/test-net-isipv6.js @@ -0,0 +1,244 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const net = require('net'); + +const v6 = [ + '::', + '1::', + '::1', + '1::8', + '1::7:8', + '1:2:3:4:5:6:7:8', + '1:2:3:4:5:6::8', + '1:2:3:4:5:6:7::', + '1:2:3:4:5::7:8', + '1:2:3:4:5::8', + '1:2:3::8', + '1::4:5:6:7:8', + '1::6:7:8', + '1::3:4:5:6:7:8', + '1:2:3:4::6:7:8', + '1:2::4:5:6:7:8', + '::2:3:4:5:6:7:8', + '1:2::8', + '2001:0000:1234:0000:0000:C1C0:ABCD:0876', + '3ffe:0b00:0000:0000:0001:0000:0000:000a', + 'FF02:0000:0000:0000:0000:0000:0000:0001', + '0000:0000:0000:0000:0000:0000:0000:0001', + '0000:0000:0000:0000:0000:0000:0000:0000', + '::ffff:192.168.1.26', + '2::10', + 'ff02::1', + 'fe80::', + '2002::', + '2001:db8::', + '2001:0db8:1234::', + '::ffff:0:0', + '::ffff:192.168.1.1', + '1:2:3:4::8', + '1::2:3:4:5:6:7', + '1::2:3:4:5:6', + '1::2:3:4:5', + '1::2:3:4', + '1::2:3', + '::2:3:4:5:6:7', + '::2:3:4:5:6', + '::2:3:4:5', + '::2:3:4', + '::2:3', + '::8', + '1:2:3:4:5:6::', + '1:2:3:4:5::', + '1:2:3:4::', + '1:2:3::', + '1:2::', + '1:2:3:4::7:8', + '1:2:3::7:8', + '1:2::7:8', + '1:2:3:4:5:6:1.2.3.4', + '1:2:3:4:5::1.2.3.4', + '1:2:3:4::1.2.3.4', + '1:2:3::1.2.3.4', + '1:2::1.2.3.4', + '1::1.2.3.4', + '1:2:3:4::5:1.2.3.4', + '1:2:3::5:1.2.3.4', + '1:2::5:1.2.3.4', + '1::5:1.2.3.4', + '1::5:11.22.33.44', + 'fe80::217:f2ff:254.7.237.98', + 'fe80::217:f2ff:fe07:ed62', + '2001:DB8:0:0:8:800:200C:417A', + 'FF01:0:0:0:0:0:0:101', + '0:0:0:0:0:0:0:1', + '0:0:0:0:0:0:0:0', + '2001:DB8::8:800:200C:417A', + 'FF01::101', + '0:0:0:0:0:0:13.1.68.3', + '0:0:0:0:0:FFFF:129.144.52.38', + '::13.1.68.3', + '::FFFF:129.144.52.38', + 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', + 'fe80:0:0:0:204:61ff:fe9d:f156', + 'fe80::204:61ff:fe9d:f156', + 'fe80:0:0:0:204:61ff:254.157.241.86', + 'fe80::204:61ff:254.157.241.86', + 'fe80::1', + '2001:0db8:85a3:0000:0000:8a2e:0370:7334', + '2001:db8:85a3:0:0:8a2e:370:7334', + '2001:db8:85a3::8a2e:370:7334', + '2001:0db8:0000:0000:0000:0000:1428:57ab', + '2001:0db8:0000:0000:0000::1428:57ab', + '2001:0db8:0:0:0:0:1428:57ab', + '2001:0db8:0:0::1428:57ab', + '2001:0db8::1428:57ab', + '2001:db8::1428:57ab', + '::ffff:12.34.56.78', + '::ffff:0c22:384e', + '2001:0db8:1234:0000:0000:0000:0000:0000', + '2001:0db8:1234:ffff:ffff:ffff:ffff:ffff', + '2001:db8:a::123', + '::ffff:192.0.2.128', + '::ffff:c000:280', + 'a:b:c:d:e:f:f1:f2', + 'a:b:c::d:e:f:f1', + 'a:b:c::d:e:f', + 'a:b:c::d:e', + 'a:b:c::d', + '::a', + '::a:b:c', + '::a:b:c:d:e:f:f1', + 'a::', + 'a:b:c::', + 'a:b:c:d:e:f:f1::', + 'a:bb:ccc:dddd:000e:00f:0f::', + '0:a:0:a:0:0:0:a', + '0:a:0:0:a:0:0:a', + '2001:db8:1:1:1:1:0:0', + '2001:db8:1:1:1:0:0:0', + '2001:db8:1:1:0:0:0:0', + '2001:db8:1:0:0:0:0:0', + '2001:db8:0:0:0:0:0:0', + '2001:0:0:0:0:0:0:0', + 'A:BB:CCC:DDDD:000E:00F:0F::', + '0:0:0:0:0:0:0:a', + '0:0:0:0:a:0:0:0', + '0:0:0:a:0:0:0:0', + 'a:0:0:a:0:0:a:a', + 'a:0:0:a:0:0:0:a', + 'a:0:0:0:a:0:0:a', + 'a:0:0:0:a:0:0:0', + 'a:0:0:0:0:0:0:0', + 'fe80::7:8%eth0', + 'fe80::7:8%1' +]; + +const v6not = [ + '', + '1:', + ':1', + '11:36:12', + '02001:0000:1234:0000:0000:C1C0:ABCD:0876', + '2001:0000:1234:0000:00001:C1C0:ABCD:0876', + '2001:0000:1234: 0000:0000:C1C0:ABCD:0876', + '2001:1:1:1:1:1:255Z255X255Y255', + '3ffe:0b00:0000:0001:0000:0000:000a', + 'FF02:0000:0000:0000:0000:0000:0000:0000:0001', + '3ffe:b00::1::a', + '::1111:2222:3333:4444:5555:6666::', + '1:2:3::4:5::7:8', + '12345::6:7:8', + '1::5:400.2.3.4', + '1::5:260.2.3.4', + '1::5:256.2.3.4', + '1::5:1.256.3.4', + '1::5:1.2.256.4', + '1::5:1.2.3.256', + '1::5:300.2.3.4', + '1::5:1.300.3.4', + '1::5:1.2.300.4', + '1::5:1.2.3.300', + '1::5:900.2.3.4', + '1::5:1.900.3.4', + '1::5:1.2.900.4', + '1::5:1.2.3.900', + '1::5:300.300.300.300', + '1::5:3000.30.30.30', + '1::400.2.3.4', + '1::260.2.3.4', + '1::256.2.3.4', + '1::1.256.3.4', + '1::1.2.256.4', + '1::1.2.3.256', + '1::300.2.3.4', + '1::1.300.3.4', + '1::1.2.300.4', + '1::1.2.3.300', + '1::900.2.3.4', + '1::1.900.3.4', + '1::1.2.900.4', + '1::1.2.3.900', + '1::300.300.300.300', + '1::3000.30.30.30', + '::400.2.3.4', + '::260.2.3.4', + '::256.2.3.4', + '::1.256.3.4', + '::1.2.256.4', + '::1.2.3.256', + '::300.2.3.4', + '::1.300.3.4', + '::1.2.300.4', + '::1.2.3.300', + '::900.2.3.4', + '::1.900.3.4', + '::1.2.900.4', + '::1.2.3.900', + '::300.300.300.300', + '::3000.30.30.30', + '2001:DB8:0:0:8:800:200C:417A:221', + 'FF01::101::2', + '1111:2222:3333:4444::5555:', + '1111:2222:3333::5555:', + '1111:2222::5555:', + '1111::5555:', + '::5555:', + ':::', + '1111:', + ':', + ':1111:2222:3333:4444::5555', + ':1111:2222:3333::5555', + ':1111:2222::5555', + ':1111::5555', + ':::5555', + '1.2.3.4:1111:2222:3333:4444::5555', + '1.2.3.4:1111:2222:3333::5555', + '1.2.3.4:1111:2222::5555', + '1.2.3.4:1111::5555', + '1.2.3.4::5555', + '1.2.3.4::', + 'fe80:0000:0000:0000:0204:61ff:254.157.241.086', + '123', + 'ldkfj', + '2001::FFD3::57ab', + '2001:db8:85a3::8a2e:37023:7334', + '2001:db8:85a3::8a2e:370k:7334', + '1:2:3:4:5:6:7:8:9', + '1::2::3', + '1:::3:4:5', + '1:2:3::4:5:6:7:8:9', + '::ffff:2.3.4', + '::ffff:257.1.2.3', + '::ffff:12345678901234567890.1.26', + '2001:0000:1234:0000:0000:C1C0:ABCD:0876 0', + '02001:0000:1234:0000:0000:C1C0:ABCD:0876' +]; + +v6.forEach((ip) => { + assert.strictEqual(net.isIPv6(ip), true); +}); + +v6not.forEach((ip) => { + assert.strictEqual(net.isIPv6(ip), false); +}); diff --git a/test/parallel/test-net-server-listen-options.js b/test/parallel/test-net-server-listen-options.js index 4f7a6bd28f561a..86bfd5d0a6efe1 100644 --- a/test/parallel/test-net-server-listen-options.js +++ b/test/parallel/test-net-server-listen-options.js @@ -54,10 +54,10 @@ const listenOnPort = [ { function shouldFailToListen(options) { - const block = () => { + const fn = () => { net.createServer().listen(options, common.mustNotCall()); }; - common.expectsError(block, + common.expectsError(fn, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, diff --git a/test/parallel/test-next-tick-domain.js b/test/parallel/test-next-tick-domain.js index 5c526197926df7..3e55ef3225fc40 100644 --- a/test/parallel/test-next-tick-domain.js +++ b/test/parallel/test-next-tick-domain.js @@ -27,5 +27,5 @@ const origNextTick = process.nextTick; require('domain'); -assert.strictEqual(origNextTick, process.nextTick, - 'Requiring domain should not change nextTick'); +// Requiring domain should not change nextTick. +assert.strictEqual(origNextTick, process.nextTick); diff --git a/test/parallel/test-os-process-priority.js b/test/parallel/test-os-process-priority.js index 9d66cfc49bc27a..05686e6c77083a 100644 --- a/test/parallel/test-os-process-priority.js +++ b/test/parallel/test-os-process-priority.js @@ -116,8 +116,10 @@ function checkPriority(pid, expected) { return; } + // On Windows setting PRIORITY_HIGHEST will only work for elevated user, + // for others it will be silently reduced to PRIORITY_HIGH if (expected < PRIORITY_HIGH) - assert.strictEqual(priority, PRIORITY_HIGHEST); + assert.ok(priority === PRIORITY_HIGHEST || priority === PRIORITY_HIGH); else if (expected < PRIORITY_ABOVE_NORMAL) assert.strictEqual(priority, PRIORITY_HIGH); else if (expected < PRIORITY_NORMAL) diff --git a/test/parallel/test-process-env-allowed-flags.js b/test/parallel/test-process-env-allowed-flags.js index 39ad09a6c35b10..7313736368ce22 100644 --- a/test/parallel/test-process-env-allowed-flags.js +++ b/test/parallel/test-process-env-allowed-flags.js @@ -6,8 +6,6 @@ require('../common'); // assert legit flags are allowed, and bogus flags are disallowed { const goodFlags = [ - '--inspect-brk', - 'inspect-brk', '--perf_basic_prof', '--perf-basic-prof', 'perf-basic-prof', @@ -17,8 +15,11 @@ require('../common'); '-r', 'r', '--stack-trace-limit=100', - '--stack-trace-limit=-=xX_nodejs_Xx=-' - ]; + '--stack-trace-limit=-=xX_nodejs_Xx=-', + ].concat(process.config.variables.v8_enable_inspector ? [ + '--inspect-brk', + 'inspect-brk', + ] : []); const badFlags = [ '--inspect_brk', @@ -50,7 +51,7 @@ require('../common'); // assert all "canonical" flags begin with dash(es) { process.allowedNodeEnvironmentFlags.forEach((flag) => { - assert(/^--?[a-z8_-]+$/.test(flag), `Unexpected format for flag ${flag}`); + assert(/^--?[a-z28_-]+$/.test(flag), `Unexpected format for flag ${flag}`); }); } diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index 6e4f4b121d20d7..c4607672b0420c 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -97,6 +97,17 @@ assert.strictEqual(decoder.lastTotal, 3); assert.strictEqual(decoder.end(), '\ufffd'); +// ArrayBufferView tests +const arrayBufferViewStr = 'String for ArrayBufferView tests\n'; +const inputBuffer = Buffer.from(arrayBufferViewStr.repeat(8), 'utf8'); +for (const expectView of common.getArrayBufferViews(inputBuffer)) { + assert.strictEqual( + decoder.write(expectView), + inputBuffer.toString('utf8') + ); + assert.strictEqual(decoder.end(), ''); +} + decoder = new StringDecoder('utf8'); assert.strictEqual(decoder.write(Buffer.from('E18B', 'hex')), ''); assert.strictEqual(decoder.end(), '\ufffd'); @@ -174,8 +185,8 @@ common.expectsError( { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, - message: 'The "buf" argument must be one of type Buffer, Uint8Array, or' + - ' ArrayBufferView. Received type object' + message: 'The "buf" argument must be one of type Buffer, TypedArray,' + + ' or DataView. Received type object' } ); diff --git a/test/parallel/test-tick-processor-arguments.js b/test/parallel/test-tick-processor-arguments.js new file mode 100644 index 00000000000000..606dbd03c8f6c4 --- /dev/null +++ b/test/parallel/test-tick-processor-arguments.js @@ -0,0 +1,34 @@ +'use strict'; +const common = require('../common'); +const tmpdir = require('../common/tmpdir'); +const fs = require('fs'); +const assert = require('assert'); +const { spawnSync } = require('child_process'); + +if (!common.isMainThread) + common.skip('chdir not available in workers'); +if (!common.enoughTestMem) + common.skip('skipped due to memory requirements'); +if (common.isAIX) + common.skip('does not work on AIX'); + +tmpdir.refresh(); +process.chdir(tmpdir.path); + +// Generate log file. +spawnSync(process.execPath, [ '--prof', '-p', '42' ]); + +const logfile = fs.readdirSync('.').filter((name) => name.endsWith('.log'))[0]; +assert(logfile); + +// Make sure that the --preprocess argument is passed through correctly, +// as an example flag listed in deps/v8/tools/tickprocessor.js. +// Any of the other flags there should work for this test too, if --preprocess +// is ever removed. +const { stdout } = spawnSync( + process.execPath, + [ '--prof-process', '--preprocess', logfile ], + { encoding: 'utf8' }); + +// Make sure that the result is valid JSON. +JSON.parse(stdout); diff --git a/test/parallel/test-timers-same-timeout-wrong-list-deleted.js b/test/parallel/test-timers-same-timeout-wrong-list-deleted.js index c66ba0a57efa11..8ad267cd16f699 100644 --- a/test/parallel/test-timers-same-timeout-wrong-list-deleted.js +++ b/test/parallel/test-timers-same-timeout-wrong-list-deleted.js @@ -37,7 +37,7 @@ const handle1 = setTimeout(common.mustCall(function() { // Make sure our clearTimeout succeeded. One timer finished and // the other was canceled, so none should be active. - assert.strictEqual(activeTimers.length, 0, 'Timers remain.'); + assert.strictEqual(activeTimers.length, 0); })); })); }), 1); @@ -53,11 +53,9 @@ const handle1 = setTimeout(common.mustCall(function() { // Make sure our clearTimeout succeeded. One timer finished and // the other was canceled, so none should be active. - assert.strictEqual(activeTimers.length, 3, - 'There should be 3 timers in the list.'); + assert.strictEqual(activeTimers.length, 3); assert(shortTimer instanceof Timer, 'The shorter timer is not in the list.'); - assert.strictEqual(longTimers.length, 2, - 'Both longer timers should be in the list.'); + assert.strictEqual(longTimers.length, 2); // When this callback completes, `listOnTimeout` should now look at the // correct list and refrain from removing the new TIMEOUT list which diff --git a/test/parallel/test-timers-unref-reuse-no-exposed-list.js b/test/parallel/test-timers-unref-reuse-no-exposed-list.js index 33b2da2f9e214f..269a2b5e85fc1d 100644 --- a/test/parallel/test-timers-unref-reuse-no-exposed-list.js +++ b/test/parallel/test-timers-unref-reuse-no-exposed-list.js @@ -4,11 +4,9 @@ require('../common'); const assert = require('assert'); const timer1 = setTimeout(() => {}, 1).unref(); -assert.strictEqual(timer1._handle._list, undefined, - 'timer1._handle._list should be undefined'); +assert.strictEqual(timer1._handle._list, undefined); // Check that everything works even if the handle was not re-used. setTimeout(() => {}, 1); const timer2 = setTimeout(() => {}, 1).unref(); -assert.strictEqual(timer2._handle._list, undefined, - 'timer2._handle._list should be undefined'); +assert.strictEqual(timer2._handle._list, undefined); diff --git a/test/parallel/test-trace-events-fs-sync.js b/test/parallel/test-trace-events-fs-sync.js index 71ffc9da726f1b..54222bcb333f51 100644 --- a/test/parallel/test-trace-events-fs-sync.js +++ b/test/parallel/test-trace-events-fs-sync.js @@ -136,7 +136,12 @@ for (const tr in tests) { } // Make sure the operation is successful. - assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`); + // Don't use assert with a custom message here. Otherwise the + // inspection in the message is done eagerly and wastes a lot of CPU + // time. + if (proc.status !== 0) { + throw new Error(`${tr}:\n${util.inspect(proc)}`); + } // Confirm that trace log file is created. assert(fs.existsSync(traceFile)); diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index d3ea866dea9580..2978cbf98deb0c 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -57,7 +57,8 @@ for (const [ value, _method ] of [ for (const key of Object.keys(types)) { if ((types.isArrayBufferView(value) || - types.isAnyArrayBuffer(value)) && key.includes('Array')) { + types.isAnyArrayBuffer(value)) && key.includes('Array') || + key === 'isBoxedPrimitive') { continue; } @@ -68,6 +69,15 @@ for (const [ value, _method ] of [ } } +// Check boxed primitives. +[ + new Boolean(), + new Number(), + new String(), + Object(Symbol()), + Object(BigInt(0)) +].forEach((entry) => assert(types.isBoxedPrimitive(entry))); + { assert(!types.isUint8Array({ [Symbol.toStringTag]: 'Uint8Array' })); assert(types.isUint8Array(vm.runInNewContext('new Uint8Array'))); diff --git a/test/parallel/test-vm-run-in-new-context.js b/test/parallel/test-vm-run-in-new-context.js index e844cd6816bba3..51577668cfe7f8 100644 --- a/test/parallel/test-vm-run-in-new-context.js +++ b/test/parallel/test-vm-run-in-new-context.js @@ -26,8 +26,8 @@ const common = require('../common'); const assert = require('assert'); const vm = require('vm'); -assert.strictEqual(typeof global.gc, 'function', - 'Run this test with --expose-gc'); +if (typeof global.gc !== 'function') + assert.fail('Run this test with --expose-gc'); // Run a string const result = vm.runInNewContext('\'passed\';'); diff --git a/test/parallel/test-worker-invalid-workerdata.js b/test/parallel/test-worker-invalid-workerdata.js new file mode 100644 index 00000000000000..d0cb1753eb4b64 --- /dev/null +++ b/test/parallel/test-worker-invalid-workerdata.js @@ -0,0 +1,15 @@ +// Flags: --experimental-worker +'use strict'; +require('../common'); +const assert = require('assert'); +const { Worker } = require('worker_threads'); + +// This tests verifies that failing to serialize workerData does not keep +// the process alive. +// Refs: https://github.com/nodejs/node/issues/22736 + +assert.throws(() => { + new Worker('./worker.js', { + workerData: { fn: () => {} } + }); +}, /DataCloneError/); diff --git a/test/parallel/test-worker-message-port-transfer-self.js b/test/parallel/test-worker-message-port-transfer-self.js index 4fe12c0a88d81d..c6f29163dfc643 100644 --- a/test/parallel/test-worker-message-port-transfer-self.js +++ b/test/parallel/test-worker-message-port-transfer-self.js @@ -27,14 +27,18 @@ assert.throws(common.mustCall(() => { port2.onmessage = common.mustCall((message) => { assert.strictEqual(message, 2); - assert(util.inspect(port1).includes('active: true'), util.inspect(port1)); - assert(util.inspect(port2).includes('active: true'), util.inspect(port2)); + const inspectedPort1 = util.inspect(port1); + const inspectedPort2 = util.inspect(port2); + assert(inspectedPort1.includes('active: true'), inspectedPort1); + assert(inspectedPort2.includes('active: true'), inspectedPort2); port1.close(); tick(10, () => { - assert(util.inspect(port1).includes('active: false'), util.inspect(port1)); - assert(util.inspect(port2).includes('active: false'), util.inspect(port2)); + const inspectedPort1 = util.inspect(port1); + const inspectedPort2 = util.inspect(port2); + assert(inspectedPort1.includes('active: false'), inspectedPort1); + assert(inspectedPort2.includes('active: false'), inspectedPort2); }); }); port1.postMessage(2); diff --git a/test/parallel/test-zlib-from-concatenated-gzip.js b/test/parallel/test-zlib-from-concatenated-gzip.js index 9433fcffa866d8..c73a29e649765b 100644 --- a/test/parallel/test-zlib-from-concatenated-gzip.js +++ b/test/parallel/test-zlib-from-concatenated-gzip.js @@ -55,8 +55,8 @@ fs.createReadStream(pmmFileGz) }) .on('data', (data) => pmmResultBuffers.push(data)) .on('finish', common.mustCall(() => { - assert.deepStrictEqual(Buffer.concat(pmmResultBuffers), pmmExpected, - 'result should match original random garbage'); + // Result should match original random garbage + assert.deepStrictEqual(Buffer.concat(pmmResultBuffers), pmmExpected); })); // test that the next gzip member can wrap around the input buffer boundary diff --git a/test/sequential/test-crypto-timing-safe-equal.js b/test/sequential/test-crypto-timing-safe-equal.js index 6aaf7de2284a67..dcebef29d782b0 100644 --- a/test/sequential/test-crypto-timing-safe-equal.js +++ b/test/sequential/test-crypto-timing-safe-equal.js @@ -6,16 +6,16 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); +// 'should consider equal strings to be equal' assert.strictEqual( crypto.timingSafeEqual(Buffer.from('foo'), Buffer.from('foo')), - true, - 'should consider equal strings to be equal' + true ); +// 'should consider unequal strings to be unequal' assert.strictEqual( crypto.timingSafeEqual(Buffer.from('foo'), Buffer.from('bar')), - false, - 'should consider unequal strings to be unequal' + false ); common.expectsError( diff --git a/test/sequential/test-http2-timeout-large-write-file.js b/test/sequential/test-http2-timeout-large-write-file.js index 910e7a0fc497bd..bb366cfff04091 100644 --- a/test/sequential/test-http2-timeout-large-write-file.js +++ b/test/sequential/test-http2-timeout-large-write-file.js @@ -48,7 +48,7 @@ server.on('stream', common.mustCall((stream) => { })); server.setTimeout(serverTimeout); server.on('timeout', () => { - assert.strictEqual(didReceiveData, false, 'Should not timeout'); + assert.ok(!didReceiveData, 'Should not timeout'); }); server.listen(0, common.mustCall(() => { diff --git a/test/sequential/test-http2-timeout-large-write.js b/test/sequential/test-http2-timeout-large-write.js index a15fb46af6d28a..73114776df0a0e 100644 --- a/test/sequential/test-http2-timeout-large-write.js +++ b/test/sequential/test-http2-timeout-large-write.js @@ -40,13 +40,13 @@ server.on('stream', common.mustCall((stream) => { stream.write(content); stream.setTimeout(serverTimeout); stream.on('timeout', () => { - assert.strictEqual(didReceiveData, false, 'Should not timeout'); + assert.ok(!didReceiveData, 'Should not timeout'); }); stream.end(); })); server.setTimeout(serverTimeout); server.on('timeout', () => { - assert.strictEqual(didReceiveData, false, 'Should not timeout'); + assert.ok(!didReceiveData, 'Should not timeout'); }); server.listen(0, common.mustCall(() => { diff --git a/test/sequential/test-inspector.js b/test/sequential/test-inspector.js index ba1fce25a04fad..d641015a3c9954 100644 --- a/test/sequential/test-inspector.js +++ b/test/sequential/test-inspector.js @@ -33,8 +33,7 @@ function checkBadPath(err) { } function checkException(message) { - assert.strictEqual(message.exceptionDetails, undefined, - 'An exception occurred during execution'); + assert.strictEqual(message.exceptionDetails, undefined); } function assertScopeValues({ result }, expected) { diff --git a/tools/cpplint.py b/tools/cpplint.py old mode 100644 new mode 100755 index d96713aa80a1ff..8afcae72a3d833 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -44,7 +44,9 @@ import codecs import copy import getopt +import glob import logging +import itertools import math # for log import os import re @@ -52,24 +54,53 @@ import string import sys import unicodedata +import xml.etree.ElementTree try: xrange except NameError: xrange = range +# if empty, use defaults +_header_extensions = set([]) +# if empty, use defaults +_valid_extensions = set([]) + +# Files with any of these extensions are considered to be +# header files (and will undergo different style checks). +# This set can be extended by using the --headers +# option (also supported in CPPLINT.cfg) +def GetHeaderExtensions(): + if not _header_extensions: + return set(['h', 'hpp', 'hxx', 'h++', 'cuh']) + return _header_extensions + +# The allowed extensions for file names +# This is set by --extensions flag +def GetAllExtensions(): + if not _valid_extensions: + return GetHeaderExtensions().union(set(['c', 'cc', 'cpp', 'cxx', 'c++', 'cu'])) + return _valid_extensions + +def GetNonHeaderExtensions(): + return GetAllExtensions().difference(GetHeaderExtensions()) logger = logging.getLogger('testrunner') _USAGE = """ -Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...] - [--counting=total|toplevel|detailed] [--root=subdir] - [--linelength=digits] [--logfile=filename] +Syntax: cpplint.py [--verbose=#] [--output=emacs|eclipse|vs7|junit] + [--filter=-x,+y,...] + [--counting=total|toplevel|detailed] [--repository=path] + [--root=subdir] [--linelength=digits] [--recursive] + [--exclude=path] + [--headers=ext1,ext2] + [--logfile=filename] + [--extensions=hpp,cpp,...] [file] ... The style guidelines this tries to follow are those in - https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml + https://google.github.io/styleguide/cppguide.html Every problem is given a confidence score from 1-5, with 5 meaning we are certain of the problem, and 1 meaning it could be a legitimate construct. @@ -80,17 +111,26 @@ suppresses errors of all categories on that line. The files passed in will be linted; at least one file must be provided. - Default linted extensions are .cc, .cpp, .cu, .cuh and .h. Change the - extensions with the --extensions flag. + Default linted extensions are %s. + Other file types will be ignored. + Change the extensions with the --extensions flag. Flags: - output=vs7 - By default, the output is formatted to ease emacs parsing. Visual Studio - compatible output (vs7) may also be used. Other formats are unsupported. + output=emacs|eclipse|vs7|junit + By default, the output is formatted to ease emacs parsing. Output + compatible with eclipse (eclipse), Visual Studio (vs7), and JUnit + XML parsers such as those used in Jenkins and Bamboo may also be + used. Other formats are unsupported. verbose=# Specify a number 0-5 to restrict errors to certain verbosity levels. + Errors with lower verbosity levels have lower confidence and are more + likely to be false positives. + + quiet + Supress output other than linting errors, such as information about + which files have been processed and excluded. filter=-x,+y,... Specify a comma-separated list of category-filters to apply: only @@ -114,17 +154,40 @@ also be printed. If 'detailed' is provided, then a count is provided for each category like 'build/class'. + repository=path + The top level directory of the repository, used to derive the header + guard CPP variable. By default, this is determined by searching for a + path that contains .git, .hg, or .svn. When this flag is specified, the + given path is used instead. This option allows the header guard CPP + variable to remain consistent even if members of a team have different + repository root directories (such as when checking out a subdirectory + with SVN). In addition, users of non-mainstream version control systems + can use this flag to ensure readable header guard CPP variables. + + Examples: + Assuming that Alice checks out ProjectName and Bob checks out + ProjectName/trunk and trunk contains src/chrome/ui/browser.h, then + with no --repository flag, the header guard CPP variable will be: + + Alice => TRUNK_SRC_CHROME_BROWSER_UI_BROWSER_H_ + Bob => SRC_CHROME_BROWSER_UI_BROWSER_H_ + + If Alice uses the --repository=trunk flag and Bob omits the flag or + uses --repository=. then the header guard CPP variable will be: + + Alice => SRC_CHROME_BROWSER_UI_BROWSER_H_ + Bob => SRC_CHROME_BROWSER_UI_BROWSER_H_ + root=subdir - The root directory used for deriving header guard CPP variable. - By default, the header guard CPP variable is calculated as the relative - path to the directory that contains .git, .hg, or .svn. When this flag - is specified, the relative path is calculated from the specified - directory. If the specified directory does not exist, this flag is - ignored. + The root directory used for deriving header guard CPP variables. This + directory is relative to the top level directory of the repository which + by default is determined by searching for a directory that contains .git, + .hg, or .svn but can also be controlled with the --repository flag. If + the specified directory does not exist, this flag is ignored. Examples: - Assuming that src/.git exists, the header guard CPP variables for - src/chrome/browser/ui/browser.h are: + Assuming that src is the top level directory of the repository, the + header guard CPP variables for src/chrome/browser/ui/browser.h are: No flag => CHROME_BROWSER_UI_BROWSER_H_ --root=chrome => BROWSER_UI_BROWSER_H_ @@ -137,14 +200,36 @@ Examples: --linelength=120 + recursive + Search for files to lint recursively. Each directory given in the list + of files to be linted is replaced by all files that descend from that + directory. Files with extensions not in the valid extensions list are + excluded. + + exclude=path + Exclude the given path from the list of files to be linted. Relative + paths are evaluated relative to the current directory and shell globbing + is performed. This flag can be provided multiple times to exclude + multiple files. + + Examples: + --exclude=one.cc + --exclude=src/*.cc + --exclude=src/*.cc --exclude=test/*.cc + extensions=extension,extension,... The allowed file extensions that cpplint will check Examples: - --extensions=hpp,cpp + --extensions=%s + + headers=extension,extension,... + The allowed header extensions that cpplint will consider to be header files + (by default, only files with extensions %s + will be assumed to be headers) - logfile=filename - Write TAP output to a logfile. + Examples: + --headers=%s cpplint.py supports per-directory configurations specified in CPPLINT.cfg files. CPPLINT.cfg file can contain a number of key=value pairs. @@ -154,6 +239,7 @@ filter=+filter1,-filter2,... exclude_files=regex linelength=80 + root=subdir "set noparent" option prevents cpplint from traversing directory tree upwards looking for more .cfg files in parent directories. This option @@ -165,22 +251,28 @@ "exclude_files" allows to specify a regular expression to be matched against a file name. If the expression matches, the file is skipped and not run - through liner. + through the linter. + + "linelength" specifies the allowed line length for the project. - "linelength" allows to specify the allowed line length for the project. + The "root" option is similar in function to the --root flag (see example + above). CPPLINT.cfg has an effect on files in the same directory and all - sub-directories, unless overridden by a nested configuration file. + subdirectories, unless overridden by a nested configuration file. Example file: filter=-build/include_order,+build/include_alpha - exclude_files=.*\.cc + exclude_files=.*\\.cc The above example disables build/include_order warning and enables build/include_alpha as well as excludes all .cc from being processed by linter, in the current directory (where the .cfg - file is located) and all sub-directories. -""" + file is located) and all subdirectories. +""" % (list(GetAllExtensions()), + ','.join(list(GetAllExtensions())), + GetHeaderExtensions(), + ','.join(GetHeaderExtensions())) # We categorize each error message we print. Here are the categories. # We want an explicit list so we can list them all in cpplint --filter=. @@ -200,6 +292,7 @@ 'build/include_alpha', 'build/include_order', 'build/include_what_you_use', + 'build/namespaces_literals', 'build/namespaces', 'build/printf_format', 'build/storage_class', @@ -270,6 +363,7 @@ '-build/include', '-build/include_alpha', '-build/include_order', + '-build/include_subdir', '-legal/copyright', ] @@ -447,7 +541,8 @@ r'^(?:[^/]*[A-Z][^/]*\.h|lua\.h|lauxlib\.h|lualib\.h)$') # Pattern for matching FileInfo.BaseName() against test file name -_TEST_FILE_SUFFIX = r'(_test|_unittest|_regtest)$' +_test_suffixes = ['_test', '_regtest', '_unittest'] +_TEST_FILE_SUFFIX = '(' + '|'.join(_test_suffixes) + r')$' # Pattern that matches only complete whitespace, possibly across multiple lines. _EMPTY_CONDITIONAL_BODY_PATTERN = re.compile(r'^\s*$', re.DOTALL) @@ -461,7 +556,7 @@ ] # Replacement macros for CHECK/DCHECK/EXPECT_TRUE/EXPECT_FALSE -_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS]) +_CHECK_REPLACEMENT = dict([(macro_var, {}) for macro_var in _CHECK_MACROS]) for op, replacement in [('==', 'EQ'), ('!=', 'NE'), ('>=', 'GE'), ('>', 'GT'), @@ -504,6 +599,7 @@ _ALT_TOKEN_REPLACEMENT_PATTERN = re.compile( r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)') + # These constants define types of headers for use with # _IncludeState.CheckNextIncludeOrder(). _C_SYS_HEADER = 1 @@ -546,13 +642,54 @@ # This is set by --root flag. _root = None +# The top level repository directory. If set, _root is calculated relative to +# this directory instead of the directory containing version control artifacts. +# This is set by the --repository flag. +_repository = None + +# Files to exclude from linting. This is set by the --exclude flag. +_excludes = None + +# Whether to supress PrintInfo messages +_quiet = False + # The allowed line length of files. # This is set by --linelength flag. _line_length = 80 -# The allowed extensions for file names -# This is set by --extensions flag. -_valid_extensions = set(['cc', 'h', 'cpp', 'cu', 'cuh']) +try: + xrange(1, 0) +except NameError: + # -- pylint: disable=redefined-builtin + xrange = range + +try: + unicode +except NameError: + # -- pylint: disable=redefined-builtin + basestring = unicode = str + +try: + long(2) +except NameError: + # -- pylint: disable=redefined-builtin + long = int + +if sys.version_info < (3,): + # -- pylint: disable=no-member + # BINARY_TYPE = str + itervalues = dict.itervalues + iteritems = dict.iteritems +else: + # BINARY_TYPE = bytes + itervalues = dict.values + iteritems = dict.items + +def unicode_escape_decode(x): + if sys.version_info < (3,): + return codecs.unicode_escape_decode(x)[0] + else: + return x # {str, bool}: a map from error categories to booleans which indicate if the # category should be suppressed for every line. @@ -670,7 +807,7 @@ def Search(pattern, s): def _IsSourceExtension(s): """File extension (excluding dot) matches a source file extension.""" - return s in ('c', 'cc', 'cpp', 'cxx') + return s in GetNonHeaderExtensions() class _IncludeState(object): @@ -710,6 +847,8 @@ class _IncludeState(object): def __init__(self): self.include_list = [[]] + self._section = None + self._last_header = None self.ResetSection('') def FindHeader(self, header): @@ -853,9 +992,16 @@ def __init__(self): # output format: # "emacs" - format that emacs can parse (default) + # "eclipse" - format that eclipse can parse # "vs7" - format that Microsoft Visual Studio 7 can parse + # "junit" - format that Jenkins, Bamboo, etc can parse self.output_format = 'emacs' + # For JUnit output, save errors and failures until the end so that they + # can be written into the XML + self._junit_errors = [] + self._junit_failures = [] + def SetOutputFormat(self, output_format): """Sets the output format for errors.""" self.output_format = output_format @@ -924,10 +1070,69 @@ def IncrementErrorCount(self, category): def PrintErrorCounts(self): """Print a summary of errors by category, and the total.""" - for category, count in self.errors_by_category.iteritems(): - sys.stderr.write('Category \'%s\' errors found: %d\n' % + for category, count in sorted(iteritems(self.errors_by_category)): + self.PrintInfo('Category \'%s\' errors found: %d\n' % (category, count)) - sys.stderr.write('Total errors found: %d\n' % self.error_count) + if self.error_count > 0: + self.PrintInfo('Total errors found: %d\n' % self.error_count) + + def PrintInfo(self, message): + if not _quiet and self.output_format != 'junit': + sys.stderr.write(message) + + def PrintError(self, message): + if self.output_format == 'junit': + self._junit_errors.append(message) + else: + sys.stderr.write(message) + + def AddJUnitFailure(self, filename, linenum, message, category, confidence): + self._junit_failures.append((filename, linenum, message, category, + confidence)) + + def FormatJUnitXML(self): + num_errors = len(self._junit_errors) + num_failures = len(self._junit_failures) + + testsuite = xml.etree.ElementTree.Element('testsuite') + testsuite.attrib['name'] = 'cpplint' + testsuite.attrib['errors'] = str(num_errors) + testsuite.attrib['failures'] = str(num_failures) + + if num_errors == 0 and num_failures == 0: + testsuite.attrib['tests'] = str(1) + xml.etree.ElementTree.SubElement(testsuite, 'testcase', name='passed') + + else: + testsuite.attrib['tests'] = str(num_errors + num_failures) + if num_errors > 0: + testcase = xml.etree.ElementTree.SubElement(testsuite, 'testcase') + testcase.attrib['name'] = 'errors' + error = xml.etree.ElementTree.SubElement(testcase, 'error') + error.text = '\n'.join(self._junit_errors) + if num_failures > 0: + # Group failures by file + failed_file_order = [] + failures_by_file = {} + for failure in self._junit_failures: + failed_file = failure[0] + if failed_file not in failed_file_order: + failed_file_order.append(failed_file) + failures_by_file[failed_file] = [] + failures_by_file[failed_file].append(failure) + # Create a testcase for each file + for failed_file in failed_file_order: + failures = failures_by_file[failed_file] + testcase = xml.etree.ElementTree.SubElement(testsuite, 'testcase') + testcase.attrib['name'] = failed_file + failure = xml.etree.ElementTree.SubElement(testcase, 'failure') + template = '{0}: {1} [{2}] [{3}]' + texts = [template.format(f[1], f[2], f[3], f[4]) for f in failures] + failure.text = '\n'.join(texts) + + xml_decl = '\n' + return xml_decl + xml.etree.ElementTree.tostring(testsuite, 'utf-8').decode('utf-8') + _cpplint_state = _CppLintState() @@ -1173,7 +1378,7 @@ def Error(filename, linenum, category, confidence, message): if _ShouldPrintError(category, confidence, linenum): _cpplint_state.IncrementErrorCount(category) if _cpplint_state.output_format == 'vs7': - sys.stderr.write('%s(%s): %s [%s] [%d]\n' % ( + _cpplint_state.PrintError('%s(%s): warning: %s [%s] [%d]\n' % ( filename, linenum, message, category, confidence)) elif _cpplint_state.output_format == 'eclipse': sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % ( @@ -1188,9 +1393,9 @@ def Error(filename, linenum, category, confidence, message): ' ...') logger.info(template % locals()) else: - sys.stderr.write('%s:%s: %s [%s] [%d]\n' % ( - filename, linenum, message, category, confidence)) - + final_message = '%s:%s: %s [%s] [%d]\n' % ( + filename, linenum, message, category, confidence) + sys.stderr.write(final_message) # Matches standard C++ escape sequences per 2.13.2.3 of the C++ standard. _RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile( @@ -1748,7 +1953,12 @@ def GetHeaderGuardCPPVariable(filename): fileinfo = FileInfo(filename) file_path_from_root = fileinfo.RepositoryName() if _root: - file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root) + suffix = os.sep + # On Windows using directory separator will leave us with + # "bogus escape error" unless we properly escape regex. + if suffix == '\\': + suffix += '\\' + file_path_from_root = re.sub('^' + _root + suffix, '', file_path_from_root) return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_' @@ -1775,6 +1985,11 @@ def CheckForHeaderGuard(filename, clean_lines, error): if Search(r'//\s*NOLINT\(build/header_guard\)', i): return + # Allow pragma once instead of header guards + for i in raw_lines: + if Search(r'^\s*#pragma\s+once', i): + return + cppvar = GetHeaderGuardCPPVariable(filename) ifndef = '' @@ -1851,28 +2066,30 @@ def CheckForHeaderGuard(filename, clean_lines, error): def CheckHeaderFileIncluded(filename, include_state, error): - """Logs an error if a .cc file does not include its header.""" + """Logs an error if a source file does not include its header.""" # Do not check test files fileinfo = FileInfo(filename) if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()): return - headerfile = filename[0:len(filename) - len(fileinfo.Extension())] + '.h' - if not os.path.exists(headerfile): - return - headername = FileInfo(headerfile).RepositoryName() - first_include = 0 - for section_list in include_state.include_list: - for f in section_list: - if headername in f[0] or f[0] in headername: - return - if not first_include: - first_include = f[1] + for ext in GetHeaderExtensions(): + basefilename = filename[0:len(filename) - len(fileinfo.Extension())] + headerfile = basefilename + '.' + ext + if not os.path.exists(headerfile): + continue + headername = FileInfo(headerfile).RepositoryName() + first_include = None + for section_list in include_state.include_list: + for f in section_list: + if headername in f[0] or f[0] in headername: + return + if not first_include: + first_include = f[1] - error(filename, first_include, 'build/include', 5, - '%s should include its header file %s' % (fileinfo.RepositoryName(), - headername)) + error(filename, first_include, 'build/include', 5, + '%s should include its header file %s' % (fileinfo.RepositoryName(), + headername)) def CheckForBadCharacters(filename, lines, error): @@ -1893,7 +2110,7 @@ def CheckForBadCharacters(filename, lines, error): error: The function to call with any errors found. """ for linenum, line in enumerate(lines): - if u'\ufffd' in line: + if unicode_escape_decode('\ufffd') in line: error(filename, linenum, 'readability/utf8', 5, 'Line contains invalid UTF-8 (or Unicode replacement character).') if '\0' in line: @@ -2537,7 +2754,7 @@ def Update(self, filename, clean_lines, linenum, error): # class LOCKABLE API Object { # }; class_decl_match = Match( - r'^(\s*(?:template\s*<[\w\s<>,:]*>\s*)?' + r'^(\s*(?:template\s*<[\w\s<>,:=]*>\s*)?' r'(class|struct)\s+(?:[A-Z_]+\s+)*(\w+(?:::\w+)*))' r'(.*)$', line) if (class_decl_match and @@ -2785,6 +3002,7 @@ def CheckForNonStandardConstructs(filename, clean_lines, linenum, constructor_args[i] = constructor_arg i += 1 + variadic_args = [arg for arg in constructor_args if '&&...' in arg] defaulted_args = [arg for arg in constructor_args if '=' in arg] noarg_constructor = (not constructor_args or # empty arg list # 'void' arg specifier @@ -2795,7 +3013,10 @@ def CheckForNonStandardConstructs(filename, clean_lines, linenum, # all but at most one arg defaulted (len(constructor_args) >= 1 and not noarg_constructor and - len(defaulted_args) >= len(constructor_args) - 1)) + len(defaulted_args) >= len(constructor_args) - 1) or + # variadic arguments with zero or one argument + (len(constructor_args) <= 2 and + len(variadic_args) >= 1)) initializer_list_constructor = bool( onearg_constructor and Search(r'\bstd\s*::\s*initializer_list\b', constructor_args[0])) @@ -2808,7 +3029,7 @@ def CheckForNonStandardConstructs(filename, clean_lines, linenum, onearg_constructor and not initializer_list_constructor and not copy_constructor): - if defaulted_args: + if defaulted_args or variadic_args: error(filename, linenum, 'runtime/explicit', 5, 'Constructors callable with one argument ' 'should be marked explicit.') @@ -3046,7 +3267,7 @@ def CheckComment(line, filename, linenum, next_line_start, error): # If the comment contains an alphanumeric character, there # should be a space somewhere between it and the // unless # it's a /// or //! Doxygen comment. - if (Match(r'(?://[^ ]*\w)|(?:////\s*$)', comment) and + if (Match(r'//[^ ]*\w', comment) and not Match(r'(///|//\!)(\s+|$)', comment)): error(filename, linenum, 'whitespace/comments', 4, 'Should have a space between // and comment') @@ -3568,7 +3789,6 @@ def IsDecltype(clean_lines, linenum, column): return True return False - def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error): """Checks for additional blank line issues related to sections. @@ -3901,6 +4121,14 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error): # outputting warnings for the matching closing brace, if there are # nested blocks with trailing semicolons, we will get the error # messages in reversed order. + + # We need to check the line forward for NOLINT + raw_lines = clean_lines.raw_lines + ParseNolintSuppressions(filename, raw_lines[endlinenum-1], endlinenum-1, + error) + ParseNolintSuppressions(filename, raw_lines[endlinenum], endlinenum, + error) + error(filename, endlinenum, 'readability/braces', 4, "You don't need a ; after a }") @@ -3978,12 +4206,12 @@ def CheckEmptyBlockBody(filename, clean_lines, linenum, error): return if closing_linenum > opening_linenum: # Opening line after the {. Ignore comments here since we checked above. - body = list(opening_line[opening_pos+1:]) + bodylist = list(opening_line[opening_pos+1:]) # All lines until closing line, excluding closing line, with comments. - body.extend(clean_lines.raw_lines[opening_linenum+1:closing_linenum]) + bodylist.extend(clean_lines.raw_lines[opening_linenum+1:closing_linenum]) # Closing line before the }. Won't (and can't) have comments. - body.append(clean_lines.elided[closing_linenum][:closing_pos-1]) - body = '\n'.join(body) + bodylist.append(clean_lines.elided[closing_linenum][:closing_pos-1]) + body = '\n'.join(bodylist) else: # If statement has brackets and fits on a single line. body = opening_line[opening_pos+1:closing_pos-1] @@ -4318,7 +4546,7 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, # Check if the line is a header guard. is_header_guard = False - if file_extension == 'h': + if file_extension in GetHeaderExtensions(): cppvar = GetHeaderGuardCPPVariable(filename) if (line.startswith('#ifndef %s' % cppvar) or line.startswith('#define %s' % cppvar) or @@ -4332,16 +4560,23 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, # # The "$Id:...$" comment may also get very long without it being the # developers fault. + # + # Doxygen documentation copying can get pretty long when using an overloaded + # function declaration if (not line.startswith('#include') and not is_header_guard and not Match(r'^\s*//.*http(s?)://\S*$', line) and not Match(r'^\s*//\s*[^\s]*$', line) and - not Match(r'^// \$Id:.*#[0-9]+ \$$', line)): + not Match(r'^// \$Id:.*#[0-9]+ \$$', line) and + not Match(r'^\s*/// [@\\](copydoc|copydetails|copybrief) .*$', line)): line_width = GetLineWidth(line) if line_width > _line_length: error(filename, linenum, 'whitespace/line_length', 2, 'Lines should be <= %i characters long' % _line_length) if (cleansed_line.count(';') > 1 and + # allow simple single line lambdas + not Match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}\n\r]*\}', + line) and # for loops are allowed two ;'s (and may run over two lines). cleansed_line.find('for') == -1 and (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or @@ -4401,8 +4636,11 @@ def _DropCommonSuffixes(filename): Returns: The filename with the common suffix removed. """ - for suffix in ('test.cc', 'regtest.cc', 'unittest.cc', - 'inl.h', 'impl.h', 'internal.h'): + for suffix in itertools.chain( + ('%s.%s' % (test_suffix.lstrip('_'), ext) + for test_suffix, ext in itertools.product(_test_suffixes, GetNonHeaderExtensions())), + ('%s.%s' % (suffix, ext) + for suffix, ext in itertools.product(['inl', 'imp', 'internal'], GetHeaderExtensions()))): if (filename.endswith(suffix) and len(filename) > len(suffix) and filename[-len(suffix) - 1] in ('-', '_')): return filename[:-len(suffix) - 1] @@ -4437,6 +4675,10 @@ def _ClassifyInclude(fileinfo, include, is_system): # those already checked for above. is_cpp_h = include in _CPP_HEADERS + # Headers with C++ extensions shouldn't be considered C system headers + if is_system and os.path.splitext(include)[1] in ['.hpp', '.hxx', '.h++']: + is_system = False + if is_system: if is_cpp_h: return _CPP_SYS_HEADER @@ -4449,9 +4691,11 @@ def _ClassifyInclude(fileinfo, include, is_system): target_dir, target_base = ( os.path.split(_DropCommonSuffixes(fileinfo.RepositoryName()))) include_dir, include_base = os.path.split(_DropCommonSuffixes(include)) + target_dir_pub = os.path.normpath(target_dir + '/../public') + target_dir_pub = target_dir_pub.replace('\\', '/') if target_base == include_base and ( include_dir == target_dir or - include_dir == os.path.normpath(target_dir + '/../public')): + include_dir == target_dir_pub): return _LIKELY_MY_HEADER # If the target and include share some initial basename @@ -4495,7 +4739,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): # naming convention but not the include convention. match = Match(r'#include\s*"([^/]+\.h)"', line) if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)): - error(filename, linenum, 'build/include', 4, + error(filename, linenum, 'build/include_subdir', 4, 'Include the directory when naming .h files') # we shouldn't include a file more than once. actually, there are a @@ -4510,11 +4754,16 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): error(filename, linenum, 'build/include', 4, '"%s" already included at %s:%s' % (include, filename, duplicate_line)) - elif (include.endswith('.cc') and + return + + for extension in GetNonHeaderExtensions(): + if (include.endswith('.' + extension) and os.path.dirname(fileinfo.RepositoryName()) != os.path.dirname(include)): - error(filename, linenum, 'build/include', 4, - 'Do not include .cc files from other packages') - elif not _THIRD_PARTY_HEADERS_PATTERN.match(include): + error(filename, linenum, 'build/include', 4, + 'Do not include .' + extension + ' files from other packages') + return + + if not _THIRD_PARTY_HEADERS_PATTERN.match(include): include_state.include_list[-1].append((include, linenum)) # We want to ensure that headers appear in the right order: @@ -4568,7 +4817,7 @@ def _GetTextInside(text, start_pattern): # Give opening punctuations to get the matching close-punctuations. matching_punctuation = {'(': ')', '{': '}', '[': ']'} - closing_punctuation = set(matching_punctuation.itervalues()) + closing_punctuation = set(itervalues(matching_punctuation)) # Find the position to start extracting text. match = re.search(start_pattern, text, re.M) @@ -4670,7 +4919,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, CheckGlobalStatic(filename, clean_lines, linenum, error) CheckPrintf(filename, clean_lines, linenum, error) - if file_extension == 'h': + if file_extension in GetHeaderExtensions(): # TODO(unknown): check that 1-arg constructors are explicit. # How to tell it's a constructor? # (handled in CheckForNonStandardConstructs for now) @@ -4731,9 +4980,14 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, % (match.group(1), match.group(2))) if Search(r'\busing namespace\b', line): - error(filename, linenum, 'build/namespaces', 5, - 'Do not use namespace using-directives. ' - 'Use using-declarations instead.') + if Search(r'\bliterals\b', line): + error(filename, linenum, 'build/namespaces_literals', 5, + 'Do not use namespace using-directives. ' + 'Use using-declarations instead.') + else: + error(filename, linenum, 'build/namespaces', 5, + 'Do not use namespace using-directives. ' + 'Use using-declarations instead.') # Detect variable-length arrays. match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line) @@ -4777,7 +5031,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, # Check for use of unnamed namespaces in header files. Registration # macros are typically OK, so we allow use of "namespace {" on lines # that end with backslashes. - if (file_extension == 'h' + if (file_extension in GetHeaderExtensions() and Search(r'\bnamespace\s*{', line) and line[-1] != '\\'): error(filename, linenum, 'build/namespaces', 4, @@ -5377,7 +5631,7 @@ def FilesBelongToSameModule(filename_cc, filename_h): some false positives. This should be sufficiently rare in practice. Args: - filename_cc: is the path for the .cc file + filename_cc: is the path for the source (e.g. .cc) file filename_h: is the path for the header path Returns: @@ -5385,20 +5639,23 @@ def FilesBelongToSameModule(filename_cc, filename_h): bool: True if filename_cc and filename_h belong to the same module. string: the additional prefix needed to open the header file. """ + fileinfo_cc = FileInfo(filename_cc) + if not fileinfo_cc.Extension().lstrip('.') in GetNonHeaderExtensions(): + return (False, '') - fileinfo = FileInfo(filename_cc) - if not fileinfo.IsSource(): + fileinfo_h = FileInfo(filename_h) + if not fileinfo_h.Extension().lstrip('.') in GetHeaderExtensions(): return (False, '') - filename_cc = filename_cc[:-len(fileinfo.Extension())] - matched_test_suffix = Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()) + + filename_cc = filename_cc[:-(len(fileinfo_cc.Extension()))] + matched_test_suffix = Search(_TEST_FILE_SUFFIX, fileinfo_cc.BaseName()) if matched_test_suffix: filename_cc = filename_cc[:-len(matched_test_suffix.group(1))] + filename_cc = filename_cc.replace('/public/', '/') filename_cc = filename_cc.replace('/internal/', '/') - if not filename_h.endswith('.h'): - return (False, '') - filename_h = filename_h[:-len('.h')] + filename_h = filename_h[:-(len(fileinfo_h.Extension()))] if filename_h.endswith('-inl'): filename_h = filename_h[:-len('-inl')] filename_h = filename_h.replace('/public/', '/') @@ -5508,7 +5765,7 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error, # include_dict is modified during iteration, so we iterate over a copy of # the keys. - header_keys = include_dict.keys() + header_keys = list(include_dict.keys()) for header in header_keys: (same_module, common_path) = FilesBelongToSameModule(abs_filename, header) fullpath = common_path + header @@ -5520,11 +5777,13 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error, # didn't include it in the .h file. # TODO(unknown): Do a better job of finding .h files so we are confident that # not having the .h file means there isn't one. - if filename.endswith('.cc') and not header_found: - return + if not header_found: + for extension in GetNonHeaderExtensions(): + if filename.endswith('.' + extension): + return # All the lines have been processed, report the errors found. - for required_header_unstripped in required: + for required_header_unstripped in sorted(required, key=required.__getitem__): template = required[required_header_unstripped][1] if required_header_unstripped.strip('<>"') not in include_dict: error(filename, required[required_header_unstripped][0], @@ -5663,11 +5922,9 @@ def IsBlockInNameSpace(nesting_state, is_forward_declaration): Whether or not the new block is directly in a namespace. """ if is_forward_declaration: - if len(nesting_state.stack) >= 1 and ( - isinstance(nesting_state.stack[-1], _NamespaceInfo)): - return True - else: - return False + return len(nesting_state.stack) >= 1 and ( + isinstance(nesting_state.stack[-1], _NamespaceInfo)) + return (len(nesting_state.stack) > 1 and nesting_state.stack[-1].check_namespace_indentation and @@ -5717,7 +5974,7 @@ def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum, def ProcessLine(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, - extra_check_functions=[]): + extra_check_functions=None): """Processes a single line in the file. Args: @@ -5756,8 +6013,9 @@ def ProcessLine(filename, file_extension, clean_lines, line, CheckMakePairUsesDeduction(filename, clean_lines, line, error) CheckRedundantVirtual(filename, clean_lines, line, error) CheckRedundantOverrideOrFinal(filename, clean_lines, line, error) - for check_fn in extra_check_functions: - check_fn(filename, clean_lines, line, error) + if extra_check_functions: + for check_fn in extra_check_functions: + check_fn(filename, clean_lines, line, error) def FlagCxx11Features(filename, clean_lines, linenum, error): """Flag those c++11 features that we only allow in certain places. @@ -5831,7 +6089,7 @@ def FlagCxx14Features(filename, clean_lines, linenum, error): def ProcessFileData(filename, file_extension, lines, error, - extra_check_functions=[]): + extra_check_functions=None): """Performs lint checks and reports any errors to the given error function. Args: @@ -5859,7 +6117,7 @@ def ProcessFileData(filename, file_extension, lines, error, RemoveMultiLineComments(filename, lines, error) clean_lines = CleansedLines(lines) - if file_extension == 'h': + if file_extension in GetHeaderExtensions(): CheckForHeaderGuard(filename, clean_lines, error) for line in xrange(clean_lines.NumLines()): @@ -5930,9 +6188,8 @@ def ProcessConfigOverrides(filename): if base_name: pattern = re.compile(val) if pattern.match(base_name): - sys.stderr.write('Ignoring "%s": file excluded by "%s". ' - 'File path component "%s" matches ' - 'pattern "%s"\n' % + _cpplint_state.PrintInfo('Ignoring "%s": file excluded by ' + '"%s". File path component "%s" matches pattern "%s"\n' % (filename, cfg_file, base_name, val)) return False elif name == 'linelength': @@ -5940,26 +6197,47 @@ def ProcessConfigOverrides(filename): try: _line_length = int(val) except ValueError: - sys.stderr.write('Line length must be numeric.') + _cpplint_state.PrintError('Line length must be numeric.') + elif name == 'extensions': + global _valid_extensions + try: + extensions = [ext.strip() for ext in val.split(',')] + _valid_extensions = set(extensions) + except ValueError: + sys.stderr.write('Extensions should be a comma-separated list of values;' + 'for example: extensions=hpp,cpp\n' + 'This could not be parsed: "%s"' % (val,)) + elif name == 'headers': + global _header_extensions + try: + extensions = [ext.strip() for ext in val.split(',')] + _header_extensions = set(extensions) + except ValueError: + sys.stderr.write('Extensions should be a comma-separated list of values;' + 'for example: extensions=hpp,cpp\n' + 'This could not be parsed: "%s"' % (val,)) + elif name == 'root': + global _root + _root = val else: - sys.stderr.write( + _cpplint_state.PrintError( 'Invalid configuration option (%s) in file %s\n' % (name, cfg_file)) except IOError: - sys.stderr.write( + _cpplint_state.PrintError( "Skipping config file '%s': Can't open for reading\n" % cfg_file) keep_looking = False # Apply all the accumulated filters in reverse order (top-level directory # config options having the least priority). - for filter in reversed(cfg_filters): - _AddFilters(filter) + for cfg_filter in reversed(cfg_filters): + _AddFilters(cfg_filter) return True -def ProcessFile(filename, vlevel, extra_check_functions=[]): +def ProcessFile(filename, vlevel, extra_check_functions=None): """Does google-lint on a single file. Args: @@ -6008,7 +6286,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]): lf_lines.append(linenum + 1) except IOError: - sys.stderr.write( + _cpplint_state.PrintError( "Skipping input '%s': Can't open for reading\n" % filename) _RestoreFilters() return @@ -6018,9 +6296,9 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]): # When reading from stdin, the extension is unknown, so no cpplint tests # should rely on the extension. - if filename != '-' and file_extension not in _valid_extensions: - sys.stderr.write('Ignoring %s; not a valid file name ' - '(%s)\n' % (filename, ', '.join(_valid_extensions))) + if filename != '-' and file_extension not in GetAllExtensions(): + _cpplint_state.PrintError('Ignoring %s; not a valid file name ' + '(%s)\n' % (filename, ', '.join(GetAllExtensions()))) else: ProcessFileData(filename, file_extension, lines, Error, extra_check_functions) @@ -6043,6 +6321,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]): Error(filename, linenum, 'whitespace/newline', 1, 'Unexpected \\r (^M) found; better to use only \\n') + _cpplint_state.PrintInfo('Done processing %s\n' % filename) _RestoreFilters() @@ -6053,10 +6332,11 @@ def PrintUsage(message): message: The optional error message. """ sys.stderr.write(_USAGE) + if message: sys.exit('\nFATAL ERROR: ' + message) else: - sys.exit(1) + sys.exit(0) def PrintCategories(): @@ -6085,8 +6365,13 @@ def ParseArguments(args): 'filter=', 'logfile=', 'root=', + 'repository=', 'linelength=', - 'extensions=']) + 'extensions=', + 'exclude=', + 'headers=', + 'quiet', + 'recursive']) except getopt.GetoptError: PrintUsage('Invalid arguments.') @@ -6094,14 +6379,15 @@ def ParseArguments(args): output_format = _OutputFormat() filters = '' counting_style = '' + recursive = False for (opt, val) in opts: if opt == '--help': PrintUsage(None) elif opt == '--output': - if val not in ('emacs', 'vs7', 'eclipse', 'tap'): + if val not in ('emacs', 'vs7', 'eclipse', 'junit', 'tap'): PrintUsage( - 'The only allowed output formats are emacs, vs7, eclipse and tap.') + 'The only allowed output formats are emacs, vs7, eclipse, junit and tap.') output_format = val elif opt == '--verbose': verbosity = int(val) @@ -6116,24 +6402,50 @@ def ParseArguments(args): elif opt == '--root': global _root _root = val + elif opt == '--repository': + global _repository + _repository = val elif opt == '--linelength': global _line_length try: _line_length = int(val) except ValueError: PrintUsage('Line length must be digits.') + elif opt == '--exclude': + global _excludes + if not _excludes: + _excludes = set() + _excludes.update(glob.glob(val)) elif opt == '--extensions': global _valid_extensions try: _valid_extensions = set(val.split(',')) except ValueError: + PrintUsage('Extensions must be comma seperated list.') + elif opt == '--headers': + global _header_extensions + try: + _header_extensions = set(val.split(',')) + except ValueError: + PrintUsage('Extensions must be comma seperated list.') + elif opt == '--recursive': PrintUsage('Extensions must be comma separated list.') elif opt == '--logfile': + recursive = True + elif opt == '--quiet': logger.addHandler(logging.FileHandler(val, mode='wb')) + global _quiet + _quiet = True if not filenames: PrintUsage('No files were specified.') + if recursive: + filenames = _ExpandDirectories(filenames) + + if _excludes: + filenames = _FilterExcludedFiles(filenames) + _SetOutputFormat(output_format) _SetVerboseLevel(verbosity) _SetFilters(filters) @@ -6141,27 +6453,72 @@ def ParseArguments(args): return filenames +def _ExpandDirectories(filenames): + """Searches a list of filenames and replaces directories in the list with + all files descending from those directories. Files with extensions not in + the valid extensions list are excluded. + + Args: + filenames: A list of files or directories + + Returns: + A list of all files that are members of filenames or descended from a + directory in filenames + """ + expanded = set() + for filename in filenames: + if not os.path.isdir(filename): + expanded.add(filename) + continue + + for root, _, files in os.walk(filename): + for loopfile in files: + fullname = os.path.join(root, loopfile) + if fullname.startswith('.' + os.path.sep): + fullname = fullname[len('.' + os.path.sep):] + expanded.add(fullname) + + filtered = [] + for filename in expanded: + if os.path.splitext(filename)[1][1:] in GetAllExtensions(): + filtered.append(filename) + + return filtered + +def _FilterExcludedFiles(filenames): + """Filters out files listed in the --exclude command line switch. File paths + in the switch are evaluated relative to the current working directory + """ + exclude_paths = [os.path.abspath(f) for f in _excludes] + return [f for f in filenames if os.path.abspath(f) not in exclude_paths] def main(): filenames = ParseArguments(sys.argv[1:]) + backup_err = sys.stderr + try: + # Change stderr to write with replacement characters so we don't die + # if we try to print something containing non-ASCII characters. + sys.stderr = codecs.StreamReaderWriter(sys.stderr, + codecs.getreader('utf8'), + codecs.getwriter('utf8'), + 'replace') - # Change stderr to write with replacement characters so we don't die - # if we try to print something containing non-ASCII characters. - sys.stderr = codecs.StreamReaderWriter(sys.stderr, - codecs.getreader('utf8'), - codecs.getwriter('utf8'), - 'replace') + logger.addHandler(logging.StreamHandler(sys.stdout)) + logger.setLevel(logging.INFO) - logger.addHandler(logging.StreamHandler(sys.stdout)) - logger.setLevel(logging.INFO) + _cpplint_state.ResetErrorCounts() + for filename in filenames: + ProcessFile(filename.decode('utf-8'), _cpplint_state.verbose_level) + _cpplint_state.PrintErrorCounts() - if _cpplint_state.output_format == 'tap': - logger.info('TAP version 13') + if _cpplint_state.output_format == 'tap': + logger.info('TAP version 13') - _cpplint_state.ResetErrorCounts() - for filename in filenames: - ProcessFile(filename.decode('utf-8'), _cpplint_state.verbose_level) - _cpplint_state.PrintErrorCounts() + if _cpplint_state.output_format == 'junit': + sys.stderr.write(_cpplint_state.FormatJUnitXML()) + + finally: + sys.stderr = backup_err sys.exit(_cpplint_state.error_count > 0) diff --git a/tools/doc/apilinks.js b/tools/doc/apilinks.js index b0a221cf014179..d7ec5684b79705 100644 --- a/tools/doc/apilinks.js +++ b/tools/doc/apilinks.js @@ -52,7 +52,9 @@ process.argv.slice(2).forEach((file) => { // Parse source. const source = fs.readFileSync(file, 'utf8'); - const ast = acorn.parse(source, { ecmaVersion: 10, locations: true }); + const ast = acorn.parse( + source, + { allowReturnOutsideFunction: true, ecmaVersion: 10, locations: true }); const program = ast.body; // Build link @@ -61,43 +63,61 @@ process.argv.slice(2).forEach((file) => { // Scan for exports. const exported = { constructors: [], identifiers: [] }; + const indirect = {}; program.forEach((statement) => { if (statement.type === 'ExpressionStatement') { const expr = statement.expression; if (expr.type !== 'AssignmentExpression') return; let lhs = expr.left; - if (expr.left.object.type === 'MemberExpression') lhs = lhs.object; if (lhs.type !== 'MemberExpression') return; - if (lhs.object.name !== 'module') return; - if (lhs.property.name !== 'exports') return; - - let rhs = expr.right; - while (rhs.type === 'AssignmentExpression') rhs = rhs.right; - - if (rhs.type === 'NewExpression') { - exported.constructors.push(rhs.callee.name); - } else if (rhs.type === 'ObjectExpression') { - rhs.properties.forEach((property) => { - if (property.value.type === 'Identifier') { - exported.identifiers.push(property.value.name); - if (/^[A-Z]/.test(property.value.name[0])) { - exported.constructors.push(property.value.name); - } + if (lhs.object.type === 'MemberExpression') lhs = lhs.object; + if (lhs.object.name === 'exports') { + const name = lhs.property.name; + if (expr.right.type === 'FunctionExpression') { + definition[`${basename}.${name}`] = + `${link}#L${statement.loc.start.line}`; + } else if (expr.right.type === 'Identifier') { + if (expr.right.name === name) { + indirect[name] = `${basename}.${name}`; } - }); - } else if (rhs.type === 'Identifier') { - exported.identifiers.push(rhs.name); + } else { + exported.identifiers.push(name); + } + } else if (lhs.object.name === 'module') { + if (lhs.property.name !== 'exports') return; + + let rhs = expr.right; + while (rhs.type === 'AssignmentExpression') rhs = rhs.right; + + if (rhs.type === 'NewExpression') { + exported.constructors.push(rhs.callee.name); + } else if (rhs.type === 'ObjectExpression') { + rhs.properties.forEach((property) => { + if (property.value.type === 'Identifier') { + exported.identifiers.push(property.value.name); + if (/^[A-Z]/.test(property.value.name[0])) { + exported.constructors.push(property.value.name); + } + } + }); + } else if (rhs.type === 'Identifier') { + exported.identifiers.push(rhs.name); + } } } else if (statement.type === 'VariableDeclaration') { for (const decl of statement.declarations) { let init = decl.init; while (init && init.type === 'AssignmentExpression') init = init.left; if (!init || init.type !== 'MemberExpression') continue; - if (init.object.name !== 'module') continue; - if (init.property.name !== 'exports') continue; - exported.constructors.push(decl.id.name); - definition[decl.id.name] = `${link}#L${statement.loc.start.line}`; + if (init.object.name === 'exports') { + definition[`${basename}.${init.property.name}`] = + `${link}#L${statement.loc.start.line}`; + } else if (init.object.name === 'module') { + if (init.property.name !== 'exports') continue; + exported.constructors.push(decl.id.name); + definition[decl.id.name] = `${link}#L${statement.loc.start.line}`; + } } } }); @@ -107,10 +127,8 @@ process.argv.slice(2).forEach((file) => { // ClassName.foo = ...; // ClassName.prototype.foo = ...; // function Identifier(...) {...}; - // class Foo {...} + // class Foo {...}; // - const indirect = {}; - program.forEach((statement) => { if (statement.type === 'ExpressionStatement') { const expr = statement.expression; diff --git a/tools/doc/common.js b/tools/doc/common.js index 7d8aefb65d84fd..86daae6cfc6d56 100644 --- a/tools/doc/common.js +++ b/tools/doc/common.js @@ -43,4 +43,4 @@ function extractAndParseYAML(text) { return meta; } -module.exports = { isYAMLBlock, extractAndParseYAML }; +module.exports = { arrify, isYAMLBlock, extractAndParseYAML }; diff --git a/tools/doc/html.js b/tools/doc/html.js index 5babe1c97e679a..c0a94b6534b171 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -308,7 +308,9 @@ function parseYAML(text) { .use(htmlStringify) .processSync(change.description).toString(); - result += `${change.version}\n` + + const version = common.arrify(change.version).join(', '); + + result += `${version}\n` + `${description}\n`; }); @@ -326,10 +328,16 @@ function parseYAML(text) { return result; } +function minVersion(a) { + return common.arrify(a).reduce((min, e) => { + return !min || versionSort(min, e) < 0 ? e : min; + }); +} + const numberRe = /^\d*/; function versionSort(a, b) { - a = a.trim(); - b = b.trim(); + a = minVersion(a).trim(); + b = minVersion(b).trim(); let i = 0; // Common prefix length. while (i < a.length && i < b.length && a[i] === b[i]) i++; a = a.substr(i); diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 1dc9b5ca7d01f6..82addcd0b40731 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -85,9 +85,6 @@ addlicense "gtest" "deps/gtest" "$(cat ${rootdir}/deps/gtest/LICENSE)" # nghttp2 addlicense "nghttp2" "deps/nghttp2" "$(cat ${rootdir}/deps/nghttp2/COPYING)" -# remark -addlicense "remark-cli" "tools/remark-cli" "$(cat ${rootdir}/tools/remark-cli/LICENSE)" - # node-inspect addlicense "node-inspect" "deps/node-inspect" "$(cat ${rootdir}/deps/node-inspect/LICENSE)" diff --git a/tools/lint-md.js b/tools/lint-md.js new file mode 100644 index 00000000000000..9d468165261766 --- /dev/null +++ b/tools/lint-md.js @@ -0,0 +1,33799 @@ +'use strict'; + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +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')); + +var vfileStatistics = 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 + } + + function count(value) { + if (value) { + if (value[0] && value[0].messages) { + /* Multiple vfiles */ + countInAll(value); + } else { + /* One vfile / messages */ + countAll(value.messages || value); + } + } + } + + function countInAll(files) { + var length = files.length; + var index = -1; + + while (++index < length) { + count(files[index].messages); + } + } + + function countAll(messages) { + var length = messages.length; + var index = -1; + var fatal; + + while (++index < length) { + fatal = messages[index].fatal; + result[fatal === null || fatal === undefined ? null : Boolean(fatal)]++; + } + } +} + +var slice = [].slice; + +var wrap_1 = 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); + } +} + +var trough_1 = trough; + +trough.wrap = wrap_1; + +var slice$1 = [].slice; + +/* Create new middleware. */ +function trough() { + var fns = []; + var middleware = {}; + + middleware.run = run; + middleware.use = use; + + return middleware + + /* 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]; + + if (typeof done !== 'function') { + throw new Error('Expected function as last argument, not ' + done) + } + + next.apply(null, [null].concat(input)); + + /* 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 + } + + /* Copy non-nully input into values. */ + while (++pos < length) { + if (values[pos] === null || values[pos] === undefined) { + values[pos] = input[pos]; + } + } + + input = values; + + /* Next or done. */ + if (fn) { + wrap_1(fn, next).apply(null, input); + } else { + done.apply(null, [null].concat(input)); + } + } + } + + /* Add `fn` to the list. */ + function use(fn) { + if (typeof fn !== 'function') { + throw new Error('Expected `fn` to be a function, not ' + fn) + } + + fns.push(fn); + + return middleware + } +} + +function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); +} + +function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); +} + + +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); +} + + +var isNothing_1 = isNothing; +var isObject_1 = isObject; +var toArray_1 = toArray; +var repeat_1 = repeat; +var isNegativeZero_1 = isNegativeZero; +var extend_1 = extend; + +var common = { + isNothing: isNothing_1, + isObject: isObject_1, + toArray: toArray_1, + repeat: repeat_1, + isNegativeZero: isNegativeZero_1, + extend: extend_1 +}; + +// YAML error class. http://stackoverflow.com/questions/8458984 +// +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // 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 || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +var exception = YAMLException; + +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; +}; + + +var mark = Mark; + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + 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.'); + } + }); + + // 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); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +var type = Type; + +/*eslint-disable max-len*/ + + + + + + +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$$1, index) { + return exclude.indexOf(index) === -1; + }); +} + + +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 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.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new exception('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.'); + } + + 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.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +var schema = 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 : []; } +}); + +var map = new type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + +var failsafe = new schema({ + explicit: [ + str, + seq, + map + ] +}); + +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; +} + +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')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +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' +}); + +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)); +} + +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 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)); +} + +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({ + include: [ + failsafe + ], + implicit: [ + _null, + bool, + int_1, + float_1 + ] +}); + +var core = new schema({ + include: [ + json + ] +}); + +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(); +} + +var timestamp = new type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +var merge = new type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = commonjsRequire; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + + + + +// [ 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); +} + +var binary = new type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +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 : []; +} + +var omap = new type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +var _toString$1 = 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$1.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; +} + +var pairs = new type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty$1.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +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 + ] +}); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +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]; + + 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]'; +} + +var regexp = new type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + +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$1 = commonjsRequire; + esprima = _require$1('esprima'); +} catch (_) { + /*global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + + + +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]'; +} + +var _function = new type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + +var default_full = schema.DEFAULT = new schema({ + include: [ + default_safe + ], + explicit: [ + _undefined, + regexp, + _function + ] +}); + +/*eslint-disable max-len,no-use-before-define*/ + + + + + + + + +var _hasOwnProperty$2 = 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; + 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 exception( + 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$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; + } +}; + + +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$2.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$2.call(overridableKeys, keyNode) && + _hasOwnProperty$2.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$2.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$2.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$2.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 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)); + } +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: default_safe }, options)); +} + + +var loadAll_1 = loadAll; +var load_1 = load; +var safeLoadAll_1 = safeLoadAll; +var safeLoad_1 = safeLoad; + +var loader = { + loadAll: loadAll_1, + load: load_1, + safeLoadAll: safeLoadAll_1, + safeLoad: safeLoad_1 +}; + +/*eslint-disable no-use-before-define*/ + + + + + + +var _toString$2 = Object.prototype.toString; +var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; + +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 ESCAPE_SEQUENCES = {}; + +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' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty$3.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + 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 '\\' + handle + common.repeat('0', length - string.length) + string; +} + +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; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// 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; + + 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; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [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); +} + +// 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; +} + +// 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; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +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; +} + +// 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 + "'"; + } + + 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); + + // 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); + } + + 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'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // 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 ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// 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; + + // 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; + + // 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; + } + + return result; +} + +// 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; + + // 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 = ''; + + // 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; + } + + // 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); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + 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); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + 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; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + 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 += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = state.condenseFlow ? '"' : ''; + + if (index !== 0) pairBuffer += ', '; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + 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; + + // 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'); + } + + 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. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + 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'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// 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; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString$2.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + 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; + } + } + } 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 { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } 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; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + 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 (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State$1(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: default_safe }, options)); +} + +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.'); + }; +} + + +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; + +// 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 +}; + +var jsYaml$2 = jsYaml; + +var isArrayish = function isArrayish(obj) { + if (!obj) { + return false; + } + + return obj instanceof Array || Array.isArray(obj) || + (obj.length >= 0 && obj.splice instanceof Function); +}; + +var errorEx = function errorEx(name, properties) { + if (!name || name.constructor !== String) { + properties = name || {}; + name = Error.name; + } + + var errorExError = function ErrorEXError(message) { + if (!this) { + return new ErrorEXError(message); + } + + message = message instanceof Error + ? message.message + : (message || this.message); + + Error.call(this, message); + Error.captureStackTrace(this, errorExError); + + this.name = name; + + Object.defineProperty(this, 'message', { + configurable: true, + enumerable: false, + get: function () { + var newMessage = message.split(/\r?\n/g); + + for (var key in properties) { + if (!properties.hasOwnProperty(key)) { + continue; + } + + var modifier = properties[key]; + + if ('message' in modifier) { + newMessage = modifier.message(this[key], newMessage) || newMessage; + if (!isArrayish(newMessage)) { + newMessage = [newMessage]; + } + } + } + + return newMessage.join('\n'); + }, + set: function (v) { + message = v; + } + }); + + var overwrittenStack = null; + + var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack'); + var stackGetter = stackDescriptor.get; + var stackValue = stackDescriptor.value; + delete stackDescriptor.value; + delete stackDescriptor.writable; + + stackDescriptor.set = function (newstack) { + overwrittenStack = newstack; + }; + + stackDescriptor.get = function () { + var stack = (overwrittenStack || ((stackGetter) + ? stackGetter.call(this) + : stackValue)).split(/\r?\n+/g); + + // starting in Node 7, the stack builder caches the message. + // just replace it. + if (!overwrittenStack) { + stack[0] = this.name + ': ' + this.message; + } + + var lineCount = 1; + for (var key in properties) { + if (!properties.hasOwnProperty(key)) { + continue; + } + + var modifier = properties[key]; + + if ('line' in modifier) { + var line = modifier.line(this[key]); + if (line) { + stack.splice(lineCount++, 0, ' ' + line); + } + } + + if ('stack' in modifier) { + modifier.stack(this[key], stack); + } + } + + return stack.join('\n'); + }; + + Object.defineProperty(this, 'stack', stackDescriptor); + }; + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(errorExError.prototype, Error.prototype); + Object.setPrototypeOf(errorExError, Error); + } else { + util.inherits(errorExError, Error); + } + + return errorExError; +}; + +errorEx.append = function (str, def) { + return { + message: function (v, message) { + v = v || def; + + if (v) { + message[0] += ' ' + str.replace('%s', v.toString()); + } + + return message; + } + }; +}; + +errorEx.line = function (str, def) { + return { + line: function (v) { + v = v || def; + + if (v) { + return str.replace('%s', v.toString()); + } + + return null; + } + }; +}; + +var errorEx_1 = errorEx; + +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 + } +} + +var parseJson$1 = createCommonjsModule(function (module) { +const JSONError = errorEx_1('JSONError', { + fileName: errorEx_1.append('in %s') +}); + +module.exports = (input, reviver, filename) => { + if (typeof reviver === 'string') { + filename = reviver; + reviver = null; + } + + try { + try { + return JSON.parse(input, reviver); + } catch (err) { + jsonParseBetterErrors(input, reviver); + + throw err; + } + } catch (err) { + err.message = err.message.replace(/\n/g, ''); + + const jsonErr = new JSONError(err); + if (filename) { + jsonErr.fileName = filename; + } + + throw jsonErr; + } +}; +}); + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * 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 + */ + +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); + } + 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 + */ + +function parse$1(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + 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 '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; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} + +var debug = createCommonjsModule(function (module, exports) { +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = ms; + +/** + * Active `debug` instances. + */ +exports.instances = []; + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.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". + */ + +exports.formatters = {}; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms$$1 = curr - (prevTime || curr); + self.diff = ms$$1; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + 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; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; +} + +function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} +}); + +var debug_1 = debug.coerce; +var debug_2 = debug.disable; +var debug_3 = debug.enable; +var debug_4 = debug.enabled; +var debug_5 = debug.humanize; +var debug_6 = debug.instances; +var debug_7 = debug.names; +var debug_8 = debug.skips; +var debug_9 = debug.formatters; + +var browser = createCommonjsModule(function (module, exports) { +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : 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 + */ + +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') { + return true; + } + + // Internet Explorer and Edge do not support colors. + 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 + 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+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + 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 index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * 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 + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} +}); + +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; + +var hasFlag = function (flag, argv) { + argv = argv || process.argv; + + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); + + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + +var supportsColor = createCommonjsModule(function (module) { +const env = process.env; + +const support = level => { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +}; + +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; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + return 1; + } + + if (process.stdout && !process.stdout.isTTY) { + return 0; + } + + 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 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return 0; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return 0; + } + + return 0; +})(); + +if ('FORCE_COLOR' in env) { + supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : (supportLevel || 1); +} + +module.exports = process && support(supportLevel); +}); + +var node = createCommonjsModule(function (module, exports) { +/** + * Module dependencies. + */ + + + + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [ 6, 2, 3, 4, 5, 1 ]; + +try { + var supportsColor$$1 = supportsColor; + if (supportsColor$$1 && 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 (err) { + // swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +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 + var val = process.env[key]; + 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); + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(process.stderr.fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); + var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } else { + return new Date().toISOString() + ' '; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // 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; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug$$1) { + debug$$1.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug$$1.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); +}); + +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; + +var src = createCommonjsModule(function (module) { +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer') { + module.exports = browser; +} else { + module.exports = node; +} +}); + +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}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDir = fs.realpathSync(fromDir); + } catch (err) { + if (err.code === 'ENOENT') { + fromDir = path.resolve(fromDir); + } else if (silent) { + return null; + } else { + throw err; + } + } + + const fromFile = path.join(fromDir, 'noop.js'); + + const resolveFileName = () => module$1._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: module$1._nodeModulePaths(fromDir) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (err) { + return null; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); +module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); +}); + +var resolveFrom_2 = resolveFrom_1.silent; + +var ini = createCommonjsModule(function (module, exports) { +exports.parse = exports.decode = decode; + +exports.stringify = exports.encode = encode; + +exports.safe = safe; +exports.unsafe = unsafe; + +var eol = typeof process !== 'undefined' && + process.platform === 'win32' ? '\r\n' : '\n'; + +function encode (obj, opt) { + var children = []; + var out = ''; + + if (typeof opt === 'string') { + opt = { + section: opt, + whitespace: false + }; + } else { + opt = opt || {}; + opt.whitespace = opt.whitespace === true; + } + + 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; + } + }); + + if (opt.section && out.length) { + out = '[' + safe(opt.section) + ']' + eol + out; + } + + 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; + }); + + return out +} + +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 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 +} + +function isQuoted (val) { + return (val.charAt(0) === '"' && val.slice(-1) === '"') || + (val.charAt(0) === "'" && val.slice(-1) === "'") +} + +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, '\\#') +} + +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 +} +}); + +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 ''; +} + +function stripWithWhitespace(str, start, end) { + return str.slice(start, end).replace(/\S/g, ' '); +} + +var stripJsonComments = function (str, opts) { + opts = opts || {}; + + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var offset = 0; + var ret = ''; + var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + + 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; + } + } + + if (insideString) { + continue; + } + + 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; + } + } + + return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset)); +}; + +var utils = createCommonjsModule(function (module, exports) { +var parse = exports.parse = function (content) { + + //if it ends in .json or starts with { then it must be json. + //must be done this way, because ini accepts everything. + //can't just try and parse it and let it throw if it's not ini. + //everything is ini. even json with a syntax error. + + if(/^\s*{/.test(content)) + return JSON.parse(stripJsonComments(content)) + return ini.parse(content) + +}; + +var file = exports.file = function () { + var args = [].slice.call(arguments).filter(function (arg) { return arg != null }); + + //path.join breaks if it's a not a string, so just skip this. + for(var i in args) + if('string' !== typeof args[i]) + return + + var file = path.join.apply(null, args); + try { + return fs.readFileSync(file,'utf-8') + } catch (err) { + return + } +}; + +var json = exports.json = function () { + var content = file.apply(null, arguments); + return content ? parse(content) : null +}; + +var env = exports.env = function (prefix, env) { + env = env || process.env; + var obj = {}; + var l = prefix.length; + for(var k in env) { + if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) { + + var keypath = k.substring(l).split('__'); + + // Trim empty strings from keypath array + var _emptyStringIndex; + while ((_emptyStringIndex=keypath.indexOf('')) > -1) { + keypath.splice(_emptyStringIndex, 1); + } + + var cursor = obj; + keypath.forEach(function _buildSubObj(_subkey,i){ + + // (check for _subkey first so we ignore empty strings) + // (check for cursor to avoid assignment to primitive objects) + if (!_subkey || typeof cursor !== 'object') + return + + // If this is the last key, just stuff the value in there + // Assigns actual value from env variable to final key + // (unless it's just an empty string- in that case use the last valid key) + if (i === keypath.length-1) + cursor[_subkey] = env[k]; + + + // Build sub-object if nothing already exists at the keypath + if (cursor[_subkey] === undefined) + cursor[_subkey] = {}; + + // Increment cursor used to track the object at the current depth + cursor = cursor[_subkey]; + + }); + + } + + } + + return obj +}; + +var find = exports.find = function () { + var rel = path.join.apply(null, [].slice.call(arguments)); + + function find(start, rel) { + var file = path.join(start, rel); + try { + fs.statSync(file); + return file + } catch (err) { + if(path.dirname(start) !== start) // root + return find(path.dirname(start), rel) + } + } + return find(process.cwd(), rel) +}; +}); + +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; + +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. + */ + +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'); + } +} + +/** + * 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; +} + +function safeGetProperty(object, property) { + return property === '__proto__' ? undefined : object[property]; +} + +/** + * 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 (arguments.length < 2) { + return arguments[0]; + } + + var target = arguments[0]; + + // convert arguments to array and cut off target object + var args = Array.prototype.slice.call(arguments, 1); + + var val, src; + + 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; + } + + Object.keys(obj).forEach(function (key) { + src = safeGetProperty(target, key); // source value + val = safeGetProperty(obj, key); // new value + + // recursion prevention + if (val === target) { + return; + + /** + * 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; + + // just clone arrays (and recursive clone objects inside) + } else if (Array.isArray(val)) { + target[key] = deepCloneArray(val); + return; + + // custom cloning and overwrite for specific objects + } else if (isSpecificValue(val)) { + target[key] = cloneSpecificValue(val); + return; + + // 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; + + // source value and new value is objects both, extending... + } else { + target[key] = deepExtend(src, val); + return; + } + }); + }); + + return target; +}; +}); + +var minimist = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + 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; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + 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 ]; + } + } + + 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]; + + 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(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg); + continue; + } + + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } + + 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; + } + } + } + + 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]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +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 join = path.join; + +var etc = '/etc'; +var win = process.platform === "win32"; +var home = win + ? process.env.USERPROFILE + : process.env.HOME; + +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 + ) || {}; + + parse = parse || utils.parse; + + var env = utils.env(name + '_'); + + 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); + } + } + + // 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); + + return deepExtend_1.apply(null, configs.concat([ + env, + argv, + configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined, + ])) +}; + +function homedir() { + var env = process.env; + var home = env.HOME; + var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; + + if (process.platform === 'win32') { + return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); + } + + return home || null; +} + +var osHomedir = typeof os.homedir === 'function' ? os.homedir : homedir; + +var home$1 = osHomedir(); + +var untildify = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return home$1 ? str.replace(/^~($|\/|\\)/, home$1 + '$1') : str; +}; + +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; + } + }); +}; + +var npmPrefix = function () { + var rcPrefix = rc('npm', null, []).prefix; + + if (rcPrefix) { + return untildify(shellsubstitute(rcPrefix, process.env)); + } + else if (process.platform == 'win32') { + return path.dirname(process.execPath); + } + else { + return path.resolve(process.execPath, '../..'); + } +}; + +var resolve = resolveFrom_1.silent; +var npmPrefix$2 = npmPrefix(); + +var loadPlugin_1 = loadPlugin; +loadPlugin.resolve = resolvePlugin; + +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'); + +/* 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'); +} + +/* Load the plug-in found using `resolvePlugin`. */ +function loadPlugin(name, options) { + return commonjsRequire(resolvePlugin(name, options) || name) +} + +/* 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; + + if (cwd && typeof cwd === 'object') { + sources = cwd.concat(); + } else { + sources = [cwd || process.cwd()]; + } + + /* Non-path. */ + if (name.indexOf(path.sep) === -1 && name.charAt(0) !== '.') { + if (settings.global == null ? globally : settings.global) { + sources.push(globals); + } + + /* Unprefix module. */ + if (prefix) { + prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-'; + + if (name.slice(0, prefix.length) !== prefix) { + plugin = prefix + name; + } + } + } + + length = sources.length; + index = -1; + + while (++index < length) { + cwd = sources[index]; + filePath = (plugin && resolve(cwd, plugin)) || resolve(cwd, name); + + if (filePath) { + return filePath + } + } + + return null +} + +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 +// + +(function() { + + //// Export the API + var namespace; + + // CommonJS / Node module + { + namespace = module.exports = format; + } + + namespace.format = format; + namespace.vsprintf = vsprintf; + + if (typeof console !== 'undefined' && typeof console.log === 'function') { + namespace.printf = printf; + } + + function printf(/* ... */) { + console.log(format.apply(null, arguments)); + } + + function vsprintf(fmt, replacements) { + return format.apply(null, [fmt].concat(replacements)); + } + + 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; + } + +}()); +}); + +var fault = create(Error); + +var fault_1 = fault; + +fault.eval = create(EvalError); +fault.range = create(RangeError); +fault.reference = create(ReferenceError); +fault.syntax = create(SyntaxError); +fault.type = create(TypeError); +fault.uri = create(URIError); + +fault.create = create; + +/* Create a new `EConstructor`, with the formatted + * `format` as a first argument. */ +function create(EConstructor) { + FormattedError.displayName = EConstructor.displayName || EConstructor.name; + + return FormattedError + + function FormattedError(format$$1) { + if (format$$1) { + format$$1 = format.apply(null, arguments); + } + + return new EConstructor(format$$1) + } +} + +var immutable = extend$1; + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend$1() { + var target = {}; + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target +} + +var isObject$1 = function isObject(x) { + return typeof x === "object" && x !== null; +}; + +var toString = Object.prototype.toString; + +var xIsString = isString; + +function isString(obj) { + return toString.call(obj) === "[object String]" +} + +var xIsFunction = function isFunction (fn) { + return Object.prototype.toString.call(fn) === '[object Function]' +}; + +var debug$2 = src('unified-engine:find-up'); + + + +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; + + self.cache = {}; + self.cwd = options.cwd; + self.detect = options.detect; + self.names = options.names; + self.create = options.create; + + if (fp) { + self.givenFilePath = resolve$1(options.cwd, fp); + } +} + +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; + + if (givenFilePath) { + if (givenFile) { + apply(callback, givenFile); + } else { + givenFile = [callback]; + self.givenFile = givenFile; + debug$2('Checking given file `%s`', givenFilePath); + read(givenFilePath, loadGiven); + } + + return; + } + + if (!self.detect) { + return callback(); + } + + filePath = resolve$1(cwd, filePath); + parent = dirname(filePath); + + if (parent in cache) { + apply(callback, cache[parent]); + } else { + cache[parent] = [callback]; + find(parent); + } + + function loadGiven(err, buf) { + var cbs = self.givenFile; + var result; + + 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$2('Read given file `%s`', givenFilePath); + } catch (err) { + result = fault_1('Cannot parse given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); + debug$2(err.message); + } + } + + givenFile = result; + self.givenFile = result; + applyAll(cbs, result); + } + + function find(directory) { + var index = -1; + var length = names.length; + + next(); + + function next() { + var parent; + + /* 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); + + if (directory === parent) { + debug$2('No files found for `%s`', filePath); + found(); + } else if (parent in cache) { + apply(found, cache[parent]); + } else { + cache[parent] = [found]; + find(parent); + } + } + } + + function done(err, buf) { + var name = names[index]; + var fp = join$1(directory, name); + var contents; + + /* istanbul ignore if - Hard to test. */ + if (err) { + if (err.code === 'ENOENT') { + return next(); + } + + err = fault_1('Cannot read file `%s`\n%s', relative(cwd, fp), err.message); + debug$2(err.message); + return found(err); + } + + try { + contents = create(buf, fp); + } catch (err) { + return found(fault_1('Cannot parse file `%s`\n%s', relative(cwd, fp), err.message)); + } + + /* istanbul ignore else - maybe used in the future. */ + if (contents) { + debug$2('Read file `%s`', fp); + found(null, contents); + } else { + next(); + } + } + + function found(err, result) { + var cbs = cache[directory]; + cache[directory] = err || result; + applyAll(cbs, err || result); + } + } + + function applyAll(cbs, result) { + var index = cbs.length; + + while (index--) { + apply(cbs[index], result); + } + } + + 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); + } + } +} + +var configuration = createCommonjsModule(function (module) { +var debug = src('unified-engine:configuration'); +var resolve = loadPlugin_1.resolve; + + + + + + + +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, immutable(options, {root: self.cwd})); + } + } else { + merge(result, contents, null, immutable(options, {root: dirname(filePath)})); + } + + merge(result, self.given, null, immutable(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$1._cache[filePath]; + + 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; + } + + return submodule.exports; +} + +function loadYAML(buf, filePath) { + return jsYaml$2.safeLoad(buf, {filename: basename(filePath)}); +} + +function loadJSON(buf, filePath) { + var result = parseJson$1(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 (isObject$1(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 (isObject$1(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 = immutable(target.settings, result.settings); + } + + function addEach(result) { + var length = result.length; + var index = -1; + var value; + + while (++index < length) { + value = result[index]; + + if (isObject$1(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 (xIsString(usable)) { + addModule(usable, value); + } else if (xIsFunction(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 = 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); + } + + 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)); + } + } 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 && isObject$1(value)) { + value = immutable(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; + } +} +}); + +var configure_1 = configure; + +function configure(context, settings) { + context.configuration = new configuration(settings); +} + +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; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +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); + + this._rules = []; + this[KEY_IGNORE] = true; + this._initCache(); + } + + _createClass(IgnoreBase, [{ + key: '_initCache', + value: function _initCache() { + this._cache = {}; + } + + // @param {Array.|string|Ignore} pattern + + }, { + key: 'add', + value: function add(pattern) { + this._added = false; + + if (typeof pattern === 'string') { + pattern = pattern.split(/\r?\n/g); + } + + make_array(pattern).forEach(this._addPattern, this); + + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache(); + } + + return this; + } + + // legacy + + }, { + 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; + } + + 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) + + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0; + } + }, { + key: 'filter', + value: function filter(paths) { + var _this = this; + + return make_array(paths).filter(function (path$$1) { + return _this._filter(path$$1); + }); + } + }, { + key: 'createFilter', + value: function createFilter() { + var _this2 = this; + + 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; + + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true; + pattern = pattern.substr(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, '#'); + + var regex = make_regex(pattern, negative); + + return { + origin: origin, + pattern: pattern, + negative: negative, + regex: regex + }; + } + + // @returns `Boolean` true if the `path` is NOT ignored + + }, { + key: '_filter', + value: function _filter(path$$1, slices) { + if (!path$$1) { + return false; + } + + if (path$$1 in this._cache) { + return this._cache[path$$1]; + } + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path$$1.split(SLASH); + } + + slices.pop(); + + 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 + + }, { + key: '_test', + value: function _test(path$$1) { + // Explicitly define variable type by setting matched to `0` + var matched = 0; + + 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); + } + }); + + return !matched; + } + }]); + + return IgnoreBase; +}(); + +// > 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` + +// '`foo/`' should not continue with the '`..`' + + +var DEFAULT_REPLACER_PREFIX = [ + +// > Trailing spaces are ignored unless they are quoted with backslash ("\") +[ +// (a\ ) -> (a ) +// (a ) -> (a) +// (a \ ) -> (a ) +/\\?\s+$/, function (match) { + return match.indexOf('\\') === 0 ? ' ' : ''; +}], + +// replace (\ ) with ' ' +[/\\\s/g, function () { + return ' '; +}], + +// Escape metacharacters +// which is written down by users but means special for regular expressions. + +// > 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; +}], + +// leading slash +[ + +// > 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 '^'; +}], + +// 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 '\\*' +/^\^*\\\*\\\*\\\//, + +// '**/foo' <-> 'foo' +function () { + return '^(?:.*\\/)?'; +}]]; + +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 + ? '(?:^|\\/)' + + // > Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) + : '^'; +}], + +// two globstars +[ +// Use lookahead assertions so that we could match more than one `'/**'` +/\\\/\\\*\\\*(?=\\\/|$)/g, + +// Zero, one or several directories +// should not use '*', or it will be replaced by the next replacer + +// Check if it is not the last `'/**'` +function (match, index, str) { + return index + 6 < str.length + + // 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. + + // #21: everything inside but it should not include the current folder + : '\\/.+'; +}], + +// intermediate wildcards +[ +// Never replace escaped '*' +// ignore rule '\*' will match the path '*' + +// 'abc.*/' -> go +// 'abc.*' -> skip this rule +/(^|[^\\]+)\\\*(?=.+)/g, + +// '*.js' matches '.js' +// '*.js' doesn't match 'abc' +function (match, p1) { + return p1 + '[^\\/]*'; +}], + +// trailing wildcard +[/(\^|\\\/)?\\\*$/, function (match, p1) { + return (p1 + // '\^': + // '/*' does not match '' + // '/*' does not match everything + + // '\\\/': + // 'abc/*' does not match 'abc/' + ? p1 + '[^/]+' + + // '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' +/(?:[^*\/])$/, + +// '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, [ + +// #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. + +// eg: +// ['node_modules/*', '!node_modules'] +// should ignore `node_modules/a.js` +[/(?:[^*])$/, function (match) { + return match + '(?=$|\\/$)'; +}]], DEFAULT_REPLACER_SUFFIX); + +// A simple cache, because an ignore rule only has only one certain meaning +var cache = {}; + +// @param {pattern} +function make_regex(pattern, negative) { + var r = cache[pattern]; + if (r) { + return r; + } + + var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS; + + var source = replacers.reduce(function (prev, current) { + return prev.replace(current[0], current[1].bind(pattern)); + }, pattern); + + return cache[pattern] = new RegExp(source, 'i'); +} + +// 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')) { + + var filter = IgnoreBase.prototype._filter; + var make_posix = function make_posix(str) { + return (/^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/') + ); + }; + + IgnoreBase.prototype._filter = function (path$$1, slices) { + path$$1 = make_posix(path$$1); + return filter.call(this, path$$1, slices); + }; +} + +var ignore$2 = Ignore; + +Ignore.prototype.check = check; + +var dirname$1 = path.dirname; +var relative$1 = path.relative; +var resolve$2 = path.resolve; + +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$1 + }); +} + +function check(filePath, callback) { + var self = this; + + self.findUp.load(filePath, done); + + 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); + } + } +} + +function create$1(buf, filePath) { + var ignore$$1 = ignore().add(String(buf)); + ignore$$1.filePath = dirname$1(filePath); + return ignore$$1; +} + +// 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 isWindows = process.platform === 'win32'; + + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +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; + + return callback; + + 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 = 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; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +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]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // 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; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // 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; + } + + 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; + } + + // 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 = path.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = path.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +var realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = path.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // 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; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // 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); + } + } + + // 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); + } + + // 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)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + 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); + } + + // 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); + + 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 resolvedLink = path.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = path.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; + +var old = { + realpathSync: realpathSync, + realpath: realpath +}; + +var fs_realpath = realpath$1; +realpath$1.realpath = realpath$1; +realpath$1.sync = realpathSync$1; +realpath$1.realpathSync = realpathSync$1; +realpath$1.monkeypatch = monkeypatch; +realpath$1.unmonkeypatch = unmonkeypatch; + + +var origRealpath = fs.realpath; +var origRealpathSync = fs.realpathSync; + +var version = process.version; +var ok = /^v[0-5]\./.test(version); + + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath$1 (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + 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); + } + }); +} + +function realpathSync$1 (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath$1; + fs.realpathSync = realpathSync$1; +} + +function unmonkeypatch () { + fs.realpath = origRealpath; + fs.realpathSync = origRealpathSync; +} + +var concatMap = 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; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +var balancedMatch = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + 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) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +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; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + 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; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + +var braceExpansion = expandTop; + +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'; + +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('.'); +} + + +// 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 = balancedMatch('{', '}', 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); + } + + parts.push.apply(parts, p); + + return parts; +} + +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 embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balancedMatch('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + 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 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; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // 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) + : ['']; + + var N; + + 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); + + N = []; + + 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) }); + } + + 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); + } + } + + return expansions; +} + +var minimatch_1 = minimatch; +minimatch.Minimatch = Minimatch; + +var path$2 = { sep: '/' }; +try { + path$2 = path; +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +}; + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]'; + +// * => any number of characters +var star = qmark + '*?'; + +// ** 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})($|\\\/)).)*?'; + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'; + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!'); + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true; + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/; + +minimatch.filter = filter$1; +function filter$1 (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 +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch; + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + }; + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + }; + + return m +}; + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +}; + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {}; + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {}; + pattern = pattern.trim(); + + // windows support: need to use /, not \ + if (path$2.sep !== '/') { + pattern = pattern.split(path$2.sep).join('/'); + } + + 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(); +} + +Minimatch.prototype.debug = function () {}; + +Minimatch.prototype.make = make; +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern; + var options = this.options; + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true; + return + } + if (!pattern) { + this.empty = true; + return + } + + // step 1: figure out negation, etc. + this.parseNegate(); + + // step 2: expand braces + var set = this.globSet = this.braceExpand(); + + if (options.debug) this.debug = console.error; + + this.debug(this.pattern, set); + + // 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) + }); + + this.debug(this.pattern, set); + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this); + + this.debug(this.pattern, set); + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }); + + this.debug(this.pattern, set); + + this.set = set; +} + +Minimatch.prototype.parseNegate = parseNegate; +function parseNegate () { + var pattern = this.pattern; + var negate = false; + var options = this.options; + var negateOffset = 0; + + 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; +} + +// 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 braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options; + } else { + options = {}; + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern; + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return braceExpansion(pattern) +} + +// 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') + } + + var options = this.options; + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') 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; + + 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; + } + } + + 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); + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c; + escaping = false; + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar(); + escaping = true; + continue + + // 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); + + // 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 + } + + // 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 + } + + if (!stateChar) { + re += '\\('; + continue + } + + 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 + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)'; + continue + } + + 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 + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|'; + escaping = false; + continue + } + + clearStateChar(); + re += '|'; + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar(); + + if (inClass) { + re += '\\' + c; + continue + } + + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue + + 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 + } + + // 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 { + + } 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 + } + } + + // finish up the class. + hasMagic = true; + inClass = false; + re += c; + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar(); + + if (escaping) { + // no need + escaping = false; + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\'; + } + + re += c; + + } // 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 = '\\'; + } + + // 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 + '|' + }); + + this.debug('tail=%j\n %s', tail, tail, pl, re); + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type; + + hasMagic = true; + re = re.slice(0, pl.reStart) + t + '\\(' + tail; + } + + // handle trailing things that only matter at the very end. + clearStateChar(); + if (escaping) { + // trailing \\ + re += '\\\\'; + } + + // 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; + } + + // 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; + + // 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; + + var dollar = ''; + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$'; + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } + + // 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; + } + + if (addPatternStart) { + re = patternStart + re; + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // 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; + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +}; + +Minimatch.prototype.makeRe = makeRe; +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // 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 options = this.options; + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot; + var flags = options.nocase ? 'i' : ''; + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|'); + + // 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 +} + +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 === '' + + if (f === '/' && partial) return true + + var options = this.options; + + // windows: need to use /, not \ + if (path$2.sep !== '/') { + f = f.split(path$2.sep).join('/'); + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit); + this.debug(this.pattern, 'split', f); + + // 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. + + var set = this.set; + this.debug(this.pattern, 'set', set); + + // 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 + } + + 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 + } + } + + // 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; + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }); + + this.debug('matchOne', file.length, pattern.length); + + 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]; + + this.debug(pattern, p, f); + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]); + + // "**" + // 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 + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr]; + + 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 { + // 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++; + } + } + + // 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 + } + + // 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); + } + + if (!hit) return 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/* + + // 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 + } + + // should be unreachable. + throw new Error('wtf?') +}; + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +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 + } + }); + }; +} 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) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +var pathIsAbsolute = process.platform === 'win32' ? win32 : posix; +var posix_1 = posix; +var win32_1 = win32; + +pathIsAbsolute.posix = posix_1; +pathIsAbsolute.win32 = win32_1; + +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; + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + + + + +var Minimatch$1 = minimatch_1.Minimatch; + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +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); + } +} + +// 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 }); + } + + return { + matcher: new Minimatch$1(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +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; + } + + 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 = pathIsAbsolute(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$1(pattern, options); + self.options = self.minimatch.options; +} + +function finish (self) { + var nou = self.nounique; + var all = nou ? [] : Object.create(null); + + 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; + }); + } + } + + 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 + }); + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }); + + self.found = all; +} + +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) === '/'; + + if (isDir && !slash) + m += '/'; + else if (!isDir && slash) + m = m.slice(0, -1); + + if (m !== p) { + var mabs = makeAbs(self, m); + self.statCache[mabs] = self.statCache[abs]; + self.cache[mabs] = self.cache[abs]; + } + } + + return m +} + +// 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); + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/'); + + return abs +} + + +// 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 + + return self.ignore.some(function(item) { + return item.matcher.match(path$$1) || !!(item.gmatcher && item.gmatcher.match(path$$1)) + }) +} + +function childrenIgnored (self, path$$1) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path$$1)) + }) +} + +var common$3 = { + 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 +}; + +var sync = globSync; +globSync.GlobSync = GlobSync; + + + + +var setopts$1 = common$3.setopts; +var ownProp$1 = common$3.ownProp; +var childrenIgnored$1 = common$3.childrenIgnored; +var isIgnored$1 = common$3.isIgnored; + +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') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + 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') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts$1(this, pattern, options); + + if (this.noprocess) + return this + + 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(); +} + +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$3.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; + while (typeof pattern[n] === 'string') { + n ++; + } + // now n is the index of the first one that is *not* a string. + + // 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 + + 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 + } + + 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 abs = this._makeAbs(read); + + //if ignored, skip processing + if (childrenIgnored$1(this, read)) + return + + 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); +}; + + +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 + + // 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 { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + + 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. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null); + + 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 (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 + } + + // 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); + } +}; + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored$1(this, e)) + return + + var abs = this._makeAbs(e); + + if (this.mark) + e = this._mark(e); + + 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 + } + + this.matches[index][e] = true; + + if (this.stat) + this._stat(e); +}; + + +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) + + var entries; + var lstat; + try { + lstat = fs.lstatSync(abs); + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + 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()) + this.cache[abs] = 'FILE'; + else + entries = this._readdir(abs, false); + + return entries +}; + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + if (inGlobStar && !ownProp$1(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp$1(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er); + return null + } +}; + +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; + } + } + + this.cache[abs] = entries; + + // 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'; + 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 + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false; + break + + 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 + } +}; + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + 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 + + // 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); + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false); + + 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 + + for (var i = 0; i < len; 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); + + var below = gspref.concat(entries[i], remain); + this._process(below, index, true); + } +}; + +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); + + if (!this.matches[index]) + this.matches[index] = Object.create(null); + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + 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 += '/'; + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/'); + + // Mark this as a match + this._emitMatch(index, prefix); +}; + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === '/'; + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp$1(this.cache, abs)) { + var c = this.cache[abs]; + + if (Array.isArray(c)) + c = 'DIR'; + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + 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) { + var lstat; + try { + lstat = fs.lstatSync(abs); + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false; + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs); + } catch (er) { + stat = lstat; + } + } else { + stat = lstat; + } + } + + 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$3.mark(this, p) +}; + +GlobSync.prototype._makeAbs = function (f) { + return common$3.makeAbs(this, f) +}; + +// 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) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k]; + }); + + return wrapper + + 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 once_1 = wrappy_1(once); +var strict = wrappy_1(onceStrict); + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }); + + 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 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 +} + +once_1.strict = strict; + +var reqs = Object.create(null); + + +var inflight_1 = wrappy_1(inflight); + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb); + return null + } else { + reqs[key] = [cb]; + return makeres(key) + } +} + +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]; + } + } + }) +} + +function slice$2 (args) { + var length = args.length; + var array = []; + + for (var i = 0; i < length; i++) array[i] = args[i]; + return array +} + +// 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 glob_1 = glob; + + + + +var EE = events.EventEmitter; + + + + + +var setopts$2 = common$3.setopts; +var ownProp$2 = common$3.ownProp; + + +var childrenIgnored$2 = common$3.childrenIgnored; +var isIgnored$2 = common$3.isIgnored; + + + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {}; + if (!options) options = {}; + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return sync(pattern, options) + } + + return new Glob$1(pattern, options, cb) +} + +glob.sync = sync; +var GlobSync$1 = glob.GlobSync = sync.GlobSync; + +// old api surface +glob.glob = glob; + +function extend$2 (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend$2({}, options_); + options.noprocess = true; + + var g = new Glob$1(pattern, options); + var set = g.minimatch.set; + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +}; + +glob.Glob = Glob$1; +inherits(Glob$1, EE); +function Glob$1 (pattern, options, cb) { + if (typeof options === 'function') { + cb = options; + options = null; + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync$1(pattern, options) + } + + 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; + + // 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_1(cb); + this.on('error', cb); + this.on('end', function (matches) { + cb(null, matches); + }); + } + + 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$$1 = true; + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done); + } + sync$$1 = false; + + function done () { + --self._processing; + if (self._processing <= 0) { + if (sync$$1) { + process.nextTick(function () { + self._finish(); + }); + } else { + self._finish(); + } + } + } +} + +Glob$1.prototype._finish = function () { + assert(this instanceof Glob$1); + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common$3.finish(this); + this.emit('end', this.found); +}; + +Glob$1.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true; + + var n = this.matches.length; + if (n === 0) + return this._finish() + + var self = this; + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next); + + function next () { + if (--n === 0) + self._finish(); + } +}; + +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; + + 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 + + if (--n === 0) { + self.matches[index] = set; + cb(); + } + }); + }); +}; + +Glob$1.prototype._mark = function (p) { + return common$3.mark(this, p) +}; + +Glob$1.prototype._makeAbs = function (f) { + return common$3.makeAbs(this, f) +}; + +Glob$1.prototype.abort = function () { + this.aborted = true; + this.emit('abort'); +}; + +Glob$1.prototype.pause = function () { + if (!this.paused) { + this.paused = true; + this.emit('pause'); + } +}; + +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]); + } + } + } +}; + +Glob$1.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob$1); + assert(typeof cb === 'function'); + + if (this.aborted) + return + + this._processing++; + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]); + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // 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. + + // 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 + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + 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('/'); + break + } + + 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 abs = this._makeAbs(read); + + //if ignored, skip _processing + if (childrenIgnored$2(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch_1.GLOBSTAR; + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb); + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb); +}; + +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) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // 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 { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + 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. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null); + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i]; + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e; + else + e = prefix + e; + } + + 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() + } + + // 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]; + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e; + else + e = prefix + e; + } + this._process([e].concat(remain), index, inGlobStar, cb); + } + 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]); + return + } + + var abs = pathIsAbsolute(e) ? e : this._makeAbs(e); + + if (this.mark) + e = this._mark(e); + + 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 + } + + this.matches[index][e] = true; + + var st = this.statCache[abs]; + if (st) + this.emit('stat', e, st); + + this.emit('match', e); +}; + +Glob$1.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // 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); + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink(); + self.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); + } +}; + +Glob$1.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight_1('readdir\0'+abs+'\0'+inGlobStar, cb); + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp$2(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp$2(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, 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); + } +} + +Glob$1.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // 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; + } + } + + this.cache[abs] = entries; + return cb(null, entries) +}; + +Glob$1.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // 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 + + 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() +}; + +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); + }); +}; + + +Glob$1.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() + + // 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); + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb); + + var isSym = this.symlinks[abs]; + var len = entries.length; + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; 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 below = gspref.concat(entries[i], remain); + this._process(below, index, true, cb); + } + + cb(); +}; + +Glob$1.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$1.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null); + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + 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 += '/'; + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/'); + + // Mark this as a match + this._emitMatch(index, prefix); + cb(); +}; + +// Returns either 'DIR', 'FILE', or false +Glob$1.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === '/'; + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp$2(this.cache, abs)) { + var c = this.cache[abs]; + + if (Array.isArray(c)) + c = 'DIR'; + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // 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 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); + }) + } else { + self._stat2(f, abs, er, lstat, cb); + } + } +}; + +Glob$1.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false; + return cb() + } + + var needDir = f.slice(-1) === '/'; + this.statCache[abs] = stat; + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true; + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE'; + this.cache[abs] = this.cache[abs] || c; + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +}; + +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// 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) +}; + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// 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)) +} + +var own = {}.hasOwnProperty; + +var unistUtilStringifyPosition = stringify; + +function stringify(value) { + /* Nothing. */ + if (!value || typeof value !== 'object') { + return null + } + + /* 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) + } + + /* Point. */ + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) + } + + /* ? */ + return null +} + +function point(point) { + if (!point || typeof point !== 'object') { + point = {}; + } + + return index(point.line) + ':' + index(point.column) +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {}; + } + + return point(pos.start) + '-' + point(pos.end) +} + +function index(value) { + return value && typeof value === 'number' ? value : 1 +} + +var vfileMessage = VMessage; + +/* Inherit from `Error#`. */ +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype; +VMessage.prototype = new VMessagePrototype(); + +/* Message properties. */ +var proto = VMessage.prototype; + +proto.file = ''; +proto.name = ''; +proto.reason = ''; +proto.message = ''; +proto.stack = ''; +proto.fatal = null; +proto.column = null; +proto.line = null; + +/* 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 (typeof position === 'string') { + origin = position; + position = null; + } + + parts = parseOrigin(origin); + range = unistUtilStringifyPosition(position) || '1:1'; + + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + }; + + /* Node. */ + if (position && position.position) { + position = position.position; + } + + if (position) { + /* Position. */ + if (position.start) { + location = position; + position = position.start; + } else { + /* Point. */ + location.start = position; + } + } + + if (reason.stack) { + this.stack = reason.stack; + reason = reason.message; + } + + 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]; +} + +function parseOrigin(origin) { + var result = [null, null]; + var index; + + if (typeof origin === 'string') { + index = origin.indexOf(':'); + + if (index === -1) { + result[1] = origin; + } else { + result[0] = origin.slice(0, index); + result[1] = origin.slice(index + 1); + } + } + + return result +} + +function replaceExt(npath, ext) { + if (typeof npath !== 'string') { + return npath; + } + + if (npath.length === 0) { + return npath; + } + + var nFileName = path.basename(npath, path.extname(npath)) + ext; + return path.join(path.dirname(npath), nFileName); +} + +var replaceExt_1 = replaceExt; + +var core$2 = VFile; + +var own$1 = {}.hasOwnProperty; +var proto$1 = VFile.prototype; + +proto$1.toString = toString$1; + +/* 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' +]; + +/* Construct a new file. */ +function VFile(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)) { + return new VFile(options); + } + + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = process.cwd(); + + /* Set path related properties in the correct order. */ + index = -1; + length = order.length; + + while (++index < length) { + prop = order[index]; + + if (own$1.call(options, prop)) { + this[prop] = options[prop]; + } + } + + /* Set non-path related properties. */ + for (prop in options) { + if (order.indexOf(prop) === -1) { + this[prop] = options[prop]; + } + } +} + +/* Access full path (`~/index.min.js`). */ +Object.defineProperty(proto$1, 'path', { + get: function () { + return this.history[this.history.length - 1]; + }, + set: function (path$$1) { + assertNonEmpty(path$$1, 'path'); + + if (path$$1 !== this.path) { + this.history.push(path$$1); + } + } +}); + +/* Access parent path (`~`). */ +Object.defineProperty(proto$1, '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); + } +}); + +/* Access basename (`index.min.js`). */ +Object.defineProperty(proto$1, '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); + } +}); + +/* Access extname (`.js`). */ +Object.defineProperty(proto$1, 'extname', { + get: function () { + return typeof this.path === 'string' ? path.extname(this.path) : undefined; + }, + set: function (extname) { + var ext = extname || ''; + + assertPart(ext, 'extname'); + assertPath(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$1, '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 || '')); + } +}); + +/* Get the value of the file. */ +function toString$1(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(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(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); +} + +var toVfile = fs_1; + +/* Expose. */ +var isHidden = hidden; + +/* Check if `filename` is hidden (starts with a dot). */ +function hidden(filename) { + if (typeof filename !== 'string') { + throw new Error('Expected string'); + } + + 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; + +/* Search `patterns`, a mix of globs, paths, and files. */ +function find(input, options, callback) { + expand$2(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}); + } + } +} + +/* 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; + + input.forEach(each); + + if (!expected) { + search(paths, options, done); + } + + 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); + } + } + + function one(err, files) { + /* istanbul ignore if - glob errors are unusual. */ + if (failed) { + return; + } + + /* istanbul ignore if - glob errors are unusual. */ + if (err) { + failed = true; + done(err); + } else { + actual++; + paths = paths.concat(files); + + if (actual === expected) { + search(paths, options, done); + } + } + } + + function done(err, files) { + /* istanbul ignore if - `search` currently does not give errors. */ + if (err) { + next(err); + } else { + next(null, {input: paths, output: files}); + } + } +} + +/* 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; + + function each(file) { + var part = base(file); + + if (nested && (isHidden(part) || part === 'node_modules')) { + return; + } + + expected++; + + statAndIgnore(file, options, handle); + + function handle(err, result) { + var ignored = result && result.ignored; + var dir = result && result.stats && result.stats.isDirectory(); + + if (ignored && (nested || silent)) { + return one(null, []); + } + + if (!ignored && dir) { + return readdir(resolve$3(cwd, filePath(file)), directory); + } + + if (nested && !dir && extensions.length !== 0 && extensions.indexOf(extname(file)) === -1) { + return one(null, []); + } + + file = toVfile(file); + file.cwd = cwd; + + if (ignored) { + try { + file.fail('Cannot process specified file: it’s ignored'); + } catch (err) {} + } + + if (err && err.code === 'ENOENT') { + try { + file.fail(err.syscall === 'stat' ? 'No such file or directory' : err); + } catch (err) {} + } + + one(null, [file]); + } + + function directory(err, basenames) { + var file; + + /* 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; + + try { + file.fail('Cannot read directory'); + } catch (err) {} + + one(null, [file]); + } else { + search(basenames.map(concat), immutable(options, {nested: true}), one); + } + } + + /* Error is never given. Always given `results`. */ + function one(_, results) { + /* istanbul ignore else - always given. */ + if (results) { + files = files.concat(results); + } + + actual++; + + if (actual === expected) { + next(null, files); + } + } + + function concat(value) { + return join$2(filePath(file), value); + } + } +} + +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; + + if (!file.contents) { + expected++; + stat(fp, handleStat); + } + + ignore.check(fp, handleIgnore); + + function handleStat(err, value) { + stats = value; + one(err); + } + + function handleIgnore(err, value) { + ignored = value; + one(err); + } + + function one(err) { + actual++; + + if (err) { + callback(err); + actual = -1; + } else if (actual === expected) { + callback(null, {stats: stats, ignored: ignored}); + } + } +} + +function base(file) { + return xIsString(file) ? basename(file) : file.basename; +} + +function filePath(file) { + return xIsString(file) ? file : file.path; +} + +function oneFileMode(result) { + return result.output.length === 1 && + result.input.length === 1 && + result.output[0].path === result.input[0]; +} + +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 + }); + + if (input.length === 0) { + return next(); + } + + finder(input, { + cwd: settings.cwd, + extensions: settings.extensions, + silentlyIgnore: skip, + ignore: ignore + }, found); + + function found(err, result) { + var output = result.files; + + /* 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; + }); + + /* Mark as given. This allows outputting files, + * which can be pretty dangerous, so it’s “hidden”. */ + output.forEach(function (file) { + file.data.unifiedEngineGiven = true; + }); + + 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); + } +} + +var toString$2 = 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' +} + +function fromArrayBuffer (obj, byteOffset, length) { + byteOffset >>>= 0; + + var maxLength = obj.byteLength - byteOffset; + + if (maxLength < 0) { + throw new RangeError("'offset' is out of bounds") + } + + if (length === undefined) { + length = maxLength; + } else { + length >>>= 0; + + if (length > maxLength) { + throw new RangeError("'length' is out of bounds") + } + } + + return isModern + ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) + : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + return isModern + ? Buffer.from(string, encoding) + : new Buffer(string, encoding) +} + +function bufferFrom (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (isArrayBuffer(value)) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + return isModern + ? Buffer.from(value) + : new Buffer(value) +} + +var bufferFrom_1 = bufferFrom; + +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 +// create, and consume so much memory, that the browser appears frozen. +var MAX_ARRAY_LENGTH = 1e5; + +// Approximations of internal ECMAScript conversion functions +var ECMAScript = (function() { + // Stash a copy in case other scripts modify these + var opts = Object.prototype.toString, + ophop = Object.prototype.hasOwnProperty; + + return { + // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: + Class: function(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); }, + HasProperty: function(o, p) { return p in o; }, + HasOwnProperty: function(o, p) { return ophop.call(o, p); }, + IsCallable: function(o) { return typeof o === 'function'; }, + ToInt32: function(v) { return v >> 0; }, + ToUint32: function(v) { return v >>> 0; } + }; +}()); + +// Snapshot intrinsics +var LN2 = Math.LN2, + abs = Math.abs, + floor = Math.floor, + log = Math.log, + min = Math.min, + pow = Math.pow, + round = Math.round; + +// ES5: lock down object properties +function configureProperties(obj) { + if (getOwnPropNames && defineProp) { + var props = getOwnPropNames(obj), i; + for (i = 0; i < props.length; i += 1) { + defineProp(obj, props[i], { + value: obj[props[i]], + writable: false, + enumerable: false, + configurable: false + }); + } + } +} + +// emulate ES5 getter/setter API using legacy APIs +// 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; +if (Object.defineProperty && (function() { + try { + Object.defineProperty({}, 'x', {}); + return true; + } catch (e) { + return false; + } + })()) { + defineProp = Object.defineProperty; +} else { + defineProp = function(o, p, desc) { + if (!o === Object(o)) throw new TypeError("Object.defineProperty called on non-object"); + if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); } + if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); } + if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; } + return o; + }; +} + +var getOwnPropNames = Object.getOwnPropertyNames || function (o) { + if (o !== Object(o)) throw new TypeError("Object.getOwnPropertyNames called on non-object"); + var props = [], p; + for (p in o) { + if (ECMAScript.HasOwnProperty(o, p)) { + props.push(p); + } + } + return props; +}; + +// ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) +// for index in 0 ... obj.length +function makeArrayAccessors(obj) { + if (!defineProp) { return; } + + if (obj.length > MAX_ARRAY_LENGTH) throw new RangeError("Array too large for polyfill"); + + function makeArrayAccessor(index) { + defineProp(obj, index, { + 'get': function() { return obj._getter(index); }, + 'set': function(v) { obj._setter(index, v); }, + enumerable: true, + configurable: false + }); + } + + var i; + for (i = 0; i < obj.length; i += 1) { + makeArrayAccessor(i); + } +} + +// Internal conversion functions: +// pack() - take a number (interpreted as Type), output a byte array +// unpack() - take a byte array, output a Type-like number + +function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } +function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } + +function packI8(n) { return [n & 0xff]; } +function unpackI8(bytes) { return as_signed(bytes[0], 8); } + +function packU8(n) { return [n & 0xff]; } +function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } + +function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } + +function packI16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackI16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); } + +function packU16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackU16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); } + +function packI32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackI32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packU32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackU32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packIEEE754(v, ebits, fbits) { + + var bias = (1 << (ebits - 1)) - 1, + s, e, f, ln, + i, bits, str, bytes; + + function roundToEven(n) { + var w = floor(n), f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + + // Compute sign, exponent, fraction + if (v !== v) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } else { + // Normalized + e = e + bias; + f = f - pow(2, fbits); + } + } else { + // Denormalized + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + bits = []; + for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } + for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + + // Bits to bytes + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; +} + +function unpackIEEE754(bytes, ebits, fbits) { + + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + // Normalized + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + // Denormalized + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } +} + +function unpackF64(b) { return unpackIEEE754(b, 11, 52); } +function packF64(v) { return packIEEE754(v, 11, 52); } +function unpackF32(b) { return unpackIEEE754(b, 8, 23); } +function packF32(v) { return packIEEE754(v, 8, 23); } + + +// +// 3 The ArrayBuffer Type +// + +(function() { + + /** @constructor */ + var ArrayBuffer = function ArrayBuffer(length) { + length = ECMAScript.ToInt32(length); + if (length < 0) throw new RangeError('ArrayBuffer size is not a small enough positive integer'); + + this.byteLength = length; + this._bytes = []; + this._bytes.length = length; + + var i; + for (i = 0; i < this.byteLength; i += 1) { + this._bytes[i] = 0; + } + + configureProperties(this); + }; + + exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; + + // + // 4 The ArrayBufferView Type + // + + // NOTE: this constructor is not exported + /** @constructor */ + var ArrayBufferView = function ArrayBufferView() { + //this.buffer = null; + //this.byteOffset = 0; + //this.byteLength = 0; + }; + + // + // 5 The Typed Array View Types + // + + function makeConstructor(bytesPerElement, pack, unpack) { + // Each TypedArray type requires a distinct constructor instance with + // identical logic, which this produces. + + var ctor; + ctor = function(buffer, byteOffset, length) { + var array, sequence, i, s; + + if (!arguments.length || typeof arguments[0] === 'number') { + // Constructor(unsigned long length) + this.length = ECMAScript.ToInt32(arguments[0]); + if (length < 0) throw new RangeError('ArrayBufferView size is not a small enough positive integer'); + + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) { + // Constructor(TypedArray array) + array = arguments[0]; + + this.length = array.length; + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + this._setter(i, array._getter(i)); + } + } else if (typeof arguments[0] === 'object' && + !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(sequence array) + sequence = arguments[0]; + + this.length = ECMAScript.ToUint32(sequence.length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + s = sequence[i]; + this._setter(i, Number(s)); + } + } else if (typeof arguments[0] === 'object' && + (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, optional unsigned long length) + this.buffer = buffer; + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (this.byteOffset % this.BYTES_PER_ELEMENT) { + // The given byteOffset must be a multiple of the element + // size of the specific type, otherwise an exception is raised. + throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size."); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + + if (this.byteLength % this.BYTES_PER_ELEMENT) { + throw new RangeError("length of buffer minus byteOffset not a multiple of the element size"); + } + this.length = this.byteLength / this.BYTES_PER_ELEMENT; + } else { + this.length = ECMAScript.ToUint32(length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + + this.constructor = ctor; + + configureProperties(this); + makeArrayAccessors(this); + }; + + ctor.prototype = new ArrayBufferView(); + ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement; + ctor.prototype._pack = pack; + ctor.prototype._unpack = unpack; + ctor.BYTES_PER_ELEMENT = bytesPerElement; + + // getter type (unsigned long index); + ctor.prototype._getter = function(index) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = [], i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + bytes.push(this.buffer._bytes[o]); + } + return this._unpack(bytes); + }; + + // NONSTANDARD: convenience alias for getter: type get(unsigned long index); + ctor.prototype.get = ctor.prototype._getter; + + // setter void (unsigned long index, type value); + ctor.prototype._setter = function(index, value) { + if (arguments.length < 2) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = this._pack(value), i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + this.buffer._bytes[o] = bytes[i]; + } + }; + + // void set(TypedArray array, optional unsigned long offset); + // void set(sequence array, optional unsigned long offset); + ctor.prototype.set = function(index, value) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + var array, sequence, offset, len, + i, s, d, + byteOffset, byteLength, tmp; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { + // void set(TypedArray array, optional unsigned long offset); + array = arguments[0]; + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + array.length > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; + byteLength = array.length * this.BYTES_PER_ELEMENT; + + if (array.buffer === this.buffer) { + tmp = []; + for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { + tmp[i] = array.buffer._bytes[s]; + } + for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { + this.buffer._bytes[d] = tmp[i]; + } + } else { + for (i = 0, s = array.byteOffset, d = byteOffset; + i < byteLength; i += 1, s += 1, d += 1) { + this.buffer._bytes[d] = array.buffer._bytes[s]; + } + } + } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { + // void set(sequence array, optional unsigned long offset); + sequence = arguments[0]; + len = ECMAScript.ToUint32(sequence.length); + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + len > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + for (i = 0; i < len; i += 1) { + s = sequence[i]; + this._setter(offset + i, Number(s)); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + }; + + // TypedArray subarray(long begin, optional long end); + ctor.prototype.subarray = function(start, end) { + function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } + + start = ECMAScript.ToInt32(start); + end = ECMAScript.ToInt32(end); + + if (arguments.length < 1) { start = 0; } + if (arguments.length < 2) { end = this.length; } + + if (start < 0) { start = this.length + start; } + if (end < 0) { end = this.length + end; } + + start = clamp(start, 0, this.length); + end = clamp(end, 0, this.length); + + var len = end - start; + if (len < 0) { + len = 0; + } + + return new this.constructor( + this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); + }; + + return ctor; + } + + var Int8Array = makeConstructor(1, packI8, unpackI8); + var Uint8Array = makeConstructor(1, packU8, unpackU8); + var Uint8ClampedArray = makeConstructor(1, packU8Clamped, unpackU8); + var Int16Array = makeConstructor(2, packI16, unpackI16); + var Uint16Array = makeConstructor(2, packU16, unpackU16); + var Int32Array = makeConstructor(4, packI32, unpackI32); + var Uint32Array = makeConstructor(4, packU32, unpackU32); + var Float32Array = makeConstructor(4, packF32, unpackF32); + var Float64Array = makeConstructor(8, packF64, unpackF64); + + exports.Int8Array = exports.Int8Array || Int8Array; + exports.Uint8Array = exports.Uint8Array || Uint8Array; + exports.Uint8ClampedArray = exports.Uint8ClampedArray || Uint8ClampedArray; + exports.Int16Array = exports.Int16Array || Int16Array; + exports.Uint16Array = exports.Uint16Array || Uint16Array; + exports.Int32Array = exports.Int32Array || Int32Array; + exports.Uint32Array = exports.Uint32Array || Uint32Array; + exports.Float32Array = exports.Float32Array || Float32Array; + exports.Float64Array = exports.Float64Array || Float64Array; +}()); + +// +// 6 The DataView View Type +// + +(function() { + function r(array, index) { + return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index]; + } + + var IS_BIG_ENDIAN = (function() { + var u16array = new(exports.Uint16Array)([0x1234]), + u8array = new(exports.Uint8Array)(u16array.buffer); + return r(u8array, 0) === 0x12; + }()); + + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, + // optional unsigned long byteLength) + /** @constructor */ + var DataView = function DataView(buffer, byteOffset, byteLength) { + if (arguments.length === 0) { + buffer = new exports.ArrayBuffer(0); + } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) { + throw new TypeError("TypeError"); + } + + this.buffer = buffer || new exports.ArrayBuffer(0); + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + } else { + this.byteLength = ECMAScript.ToUint32(byteLength); + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + + configureProperties(this); + }; + + function makeGetter(arrayType) { + return function(byteOffset, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + byteOffset += this.byteOffset; + + var uint8Array = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), + bytes = [], i; + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(uint8Array, i)); + } + + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + return r(new arrayType(new exports.Uint8Array(bytes).buffer), 0); + }; + } + + DataView.prototype.getUint8 = makeGetter(exports.Uint8Array); + DataView.prototype.getInt8 = makeGetter(exports.Int8Array); + DataView.prototype.getUint16 = makeGetter(exports.Uint16Array); + DataView.prototype.getInt16 = makeGetter(exports.Int16Array); + DataView.prototype.getUint32 = makeGetter(exports.Uint32Array); + DataView.prototype.getInt32 = makeGetter(exports.Int32Array); + DataView.prototype.getFloat32 = makeGetter(exports.Float32Array); + DataView.prototype.getFloat64 = makeGetter(exports.Float64Array); + + function makeSetter(arrayType) { + return function(byteOffset, value, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + + // Get bytes + var typeArray = new arrayType([value]), + byteArray = new exports.Uint8Array(typeArray.buffer), + bytes = [], i, byteView; + + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(byteArray, i)); + } + + // Flip if necessary + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + // Write them + byteView = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); + byteView.set(bytes); + }; + } + + DataView.prototype.setUint8 = makeSetter(exports.Uint8Array); + DataView.prototype.setInt8 = makeSetter(exports.Int8Array); + DataView.prototype.setUint16 = makeSetter(exports.Uint16Array); + DataView.prototype.setInt16 = makeSetter(exports.Int16Array); + DataView.prototype.setUint32 = makeSetter(exports.Uint32Array); + DataView.prototype.setInt32 = makeSetter(exports.Int32Array); + DataView.prototype.setFloat32 = makeSetter(exports.Float32Array); + DataView.prototype.setFloat64 = makeSetter(exports.Float64Array); + + 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; + + + +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 +} + +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$3 = 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$3('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$3('Cannot read from `tty` stream'); + next(new Error('No input')); + + return; + } + + debug$3('Reading from `streamIn`'); + + streamIn.pipe(concatStream({encoding: 'string'}, read)); + + function read(value) { + var file = toVfile(settings.filePath || undefined); + + debug$3('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(); + } +} + +var inherits$3 = util.inherits; + + + + +var fileSet = FileSet; + +/* FileSet constructor. */ +function FileSet() { + var self = this; + + self.files = []; + self.origins = []; + + self.expected = 0; + self.actual = 0; + + self.pipeline = trough_1(); + self.plugins = []; + + events.init.call(self); + + self.on('one', one.bind(self)); +} + +/* Events. */ +inherits$3(FileSet, events.EventEmitter); + +/* Expose methods. */ +FileSet.prototype.valueOf = valueOf; +FileSet.prototype.use = use; +FileSet.prototype.add = add; + +/* Create an array representation of `fileSet`. */ +function valueOf() { + return this.files; +} + +/* Attach middleware to the pipeline on `fileSet`. */ +function use(plugin) { + var self = this; + var pipeline = self.pipeline; + var duplicate = false; + + if (plugin && plugin.pluginId) { + duplicate = self.plugins.some(function (fn) { + return fn.pluginId === plugin.pluginId; + }); + } + + if (!duplicate && self.plugins.indexOf(plugin) !== -1) { + duplicate = true; + } + + if (!duplicate) { + self.plugins.push(plugin); + pipeline.use(plugin); + } + + return this; +} + +/* Add a file to be processed. + * + * Ignores duplicate files (based on the `filePath` at time + * of addition). + * + * Only runs `file-pipeline` on files which have not + * `failed` before addition. */ +function add(file) { + var self = this; + var origin; + + if (xIsString(file)) { + file = toVfile(file); + } + + /* Prevent files from being added multiple times. */ + origin = file.history[0]; + + if (self.origins.indexOf(origin) !== -1) { + return self; + } + + self.origins.push(origin); + + /* Add. */ + self.valueOf().push(file); + self.expected++; + + /* Force an asynchronous operation. + * This ensures that files which fall through + * the file pipeline immediately (e.g., when + * already fatally failed) still queue up + * correctly. */ + setImmediate(function () { + self.emit('add', file); + }); + + return self; +} + +/* Utility invoked when a single file has completed it's + * pipeline, triggering `done` when all files are complete. */ +function one() { + var self = this; + + self.actual++; + + if (self.actual >= self.expected) { + self.emit('done'); + } +} + +var debug$4 = src('unified-engine:file-pipeline:read'); + + +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; + + if (file.contents || file.data.unifiedEngineStreamIn) { + debug$4('Not reading file `%s` with contents', filePath); + next(); + } else if (vfileStatistics(file).fatal) { + debug$4('Not reading failed file `%s`', filePath); + next(); + } else { + filePath = resolve$4(context.cwd, filePath); + + debug$4('Reading `%s` in `%s`', filePath, 'utf8'); + + readFile(filePath, 'utf8', function (err, contents) { + debug$4('Read `%s` (err: %s)', filePath, err); + + file.contents = contents || ''; + + next(err); + }); + } +} + +var fnName = function (fn) { + if (typeof fn !== 'function') { + throw new TypeError('Expected a function'); + } + + return fn.displayName || fn.name || (/function ([^\(]+)?\(/.exec(fn.toString()) || [])[1] || null; +}; + +/** + * Has own property. + * + * @type {Function} + */ + +var has = Object.prototype.hasOwnProperty; + +/** + * To string. + * + * @type {Function} + */ + +var toString$3 = Object.prototype.toString; + +/** + * Test whether a value is "empty". + * + * @param {Mixed} val + * @return {Boolean} + */ + +function isEmpty(val) { + // Null and Undefined... + if (val == null) return true + + // Booleans... + if ('boolean' == typeof val) return false + + // Numbers... + if ('number' == typeof val) return val === 0 + + // Strings... + if ('string' == typeof val) return val.length === 0 + + // Functions... + if ('function' == typeof val) return val.length === 0 + + // Arrays... + if (Array.isArray(val)) return val.length === 0 + + // Errors... + if (val instanceof Error) return val.message === '' + + // Objects... + if (val.toString == toString$3) { + switch (val.toString()) { + + // Maps, Sets, Files and Errors... + case '[object File]': + case '[object Map]': + case '[object Set]': { + return val.size === 0 + } + + // Plain objects... + case '[object Object]': { + for (var key in val) { + if (has.call(val, key)) return false + } + + return true + } + } + } + + // Anything else... + return false +} + +/** + * Export `isEmpty`. + * + * @type {Function} + */ + +var lib = isEmpty; + +var debug$5 = src('unified-engine:file-pipeline:configure'); + + + + + +var configure_1$2 = configure$1; + +/* Collect configuration for a file based on the context. */ +function configure$1(context, file, fileSet, next) { + var config = context.configuration; + var processor = context.processor; + + if (vfileStatistics(file).fatal) { + return next(); + } + + config.load(file.path, handleConfiguration); + + function handleConfiguration(err, configuration) { + var plugins; + var options; + var plugin; + var length; + var index; + var name; + + if (err) { + return next(err); + } + + /* Store configuration on the context object. */ + debug$5('Using settings `%j`', configuration.settings); + processor.data('settings', configuration.settings); + + plugins = configuration.plugins; + length = plugins.length; + index = -1; + + debug$5('Using `%d` plugins', length); + + while (++index < length) { + plugin = plugins[index][0]; + options = plugins[index][1]; + + if (options === false) { + continue; + } + + /* Allow for default arguments in es2020. */ + if (options === null || (isObject$1(options) && lib(options))) { + options = undefined; + } + + name = fnName(plugin) || 'function'; + debug$5('Using plug-in `%s`, with options `%j`', name, options); + + try { + processor.use(plugin, options, fileSet); + } catch (err) { + /* istanbul ignore next - Shouldn’t happen anymore! */ + return next(err); + } + } + + next(); + } +} + +var debug$6 = src('unified-engine:file-pipeline:parse'); + + + +var parse_1 = parse$3; + +/* Fill a file with a tree. */ +function parse$3(context, file) { + var message; + + if (vfileStatistics(file).fatal) { + return; + } + + if (context.treeIn) { + debug$6('Not parsing already parsed document'); + + try { + context.tree = parseJson$1(file.toString()); + } catch (err) { + message = file.message(new Error('Cannot read file as JSON\n' + err.message)); + message.fatal = true; + } + + /* Add the preferred extension to ensure the file, when compiled, is + * correctly recognized. Only add it if there’s a path — not if the + * file is for example stdin. */ + if (file.path) { + file.extname = context.extensions[0]; + } + + file.contents = ''; + + return; + } + + debug$6('Parsing `%s`', file.path); + + context.tree = context.processor.parse(file); + + debug$6('Parsed document'); +} + +var debug$7 = src('unified-engine:file-pipeline:transform'); + + +var transform_1 = transform; + +/* Transform the tree associated with a file with + * configured plug-ins. */ +function transform(context, file, fileSet, next) { + if (vfileStatistics(file).fatal) { + next(); + return; + } + + debug$7('Transforming document `%s`', file.path); + + context.processor.run(context.tree, file, function (err, node) { + debug$7('Transformed document (error: %s)', err); + context.tree = node; + next(err); + }); +} + +var debug$8 = src('unified-engine:file-pipeline:queue'); + + + +var queue_1 = queue; + +/* Queue all files which came this far. + * When the last file gets here, run the file-set pipeline + * and flush the queue. */ +function queue(context, file, fileSet, next) { + var origin = file.history[0]; + var map = fileSet.complete; + var complete = true; + + if (!map) { + map = {}; + fileSet.complete = map; + } + + debug$8('Queueing `%s`', origin); + + map[origin] = next; + + fileSet.valueOf().forEach(each); + + if (!complete) { + debug$8('Not flushing: some files cannot be flushed'); + return; + } + + fileSet.complete = {}; + + fileSet.pipeline.run(fileSet, done); + + function each(file) { + var key = file.history[0]; + + if (vfileStatistics(file).fatal) { + return; + } + + if (xIsFunction(map[key])) { + debug$8('`%s` can be flushed', key); + } else { + debug$8('Interupting flush: `%s` is not finished', key); + complete = false; + } + } + + function done(err) { + debug$8('Flushing: all files can be flushed'); + + /* Flush. */ + for (origin in map) { + map[origin](err); + } + } +} + +/* Detect color support. */ + +var color = true; + +try { + color = 'inspect' in util; +} catch (err) { + /* istanbul ignore next - browser */ + color = false; +} + +var unistUtilInspect = color ? inspect : /* istanbul ignore next */ 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); + +/* Define ANSII color removal functionality. */ +var COLOR_EXPRESSION = new RegExp( + '(?:' + + '(?:\\u001b\\[)|' + + '\\u009b' + + ')' + + '(?:' + + '(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m]' + + ')|' + + '\\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']; + +/* Inspects a node, without using color. */ +function noColor(node, pad) { + return stripColor(inspect(node, pad)) +} + +/* Inspects a node. */ +function inspect(node, pad) { + var result; + var children; + var index; + var length; + + if (node && Boolean(node.length) && typeof node !== 'string') { + length = node.length; + index = -1; + result = []; + + while (++index < length) { + result[index] = inspect(node[index]); + } + + return result.join('\n') + } + + if (!node || !node.type) { + return String(node) + } + + result = [formatNode(node)]; + children = node.children; + length = children && children.length; + index = -1; + + if (!length) { + return result[0] + } + + if (!pad || typeof pad === 'number') { + pad = ''; + } + + while (++index < length) { + node = children[index]; + + if (index === length - 1) { + result.push(formatNesting(pad + '└─ ') + inspect(node, pad + ' ')); + } else { + result.push(formatNesting(pad + '├─ ') + inspect(node, pad + '│ ')); + } + } + + return result.join('\n') +} + +/* Colored nesting formatter. */ +function formatNesting(value) { + return dim(value) +} + +/* Compile a single position. */ +function compile(pos) { + var values = []; + + if (!pos) { + return null + } + + values = [[pos.line || 1, pos.column || 1].join(':')]; + + if ('offset' in pos) { + values.push(String(pos.offset || 0)); + } + + return values +} + +/* Compile a location. */ +function stringify$2(start, end) { + var values = []; + var positions = []; + var offsets = []; + + add(start); + add(end); + + if (positions.length !== 0) { + values.push(positions.join('-')); + } + + if (offsets.length !== 0) { + values.push(offsets.join('-')); + } + + return values.join(', ') + + /* Add a position. */ + function add(position) { + var tuple = compile(position); + + if (tuple) { + positions.push(tuple[0]); + + if (tuple[1]) { + offsets.push(tuple[1]); + } + } + } +} + +/* 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; + + if (node.children) { + log += dim('[') + yellow(node.children.length) + dim(']'); + } else if (typeof node.value === 'string') { + log += dim(': ') + green(JSON.stringify(node.value)); + } + + if (position) { + log += ' (' + position + ')'; + } + + for (key in node) { + value = node[key]; + + if ( + ignore$4.indexOf(key) !== -1 || + value === null || + value === undefined || + (typeof value === 'object' && lib(value)) + ) { + continue + } + + values.push('[' + key + '=' + JSON.stringify(value) + ']'); + } + + if (values.length !== 0) { + log += ' ' + values.join(''); + } + + return log +} + +/* Remove ANSI colour from `value`. */ +function stripColor(value) { + return value.replace(COLOR_EXPRESSION, '') +} + +/* Factory to wrap values in ANSI colours. */ +function ansiColor(open, close) { + return color + + function color(value) { + return '\u001B[' + open + 'm' + value + '\u001B[' + close + 'm' + } +} + +var debug$9 = 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$9('Not compiling failed document'); + return; + } + + if (!context.output && !context.out && !context.alwaysStringify) { + debug$9('Not compiling document without output settings'); + return; + } + + debug$9('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; + + debug$9('Compiled document'); +} + +var debug$10 = src('unified-engine:file-pipeline:copy'); + + +var copy_1 = copy; + +var stat$1 = fs.stat; +var dirname$2 = path.dirname; +var resolve$5 = path.resolve; +var relative$3 = path.relative; + +/* Move a file. */ +function copy(context, file, fileSet, next) { + var output = context.output; + var multi = fileSet.expected > 1; + var outpath = output; + var currentPath = file.path; + + if (!xIsString(outpath)) { + debug$10('Not copying'); + return next(); + } + + outpath = resolve$5(context.cwd, outpath); + + debug$10('Copying `%s`', currentPath); + + stat$1(outpath, onstatfile); + + function onstatfile(err, stats) { + if (err) { + if (err.code !== 'ENOENT' || output.charAt(output.length - 1) === path.sep) { + return next(new Error('Cannot read output directory. Error:\n' + err.message)); + } + + stat$1(dirname$2(outpath), onstatparent); + } else { + done(stats.isDirectory()); + } + } + + /* This is either given an error, or the parent exists which + * is a directory, but we should keep the basename of the + * given file. */ + function onstatparent(err) { + if (err) { + next(new Error('Cannot read parent directory. Error:\n' + err.message)); + } else { + done(false); + } + } + + function done(directory) { + if (!directory && multi) { + return next(new Error('Cannot write multiple files to single output: ' + outpath)); + } + + file[directory ? 'dirname' : 'path'] = relative$3(file.cwd, outpath); + + debug$10('Copying document from %s to %s', currentPath, file.path); + + next(); + } +} + +var debug$11 = src('unified-engine:file-pipeline:stdout'); + + +var stdout_1 = 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$11('Ignoring programmatically added file'); + next(); + } else if (vfileStatistics(file).fatal || context.output || !context.out) { + debug$11('Ignoring writing to `streamOut`'); + next(); + } else { + debug$11('Writing document to `streamOut`'); + context.streamOut.write(file.toString(), next); + } +} + +var debug$12 = src('unified-engine:file-pipeline:file-system'); + +var fileSystem_1$2 = fileSystem$1; + +var writeFile = fs.writeFile; +var resolve$6 = path.resolve; + +/* Write a virtual file to the file-system. + * Ignored when `output` is not given. */ +function fileSystem$1(context, file, fileSet, next) { + var destinationPath; + + if (!context.output) { + debug$12('Ignoring writing to file-system'); + return next(); + } + + if (!file.data.unifiedEngineGiven) { + debug$12('Ignoring programmatically added file'); + return next(); + } + + destinationPath = file.path; + + if (!destinationPath) { + debug$12('Cannot write file without a `destinationPath`'); + return next(new Error('Cannot write file without an output path ')); + } + + destinationPath = resolve$6(context.cwd, destinationPath); + debug$12('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; + +/* Transform all files. */ +function transform$2(context, settings, next) { + var fileSet$$1 = new fileSet(); + + context.fileSet = fileSet$$1; + + fileSet$$1.on('add', add).on('done', next); + + if (context.files.length === 0) { + next(); + } else { + context.files.forEach(fileSet$$1.add, fileSet$$1); + } + + 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); + + 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$$1.emit('one', file); + } + } +} + +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); + } + + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } + + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} + +var supported = supportsColor.hasBasic; + + + + + +var vfileReporter = reporter; + +/* Check which characters should be used. */ +var windows$1 = process.platform === 'win32'; +/* `log-symbols` without chalk: */ +/* istanbul ignore next - Windows. */ +var chars = windows$1 ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}; + +/* Match trailing white-space. */ +var trailing = /\s*$/; + +/* Default filename. */ +var DEFAULT = ''; + +var noop = {open: '', close: ''}; + +var colors = { + underline: {open: '\u001b[4m', close: '\u001b[24m'}, + red: {open: '\u001b[31m', close: '\u001b[39m'}, + yellow: {open: '\u001b[33m', close: '\u001b[39m'}, + green: {open: '\u001b[32m', close: '\u001b[39m'} +}; + +var noops = { + underline: noop, + red: noop, + yellow: noop, + green: noop +}; + +var labels = { + true: 'error', + false: 'warning', + null: 'info', + undefined: 'info' +}; + +/* Report a file’s messages. */ +function reporter(files, options) { + var settings = options || {}; + var one; + + if (!files) { + return ''; + } + + /* Error. */ + if ('name' in files && 'message' in files) { + return String(files.stack || files); + } + + /* One file. */ + if (!('length' in files)) { + one = true; + files = [files]; + } + + return compile$1(parse$5(filter$2(files, settings), settings), one, settings); +} + +function filter$2(files, options) { + var result = []; + var length = files.length; + var index = -1; + var file; + + if (!options.quiet && !options.silent) { + return files.concat(); + } + + while (++index < length) { + file = files[index]; + + if (applicable(file, options).length !== 0) { + result.push(file); + } + } + + return result; +} + +function parse$5(files, options) { + var length = files.length; + var index = -1; + var rows = []; + var all = []; + var locationSize = 0; + var labelSize = 0; + var reasonSize = 0; + var ruleIdSize = 0; + var file; + var destination; + var origin; + var messages; + var offset; + var count; + var message; + var loc; + var reason; + var label; + var id; + + while (++index < length) { + file = files[index]; + destination = current(file); + origin = file.history[0] || destination; + messages = applicable(file, options).sort(comparator); + + if (rows.length !== 0 && rows[rows.length - 1].type !== 'header') { + rows.push({type: 'separator'}); + } + + rows.push({ + type: 'header', + origin: origin, + destination: destination, + name: origin || options.defaultName || DEFAULT, + stored: Boolean(file.stored), + moved: Boolean(file.stored && destination !== origin), + stats: vfileStatistics(messages) + }); + + offset = -1; + count = messages.length; + + while (++offset < count) { + message = messages[offset]; + id = message.ruleId || ''; + reason = message.stack || message.message; + loc = message.location; + loc = unistUtilStringifyPosition(loc.end.line && loc.end.column ? loc : loc.start); + + if (options.verbose && message.note) { + reason += '\n' + message.note; + } + + label = labels[message.fatal]; + + rows.push({ + location: loc, + label: label, + reason: reason, + ruleId: id, + source: message.source + }); + + locationSize = Math.max(realLength(loc), locationSize); + labelSize = Math.max(realLength(label), labelSize); + reasonSize = Math.max(realLength(reason), reasonSize); + ruleIdSize = Math.max(realLength(id), ruleIdSize); + } + + all = all.concat(messages); + } + + return { + rows: rows, + statistics: vfileStatistics(all), + location: locationSize, + label: labelSize, + reason: reasonSize, + ruleId: ruleIdSize + }; +} + +function compile$1(map, one, options) { + var enabled = options.color; + var all = map.statistics; + var rows = map.rows; + var length = rows.length; + var index = -1; + var lines = []; + var row; + var line; + var style; + var color; + + if (enabled === null || enabled === undefined) { + enabled = supported; + } + + style = enabled ? colors : noops; + + while (++index < length) { + row = rows[index]; + + if (row.type === 'separator') { + lines.push(''); + } else if (row.type === 'header') { + if (one && !options.defaultName && !row.origin) { + line = ''; + } else { + color = style[row.stats.fatal ? 'red' : (row.stats.total ? 'yellow' : 'green')]; + line = style.underline.open + color.open + row.name + color.close + style.underline.close; + line += row.moved ? ' > ' + row.destination : ''; + } + + if (!row.stats.total) { + line += line ? ': ' : ''; + + if (row.stored) { + line += style.yellow.open + 'written' + style.yellow.close; + } else { + line += 'no issues found'; + } + } + + if (line) { + lines.push(line); + } + } else { + color = style[row.label === 'error' ? 'red' : 'yellow']; + + lines.push([ + '', + padLeft(row.location, map.location), + padRight(color.open + row.label + color.close, map.label), + padRight(row.reason, map.reason), + padRight(row.ruleId, map.ruleId), + row.source || '' + ].join(' ').replace(trailing, '')); + } + } + + if (all.fatal || all.warn) { + line = []; + + if (all.fatal) { + line.push([ + style.red.open + chars.error + style.red.close, + all.fatal, + plural$1(labels.true, all.fatal) + ].join(' ')); + } + + if (all.warn) { + line.push([ + style.yellow.open + chars.warning + style.yellow.close, + all.warn, + plural$1(labels.false, all.warn) + ].join(' ')); + } + + line = line.join(', '); + + if (all.total !== all.fatal && all.total !== all.warn) { + line = all.total + ' messages (' + line + ')'; + } + + lines.push('', line); + } + + return lines.join('\n'); +} + +function applicable(file, options) { + var messages = file.messages; + var length = messages.length; + var index = -1; + var result = []; + + if (options.silent) { + while (++index < length) { + if (messages[index].fatal) { + result.push(messages[index]); + } + } + } else { + result = messages.concat(); + } + + return result; +} + +/* 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)); +} + +/* Pad `value` on the left. */ +function padLeft(value, minimum) { + return repeatString(' ', minimum - realLength(value)) + value; +} + +/* Pad `value` on the Right. */ +function padRight(value, minimum) { + return value + repeatString(' ', minimum - realLength(value)); +} + +/* Comparator. */ +function comparator(a, b) { + return check$1(a, b, 'line') || check$1(a, b, 'column') || -1; +} + +/* Compare a single property. */ +function check$1(a, b, property) { + return (a[property] || 0) - (b[property] || 0); +} + +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); + } +} + +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; +} + +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]; + + 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; + } + } + + return input; +}; + +module.exports = (input, options) => { + options = Object.assign({ + pascalCase: false + }, options); + + const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; + + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } + + if (input.length === 0) { + return ''; + } + + if (input.length === 1) { + return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); + } + + if (/^[a-z\d]+$/.test(input)) { + return postProcess(input); + } + + const hasUpperCase = input !== input.toLowerCase(); + + if (hasUpperCase) { + input = preserveCamelCase(input); + } + + input = input + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); + + return postProcess(input); +}; +}); + +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; + +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)} +}); + +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 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']; +}); + +unwrapExports(parse_1$2); + +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" + }, + { + "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 + } +] +; + +var schema$3 = Object.freeze({ + default: schema$2 +}); + +var schema$4 = ( schema$3 && schema$2 ) || schema$3; + +var options_1 = options; + +/* Schema for `minimist`. */ +var minischema = { + unknown: handleUnknownArgument, + default: {}, + alias: {}, + string: [], + boolean: [] +}; + +schema$4.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) { + if (option.type === 'string' && config[option.long] === '') { + throw fault_1('Missing value:%s', inspect$2(option).join(' ')) + } + }); + + ext = extensions(config.ext); + report = reporter$1(config.report); + + help = [ + inspectAll(schema$4), + '', + 'Examples:', + '', + ' # Process `input.' + extension + '`', + ' $ ' + name + ' input.' + extension + ' -o output.' + extension, + '', + ' # Pipe', + ' $ ' + name + ' < input.' + extension + ' > output.' + extension, + '', + ' # Rewrite all applicable files', + ' $ ' + name + ' . -o' + ].join('\n'); + + return { + helpMessage: help, + /* “hidden” feature, makes testing easier. */ + cwd: configuration.cwd, + processor: configuration.processor, + help: config.help, + version: config.version, + files: config._, + watch: config.watch, + extensions: ext.length ? ext : configuration.extensions, + output: config.output, + out: config.stdout, + tree: config.tree, + treeIn: config.treeIn, + treeOut: config.treeOut, + inspect: config.inspect, + rcName: configuration.rcName, + packageField: configuration.packageField, + rcPath: config.rcPath, + detectConfig: config.config, + settings: settings(config.setting), + ignoreName: configuration.ignoreName, + ignorePath: config.ignorePath, + detectIgnore: config.ignore, + pluginPrefix: configuration.pluginPrefix, + plugins: plugins(config.use), + reporter: report[0], + reporterOptions: report[1], + color: config.color, + silent: config.silent, + quiet: config.quiet, + frail: config.frail + } +} + +function addEach(option) { + var value = option.default; + + minischema.default[option.long] = value === undefined ? null : value; + + if (option.type in minischema) { + minischema[option.type].push(option.long); + } + + if (option.short) { + minischema.alias[option.short] = option.long; + } +} + +/* Parse `extensions`. */ +function extensions(value) { + return flatten(normalize$1(value).map(splitList)) +} + +/* Parse `plugins`. */ +function plugins(value) { + var result = {}; + + normalize$1(value) + .map(splitOptions) + .forEach(function(value) { + 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) + .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 = {}; + + normalize$1(value).forEach(function(value) { + parseConfig(value, cache); + }); + + return cache +} + +/* Parse configuration. */ +function parseConfig(flags, cache) { + var flag; + var message; + + try { + flags = toCamelCase(parseJSON(flags)); + } catch (err) { + /* Fix position */ + message = err.message.replace(/at(?= position)/, 'around'); + + throw fault_1('Cannot parse `%s` as JSON: %s', flags, message) + } + + for (flag in flags) { + cache[flag] = flags[flag]; + } + + return cache +} + +/* Handle an unknown flag. */ +function handleUnknownArgument(flag) { + /* Glob. */ + if (flag.charAt(0) !== '-') { + return + } + + /* Long options. Always unknown. */ + if (flag.charAt(1) === '-') { + throw fault_1('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema$4)) + } + + /* Short options. Can be grouped. */ + flag + .slice(1) + .split('') + .forEach(each); + + function each(key) { + var length = schema$4.length; + var index = -1; + var option; + + while (++index < length) { + option = schema$4[index]; + + if (option.short === key) { + return + } + } + + throw fault_1( + 'Unknown short option `-%s`, expected:\n%s', + key, + inspectAll(schema$4.filter(short)) + ) + } + + function short(option) { + return option.short + } +} + +/* Inspect all `options`. */ +function inspectAll(options) { + return textTable(options.map(inspect$2)) +} + +/* Inspect one `option`. */ +function inspect$2(option) { + var description = option.description; + var long = option.long; + + if (option.default === true || option.truelike) { + description += ' (on by default)'; + long = '[no-]' + long; + } + + return [ + '', + option.short ? '-' + option.short : '', + '--' + long + (option.value ? ' ' + option.value : ''), + description + ] +} + +/* Normalize `value`. */ +function normalize$1(value) { + if (!value) { + return [] + } + + if (typeof value === 'string') { + return [value] + } + + return flatten(value.map(normalize$1)) +} + +/* Flatten `values`. */ +function flatten(values) { + return [].concat.apply([], values) +} + +function splitOptions(value) { + return value.split('=') +} + +function splitList(value) { + return value.split(',') +} + +/* 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$15 = ( markdownExtensions$1 && markdownExtensions ) || markdownExtensions$1; + +var markdownExtensions$2 = require$$0$15; + +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) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, 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; + } +}; + +// 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; + } + } + + return obj[name]; +}; + +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; + + // 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); + + // 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 : {}; + } + + // Never move original objects, clone them + setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + setProperty(target, { name: name, newValue: copy }); + } + } + } + } + } + + // Return the modified object + return target; +}; + +var bail_1 = bail; + +function bail(err) { + if (err) { + throw err + } +} + +var toString$4 = Object.prototype.toString; + +var isPlainObj = function (x) { + var prototype; + return toString$4.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +}; + +/* Dependencies. */ + + + + + + + +/* Expose a frozen processor. */ +var unified_1 = unified().freeze(); + +var slice$3 = [].slice; +var own$2 = {}.hasOwnProperty; + +/* Process pipeline. */ +var pipeline = trough_1() + .use(pipelineParse) + .use(pipelineRun) + .use(pipelineStringify); + +function pipelineParse(p, ctx) { + ctx.tree = p.parse(ctx.file); +} + +function pipelineRun(p, ctx, next) { + p.run(ctx.tree, ctx.file, done); + + function done(err, tree, file) { + if (err) { + next(err); + } else { + ctx.tree = tree; + ctx.file = file; + next(); + } + } +} + +function pipelineStringify(p, ctx) { + 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; + + /* Data management. */ + processor.data = data; + + /* Lock. */ + processor.freeze = freeze; + + /* Plug-ins. */ + 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; + + /* 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; + + while (++index < length) { + destination.use.apply(null, attachers[index]); + } + + destination.data(extend$3(true, {}, namespace)); + + 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. */ + function freeze() { + 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; + + if (options === false) { + continue + } + + if (options === true) { + values[1] = undefined; + } + + transformer = plugin.apply(processor, values.slice(1)); + + if (typeof transformer === 'function') { + transformers.use(transformer); + } + } + + frozen = true; + freezeIndex = Infinity; + + return processor + } + + /* Data management. + * Getter / setter for processor-specific informtion. */ + function data(key, value) { + if (xIsString(key)) { + /* Set `key`. */ + if (arguments.length === 2) { + assertUnfrozen('data', frozen); + + namespace[key] = value; + + return processor + } + + /* Get `key`. */ + return (own$2.call(namespace, key) && namespace[key]) || null + } + + /* Set space. */ + if (key) { + assertUnfrozen('data', frozen); + namespace = key; + return processor + } + + /* 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). */ + function use(value) { + var settings; + + assertUnfrozen('use', frozen); + + if (value === null || value === undefined) { + /* Empty */ + } else if (typeof value === 'function') { + addPlugin.apply(null, arguments); + } else if (typeof value === 'object') { + if ('length' in value) { + addList(value); + } else { + addPreset(value); + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + + if (settings) { + namespace.settings = extend$3(namespace.settings || {}, settings); + } + + return processor + + function addPreset(result) { + addList(result.plugins); + + if (result.settings) { + settings = extend$3(settings || {}, result.settings); + } + } + + function add(value) { + if (typeof value === 'function') { + addPlugin(value); + } else if (typeof value === 'object') { + if ('length' in value) { + addPlugin.apply(null, value); + } else { + addPreset(value); + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + } + + function addList(plugins) { + var length; + var index; + + if (plugins === null || plugins === undefined) { + /* Empty */ + } else if (typeof plugins === 'object' && 'length' in plugins) { + length = plugins.length; + index = -1; + + while (++index < length) { + add(plugins[index]); + } + } else { + throw new Error('Expected a list of plugins, not `' + plugins + '`') + } + } + + function addPlugin(plugin, value) { + var entry = find(plugin); + + if (entry) { + if (isPlainObj(entry[1]) && isPlainObj(value)) { + value = extend$3(entry[1], value); + } + + entry[1] = value; + } else { + attachers.push(slice$3.call(arguments)); + } + } + } + + function find(plugin) { + var length = attachers.length; + var index = -1; + var entry; + + while (++index < length) { + entry = attachers[index]; + + if (entry[0] === plugin) { + return entry + } + } + } + + /* 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 Parser; + + freeze(); + Parser = processor.Parser; + assertParser('parse', Parser); + + if (newable(Parser)) { + return new Parser(String(file), file).parse() + } + + 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. */ + function run(node, file, cb) { + assertNode(node); + freeze(); + + if (!cb && typeof file === 'function') { + cb = file; + file = null; + } + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb); + + function executor(resolve, reject) { + transformers.run(node, vfile(file), done); + + function done(err, tree, file) { + tree = tree || node; + if (err) { + reject(err); + } else if (resolve) { + resolve(tree); + } else { + cb(null, tree, file); + } + } + } + } + + /* 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; + + run(node, file, done); + + assertDone('runSync', 'run', complete); + + return result + + function done(err, tree) { + complete = true; + bail_1(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(doc); + var Compiler; + + freeze(); + Compiler = processor.Compiler; + assertCompiler('stringify', Compiler); + assertNode(node); + + if (newable(Compiler)) { + return new Compiler(node, file).compile() + } + + 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. */ + function process(doc, cb) { + freeze(); + assertParser('process', processor.Parser); + assertCompiler('process', processor.Compiler); + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb); + + function executor(resolve, reject) { + var file = vfile(doc); + + pipeline.run(processor, {file: file}, done); + + function done(err) { + if (err) { + reject(err); + } else if (resolve) { + resolve(file); + } else { + cb(null, file); + } + } + } + } + + /* Process the given document (in string or VFile + * representation), sync. */ + function processSync(doc) { + var complete = false; + var file; + + freeze(); + assertParser('processSync', processor.Parser); + assertCompiler('processSync', processor.Compiler); + file = vfile(doc); + + process(file, done); + + assertDone('processSync', 'process', complete); + + return file + + function done(err) { + complete = true; + bail_1(err); + } + } +} + +/* Check if `func` is a constructor. */ +function newable(value) { + return typeof value === 'function' && keys(value.prototype) +} + +/* Check if `value` is an object with keys. */ +function keys(value) { + var key; + for (key in value) { + return true + } + return false +} + +/* 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. */ +function assertCompiler(name, Compiler) { + if (typeof Compiler !== 'function') { + throw new Error('Cannot `' + name + '` without `Compiler`') + } +} + +/* 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('') + ) + } +} + +/* 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`. */ +function assertDone(name, asyncName, complete) { + if (!complete) { + throw new Error( + '`' + name + '` finished async. Use `' + asyncName + '` instead' + ) + } +} + +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]; + + if (value && typeof value === 'object') { + result[key] = 'concat' in value ? value.concat() : immutable(value); + } + } + + return Of + + /* Constructor accepting a single argument, + * which itself is an `arguments` object. */ + function From(parameters) { + return Super.apply(this, parameters) + } + + /* Constructor accepting variadic arguments. */ + function Of() { + if (!(this instanceof Of)) { + return new From(arguments) + } + + return Super.apply(this, arguments) + } +} + +var stateToggle = factory; + +/* 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 + + function enter() { + var context = ctx || this; + var current = context[key]; + + context[key] = !state; + + return exit + + function exit() { + context[key] = current; + } + } +} + +/* Expose. */ +var vfileLocation = factory$1; + +/* Factory. */ +function factory$1(file) { + var contents = indices(String(file)); + + return { + toPosition: offsetToPositionFactory(contents), + toOffset: positionToOffsetFactory(contents) + } +} + +/* Factory to get the line and column-based `position` for + * `offset` in the bound indices. */ +function offsetToPositionFactory(indices) { + return offsetToPosition + + /* Get the line and column-based `position` for + * `offset` in the bound indices. */ + function offsetToPosition(offset) { + var index = -1; + var length = indices.length; + + if (offset < 0) { + return {} + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } + + return {} + } +} + +/* 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; + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } + + return -1 + } +} + +/* Get indices of line-breaks in `value`. */ +function indices(value) { + var result = []; + var index = value.indexOf('\n'); + + while (index !== -1) { + result.push(index + 1); + index = value.indexOf('\n', index + 1); + } + + result.push(value.length + 1); + + return result +} + +var _unescape = factory$2; + +/* Factory to de-escape a value, based on a list at `key` + * in `ctx`. */ +function factory$2(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('\\'); + 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('\\'); + } + + index = value.indexOf('\\', prev); + } + + queue.push(value.slice(prev)); + + return queue.join(''); + } +} + +const AEli = "Æ"; +const AElig = "Æ"; +const AM = "&"; +const AMP = "&"; +const Aacut = "Á"; +const Aacute = "Á"; +const Abreve = "Ă"; +const Acir = "Â"; +const Acirc = "Â"; +const Acy = "А"; +const Afr = "𝔄"; +const Agrav = "À"; +const Agrave = "À"; +const Alpha = "Α"; +const Amacr = "Ā"; +const And = "⩓"; +const Aogon = "Ą"; +const Aopf = "𝔸"; +const ApplyFunction = "⁡"; +const Arin = "Å"; +const Aring = "Å"; +const Ascr = "𝒜"; +const Assign = "≔"; +const Atild = "Ã"; +const Atilde = "Ã"; +const Aum = "Ä"; +const Auml = "Ä"; +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 = "©"; +const Cacute = "Ć"; +const Cap = "⋒"; +const CapitalDifferentialD = "ⅅ"; +const Cayleys = "ℭ"; +const Ccaron = "Č"; +const Ccedi = "Ç"; +const Ccedil = "Ç"; +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 = "Ð"; +const Eacut = "É"; +const Eacute = "É"; +const Ecaron = "Ě"; +const Ecir = "Ê"; +const Ecirc = "Ê"; +const Ecy = "Э"; +const Edot = "Ė"; +const Efr = "𝔈"; +const Egrav = "È"; +const Egrave = "È"; +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 = "Ë"; +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 = ">"; +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 = "Í"; +const Icir = "Î"; +const Icirc = "Î"; +const Icy = "И"; +const Idot = "İ"; +const Ifr = "ℑ"; +const Igrav = "Ì"; +const Igrave = "Ì"; +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 = "Ï"; +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 = "<"; +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 = "Ñ"; +const Nu = "Ν"; +const OElig = "Œ"; +const Oacut = "Ó"; +const Oacute = "Ó"; +const Ocir = "Ô"; +const Ocirc = "Ô"; +const Ocy = "О"; +const Odblac = "Ő"; +const Ofr = "𝔒"; +const Ograv = "Ò"; +const Ograve = "Ò"; +const Omacr = "Ō"; +const Omega = "Ω"; +const Omicron = "Ο"; +const Oopf = "𝕆"; +const OpenCurlyDoubleQuote = "“"; +const OpenCurlyQuote = "‘"; +const Or = "⩔"; +const Oscr = "𝒪"; +const Oslas = "Ø"; +const Oslash = "Ø"; +const Otild = "Õ"; +const Otilde = "Õ"; +const Otimes = "⨷"; +const Oum = "Ö"; +const Ouml = "Ö"; +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 = "\""; +const Qfr = "𝔔"; +const Qopf = "ℚ"; +const Qscr = "𝒬"; +const RBarr = "⤐"; +const RE = "®"; +const REG = "®"; +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 = "Þ"; +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 = "Ú"; +const Uarr = "↟"; +const Uarrocir = "⥉"; +const Ubrcy = "Ў"; +const Ubreve = "Ŭ"; +const Ucir = "Û"; +const Ucirc = "Û"; +const Ucy = "У"; +const Udblac = "Ű"; +const Ufr = "𝔘"; +const Ugrav = "Ù"; +const Ugrave = "Ù"; +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 = "Ü"; +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 = "Ý"; +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 = "á"; +const abreve = "ă"; +const ac = "∾"; +const acE = "∾̳"; +const acd = "∿"; +const acir = "â"; +const acirc = "â"; +const acut = "´"; +const acute = "´"; +const acy = "а"; +const aeli = "æ"; +const aelig = "æ"; +const af = "⁡"; +const afr = "𝔞"; +const agrav = "à"; +const agrave = "à"; +const alefsym = "ℵ"; +const aleph = "ℵ"; +const alpha = "α"; +const amacr = "ā"; +const amalg = "⨿"; +const am = "&"; +const amp = "&"; +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 = "å"; +const ascr = "𝒶"; +const ast = "*"; +const asymp = "≈"; +const asympeq = "≍"; +const atild = "ã"; +const atilde = "ã"; +const aum = "ä"; +const auml = "ä"; +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 = "¦"; +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 = "ç"; +const ccirc = "ĉ"; +const ccups = "⩌"; +const ccupssm = "⩐"; +const cdot = "ċ"; +const cedi = "¸"; +const cedil = "¸"; +const cemptyv = "⦲"; +const cen = "¢"; +const cent = "¢"; +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$2 = "©"; +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 = "¤"; +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 = "°"; +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 = "÷"; +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 = "é"; +const easter = "⩮"; +const ecaron = "ě"; +const ecir = "ê"; +const ecirc = "ê"; +const ecolon = "≕"; +const ecy = "э"; +const edot = "ė"; +const ee = "ⅇ"; +const efDot = "≒"; +const efr = "𝔢"; +const eg = "⪚"; +const egrav = "è"; +const egrave = "è"; +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 = "ð"; +const eum = "ë"; +const euml = "ë"; +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 = "½"; +const frac13 = "⅓"; +const frac14 = "¼"; +const frac15 = "⅕"; +const frac16 = "⅙"; +const frac18 = "⅛"; +const frac23 = "⅔"; +const frac25 = "⅖"; +const frac3 = "¾"; +const frac34 = "¾"; +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 = ">"; +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 = "í"; +const ic = "⁣"; +const icir = "î"; +const icirc = "î"; +const icy = "и"; +const iecy = "е"; +const iexc = "¡"; +const iexcl = "¡"; +const iff = "⇔"; +const ifr = "𝔦"; +const igrav = "ì"; +const igrave = "ì"; +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 = "¿"; +const iscr = "𝒾"; +const isin = "∈"; +const isinE = "⋹"; +const isindot = "⋵"; +const isins = "⋴"; +const isinsv = "⋳"; +const isinv = "∈"; +const it = "⁢"; +const itilde = "ĩ"; +const iukcy = "і"; +const ium = "ï"; +const iuml = "ï"; +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 = "«"; +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 = "<"; +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 = "¯"; +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 = "µ"; +const mid = "∣"; +const midast = "*"; +const midcir = "⫰"; +const middo = "·"; +const middot = "·"; +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 = " "; +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 = "¬"; +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 = "ñ"; +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 = "ó"; +const oast = "⊛"; +const ocir = "ô"; +const ocirc = "ô"; +const ocy = "о"; +const odash = "⊝"; +const odblac = "ő"; +const odiv = "⨸"; +const odot = "⊙"; +const odsold = "⦼"; +const oelig = "œ"; +const ofcir = "⦿"; +const ofr = "𝔬"; +const ogon = "˛"; +const ograv = "ò"; +const ograve = "ò"; +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$1 = "ℴ"; +const orderof = "ℴ"; +const ordf = "ª"; +const ordm = "º"; +const origof = "⊶"; +const oror = "⩖"; +const orslope = "⩗"; +const orv = "⩛"; +const oscr = "ℴ"; +const oslas = "ø"; +const oslash = "ø"; +const osol = "⊘"; +const otild = "õ"; +const otilde = "õ"; +const otimes = "⊗"; +const otimesas = "⨶"; +const oum = "ö"; +const ouml = "ö"; +const ovbar = "⌽"; +const par = "¶"; +const para = "¶"; +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 = "±"; +const plussim = "⨦"; +const plustwo = "⨧"; +const pm = "±"; +const pointint = "⨕"; +const popf = "𝕡"; +const poun = "£"; +const pound = "£"; +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 = "\""; +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 = "»"; +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 = "®"; +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 = "§"; +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 = "­"; +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 = "¹"; +const sup2 = "²"; +const sup3 = "³"; +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 = "ß"; +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 = "þ"; +const tilde = "˜"; +const time = "×"; +const times = "×"; +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 = "ú"; +const uarr = "↑"; +const ubrcy = "ў"; +const ubreve = "ŭ"; +const ucir = "û"; +const ucirc = "û"; +const ucy = "у"; +const udarr = "⇅"; +const udblac = "ű"; +const udhar = "⥮"; +const ufisht = "⥾"; +const ufr = "𝔲"; +const ugrav = "ù"; +const ugrave = "ù"; +const uharl = "↿"; +const uharr = "↾"; +const uhblk = "▀"; +const ulcorn = "⌜"; +const ulcorner = "⌜"; +const ulcrop = "⌏"; +const ultri = "◸"; +const umacr = "ū"; +const um = "¨"; +const uml = "¨"; +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 = "ü"; +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 = "ý"; +const yacy = "я"; +const ycirc = "ŷ"; +const ycy = "ы"; +const ye = "¥"; +const yen = "¥"; +const yfr = "𝔶"; +const yicy = "ї"; +const yopf = "𝕪"; +const yscr = "𝓎"; +const yucy = "ю"; +const yum = "ÿ"; +const yuml = "ÿ"; +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$2 = { + AEli: AEli, + AElig: AElig, + AM: AM, + AMP: AMP, + Aacut: Aacut, + Aacute: Aacute, + Abreve: Abreve, + Acir: Acir, + Acirc: Acirc, + Acy: Acy, + Afr: Afr, + Agrav: Agrav, + Agrave: Agrave, + Alpha: Alpha, + Amacr: Amacr, + And: And, + Aogon: Aogon, + Aopf: Aopf, + ApplyFunction: ApplyFunction, + Arin: Arin, + Aring: Aring, + Ascr: Ascr, + Assign: Assign, + Atild: Atild, + Atilde: Atilde, + Aum: Aum, + Auml: Auml, + 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, + Cacute: Cacute, + Cap: Cap, + CapitalDifferentialD: CapitalDifferentialD, + Cayleys: Cayleys, + Ccaron: Ccaron, + Ccedi: Ccedi, + Ccedil: Ccedil, + 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, + Eacut: Eacut, + Eacute: Eacute, + Ecaron: Ecaron, + Ecir: Ecir, + Ecirc: Ecirc, + Ecy: Ecy, + Edot: Edot, + Efr: Efr, + Egrav: Egrav, + Egrave: Egrave, + 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, + 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, + 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, + Icir: Icir, + Icirc: Icirc, + Icy: Icy, + Idot: Idot, + Ifr: Ifr, + Igrav: Igrav, + Igrave: Igrave, + 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, + 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, + 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, + Nu: Nu, + OElig: OElig, + Oacut: Oacut, + Oacute: Oacute, + Ocir: Ocir, + Ocirc: Ocirc, + Ocy: Ocy, + Odblac: Odblac, + Ofr: Ofr, + Ograv: Ograv, + Ograve: Ograve, + Omacr: Omacr, + Omega: Omega, + Omicron: Omicron, + Oopf: Oopf, + OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, + OpenCurlyQuote: OpenCurlyQuote, + Or: Or, + Oscr: Oscr, + Oslas: Oslas, + Oslash: Oslash, + Otild: Otild, + Otilde: Otilde, + Otimes: Otimes, + Oum: Oum, + Ouml: Ouml, + 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, + Qfr: Qfr, + Qopf: Qopf, + Qscr: Qscr, + RBarr: RBarr, + RE: RE, + REG: REG, + 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, + 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, + Uarr: Uarr, + Uarrocir: Uarrocir, + Ubrcy: Ubrcy, + Ubreve: Ubreve, + Ucir: Ucir, + Ucirc: Ucirc, + Ucy: Ucy, + Udblac: Udblac, + Ufr: Ufr, + Ugrav: Ugrav, + Ugrave: Ugrave, + 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, + 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, + 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, + abreve: abreve, + ac: ac, + acE: acE, + acd: acd, + acir: acir, + acirc: acirc, + acut: acut, + acute: acute, + acy: acy, + aeli: aeli, + aelig: aelig, + af: af, + afr: afr, + agrav: agrav, + agrave: agrave, + alefsym: alefsym, + aleph: aleph, + alpha: alpha, + amacr: amacr, + amalg: amalg, + am: am, + amp: amp, + 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, + ascr: ascr, + ast: ast, + asymp: asymp, + asympeq: asympeq, + atild: atild, + atilde: atilde, + aum: aum, + auml: auml, + 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, + 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, + ccirc: ccirc, + ccups: ccups, + ccupssm: ccupssm, + cdot: cdot, + cedi: cedi, + cedil: cedil, + cemptyv: cemptyv, + cen: cen, + cent: cent, + 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$2, + 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, + 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, + 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, + 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, + easter: easter, + ecaron: ecaron, + ecir: ecir, + ecirc: ecirc, + ecolon: ecolon, + ecy: ecy, + edot: edot, + ee: ee, + efDot: efDot, + efr: efr, + eg: eg, + egrav: egrav, + egrave: egrave, + 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, + eum: eum, + euml: euml, + 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, + frac13: frac13, + frac14: frac14, + frac15: frac15, + frac16: frac16, + frac18: frac18, + frac23: frac23, + frac25: frac25, + frac3: frac3, + frac34: frac34, + 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, + 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, + ic: ic, + icir: icir, + icirc: icirc, + icy: icy, + iecy: iecy, + iexc: iexc, + iexcl: iexcl, + iff: iff, + ifr: ifr, + igrav: igrav, + igrave: igrave, + 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, + iscr: iscr, + isin: isin, + isinE: isinE, + isindot: isindot, + isins: isins, + isinsv: isinsv, + isinv: isinv, + it: it, + itilde: itilde, + iukcy: iukcy, + ium: ium, + iuml: iuml, + 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, + 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, + 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, + 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, + mid: mid, + midast: midast, + midcir: midcir, + middo: middo, + middot: middot, + 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, + 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, + 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, + 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, + oast: oast, + ocir: ocir, + ocirc: ocirc, + ocy: ocy, + odash: odash, + odblac: odblac, + odiv: odiv, + odot: odot, + odsold: odsold, + oelig: oelig, + ofcir: ofcir, + ofr: ofr, + ogon: ogon, + ograv: ograv, + ograve: ograve, + 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$1, + orderof: orderof, + ordf: ordf, + ordm: ordm, + origof: origof, + oror: oror, + orslope: orslope, + orv: orv, + oscr: oscr, + oslas: oslas, + oslash: oslash, + osol: osol, + otild: otild, + otilde: otilde, + otimes: otimes, + otimesas: otimesas, + oum: oum, + ouml: ouml, + ovbar: ovbar, + par: par, + para: para, + 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, + plussim: plussim, + plustwo: plustwo, + pm: pm, + pointint: pointint, + popf: popf, + poun: poun, + pound: pound, + 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, + 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, + 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, + 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, + 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, + 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, + sup2: sup2, + sup3: sup3, + 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, + 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, + tilde: tilde, + time: time, + times: times, + 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, + uarr: uarr, + ubrcy: ubrcy, + ubreve: ubreve, + ucir: ucir, + ucirc: ucirc, + ucy: ucy, + udarr: udarr, + udblac: udblac, + udhar: udhar, + ufisht: ufisht, + ufr: ufr, + ugrav: ugrav, + ugrave: ugrave, + uharl: uharl, + uharr: uharr, + uhblk: uhblk, + ulcorn: ulcorn, + ulcorner: ulcorner, + ulcrop: ulcrop, + ultri: ultri, + umacr: umacr, + um: um, + uml: uml, + 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, + 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, + yacy: yacy, + ycirc: ycirc, + ycy: ycy, + ye: ye, + yen: yen, + yfr: yfr, + yicy: yicy, + yopf: yopf, + yscr: yscr, + yucy: yucy, + yum: yum, + yuml: yuml, + 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 characterEntities = Object.freeze({ + AEli: AEli, + AElig: AElig, + AM: AM, + AMP: AMP, + Aacut: Aacut, + Aacute: Aacute, + Abreve: Abreve, + Acir: Acir, + Acirc: Acirc, + Acy: Acy, + Afr: Afr, + Agrav: Agrav, + Agrave: Agrave, + Alpha: Alpha, + Amacr: Amacr, + And: And, + Aogon: Aogon, + Aopf: Aopf, + ApplyFunction: ApplyFunction, + Arin: Arin, + Aring: Aring, + Ascr: Ascr, + Assign: Assign, + Atild: Atild, + Atilde: Atilde, + Aum: Aum, + Auml: Auml, + 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, + Cacute: Cacute, + Cap: Cap, + CapitalDifferentialD: CapitalDifferentialD, + Cayleys: Cayleys, + Ccaron: Ccaron, + Ccedi: Ccedi, + Ccedil: Ccedil, + 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, + Eacut: Eacut, + Eacute: Eacute, + Ecaron: Ecaron, + Ecir: Ecir, + Ecirc: Ecirc, + Ecy: Ecy, + Edot: Edot, + Efr: Efr, + Egrav: Egrav, + Egrave: Egrave, + 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, + 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, + 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, + Icir: Icir, + Icirc: Icirc, + Icy: Icy, + Idot: Idot, + Ifr: Ifr, + Igrav: Igrav, + Igrave: Igrave, + 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, + 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, + 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, + Nu: Nu, + OElig: OElig, + Oacut: Oacut, + Oacute: Oacute, + Ocir: Ocir, + Ocirc: Ocirc, + Ocy: Ocy, + Odblac: Odblac, + Ofr: Ofr, + Ograv: Ograv, + Ograve: Ograve, + Omacr: Omacr, + Omega: Omega, + Omicron: Omicron, + Oopf: Oopf, + OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, + OpenCurlyQuote: OpenCurlyQuote, + Or: Or, + Oscr: Oscr, + Oslas: Oslas, + Oslash: Oslash, + Otild: Otild, + Otilde: Otilde, + Otimes: Otimes, + Oum: Oum, + Ouml: Ouml, + 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, + Qfr: Qfr, + Qopf: Qopf, + Qscr: Qscr, + RBarr: RBarr, + RE: RE, + REG: REG, + 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, + 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, + Uarr: Uarr, + Uarrocir: Uarrocir, + Ubrcy: Ubrcy, + Ubreve: Ubreve, + Ucir: Ucir, + Ucirc: Ucirc, + Ucy: Ucy, + Udblac: Udblac, + Ufr: Ufr, + Ugrav: Ugrav, + Ugrave: Ugrave, + 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, + 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, + 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, + abreve: abreve, + ac: ac, + acE: acE, + acd: acd, + acir: acir, + acirc: acirc, + acut: acut, + acute: acute, + acy: acy, + aeli: aeli, + aelig: aelig, + af: af, + afr: afr, + agrav: agrav, + agrave: agrave, + alefsym: alefsym, + aleph: aleph, + alpha: alpha, + amacr: amacr, + amalg: amalg, + am: am, + amp: amp, + 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, + ascr: ascr, + ast: ast, + asymp: asymp, + asympeq: asympeq, + atild: atild, + atilde: atilde, + aum: aum, + auml: auml, + 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, + 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, + ccirc: ccirc, + ccups: ccups, + ccupssm: ccupssm, + cdot: cdot, + cedi: cedi, + cedil: cedil, + cemptyv: cemptyv, + cen: cen, + cent: cent, + 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$2, + 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, + 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, + 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, + 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, + easter: easter, + ecaron: ecaron, + ecir: ecir, + ecirc: ecirc, + ecolon: ecolon, + ecy: ecy, + edot: edot, + ee: ee, + efDot: efDot, + efr: efr, + eg: eg, + egrav: egrav, + egrave: egrave, + 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, + eum: eum, + euml: euml, + 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, + frac13: frac13, + frac14: frac14, + frac15: frac15, + frac16: frac16, + frac18: frac18, + frac23: frac23, + frac25: frac25, + frac3: frac3, + frac34: frac34, + 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, + 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, + ic: ic, + icir: icir, + icirc: icirc, + icy: icy, + iecy: iecy, + iexc: iexc, + iexcl: iexcl, + iff: iff, + ifr: ifr, + igrav: igrav, + igrave: igrave, + 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, + iscr: iscr, + isin: isin, + isinE: isinE, + isindot: isindot, + isins: isins, + isinsv: isinsv, + isinv: isinv, + it: it, + itilde: itilde, + iukcy: iukcy, + ium: ium, + iuml: iuml, + 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, + 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, + 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, + 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, + mid: mid, + midast: midast, + midcir: midcir, + middo: middo, + middot: middot, + 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, + 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, + 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, + 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, + oast: oast, + ocir: ocir, + ocirc: ocirc, + ocy: ocy, + odash: odash, + odblac: odblac, + odiv: odiv, + odot: odot, + odsold: odsold, + oelig: oelig, + ofcir: ofcir, + ofr: ofr, + ogon: ogon, + ograv: ograv, + ograve: ograve, + 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$1, + orderof: orderof, + ordf: ordf, + ordm: ordm, + origof: origof, + oror: oror, + orslope: orslope, + orv: orv, + oscr: oscr, + oslas: oslas, + oslash: oslash, + osol: osol, + otild: otild, + otilde: otilde, + otimes: otimes, + otimesas: otimesas, + oum: oum, + ouml: ouml, + ovbar: ovbar, + par: par, + para: para, + 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, + plussim: plussim, + plustwo: plustwo, + pm: pm, + pointint: pointint, + popf: popf, + poun: poun, + pound: pound, + 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, + 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, + 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, + 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, + 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, + 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, + sup2: sup2, + sup3: sup3, + 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, + 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, + tilde: tilde, + time: time, + times: times, + 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, + uarr: uarr, + ubrcy: ubrcy, + ubreve: ubreve, + ucir: ucir, + ucirc: ucirc, + ucy: ucy, + udarr: udarr, + udblac: udblac, + udhar: udhar, + ufisht: ufisht, + ufr: ufr, + ugrav: ugrav, + ugrave: ugrave, + uharl: uharl, + uharr: uharr, + uhblk: uhblk, + ulcorn: ulcorn, + ulcorner: ulcorner, + ulcrop: ulcrop, + ultri: ultri, + umacr: umacr, + um: um, + uml: uml, + 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, + 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, + yacy: yacy, + ycirc: ycirc, + ycy: ycy, + ye: ye, + yen: yen, + yfr: yfr, + yicy: yicy, + yopf: yopf, + yscr: yscr, + yucy: yucy, + yum: yum, + yuml: yuml, + 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$2 +}); + +const AElig$1 = "Æ"; +const AMP$1 = "&"; +const Aacute$1 = "Á"; +const Acirc$1 = "Â"; +const Agrave$1 = "À"; +const Aring$1 = "Å"; +const Atilde$1 = "Ã"; +const Auml$1 = "Ä"; +const COPY$1 = "©"; +const Ccedil$1 = "Ç"; +const ETH$1 = "Ð"; +const Eacute$1 = "É"; +const Ecirc$1 = "Ê"; +const Egrave$1 = "È"; +const Euml$1 = "Ë"; +const GT$1 = ">"; +const Iacute$1 = "Í"; +const Icirc$1 = "Î"; +const Igrave$1 = "Ì"; +const Iuml$1 = "Ï"; +const LT$1 = "<"; +const Ntilde$1 = "Ñ"; +const Oacute$1 = "Ó"; +const Ocirc$1 = "Ô"; +const Ograve$1 = "Ò"; +const Oslash$1 = "Ø"; +const Otilde$1 = "Õ"; +const Ouml$1 = "Ö"; +const QUOT$1 = "\""; +const REG$1 = "®"; +const THORN$1 = "Þ"; +const Uacute$1 = "Ú"; +const Ucirc$1 = "Û"; +const Ugrave$1 = "Ù"; +const Uuml$1 = "Ü"; +const Yacute$1 = "Ý"; +const aacute$1 = "á"; +const acirc$1 = "â"; +const acute$1 = "´"; +const aelig$1 = "æ"; +const agrave$1 = "à"; +const amp$1 = "&"; +const aring$1 = "å"; +const atilde$1 = "ã"; +const auml$1 = "ä"; +const brvbar$1 = "¦"; +const ccedil$1 = "ç"; +const cedil$1 = "¸"; +const cent$1 = "¢"; +const copy$3 = "©"; +const curren$1 = "¤"; +const deg$1 = "°"; +const divide$1 = "÷"; +const eacute$1 = "é"; +const ecirc$1 = "ê"; +const egrave$1 = "è"; +const eth$1 = "ð"; +const euml$1 = "ë"; +const frac12$1 = "½"; +const frac14$1 = "¼"; +const frac34$1 = "¾"; +const gt$1 = ">"; +const iacute$1 = "í"; +const icirc$1 = "î"; +const iexcl$1 = "¡"; +const igrave$1 = "ì"; +const iquest$1 = "¿"; +const iuml$1 = "ï"; +const laquo$1 = "«"; +const lt$1 = "<"; +const macr$1 = "¯"; +const micro$1 = "µ"; +const middot$1 = "·"; +const nbsp$1 = " "; +const not$1 = "¬"; +const ntilde$1 = "ñ"; +const oacute$1 = "ó"; +const ocirc$1 = "ô"; +const ograve$1 = "ò"; +const ordf$1 = "ª"; +const ordm$1 = "º"; +const oslash$1 = "ø"; +const otilde$1 = "õ"; +const ouml$1 = "ö"; +const para$1 = "¶"; +const plusmn$1 = "±"; +const pound$1 = "£"; +const quot$1 = "\""; +const raquo$1 = "»"; +const reg$1 = "®"; +const sect$1 = "§"; +const shy$1 = "­"; +const sup1$1 = "¹"; +const sup2$1 = "²"; +const sup3$1 = "³"; +const szlig$1 = "ß"; +const thorn$1 = "þ"; +const times$1 = "×"; +const uacute$1 = "ú"; +const ucirc$1 = "û"; +const ugrave$1 = "ù"; +const uml$1 = "¨"; +const uuml$1 = "ü"; +const yacute$1 = "ý"; +const yen$1 = "¥"; +const yuml$1 = "ÿ"; +var index$3 = { + AElig: AElig$1, + AMP: AMP$1, + Aacute: Aacute$1, + Acirc: Acirc$1, + Agrave: Agrave$1, + Aring: Aring$1, + Atilde: Atilde$1, + Auml: Auml$1, + COPY: COPY$1, + Ccedil: Ccedil$1, + ETH: ETH$1, + Eacute: Eacute$1, + Ecirc: Ecirc$1, + Egrave: Egrave$1, + Euml: Euml$1, + GT: GT$1, + Iacute: Iacute$1, + Icirc: Icirc$1, + Igrave: Igrave$1, + Iuml: Iuml$1, + LT: LT$1, + Ntilde: Ntilde$1, + Oacute: Oacute$1, + Ocirc: Ocirc$1, + Ograve: Ograve$1, + Oslash: Oslash$1, + Otilde: Otilde$1, + Ouml: Ouml$1, + QUOT: QUOT$1, + REG: REG$1, + THORN: THORN$1, + Uacute: Uacute$1, + Ucirc: Ucirc$1, + Ugrave: Ugrave$1, + Uuml: Uuml$1, + Yacute: Yacute$1, + aacute: aacute$1, + acirc: acirc$1, + acute: acute$1, + aelig: aelig$1, + agrave: agrave$1, + amp: amp$1, + aring: aring$1, + atilde: atilde$1, + auml: auml$1, + brvbar: brvbar$1, + ccedil: ccedil$1, + cedil: cedil$1, + cent: cent$1, + copy: copy$3, + curren: curren$1, + deg: deg$1, + divide: divide$1, + eacute: eacute$1, + ecirc: ecirc$1, + egrave: egrave$1, + eth: eth$1, + euml: euml$1, + frac12: frac12$1, + frac14: frac14$1, + frac34: frac34$1, + gt: gt$1, + iacute: iacute$1, + icirc: icirc$1, + iexcl: iexcl$1, + igrave: igrave$1, + iquest: iquest$1, + iuml: iuml$1, + laquo: laquo$1, + lt: lt$1, + macr: macr$1, + micro: micro$1, + middot: middot$1, + nbsp: nbsp$1, + not: not$1, + ntilde: ntilde$1, + oacute: oacute$1, + ocirc: ocirc$1, + ograve: ograve$1, + ordf: ordf$1, + ordm: ordm$1, + oslash: oslash$1, + otilde: otilde$1, + ouml: ouml$1, + para: para$1, + plusmn: plusmn$1, + pound: pound$1, + quot: quot$1, + raquo: raquo$1, + reg: reg$1, + sect: sect$1, + shy: shy$1, + sup1: sup1$1, + sup2: sup2$1, + sup3: sup3$1, + szlig: szlig$1, + thorn: thorn$1, + times: times$1, + uacute: uacute$1, + ucirc: ucirc$1, + ugrave: ugrave$1, + uml: uml$1, + uuml: uuml$1, + yacute: yacute$1, + yen: yen$1, + yuml: yuml$1 +}; + +var characterEntitiesLegacy = Object.freeze({ + AElig: AElig$1, + AMP: AMP$1, + Aacute: Aacute$1, + Acirc: Acirc$1, + Agrave: Agrave$1, + Aring: Aring$1, + Atilde: Atilde$1, + Auml: Auml$1, + COPY: COPY$1, + Ccedil: Ccedil$1, + ETH: ETH$1, + Eacute: Eacute$1, + Ecirc: Ecirc$1, + Egrave: Egrave$1, + Euml: Euml$1, + GT: GT$1, + Iacute: Iacute$1, + Icirc: Icirc$1, + Igrave: Igrave$1, + Iuml: Iuml$1, + LT: LT$1, + Ntilde: Ntilde$1, + Oacute: Oacute$1, + Ocirc: Ocirc$1, + Ograve: Ograve$1, + Oslash: Oslash$1, + Otilde: Otilde$1, + Ouml: Ouml$1, + QUOT: QUOT$1, + REG: REG$1, + THORN: THORN$1, + Uacute: Uacute$1, + Ucirc: Ucirc$1, + Ugrave: Ugrave$1, + Uuml: Uuml$1, + Yacute: Yacute$1, + aacute: aacute$1, + acirc: acirc$1, + acute: acute$1, + aelig: aelig$1, + agrave: agrave$1, + amp: amp$1, + aring: aring$1, + atilde: atilde$1, + auml: auml$1, + brvbar: brvbar$1, + ccedil: ccedil$1, + cedil: cedil$1, + cent: cent$1, + copy: copy$3, + curren: curren$1, + deg: deg$1, + divide: divide$1, + eacute: eacute$1, + ecirc: ecirc$1, + egrave: egrave$1, + eth: eth$1, + euml: euml$1, + frac12: frac12$1, + frac14: frac14$1, + frac34: frac34$1, + gt: gt$1, + iacute: iacute$1, + icirc: icirc$1, + iexcl: iexcl$1, + igrave: igrave$1, + iquest: iquest$1, + iuml: iuml$1, + laquo: laquo$1, + lt: lt$1, + macr: macr$1, + micro: micro$1, + middot: middot$1, + nbsp: nbsp$1, + not: not$1, + ntilde: ntilde$1, + oacute: oacute$1, + ocirc: ocirc$1, + ograve: ograve$1, + ordf: ordf$1, + ordm: ordm$1, + oslash: oslash$1, + otilde: otilde$1, + ouml: ouml$1, + para: para$1, + plusmn: plusmn$1, + pound: pound$1, + quot: quot$1, + raquo: raquo$1, + reg: reg$1, + sect: sect$1, + shy: shy$1, + sup1: sup1$1, + sup2: sup2$1, + sup3: sup3$1, + szlig: szlig$1, + thorn: thorn$1, + times: times$1, + uacute: uacute$1, + ucirc: ucirc$1, + ugrave: ugrave$1, + uml: uml$1, + uuml: uuml$1, + yacute: yacute$1, + yen: yen$1, + yuml: yuml$1, + default: index$3 +}); + +var index$4 = { + "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": "Ÿ" +}; + +var characterReferenceInvalid = Object.freeze({ + default: index$4 +}); + +var isDecimal = decimal; + +/* 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 */ +} + +var isHexadecimal = 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 */ + ) +} + +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; + + return ( + (code >= 97 && code <= 122) /* a-z */ || + (code >= 65 && code <= 90) /* A-Z */ + ) +} + +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) +} + +var characterEntities$1 = ( characterEntities && index$2 ) || characterEntities; + +var legacy = ( characterEntitiesLegacy && index$3 ) || characterEntitiesLegacy; + +var invalid = ( characterReferenceInvalid && index$4 ) || characterReferenceInvalid; + +var parseEntities_1 = parseEntities; + +var own$3 = {}.hasOwnProperty; +var fromCharCode = String.fromCharCode; +var noop$1 = 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 = {}; + +BASE[HEXADECIMAL] = 16; +BASE[DECIMAL] = 10; + +/* 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 = {}; + +TESTS[NAMED] = isAlphanumerical; +TESTS[DECIMAL] = isDecimal; +TESTS[HEXADECIMAL] = isHexadecimal; + +/* 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; + +var MESSAGES = {}; + +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'; + +/* Wrap to ensure clean parameters are given to `parse`. */ +function parseEntities(value, options) { + var settings = {}; + var option; + var key; + + if (!options) { + options = {}; + } + + for (key in defaults) { + option = options[key]; + settings[key] = + option === null || option === undefined ? defaults[key] : option; + } + + if (settings.position.indent || settings.position.start) { + settings.indent = settings.position.indent || []; + settings.position = settings.position.start; + } + + return parse$7(value, settings) +} + +/* 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 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(); + + /* Wrap `handleWarning`. */ + warning = handleWarning ? parseError : noop$1; + + /* 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; + + /* 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); + + if (following === 'x' || following === 'X') { + /* ASCII hex digits. */ + type = HEXADECIMAL; + end = ++begin; + } else { + /* ASCII digits. */ + type = DECIMAL; + } + } + + entityCharacters = ''; + entity = ''; + characters = ''; + test = TESTS[type]; + end--; + + while (++end < length) { + following = at(end); + + if (!test(following)) { + break + } + + 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$3.call(legacy, characters)) { + entityCharacters = characters; + entity = legacy[characters]; + } + } + + terminated = at(end) === ';'; + + if (terminated) { + end++; + + if (type === NAMED && own$3.call(characterEntities$1, characters)) { + entityCharacters = characters; + entity = characterEntities$1[characters]; + } + } + + diff = 1 + end - start; + + 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; + } + + /* 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); + + if (following === '=') { + warning(reason, diff); + entity = null; + } else if (isAlphanumerical(following)) { + entity = null; + } else { + warning(reason, diff); + } + } + } + } + + reference = entity; + } else { + if (!terminated) { + /* All non-terminated numeric entities are + * not rendered, and trigger a warning. */ + warning(NUMERIC_NOT_TERMINATED, diff); + } + + /* When terminated and number, parse as + * either hexadecimal or decimal. */ + reference = parseInt(characters, BASE[type]); + + /* 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 = ''; + + /* Trigger a warning when the parsed + * number should not be used. */ + if (disallowed(reference)) { + warning(NUMERIC_DISALLOWED, diff); + } + + /* Stringify the number. */ + if (reference > 0xffff) { + reference -= 0x10000; + output += fromCharCode((reference >>> (10 & 0x3ff)) | 0xd800); + reference = 0xdc00 | (reference & 0x3ff); + } + + 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(); + + prev = now(); + index = end - 1; + column += end - start + 1; + result.push(reference); + next = now(); + next.offset++; + + if (handleReference) { + handleReference.call( + referenceContext, + reference, + {start: prev, end: next}, + value.slice(start - 1, end) + ); + } + + prev = next; + } + } + } + + /* Return the reduced nodes, and any possible warnings. */ + return result.join('') + + /* Get current position. */ + function now() { + return { + line: line, + column: column, + offset: index + (pos.offset || 0) + } + } + + /* “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); + } + + /* Get character at position. */ + function at(position) { + return value.charAt(position) + } + + /* 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()}); + } + + queue = ''; + } + } +} + +/* 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 + ) +} + +var decode$1 = factory$3; + +/* Factory to create an entity decoder. */ +function factory$3(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 = []; + + while (++line) { + if (!(line in offsets)) { + 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); + } + + /* Decode `value` (at `position`) into text-nodes. */ + function decoder(value, position, handler) { + parseEntities_1(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) { + return parseEntities_1(value, { + 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; + } + + 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; +} + +/* Construct a tokenizer. This creates both + * `tokenizeInline` and `tokenizeBlock`. */ +function factory$4(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; + + /* Trim white space only lines. */ + if (!value) { + return tokens; + } + + /* Expose on `eat`. */ + eat.now = now; + eat.file = self.file; + + /* 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. */ + while (value) { + index = -1; + length = methods.length; + matched = false; + + while (++index < length) { + name = methods[index]; + method = tokenizers[name]; + + if ( + method && + /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && + (!method.notInList || !self.inList) && + (!method.notInBlock || !self.inBlock) && + (!method.notInLink || !self.inLink) + ) { + valueLength = value.length; + + method.apply(self, [eat, value]); + + matched = valueLength !== value.length; + + if (matched) { + break; + } + } + } + + /* istanbul ignore if */ + if (!matched) { + self.file.fail(new Error('Infinite loop'), eat.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'); + + while (index !== -1) { + line++; + lastIndex = index; + index = subvalue.indexOf('\n', index + 1); + } + + if (lastIndex === -1) { + column += subvalue.length; + } else { + column = subvalue.length - lastIndex; + } + + if (line in offset) { + if (lastIndex !== -1) { + column += offset[line]; + } else if (column <= offset[line]) { + column = offset[line] + 1; + } + } + } + + /* 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 () { + var last = line + 1; + + while (pos < last) { + indentation.push((offset[pos] || 0) + 1); + + pos++; + } + + return indentation; + }; + } + + /* Get the current position. */ + function now() { + var pos = {line: line, column: column}; + + pos.offset = self.toOffset(pos); + + return pos; + } + + /* 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. */ + function validateEat(subvalue) { + /* istanbul ignore if */ + if (value.substring(0, subvalue.length) !== subvalue) { + /* Capture stack-trace. */ + self.file.fail( + new Error( + 'Incorrectly eaten value: please report this ' + + 'warning on http://git.io/vg5Ft' + ), + now() + ); + } + } + + /* Mark position and patch `node.position`. */ + function position() { + 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; + + 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 (prev && indent && prev.indent) { + combined = prev.indent; + + if (n < l) { + while (++n < l) { + combined.push((offset[n] || 0) + 1); + } + + combined.push(before.column); + } + + indent = combined.concat(indent); + } + + node.position.indent = indent || []; + + return node; + } + } + + /* 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]; + + if ( + prev && + node.type === prev.type && + node.type in MERGEABLE_NODES && + mergeable(prev) && + mergeable(node) + ) { + node = MERGEABLE_NODES[node.type].call(self, prev, node); + } + + if (node !== prev) { + children.push(node); + } + + if (self.atStart && tokens.length !== 0) { + self.exitStart(); + } + + return node; + } + + /* Remove `subvalue` from `value`. + * `subvalue` must be at the start of `value`. */ + function eat(subvalue) { + var indent = getOffset(); + var pos = position(); + var current = now(); + + validateEat(subvalue); + + apply.reset = reset; + reset.test = test; + apply.test = test; + + value = value.substring(subvalue.length); + + updatePosition(subvalue); + + indent = indent(); + + return apply; + + /* 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); + } + + /* 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); + + 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({}); + + line = current.line; + column = current.column; + value = subvalue + value; + + return result.position; + } + } + } +} + +var markdownEscapes = escapes; + +var defaults$1 = [ + '\\', + '`', + '*', + '{', + '}', + '[', + ']', + '(', + ')', + '#', + '+', + '-', + '.', + '!', + '_', + '>' +]; + +var gfm = defaults$1.concat(['~', '|']); + +var commonmark = gfm.concat([ + '\n', + '"', + '$', + '%', + '&', + "'", + ',', + '/', + ':', + ';', + '<', + '=', + '?', + '@', + '^' +]); + +escapes.default = defaults$1; +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$1 +} + +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$16 = ( blockElements$1 && blockElements ) || blockElements$1; + +var defaults$2 = { + position: true, + gfm: true, + commonmark: false, + footnotes: false, + pedantic: false, + blocks: require$$0$16 +}; + +var setOptions_1 = 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 = immutable(options); + } else { + throw new Error( + 'Invalid value `' + options + '` ' + + 'for setting `options`' + ); + } + + for (key in defaults$2) { + value = options[key]; + + if (value == null) { + value = current[key]; + } + + if ( + (key !== 'blocks' && typeof value !== 'boolean') || + (key === 'blocks' && typeof value !== 'object') + ) { + throw new Error('Invalid value `' + value + '` for setting `options.' + key + '`'); + } + + options[key] = value; + } + + self.options = options; + self.escape = markdownEscapes(options); + + return self; +} + +/* eslint-disable max-params */ + +/* Expose. */ +var unistUtilIs = 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); + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(null, parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok$1 + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = []; + var length = tests.length; + var index = -1; + + while (++index < length) { + results[index] = convert(tests[index]); + } + + return results +} + +/* Utility assert each property in `test` is represented + * in `node`, and each values are strictly equal. */ +function matchesFactory(test) { + return matches + + function matches(node) { + var key; + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests); + var length = checks.length; + + return matches + + function matches() { + var index = -1; + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +/* Utility to convert a string into a function which checks + * a given node’s type for said string. */ +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 C_NEWLINE = '\n'; +var EXPRESSION_LINE_BREAKS = /\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(EXPRESSION_LINE_BREAKS, C_NEWLINE); + + 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 node; +} + +var isWhitespaceCharacter = whitespace; + +var fromCode = String.fromCharCode; +var re$1 = /\s/; + +/* 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; + +/* Tokenise newline. */ +function newline(eat, value, silent) { + var character = value.charAt(0); + var length; + var subvalue; + var queue; + var index; + + if (character !== '\n') { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + index = 1; + length = value.length; + subvalue = character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + queue += character; + + if (character === '\n') { + subvalue += queue; + queue = ''; + } + + index++; + } + + eat(subvalue); +} + +var trimTrailingLines_1 = trimTrailingLines; + +var line = '\n'; + +/* Remove final newline characters from `value`. */ +function trimTrailingLines(value) { + var val = String(value); + var index = val.length; + + while (val.charAt(--index) === line) { + /* Empty */ + } + + return val.slice(0, index + 1) +} + +var codeIndented = indentedCode; + +var C_NEWLINE$1 = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; + +var CODE_INDENT_COUNT = 4; +var CODE_INDENT = repeatString(C_SPACE, CODE_INDENT_COUNT); + +/* Tokenise indented code. */ +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; + + while (++index < length) { + character = value.charAt(index); + + if (indent) { + indent = false; + + subvalue += subvalueQueue; + content += contentQueue; + subvalueQueue = ''; + contentQueue = ''; + + if (character === C_NEWLINE$1) { + subvalueQueue = character; + contentQueue = character; + } else { + subvalue += character; + content += character; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE$1) { + contentQueue = character; + subvalueQueue = character; + break; + } + + subvalue += character; + content += character; + } + } + } else if ( + character === C_SPACE && + value.charAt(index + 1) === character && + value.charAt(index + 2) === character && + value.charAt(index + 3) === character + ) { + subvalueQueue += CODE_INDENT; + index += 3; + indent = true; + } else if (character === C_TAB) { + subvalueQueue += character; + indent = true; + } else { + blankQueue = ''; + + while (character === C_TAB || character === C_SPACE) { + blankQueue += character; + character = value.charAt(++index); + } + + if (character !== C_NEWLINE$1) { + break; + } + + subvalueQueue += blankQueue + character; + contentQueue += character; + } + } + + if (content) { + if (silent) { + return true; + } + + return eat(subvalue)({ + type: 'code', + lang: 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 MIN_FENCE_COUNT = 3; +var CODE_INDENT_COUNT$1 = 4; + +function fencedCode(eat, value, silent) { + var self = this; + var settings = self.options; + var length = value.length + 1; + var index = 0; + var subvalue = ''; + var fenceCount; + var marker; + var character; + var flag; + var queue; + var content; + var exdentedContent; + var closing; + var exdentedClosing; + var indent; + var now; + + if (!settings.gfm) { + return; + } + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$1 && character !== C_TAB$1) { + break; + } + + subvalue += character; + index++; + } + + indent = index; + + /* Eat the fence. */ + character = value.charAt(index); + + if (character !== C_TILDE && character !== C_TICK) { + return; + } + + index++; + marker = character; + fenceCount = 1; + subvalue += character; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + subvalue += character; + fenceCount++; + index++; + } + + if (fenceCount < MIN_FENCE_COUNT) { + return; + } + + /* Eat spacing before flag. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$1 && character !== C_TAB$1) { + break; + } + + subvalue += character; + index++; + } + + /* Eat flag. */ + flag = ''; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character === C_NEWLINE$2 || + character === C_TILDE || + character === C_TICK + ) { + break; + } + + if (character === C_SPACE$1 || character === C_TAB$1) { + queue += character; + } else { + flag += queue + character; + queue = ''; + } + + index++; + } + + character = value.charAt(index); + + if (character && character !== C_NEWLINE$2) { + return; + } + + if (silent) { + return true; + } + + now = eat.now(); + now.column += subvalue.length; + now.offset += subvalue.length; + + subvalue += flag; + flag = self.decode.raw(self.unescape(flag), now); + + if (queue) { + subvalue += queue; + } + + queue = ''; + closing = ''; + exdentedClosing = ''; + content = ''; + exdentedContent = ''; + + /* Eat content. */ + while (index < length) { + character = value.charAt(index); + content += closing; + exdentedContent += exdentedClosing; + closing = ''; + exdentedClosing = ''; + + if (character !== C_NEWLINE$2) { + 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; + } else { + subvalue += character; + } + + queue = ''; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$1) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue.slice(indent); + + if (queue.length >= CODE_INDENT_COUNT$1) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue; + + if (queue.length < fenceCount) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$1 && character !== C_TAB$1) { + break; + } + + closing += character; + exdentedClosing += character; + index++; + } + + if (!character || character === C_NEWLINE$2) { + break; + } + } + + subvalue += content + closing; + + return eat(subvalue)({ + type: 'code', + lang: flag || null, + value: trimTrailingLines_1(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 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 (ignore) { + continue; + } + + if (tokenizers[fn].apply(ctx, params)) { + return true; + } + } + + return false; +} + +var blockquote_1 = blockquote; + +var C_NEWLINE$3 = '\n'; +var C_TAB$2 = '\t'; +var C_SPACE$2 = ' '; +var C_GT = '>'; + +/* Tokenise a blockquote. */ +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; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$2 && character !== C_TAB$2) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_GT) { + return; + } + + if (silent) { + return true; + } + + index = 0; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE$3, index); + startIndex = index; + prefixed = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$2 && character !== C_TAB$2) { + break; + } + + index++; + } + + if (value.charAt(index) === C_GT) { + index++; + prefixed = true; + + if (value.charAt(index) === C_SPACE$2) { + index++; + } + } else { + index = startIndex; + } + + content = value.slice(index, nextIndex); + + if (!prefixed && !trim_1(content)) { + index = startIndex; + break; + } + + if (!prefixed) { + rest = value.slice(index); + + /* Check if the following code contains a possible + * block. */ + if (interrupt_1(interruptors, tokenizers, self, [eat, rest, true])) { + break; + } + } + + line = startIndex === index ? content : value.slice(startIndex, nextIndex); + + indents.push(index - startIndex); + values.push(line); + contents.push(content); + + index = nextIndex + 1; + } + + index = -1; + length = indents.length; + add = eat(values.join(C_NEWLINE$3)); + + while (++index < length) { + offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; + currentLine++; + } + + exit = self.enterBlock(); + contents = self.tokenizeBlock(contents.join(C_NEWLINE$3), now); + exit(); + + 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 MAX_ATX_COUNT = 6; + +function atxHeading(eat, value, silent) { + var self = this; + var settings = self.options; + 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); + + if (character !== C_SPACE$3 && character !== C_TAB$3) { + index--; + break; + } + + subvalue += character; + } + + /* Eat hashes. */ + depth = 0; + + while (++index <= length) { + character = value.charAt(index); + + if (character !== C_HASH) { + index--; + break; + } + + subvalue += character; + depth++; + } + + if (depth > MAX_ATX_COUNT) { + return; + } + + if ( + !depth || + (!settings.pedantic && value.charAt(index + 1) === C_HASH) + ) { + return; + } + + length = value.length + 1; + + /* Eat intermediate white-space. */ + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$3 && character !== C_TAB$3) { + index--; + break; + } + + queue += character; + } + + /* Exit when not in pedantic mode without spacing. */ + if ( + !settings.pedantic && + queue.length === 0 && + character && + character !== C_NEWLINE$4 + ) { + return; + } + + if (silent) { + return true; + } + + /* Eat content. */ + subvalue += queue; + queue = ''; + content = ''; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE$4) { + break; + } + + if ( + character !== C_SPACE$3 && + character !== C_TAB$3 && + character !== C_HASH + ) { + content += queue + character; + queue = ''; + continue; + } + + while (character === C_SPACE$3 || character === C_TAB$3) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_HASH) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_SPACE$3 || character === C_TAB$3) { + queue += character; + character = value.charAt(++index); + } + + index--; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + subvalue += content + queue; + + return eat(subvalue)({ + 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 THEMATIC_BREAK_MARKER_COUNT = 3; + +function thematicBreak(eat, value, silent) { + 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); + + if (character !== C_TAB$4 && character !== C_SPACE$4) { + break; + } + + subvalue += character; + } + + if ( + character !== C_ASTERISK && + character !== C_DASH && + character !== C_UNDERSCORE + ) { + return; + } + + marker = character; + subvalue += character; + markerCount = 1; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === marker) { + markerCount++; + subvalue += queue + marker; + queue = ''; + } else if (character === C_SPACE$4) { + queue += character; + } else if ( + markerCount >= THEMATIC_BREAK_MARKER_COUNT && + (!character || character === C_NEWLINE$5) + ) { + subvalue += queue; + + if (silent) { + return true; + } + + return eat(subvalue)({type: 'thematicBreak'}); + } else { + return; + } + } +} + +var getIndentation = indentation; + +/* Map of characters, and their column length, + * which can be used as indentation. */ +var characters = {' ': 1, '\t': 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 in characters) { + size = characters[character]; + + 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 C_SPACE$5 = ' '; +var C_NEWLINE$6 = '\n'; +var C_TAB$5 = '\t'; + +/* 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 position = values.length + 1; + var minIndent = Infinity; + var matrix = []; + var index; + var indentation; + var stops; + var padding; + + values.unshift(repeatString(C_SPACE$5, maximum) + '!'); + + 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 = C_TAB$5; + } else { + padding = ''; + } + + values[position] = padding + values[position].slice( + index in stops ? stops[index] + 1 : 0 + ); + } + } + + values.shift(); + + return values.join(C_NEWLINE$6); +} + +/* eslint-disable max-params */ + + + + + + + + +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; + +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 markers; + 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 isLoose; + var node; + var now; + var end; + var indented; + + while (index < length) { + character = value.charAt(index); + + if (character === C_TAB$6) { + size += TAB_SIZE - (size % TAB_SIZE); + } else if (character === C_SPACE$6) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + return; + } + + character = value.charAt(index); + + markers = commonmark ? + LIST_ORDERED_COMMONMARK_MARKERS : + LIST_ORDERED_MARKERS; + + if (LIST_UNORDERED_MARKERS[character] === true) { + marker = character; + ordered = false; + } else { + ordered = true; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!isDecimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || markers[character] !== true) { + return; + } + + start = parseInt(queue, 10); + marker = character; + } + + character = value.charAt(++index); + + if (character !== C_SPACE$6 && character !== C_TAB$6) { + return; + } + + if (silent) { + return true; + } + + index = 0; + items = []; + allLines = []; + emptyLines = []; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE$7, index); + startIndex = index; + prefixed = false; + indented = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + end = index + TAB_SIZE; + 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) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + indented = true; + } + + if (item && size >= item.indent) { + indented = true; + } + + character = value.charAt(index); + currentMarker = null; + + if (!indented) { + if (LIST_UNORDERED_MARKERS[character] === true) { + currentMarker = character; + index++; + size++; + } else { + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!isDecimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + index++; + + if (queue && markers[character] === true) { + currentMarker = character; + size += queue.length + 1; + } + } + + if (currentMarker) { + character = value.charAt(index); + + if (character === C_TAB$6) { + size += TAB_SIZE - (size % TAB_SIZE); + index++; + } else if (character === C_SPACE$6) { + end = index + TAB_SIZE; + + while (index < end) { + if (value.charAt(index) !== C_SPACE$6) { + break; + } + + index++; + size++; + } + + if (index === end && value.charAt(index) === C_SPACE$6) { + index -= TAB_SIZE - 1; + size -= TAB_SIZE - 1; + } + } else if (character !== C_NEWLINE$7 && character !== '') { + currentMarker = null; + } + } + } + + if (currentMarker) { + if (!pedantic && marker !== currentMarker) { + break; + } + + prefixed = true; + } else { + if (!commonmark && !indented && value.charAt(startIndex) === C_SPACE$6) { + indented = true; + } else if (commonmark && item) { + indented = size >= item.indent || size > TAB_SIZE; + } + + prefixed = false; + index = startIndex; + } + + line = value.slice(startIndex, nextIndex); + content = startIndex === index ? line : value.slice(index, nextIndex); + + if ( + currentMarker === C_ASTERISK$1 || + currentMarker === C_UNDERSCORE$1 || + currentMarker === C_DASH$1 + ) { + if (tokenizers.thematicBreak.call(self, eat, line, true)) { + break; + } + } + + prevEmpty = empty; + empty = !trim_1(content).length; + + if (indented && item) { + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (prefixed) { + if (emptyLines.length !== 0) { + item.value.push(''); + item.trail = emptyLines.concat(); + } + + item = { + value: [line], + indent: size, + trail: [] + }; + + items.push(item); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (empty) { + if (prevEmpty) { + break; + } + + emptyLines.push(line); + } else { + if (prevEmpty) { + break; + } + + if (interrupt_1(interuptors, tokenizers, self, [eat, line, true])) { + break; + } + + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } + + index = nextIndex + 1; + } + + node = eat(allLines.join(C_NEWLINE$7)).reset({ + type: 'list', + ordered: ordered, + start: start, + loose: null, + 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); + now = eat.now(); + + item = eat(item)(listItem(self, item, now), node); + + if (item.loose) { + isLoose = true; + } + + item = items[index].trail.join(C_NEWLINE$7); + + if (index !== length - 1) { + item += C_NEWLINE$7; + } + + eat(item); + } + + enterTop(); + exitBlockquote(); + + node.loose = isLoose; + + 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; + + value = fn.apply(null, arguments); + + if (ctx.options.gfm) { + task = value.match(EXPRESSION_TASK_ITEM); + + if (task) { + indent = task[0].length; + checked = task[1].toLowerCase() === C_X_LOWER; + offsets[position.line] += indent; + value = value.slice(indent); + } + } + + return { + type: 'listItem', + loose: EXPRESSION_LOOSE_LIST_ITEM.test(value) || + value.charAt(value.length - 1) === C_NEWLINE$7, + checked: checked, + children: ctx.tokenizeBlock(value, position) + }; +} + +/* 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); + + /* The initial line was also matched by the below, so + * we reset the `line`. */ + line = position.line; + + return value.replace(EXPRESSION_INITIAL_INDENT, 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++; + + return ''; + } +} + +/* 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; + + /* Remove the list-item’s bullet. */ + value = value.replace(EXPRESSION_BULLET, replacer); + + lines = value.split(C_NEWLINE$7); + + trimmedLines = removeIndentation(value, getIndentation(max).indent).split(C_NEWLINE$7); + + /* 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; + line++; + + index = 0; + length = lines.length; + + while (++index < length) { + offsets[line] = (offsets[line] || 0) + + lines[index].length - trimmedLines[index].length; + line++; + } + + return trimmedLines.join(C_NEWLINE$7); + + 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. */ + if (Number($2) < 10 && bullet.length % 2 === 1) { + $2 = C_SPACE$6 + $2; + } + + max = $1 + repeatString(C_SPACE$6, $2.length) + $3; + + 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; + +/* Map of characters which can be used to mark setext + * headers, mapping to their corresponding depth. */ +var SETEXT_MARKERS = {}; + +SETEXT_MARKERS[C_EQUALS] = 1; +SETEXT_MARKERS[C_DASH$2] = 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; + + /* Eat initial indentation. */ + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$7 || index >= MAX_HEADING_INDENT) { + index--; + break; + } + + subvalue += character; + } + + /* Eat content. */ + content = ''; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE$8) { + index--; + break; + } + + if (character === C_SPACE$7 || character === C_TAB$7) { + queue += character; + } else { + content += queue + character; + 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); + + if (character !== C_NEWLINE$8 || !SETEXT_MARKERS[marker]) { + return; + } + + subvalue += character; + + /* Eat Setext-line. */ + queue = marker; + depth = SETEXT_MARKERS[marker]; + + while (++index < length) { + character = value.charAt(index); + + if (character !== marker) { + if (character !== C_NEWLINE$8) { + return; + } + + index--; + break; + } + + queue += character; + } + + if (silent) { + 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 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 + ')'); + +var tag = new RegExp('^(?:' + + openTag + '|' + + closeTag + '|' + + comment + '|' + + processing + '|' + + declaration + '|' + + cdata + +')'); + +var html = { + openCloseTag: openCloseTag, + tag: tag +}; + +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 self = this; + var blocks = self.options.blocks; + var length = value.length; + var index = 0; + var next; + var line; + var offset; + var character; + var count; + var sequence; + 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] + ]; + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB$8 && character !== C_SPACE$8) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_LT) { + return; + } + + next = value.indexOf(C_NEWLINE$9, 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]; + break; + } + } + + if (!sequence) { + return; + } + + if (silent) { + return sequence[2]; + } + + index = next; + + if (!sequence[1].test(line)) { + while (index < length) { + next = value.indexOf(C_NEWLINE$9, index + 1); + next = next === -1 ? length : next; + line = value.slice(index + 1, next); + + if (sequence[1].test(line)) { + if (line) { + index = next; + } + + break; + } + + index = next; + } + } + + 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, ' ') +} + +var normalize_1 = normalize$2; + +/* 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 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 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; + + if (!self.options.footnotes) { + return; + } + + index = 0; + length = value.length; + subvalue = ''; + now = eat.now(); + currentLine = now.line; + + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + subvalue += character; + index++; + } + + if ( + value.charAt(index) !== C_BRACKET_OPEN || + value.charAt(index + 1) !== C_CARET + ) { + return; + } + + subvalue += C_BRACKET_OPEN + C_CARET; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + break; + } else if (character === C_BACKSLASH) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE || + value.charAt(index + 1) !== C_COLON + ) { + return; + } + + if (silent) { + return true; + } + + identifier = normalize_1(queue); + subvalue += queue + C_BRACKET_CLOSE + C_COLON; + index = subvalue.length; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB$9 && character !== C_SPACE$9) { + break; + } + + subvalue += character; + index++; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + queue = ''; + content = ''; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE$10) { + subqueue = character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_NEWLINE$10) { + break; + } + + subqueue += character; + index++; + } + + queue += subqueue; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$9) { + break; + } + + subqueue += character; + index++; + } + + if (subqueue.length === 0) { + break; + } + + queue += subqueue; + } + + if (queue) { + content += queue; + queue = ''; + } + + content += character; + index++; + } + + subvalue += content; + + content = content.replace(EXPRESSION_INITIAL_TAB, function (line) { + offsets[currentLine] = (offsets[currentLine] || 0) + line.length; + currentLine++; + + return ''; + }); + + add = eat(subvalue); + + exit = self.enterBlock(); + content = self.tokenizeBlock(content, now); + exit(); + + return add({ + type: 'footnoteDefinition', + identifier: 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 = '>'; + +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; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE$10 && character !== C_TAB$10) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (character !== C_BRACKET_OPEN$1) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE$1) { + break; + } else if (character === C_BACKSLASH$1) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE$1 || + value.charAt(index + 1) !== C_COLON$1 + ) { + return; + } + + identifier = queue; + subvalue += queue + C_BRACKET_CLOSE$1 + C_COLON$1; + 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; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + queue = ''; + beforeURL = subvalue; + + if (character === C_LT$1) { + index++; + + while (index < length) { + character = value.charAt(index); + + if (!isEnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character === isEnclosedURLCharacter.delimiter) { + subvalue += C_LT$1 + queue + character; + index++; + } else { + if (commonmark) { + return; + } + + index -= queue.length + 1; + queue = ''; + } + } + + if (!queue) { + while (index < length) { + character = value.charAt(index); + + if (!isUnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + subvalue += queue; + } + + if (!queue) { + return; + } + + url = queue; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character !== C_TAB$10 && + character !== C_SPACE$10 && + character !== C_NEWLINE$11 + ) { + break; + } + + queue += character; + index++; + } + + 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 (!test) { + queue = ''; + index = subvalue.length; + } else if (queue) { + subvalue += queue + character; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === test) { + break; + } + + if (character === C_NEWLINE$11) { + index++; + character = value.charAt(index); + + if (character === C_NEWLINE$11 || character === test) { + return; + } + + queue += C_NEWLINE$11; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character !== test) { + return; + } + + beforeTitle = subvalue; + subvalue += queue + character; + index++; + title = queue; + queue = ''; + } else { + return; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB$10 && character !== C_SPACE$10) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (!character || character === C_NEWLINE$11) { + if (silent) { + return true; + } + + beforeURL = eat(beforeURL).test().end; + url = self.decode.raw(self.unescape(url), beforeURL); + + if (title) { + beforeTitle = eat(beforeTitle).test().end; + title = self.decode.raw(self.unescape(title), beforeTitle); + } + + return eat(subvalue)({ + type: 'definition', + identifier: normalize_1(identifier), + title: title || null, + url: url + }); + } +} + +/* 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; +} + +isEnclosedURLCharacter.delimiter = C_GT$1; + +/* 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); +} + +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 MIN_TABLE_COLUMNS = 1; +var MIN_TABLE_ROWS = 2; + +var TABLE_ALIGN_LEFT = 'left'; +var TABLE_ALIGN_CENTER = 'center'; +var TABLE_ALIGN_RIGHT = 'right'; +var TABLE_ALIGN_NONE = null; + +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; + + /* Exit when not in gfm-mode. */ + if (!self.options.gfm) { + 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. */ + 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); + + if (lineIndex === -1) { + lineIndex = value.length; + } + + if (pipeIndex === -1 || pipeIndex > lineIndex) { + if (lineCount < MIN_TABLE_ROWS) { + return; + } + + break; + } + + lines.push(value.slice(index, lineIndex)); + lineCount++; + index = lineIndex + 1; + } + + /* Parse the alignment row. */ + subvalue = lines.join(C_NEWLINE$12); + alignments = lines.splice(1, 1)[0] || []; + index = 0; + length = alignments.length; + lineCount--; + alignment = false; + align = []; + + while (index < length) { + character = alignments.charAt(index); + + if (character === C_PIPE) { + hasDash = null; + + if (alignment === false) { + if (first === false) { + return; + } + } else { + align.push(alignment); + alignment = false; + } + + first = false; + } else if (character === C_DASH$3) { + 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; + } else { + alignment = TABLE_ALIGN_LEFT; + } + } else if (!isWhitespaceCharacter(character)) { + return; + } + + index++; + } + + if (alignment !== false) { + align.push(alignment); + } + + /* Exit when without enough columns. */ + if (align.length < MIN_TABLE_COLUMNS) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + /* Parse the rows. */ + position = -1; + 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. */ + if (position) { + eat(C_NEWLINE$12); + } + + /* Eat the row. */ + eat(line).reset(row, table); + + length = line.length + 1; + index = 0; + queue = ''; + cell = ''; + preamble = true; + count = null; + opening = null; + + while (index < length) { + character = line.charAt(index); + + if (character === C_TAB$11 || character === C_SPACE$11) { + if (cell) { + queue += character; + } else { + eat(character); + } + + index++; + continue; + } + + if (character === '' || character === C_PIPE) { + if (preamble) { + eat(character); + } else { + if (character && opening) { + queue += character; + index++; + continue; + } + + if ((cell || character) && !preamble) { + subvalue = cell; + + if (queue.length > 1) { + if (character) { + subvalue += queue.slice(0, queue.length - 1); + queue = queue.charAt(queue.length - 1); + } else { + subvalue += queue; + queue = ''; + } + } + + now = eat.now(); + + eat(subvalue)({ + type: 'tableCell', + children: self.tokenizeInline(cell, now) + }, row); + } + + eat(queue + character); + + queue = ''; + cell = ''; + } + } else { + if (queue) { + cell += queue; + queue = ''; + } + + cell += character; + + if (character === C_BACKSLASH$2 && index !== length - 2) { + cell += line.charAt(index + 1); + index++; + } + + if (character === C_TICK$1) { + count = 1; + + while (line.charAt(index + 1) === character) { + cell += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } + } + + preamble = false; + index++; + } + + /* Eat the alignment row. */ + if (!position) { + eat(C_NEWLINE$12 + alignments); + } + } + + return table; +} + +var paragraph_1 = paragraph; + +var C_NEWLINE$13 = '\n'; +var C_TAB$12 = '\t'; +var C_SPACE$12 = ' '; + +var TAB_SIZE$1 = 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(C_NEWLINE$13); + 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; + break; + } + + /* Stop if the next character is NEWLINE. */ + if (value.charAt(index + 1) === C_NEWLINE$13) { + break; + } + + /* In commonmark-mode, following indented lines + * are part of the paragraph. */ + if (commonmark) { + size = 0; + position = index + 1; + + while (position < length) { + character = value.charAt(position); + + if (character === C_TAB$12) { + size = TAB_SIZE$1; + break; + } else if (character === C_SPACE$12) { + size++; + } else { + break; + } + + position++; + } + + if (size >= TAB_SIZE$1) { + index = value.indexOf(C_NEWLINE$13, index + 1); + continue; + } + } + + subvalue = value.slice(index + 1); + + /* Check if the following code contains a possible + * block. */ + if (interrupt_1(interruptors, tokenizers, self, [eat, subvalue, true])) { + 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. */ + if ( + tokenizers.list.call(self, eat, subvalue, true) && + ( + self.inList || + commonmark || + (gfm && !isDecimal(trim_1.left(subvalue).charAt(0))) + ) + ) { + break; + } + + position = index; + index = value.indexOf(C_NEWLINE$13, index + 1); + + if (index !== -1 && trim_1(value.slice(position, index)) === '') { + index = position; + break; + } + } + + subvalue = value.slice(0, index); + + if (trim_1(subvalue) === '') { + eat(subvalue); + + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + subvalue = trimTrailingLines_1(subvalue); + + return eat(subvalue)({ + type: 'paragraph', + children: self.tokenizeInline(subvalue, now) + }); +} + +var _escape = locate; + +function locate(value, fromIndex) { + return value.indexOf('\\', fromIndex); +} + +var _escape$2 = escape; +escape.locator = _escape; + +function escape(eat, value, silent) { + var self = this; + var character; + var node; + + if (value.charAt(0) === '\\') { + character = value.charAt(1); + + if (self.escape.indexOf(character) !== -1) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (character === '\n') { + node = {type: 'break'}; + } else { + node = { + type: 'text', + value: character + }; + } + + return eat('\\' + character)(node); + } + } +} + +var tag$1 = locate$2; + +function locate$2(value, 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; + +/* Tokenise a link. */ +function autoLink(eat, value, silent) { + var self; + var subvalue; + var length; + var index; + var queue; + var character; + var hasAtCharacter; + var link; + var now; + var content; + var tokenize; + var exit; + + if (value.charAt(0) !== C_LT$2) { + return; + } + + self = this; + subvalue = ''; + length = value.length; + index = 0; + queue = ''; + hasAtCharacter = false; + link = ''; + + index++; + subvalue = C_LT$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) + ) { + break; + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + link += queue; + queue = ''; + + character = value.charAt(index); + link += character; + index++; + + if (character === C_AT_SIGN) { + hasAtCharacter = true; + } else { + if ( + character !== ':' || + value.charAt(index + 1) !== C_SLASH + ) { + return; + } + + link += C_SLASH; + index++; + } + + while (index < length) { + character = value.charAt(index); + + if (isWhitespaceCharacter(character) || character === C_GT$2) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || character !== C_GT$2) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + link += queue; + content = link; + subvalue += link + character; + now = eat.now(); + now.column++; + 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; + } else { + link = MAILTO + link; + } + } + + /* Temporarily remove support for escapes in autolinks. */ + tokenize = self.inlineTokenizers.escape; + self.inlineTokenizers.escape = null; + exit = self.enterLink(); + + content = self.tokenizeInline(content, now); + + self.inlineTokenizers.escape = tokenize; + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: parseEntities_1(link), + 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; + } + + while (++index < length) { + position = value.indexOf(PROTOCOLS[index], fromIndex); + + if (position !== -1 && (position < min || min === -1)) { + min = position; + } + } + + 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 PROTOCOLS_LENGTH = PROTOCOLS$1.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 exit; + + if (!self.options.gfm) { + return; + } + + subvalue = ''; + index = -1; + length = PROTOCOLS_LENGTH; + + while (++index < length) { + protocol = PROTOCOLS$1[index]; + match = value.slice(0, protocol.length); + + if (match.toLowerCase() === protocol) { + subvalue = match; + break; + } + } + + if (!subvalue) { + return; + } + + index = subvalue.length; + length = value.length; + queue = ''; + parenCount = 0; + + while (index < length) { + character = value.charAt(index); + + if (isWhitespaceCharacter(character) || character === C_LT$3) { + break; + } + + if ( + character === '.' || + character === ',' || + character === ':' || + character === ';' || + character === '"' || + character === '\'' || + character === ')' || + character === ']' + ) { + nextCharacter = value.charAt(index + 1); + + if (!nextCharacter || isWhitespaceCharacter(nextCharacter)) { + break; + } + } + + if (character === C_PAREN_OPEN$1 || character === C_BRACKET_OPEN$2) { + parenCount++; + } + + if (character === C_PAREN_CLOSE$2 || character === C_BRACKET_CLOSE$2) { + parenCount--; + + if (parenCount < 0) { + break; + } + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + subvalue += queue; + content = subvalue; + + if (protocol === MAILTO_PROTOCOL) { + position = queue.indexOf(C_AT_SIGN$1); + + if (position === -1 || position === length - 1) { + return; + } + + content = content.substr(MAILTO_PROTOCOL.length); + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + exit = self.enterLink(); + content = self.tokenizeInline(content, eat.now()); + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: parseEntities_1(subvalue), + children: content + }); +} + +var tag$3 = html.tag; + +var htmlInline = inlineHTML; +inlineHTML.locator = tag$1; + +var EXPRESSION_HTML_LINK_OPEN = /^/i; + +function inlineHTML(eat, value, silent) { + var self = this; + var length = value.length; + var character; + var subvalue; + + if (value.charAt(0) !== '<' || length < 3) { + return; + } + + character = value.charAt(1); + + if ( + !isAlphabetical(character) && + character !== '?' && + character !== '!' && + character !== '/' + ) { + return; + } + + subvalue = value.match(tag$3); + + if (!subvalue) { + return; + } + + /* istanbul ignore if - not used yet. */ + if (silent) { + return true; + } + + subvalue = subvalue[0]; + + if (!self.inLink && EXPRESSION_HTML_LINK_OPEN.test(subvalue)) { + self.inLink = true; + } else if (self.inLink && EXPRESSION_HTML_LINK_CLOSE.test(subvalue)) { + 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 own$4 = {}.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; + +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 markers; + 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 === '!') { + isImage = true; + subvalue = character; + character = value.charAt(++index); + } + + /* Eat the opening. */ + if (character !== C_BRACKET_OPEN$3) { + return; + } + + /* Exit when this is a link and we’re already inside + * a link. */ + if (!isImage && self.inLink) { + return; + } + + subvalue += character; + queue = ''; + index++; + + /* Eat the content. */ + length = value.length; + now = eat.now(); + depth = 0; + + now.column += index; + now.offset += index; + + while (index < length) { + character = value.charAt(index); + subqueue = character; + + if (character === C_TICK$2) { + /* Inline-code in link content. */ + count = 1; + + while (value.charAt(index + 1) === C_TICK$2) { + subqueue += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } else if (character === C_BACKSLASH$3) { + /* 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) { + depth++; + } else if ((!opening || gfm) && character === C_BRACKET_CLOSE$3) { + if (depth) { + depth--; + } else { + /* Allow white-space between content and + * url in GFM mode. */ + if (!pedantic) { + while (index < length) { + character = value.charAt(index + 1); + + if (!isWhitespaceCharacter(character)) { + break; + } + + subqueue += character; + index++; + } + } + + if (value.charAt(index + 1) !== C_PAREN_OPEN$2) { + return; + } + + subqueue += C_PAREN_OPEN$2; + closed = true; + index++; + + break; + } + } + + queue += subqueue; + subqueue = ''; + index++; + } + + /* Eat the content closing. */ + if (!closed) { + return; + } + + content = queue; + subvalue += queue + subqueue; + index++; + + /* Eat white-space. */ + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + subvalue += character; + index++; + } + + /* Eat the URL. */ + character = value.charAt(index); + markers = commonmark ? COMMONMARK_LINK_MARKERS : LINK_MARKERS; + queue = ''; + beforeURL = subvalue; + + if (character === C_LT$4) { + index++; + beforeURL += C_LT$4; + + while (index < length) { + character = value.charAt(index); + + if (character === C_GT$3) { + break; + } + + if (commonmark && character === '\n') { + return; + } + + queue += character; + index++; + } + + if (value.charAt(index) !== C_GT$3) { + return; + } + + subvalue += C_LT$4 + queue + C_GT$3; + url = queue; + index++; + } else { + character = null; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (subqueue && own$4.call(markers, character)) { + break; + } + + if (isWhitespaceCharacter(character)) { + if (!pedantic) { + break; + } + + subqueue += character; + } else { + if (character === C_PAREN_OPEN$2) { + depth++; + } else if (character === C_PAREN_CLOSE$3) { + if (depth === 0) { + break; + } + + depth--; + } + + queue += subqueue; + subqueue = ''; + + if (character === C_BACKSLASH$3) { + queue += C_BACKSLASH$3; + character = value.charAt(++index); + } + + queue += character; + } + + index++; + } + + subvalue += queue; + url = queue; + index = subvalue.length; + } + + /* Eat white-space. */ + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + subvalue += queue; + + /* Eat the title. */ + if (queue && own$4.call(markers, character)) { + index++; + subvalue += character; + queue = ''; + marker = markers[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); + + if (character === marker) { + break; + } + + if (character === C_BACKSLASH$3) { + queue += C_BACKSLASH$3; + character = value.charAt(++index); + } + + index++; + queue += character; + } + + character = value.charAt(index); + + if (character !== marker) { + return; + } + + title = queue; + subvalue += queue + character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + subvalue += character; + index++; + } + } else { + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === marker) { + if (hasMarker) { + queue += marker + subqueue; + subqueue = ''; + } + + hasMarker = true; + } else if (!hasMarker) { + queue += character; + } else if (character === C_PAREN_CLOSE$3) { + subvalue += queue + marker + subqueue; + title = queue; + break; + } else if (isWhitespaceCharacter(character)) { + subqueue += character; + } else { + queue += marker + subqueue + character; + subqueue = ''; + hasMarker = false; + } + + index++; + } + } + } + + if (value.charAt(index) !== C_PAREN_CLOSE$3) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + subvalue += C_PAREN_CLOSE$3; + + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end); + + if (title) { + 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; + } else { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } + + 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 = ']'; + +function reference(eat, value, silent) { + var self = this; + 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 content; + var identifier; + var now; + var node; + var exit; + var queue; + var bracketed; + var depth; + + /* Check whether we’re eating an image. */ + if (character === '!') { + type = T_IMAGE; + intro = character; + character = value.charAt(++index); + } + + if (character !== C_BRACKET_OPEN$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; + index++; + type = T_FOOTNOTE; + } + + /* Eat the text. */ + depth = 0; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN$4) { + bracketed = true; + depth++; + } else if (character === C_BRACKET_CLOSE$4) { + if (!depth) { + break; + } + + depth--; + } + + if (character === C_BACKSLASH$4) { + queue += C_BACKSLASH$4; + character = value.charAt(++index); + } + + queue += character; + index++; + } + + subvalue = queue; + content = queue; + character = value.charAt(index); + + if (character !== C_BRACKET_CLOSE$4) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!isWhitespaceCharacter(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + /* Inline footnotes cannot have an identifier. */ + if (type !== T_FOOTNOTE && character === C_BRACKET_OPEN$4) { + identifier = ''; + queue += character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN$4 || character === C_BRACKET_CLOSE$4) { + break; + } + + if (character === C_BACKSLASH$4) { + identifier += C_BACKSLASH$4; + character = value.charAt(++index); + } + + identifier += character; + index++; + } + + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE$4) { + referenceType = identifier ? REFERENCE_TYPE_FULL : REFERENCE_TYPE_COLLAPSED; + queue += identifier + character; + index++; + } else { + identifier = ''; + } + + subvalue += queue; + queue = ''; + } else { + if (!content) { + return; + } + + identifier = content; + } + + /* Brackets cannot be inside the identifier. */ + if (referenceType !== REFERENCE_TYPE_FULL && bracketed) { + return; + } + + subvalue = intro + subvalue; + + if (type === T_LINK && self.inLink) { + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (type === T_FOOTNOTE && content.indexOf(' ') !== -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 === REFERENCE_TYPE_FULL ? identifier : content; + + node = { + type: type + 'Reference', + identifier: normalize_1(identifier) + }; + + if (type === T_LINK || type === T_IMAGE) { + node.referenceType = referenceType; + } + + if (type === T_LINK) { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } else if (type === T_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); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} + +var strong_1 = strong$2; +strong$2.locator = strong; + +var C_ASTERISK$2 = '*'; +var C_UNDERSCORE$2 = '_'; + +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; + + if ( + (character !== C_ASTERISK$2 && character !== C_UNDERSCORE$2) || + value.charAt(++index) !== character + ) { + return; + } + + pedantic = self.options.pedantic; + marker = character; + subvalue = marker + marker; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && isWhitespaceCharacter(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if ( + character === marker && + value.charAt(index + 1) === marker && + (!pedantic || !isWhitespaceCharacter(prev)) + ) { + character = value.charAt(index + 2); + + if (character !== marker) { + if (!trim_1(queue)) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + now.column += 2; + now.offset += 2; + + return eat(subvalue + queue + subvalue)({ + type: 'strong', + children: self.tokenizeInline(queue, now) + }); + } + } + + if (!pedantic && character === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} + +var isWordCharacter = wordCharacter; + +var fromCode$1 = String.fromCharCode; +var re$2 = /\w/; + +/* 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) + ) +} + +var emphasis = locate$10; + +function locate$10(value, fromIndex) { + var asterisk = value.indexOf('*', fromIndex); + var underscore = value.indexOf('_', fromIndex); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} + +var emphasis_1 = emphasis$2; +emphasis$2.locator = emphasis; + +var C_ASTERISK$3 = '*'; +var C_UNDERSCORE$3 = '_'; + +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 !== C_ASTERISK$3 && character !== C_UNDERSCORE$3) { + return; + } + + pedantic = self.options.pedantic; + subvalue = character; + marker = character; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && isWhitespaceCharacter(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if (character === marker && (!pedantic || !isWhitespaceCharacter(prev))) { + character = value.charAt(++index); + + if (character !== marker) { + if (!trim_1(queue) || prev === marker) { + return; + } + + if (!pedantic && marker === C_UNDERSCORE$3 && isWordCharacter(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 === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} + +var _delete = locate$12; + +function locate$12(value, fromIndex) { + return value.indexOf('~~', fromIndex); +} + +var _delete$2 = strikethrough; +strikethrough.locator = _delete; + +var C_TILDE$1 = '~'; +var DOUBLE = '~~'; + +function strikethrough(eat, value, silent) { + var self = this; + var character = ''; + var previous = ''; + var preceding = ''; + var subvalue = ''; + var index; + var length; + var now; + + if ( + !self.options.gfm || + value.charAt(0) !== C_TILDE$1 || + value.charAt(1) !== C_TILDE$1 || + isWhitespaceCharacter(value.charAt(2)) + ) { + return; + } + + index = 1; + length = value.length; + now = eat.now(); + now.column += 2; + now.offset += 2; + + while (++index < length) { + character = value.charAt(index); + + if ( + character === C_TILDE$1 && + previous === C_TILDE$1 && + (!preceding || !isWhitespaceCharacter(preceding)) + ) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + return eat(DOUBLE + subvalue + DOUBLE)({ + type: 'delete', + children: self.tokenizeInline(subvalue, now) + }); + } + + subvalue += previous; + preceding = previous; + previous = character; + } +} + +var codeInline = locate$14; + +function locate$14(value, fromIndex) { + return value.indexOf('`', fromIndex); +} + +var codeInline$2 = inlineCode; +inlineCode.locator = codeInline; + +var C_TICK$3 = '`'; + +/* Tokenise inline code. */ +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; + + while (index < length) { + if (value.charAt(index) !== C_TICK$3) { + break; + } + + queue += C_TICK$3; + index++; + } + + if (!queue) { + return; + } + + subvalue = queue; + openingCount = index; + queue = ''; + next = value.charAt(index); + count = 0; + + while (index < length) { + character = next; + next = value.charAt(index + 1); + + if (character === C_TICK$3) { + count++; + tickQueue += character; + } else { + count = 0; + queue += character; + } + + if (count && next !== C_TICK$3) { + if (count === openingCount) { + subvalue += queue + tickQueue; + found = true; + break; + } + + queue += tickQueue; + tickQueue = ''; + } + + index++; + } + + if (!found) { + if (openingCount % 2 !== 0) { + return; + } + + queue = ''; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + contentQueue = ''; + subqueue = ''; + length = queue.length; + index = -1; + + while (++index < length) { + character = queue.charAt(index); + + if (isWhitespaceCharacter(character)) { + subqueue += character; + continue; + } + + if (subqueue) { + if (contentQueue) { + contentQueue += subqueue; + } + + subqueue = ''; + } + + contentQueue += character; + } + + return eat(subvalue)({ + type: 'inlineCode', + value: contentQueue + }); +} + +var _break = locate$16; + +function locate$16(value, fromIndex) { + var index = value.indexOf('\n', fromIndex); + + while (index > fromIndex) { + if (value.charAt(index - 1) !== ' ') { + break; + } + + index--; + } + + return index; +} + +var _break$2 = hardBreak; +hardBreak.locator = _break; + +var MIN_BREAK_LENGTH = 2; + +function hardBreak(eat, value, silent) { + var length = value.length; + var index = -1; + var queue = ''; + var character; + + while (++index < length) { + character = value.charAt(index); + + if (character === '\n') { + if (index < MIN_BREAK_LENGTH) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + queue += character; + + return eat(queue)({type: 'break'}); + } + + if (character !== ' ') { + return; + } + + queue += character; + } +} + +var text_1 = 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; + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + methods = self.inlineMethods; + length = methods.length; + tokenizers = self.inlineTokenizers; + index = -1; + min = value.length; + + while (++index < length) { + name = methods[index]; + + if (name === 'text' || !tokenizers[name]) { + continue; + } + + tokenizer = tokenizers[name].locator; + + if (!tokenizer) { + eat.file.fail('Missing locator: `' + name + '`'); + } + + position = tokenizer.call(self, value, 1); + + if (position !== -1 && position < min) { + min = position; + } + } + + subvalue = value.slice(0, min); + now = eat.now(); + + self.decode(subvalue, now, function (content, position, source) { + 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({}); + + this.inList = false; + this.inBlock = false; + this.inLink = false; + this.atStart = true; + + this.toOffset = vfileLocation(file).toOffset; + this.unescape = _unescape(this, 'escape'); + this.decode = decode$1(this); +} + +var proto$3 = Parser.prototype; + +/* Expose core. */ +proto$3.setOptions = setOptions_1; +proto$3.parse = parse_1$3; + +/* Expose `defaults`. */ +proto$3.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); + +/* 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 = [ + ['thematicBreak'], + ['atxHeading'], + ['fencedCode'], + ['blockquote'], + ['html'], + ['setextHeading', {commonmark: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Nodes that can interupt a list: + * + * ```markdown + * - One + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the list. */ +proto$3.interruptList = [ + ['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 = [ + ['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}] +]; + +/* Handlers. */ +proto$3.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 +}; + +proto$3.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 +}; + +/* Expose precedence. */ +proto$3.blockMethods = keys$1(proto$3.blockTokenizers); +proto$3.inlineMethods = keys$1(proto$3.inlineTokenizers); + +/* Tokenizers. */ +proto$3.tokenizeBlock = tokenizer('block'); +proto$3.tokenizeInline = tokenizer('inline'); +proto$3.tokenizeFactory = tokenizer; + +/* Get all keys in `value`. */ +function keys$1(value) { + var result = []; + var key; + + for (key in value) { + result.push(key); + } + + return result; +} + +var remarkParse = parse$9; +parse$9.Parser = parser; + +function parse$9(options) { + var Local = unherit_1(parser); + Local.prototype.options = immutable(Local.prototype.options, this.data('settings'), options); + this.Parser = Local; +} + +var returner_1 = returner; + +function returner(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`. + */ +function enter(compiler, node) { + var encode = compiler.encode; + var escape = compiler.escape; + var exit = compiler.enterLink(); + + if ( + node.referenceType !== 'shortcut' && + node.referenceType !== 'collapsed' + ) { + return exit; + } + + compiler.escape = returner_1; + compiler.encode = returner_1; + + return function () { + compiler.encode = encode; + compiler.escape = escape; + exit(); + }; +} + +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; +} + +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$1 = "ℑ"; +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$1 = "˜"; +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$1, + 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$1, + 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$1, + 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$1, + 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" +] +; + +var dangerous$1 = Object.freeze({ + default: dangerous +}); + +var entities = ( characterEntitiesHtml4 && index$5 ) || characterEntitiesHtml4; + +var dangerous$2 = ( dangerous$1 && dangerous ) || dangerous$1; + +/* Expose. */ +var stringifyEntities = encode; +encode.escape = escape$1; + +var own$5 = {}.hasOwnProperty; + +/* List of enforced escapes. */ +var escapes$2 = ['"', "'", '<', '>', '&', '`']; + +/* Map of characters to names. */ +var characters$1 = construct(); + +/* Default escapes. */ +var defaultEscapes = toExpression(escapes$2); + +/* Surrogate pairs. */ +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; + +/* 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; + + value = value.replace(set, function(char, pos, val) { + return one$1(char, val.charAt(pos + 1), settings) + }); + + if (subset || escapeOnly) { + return value + } + + return value + .replace(surrogatePair, replaceSurrogatePair) + .replace(bmp, replaceBmp) + + function replaceSurrogatePair(pair, pos, val) { + return toHexReference( + (pair.charCodeAt(0) - 0xd800) * 0x400 + + pair.charCodeAt(1) - + 0xdc00 + + 0x10000, + val.charAt(pos + 2), + omit + ) + } + + function replaceBmp(char, pos, val) { + return one$1(char, val.charAt(pos + 1), settings) + } +} + +/* Shortcut to escape special characters in HTML. */ +function escape$1(value) { + return encode(value, { + escapeOnly: true, + useNamedReferences: true + }) +} + +/* Encode `char` according to `options`. */ +function one$1(char, next, options) { + var shortest = options.useShortestReferences; + var omit = options.omitOptionalSemicolons; + var named; + var numeric; + + if ((shortest || options.useNamedReferences) && own$5.call(characters$1, char)) { + named = toNamed(characters$1[char], next, omit, options.attribute); + } + + if (shortest || !named) { + numeric = toHexReference(char.charCodeAt(0), next, omit); + } + + if (named && (!shortest || named.length < numeric.length)) { + return named + } + + return numeric +} + +/* Transform `code` into an entity. */ +function toNamed(name, next, omit, attribute) { + var value = '&' + name; + + if ( + omit && + own$5.call(legacy, name) && + dangerous$2.indexOf(name) === -1 && + (!attribute || (next && next !== '=' && !isAlphanumerical(next))) + ) { + return value + } + + return value + ';' +} + +/* 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 + ';' +} + +/* Create an expression for `characters`. */ +function toExpression(characters) { + return new RegExp('[' + characters.join('') + ']', 'g') +} + +/* Construct the map. */ +function construct() { + var chars = {}; + var name; + + for (name in entities) { + 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()); +}; + +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. */ +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; + } + + prefix = value.split('&', 2).join('&'); + + return prefix.length - parseEntities_1(prefix).length; +} + +var _escape$4 = factory$5; + +var BACKSLASH = '\\'; +var BULLETS = ['*', '-', '+']; +var ALLIGNMENT = [':', '-', ' ', '|']; +var entities$1 = {'<': '<', ':': ':', '&': '&', '|': '|', '~': '~'}; + +/* Factory to escape characters. */ +function factory$5(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 ? ['.', ')'] : ['.']; + 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; + + if (prev) { + afterNewLine = text$1(prev) && /\n\s*$/.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; + } + + while (++position < length) { + character = value.charAt(position); + replace = false; + + 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. */ + position > 0 && + position < length - 1 && + ( + pedantic || + !isAlphanumeric(value.charAt(position - 1)) || + !isAlphanumeric(value.charAt(position + 1)) + ) + ) || + (gfm && !self.inLink && character === ':' && protocol(queue.join(''))) + ) { + replace = true; + } else if (afterNewLine) { + if ( + character === '>' || + character === '#' || + BULLETS.indexOf(character) !== -1 + ) { + replace = true; + } else if (isDecimal(character)) { + offset = position + 1; + + while (offset < length) { + if (!isDecimal(value.charAt(offset))) { + break; + } + + offset++; + } + + if (markers.indexOf(value.charAt(offset)) !== -1) { + next = value.charAt(offset + 1); + + if (!next || next === ' ' || next === '\t' || next === '\n') { + queue.push(value.slice(position, offset)); + position = offset; + character = value.charAt(position); + replace = true; + } + } + } + } + + if (afterNewLine && !isWhitespaceCharacter(character)) { + afterNewLine = false; + } + + queue.push(replace ? one(character) : character); + } + + /* 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') { + position = -1; + length = escaped.length; + + while (++position < length) { + character = escaped[position]; + + if (character === ' ' || character === '\t') { + continue; + } + + if (character === '(' || character === ':') { + escaped[position] = one(character); + } + + break; + } + + /* 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) === '(' + ) { + escaped.push(BACKSLASH); + } + } + + /* 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) === ':' && + protocol(prev.value.slice(-6)) + ) { + escaped[0] = one(':'); + } + + /* Escape ampersand if it would otherwise + * start an entity. */ + if ( + text$1(next) && + value.charAt(length - 1) === '&' && + entityPrefixLength('&' + next.value) !== 0 + ) { + escaped[escaped.length - 1] = one('&'); + } + + /* Escape double tildes in GFM. */ + if ( + gfm && + text$1(next) && + value.charAt(length - 1) === '~' && + next.value.charAt(0) === '~' + ) { + 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)); + + if (length === 1) { + if (value === '_' && (pedantic || !wordCharBefore || !wordCharAfter)) { + escaped.unshift(BACKSLASH); + } + } else { + if ( + value.charAt(0) === '_' && + (pedantic || !wordCharBefore || !isAlphanumeric(value.charAt(1))) + ) { + escaped.unshift(BACKSLASH); + } + + if ( + value.charAt(length - 1) === '_' && + (pedantic || !wordCharAfter || !isAlphanumeric(value.charAt(length - 2))) + ) { + escaped.splice(escaped.length - 1, 0, BACKSLASH); + } + } + } + + return escaped.join(''); + } +} + +/* 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); + + start = start === -1 ? -1 : start; + end = end === -1 ? value.length : end; + + while (++start < end) { + if (ALLIGNMENT.indexOf(value.charAt(start)) === -1) { + return false; + } + } + + return true; +} + +/* Check if `node` is a text node. */ +function text$1(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' || val.slice(-5) === 'https' || val.slice(-4) === 'http'; +} + +var setOptions_1$2 = setOptions$1; + +/* Map of applicable enum's. */ +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; +} + +/* Throw an exception with in its `message` `value` + * and `name`. */ +function raise(value, name) { + throw new Error('Invalid value `' + value + '` for setting `' + name + '`'); +} + +/* 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); + } + + context[name] = value; +} + +/* 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; + } + + if (typeof value !== 'function') { + raise(value, 'options.' + name); + } + + 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'`. */ +function encodeFactory(type) { + var options = {}; + + if (type === 'false') { + return returner_1; + } + + if (type === 'true') { + options.useNamedReferences = true; + } + + if (type === 'escape') { + options.escapeOnly = true; + options.useNamedReferences = true; + } + + return wrapped; + + /* Encode HTML entities using the bound options. */ + function wrapped(value) { + return stringifyEntities(value, options); + } +} + +var mdastUtilCompact = compact; + +/* Make an MDAST tree compact by merging adjacent text nodes. */ +function compact(tree, commonmark) { + unistUtilVisit(tree, visitor); + + return tree + + function visitor(child, index, parent) { + 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) + ) { + if (child.value) { + prev.value += child.value; + } + + if (child.children) { + prev.children = prev.children.concat(child.children); + } + + siblings.splice(index, 1); + + if (prev.position && child.position) { + prev.position.end = child.position.end; + } + + return index + } + } +} + +function mergeable$1(node, commonmark) { + var start; + var end; + + if (node.type === 'text') { + if (!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 + ) + } + + 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)); +} + +var one_1 = one$2; + +function one$2(node, parent) { + var self = this; + var visitors = self.visitors; + + /* Fail on unknown nodes. */ + if (typeof visitors[node.type] !== 'function') { + self.file.fail( + new Error( + 'Missing compiler for node of type `' + + node.type + '`: `' + node + '`' + ), + node + ); + } + + return visitors[node.type].call(self, node, parent); +} + +var all_1 = 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; + + while (++index < length) { + results[index] = self.visit(children[index], parent); + } + + 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. */ +function block$1(node) { + var self = this; + var values = []; + var children = node.children; + var length = children.length; + var index = -1; + var child; + var prev; + + while (++index < length) { + 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'); + } else { + values.push('\n\n'); + } + } + + values.push(self.visit(child, node)); + + prev = child; + } + + 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 + */ +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; + + while (++index < length) { + bullet = (increment ? start + index : start) + '.'; + values[index] = fn.call(self, children[index], node, index, bullet); + } + + return values.join('\n'); +} + +var unorderedItems_1 = unorderedItems; + +/* 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 = []; + + while (++index < length) { + values[index] = fn.call(self, children[index], node, index, bullet); + } + + return values.join('\n'); +} + +var root_1 = root; + +/* Stringify a root. + * Adds a final newline to ensure valid POSIX files. */ +function root(node) { + return this.block(node) + '\n'; +} + +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 + */ +function text$2(node, parent) { + 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 ### + */ +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; + + if (setext && depth < 3) { + return content + '\n' + repeatString(depth === 1 ? '=' : '-', content.length); + } + + prefix = repeatString('#', node.depth); + + return prefix + ' ' + content + (closeAtx ? ' ' + prefix : ''); +} + +var paragraph_1$2 = paragraph$1; + +function paragraph$1(node) { + return this.all(node).join(''); +} + +var blockquote_1$2 = blockquote$1; + +function blockquote$1(node) { + var values = this.block(node).split('\n'); + var result = []; + var length = values.length; + var index = -1; + var value; + + while (++index < length) { + value = values[index]; + result[index] = (value ? ' ' : '') + value; + } + + return '>' + result.join('\n>'); +} + +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 pad_1 = pad; + +var INDENT = 4; + +/* Pad `value` with `level * INDENT` spaces. Respects + * lines. Ignores empty lines. */ +function pad(value, level) { + var index; + var padding; + + value = value.split('\n'); + + index = value.length; + padding = repeatString(' ', level * INDENT); + + while (index--) { + if (value[index].length !== 0) { + value[index] = padding + value[index]; + } + } + + return value.join('\n'); +} + +var listItem_1 = listItem$1; + +/* Which checkbox to use. */ +var CHECKBOX_MAP = { + undefined: '', + null: '', + true: '[x] ', + false: '[ ] ' +}; + +/* 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 + */ +function listItem$1(node, parent, position, bullet) { + var self = this; + var style = self.options.listItemIndent; + var loose = node.loose; + 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); + } + + value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\n\n' : '\n'); + + 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); + } + + value = bullet + spacing + pad_1(value, indent / 4).slice(indent); + + if (loose && parent.children.length - 1 !== position) { + value += '\n'; + } + + return value; +} + +/* 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++; + + if (index === expected) { + if (count > maximum) { + maximum = count; + } + } else { + count = 1; + } + + expected = index + 1; + index = value.indexOf(character, expected); + } + + return maximum; +} + +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` `` + */ +function inlineCode$1(node) { + var value = node.value; + var ticks = repeatString('`', longestStreak_1(value, '`') + 1); + var start = ticks; + var end = ticks; + + if (value.charAt(0) === '`') { + start += ' '; + } + + if (value.charAt(value.length - 1) === '`') { + end = ' ' + end; + } + + return start + value + end; +} + +var code_1 = code; + +var FENCE = /([`~])\1{2}/; + +/* 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 + * ``` + * ```` + */ +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 fence; + + /* Without (needed) fences. */ + if (!language && !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); + } + + 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); + } + + fence = repeatString(marker, Math.max(fence, 3)); + + return fence + language + '\n' + value + '\n' + fence; +} + +var html_1 = html$2; + +function html$2(node) { + 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`) + * + * * * * + */ +function thematic() { + var options = this.options; + var rule = repeatString(options.rule, options.ruleRepetition); + return options.ruleSpaces ? rule.split('').join(' ') : 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__ + */ +function strong$3(node) { + var marker = repeatString(this.options.strong, 2); + 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* + */ +function emphasis$3(node) { + var marker = this.options.emphasis; + return marker + this.all(node).join('') + marker; +} + +var _break$4 = lineBreak; + +var map$4 = {true: '\\\n', false: ' \n'}; + +function lineBreak() { + return map$4[this.options.commonmark]; +} + +var _delete$4 = strikethrough$1; + +function strikethrough$1(node) { + return '~~' + this.all(node).join('') + '~~'; +} + +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') + } + + index = value.indexOf(character); + + while (index !== -1) { + count++; + index = value.indexOf(character, index + 1); + } + + return count +} + +var encloseUri = enclose; + +var re$3 = /\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 + '>'; + } + + 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. */ +function enclose$1(title) { + var delimiter = title.indexOf('"') === -1 ? '"' : '\''; + return delimiter + title + delimiter; +} + +var link_1$2 = link$3; + +/* Expression for a protocol: + * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ +var PROTOCOL = /^[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: + * + * + * + * 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) { + 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(); + + 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); + } + + content = encloseUri(content); + + if (node.title) { + content += ' ' + encloseTitle(self.encode(self.escape(node.title, node), node)); + } + + return '[' + value + '](' + content + ')'; +} + +var copyIdentifierEncoding = copy$5; + +var PUNCTUATION = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; + +/* 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; + var result = []; + var position = 0; + var index = 0; + var start; + + while (index < length) { + /* Take next non-punctuation characters from `value`. */ + start = index; + + while (index < length && !PUNCTUATION.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))) { + position += 1; + } + + /* Take next punctuation characters from `identifier`. */ + start = position; + + while (position < count && PUNCTUATION.test(identifier.charAt(position))) { + if (identifier.charAt(position) === '&') { + position += entityPrefixLength(identifier.slice(position)); + } + + position += 1; + } + + result.push(identifier.slice(start, position)); + + /* Advance `index` to the next non-punctuation character. */ + while (index < length && PUNCTUATION.test(value.charAt(index))) { + index += 1; + } + } + + 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. */ +function label(node) { + var type = node.referenceType; + var value = type === 'full' ? node.identifier : ''; + + return type === 'shortcut' ? value : '[' + value + ']'; +} + +var linkReference_1 = linkReference; + +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 = copyIdentifierEncoding(value, node.identifier); + } + + return '[' + value + ']' + label_1(node); +} + +var imageReference_1 = imageReference; + +function imageReference(node) { + return '![' + (this.encode(node.alt, node) || '') + ']' + 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' + */ +function definition$1(node) { + var content = encloseUri(node.url); + + if (node.title) { + content += ' ' + encloseTitle(node.title); + } + + return '[' + node.identifier + ']: ' + content; +} + +var image_1 = image$2; + +/* 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 self = this; + var content = encloseUri(self.encode(node.url || '', node)); + var exit = self.enterLink(); + var alt = self.encode(self.escape(node.alt || '', node)); + + exit(); + + if (node.title) { + content += ' ' + encloseTitle(self.encode(node.title, node)); + } + + return '![' + alt + '](' + content + ')'; +} + +var footnote_1 = footnote; + +function footnote(node) { + return '[^' + this.all(node).join('') + ']'; +} + +var footnoteReference_1 = footnoteReference; + +function footnoteReference(node) { + return '[^' + node.identifier + ']'; +} + +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)); + + return '[^' + id + ']: ' + content; +} + +/* Expose. */ +var markdownTable_1 = markdownTable; + +/* Expressions. */ +var EXPRESSION_DOT = /\./; +var EXPRESSION_LAST_DOT = /\.[^.]*$/; + +/* Allowed alignment values. */ +var LEFT = 'l'; +var RIGHT = 'r'; +var CENTER = 'c'; +var DOT = '.'; +var NULL = ''; + +var ALLIGNMENT$1 = [LEFT, RIGHT, CENTER, DOT, NULL]; +var MIN_CELL_SIZE = 3; + +/* Characters. */ +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() : []; + + if (delimiter === null || delimiter === undefined) { + delimiter = SPACE + PIPE + SPACE; + } + + if (start === null || start === undefined) { + start = PIPE + SPACE; + } + + if (end === null || end === undefined) { + end = SPACE + PIPE; + } + + while (++rowIndex < rowLength) { + row = table[rowIndex]; + + index = -1; + + if (row.length > cellCount) { + cellCount = row.length; + } + + while (++index < cellCount) { + position = row[index] ? dotindex$1(row[index]) : null; + + if (!sizes[index]) { + sizes[index] = MIN_CELL_SIZE; + } + + if (position > sizes[index]) { + sizes[index] = position; + } + } + } + + if (typeof alignment === 'string') { + alignment = pad$2(cellCount, alignment).split(''); + } + + /* Make sure only valid alignments are used. */ + index = -1; + + while (++index < cellCount) { + align = alignment[index]; + + if (typeof align === 'string') { + align = align.charAt(0).toLowerCase(); + } + + if (ALLIGNMENT$1.indexOf(align) === -1) { + align = NULL; + } + + alignment[index] = align; + } + + rowIndex = -1; + rows = []; + + while (++rowIndex < rowLength) { + row = table[rowIndex]; + + index = -1; + cells = []; + + while (++index < cellCount) { + value = row[index]; + + value = stringify$6(value); + + if (alignment[index] === DOT) { + position = dotindex$1(value); + + size = + sizes[index] + + (EXPRESSION_DOT.test(value) ? 0 : 1) - + (calculateStringLength(value) - position); + + cells[index] = value + pad$2(size - 1); + } else { + cells[index] = value; + } + } + + rows[rowIndex] = cells; + } + + sizes = []; + rowIndex = -1; + + while (++rowIndex < rowLength) { + cells = rows[rowIndex]; + + index = -1; + + while (++index < cellCount) { + value = cells[index]; + + if (!sizes[index]) { + sizes[index] = MIN_CELL_SIZE; + } + + size = calculateStringLength(value); + + if (size > sizes[index]) { + sizes[index] = size; + } + } + } + + rowIndex = -1; + + while (++rowIndex < rowLength) { + cells = rows[rowIndex]; + + index = -1; + + if (settings.pad !== false) { + while (++index < cellCount) { + value = cells[index]; + + position = sizes[index] - (calculateStringLength(value) || 0); + spacing = pad$2(position); + + if (alignment[index] === RIGHT || alignment[index] === DOT) { + value = spacing + value; + } else if (alignment[index] === CENTER) { + position /= 2; + + if (position % 1 === 0) { + before = position; + after = position; + } else { + before = position + 0.5; + after = position - 0.5; + } + + value = pad$2(before) + value + pad$2(after); + } else { + value += spacing; + } + + cells[index] = value; + } + } + + rows[rowIndex] = cells.join(delimiter); + } + + if (settings.rule !== false) { + 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; + } else { + spacing = sizes[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; + + rule[index] = value; + } + + rows.splice(1, 0, rule.join(delimiter)); + } + + return start + rows.join(end + NEW_LINE + start) + end +} + +function stringify$6(value) { + return value === null || value === undefined ? '' : String(value) +} + +/* Get the length of `value`. */ +function lengthNoop(value) { + return String(value).length +} + +/* Get a string consisting of `length` `character`s. */ +function pad$2(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); + + return match ? match.index + 1 : value.length +} + +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| + */ +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(); + + if (loose) { + start = ''; + end = ''; + } else if (spaced) { + start = '| '; + end = ' |'; + } else { + start = '|'; + end = '|'; + } + + return markdownTable_1(result, { + align: node.align, + pad: pad, + start: start, + end: end, + stringLength: stringLength, + delimiter: spaced ? ' | ' : '|' + }); +} + +var tableCell_1 = 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({}); +} + +var proto$4 = Compiler.prototype; + +/* Enter and exit helpers. */ +proto$4.enterLink = stateToggle('inLink', false); +proto$4.enterTable = stateToggle('inTable', false); +proto$4.enterLinkReference = enterLinkReference; + +/* Configuration. */ +proto$4.options = defaults$5; +proto$4.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; + +/* Expose visitors. */ +proto$4.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; + +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 _from = "remark@8.0.0"; +const _id = "remark@8.0.0"; +const _inBundle = false; +const _integrity = "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw=="; +const _location = "/remark"; +const _phantomChildren = {}; +const _requested = {"type":"version","registry":true,"raw":"remark@8.0.0","name":"remark","escapedName":"remark","rawSpec":"8.0.0","saveSpec":null,"fetchSpec":"8.0.0"}; +const _requiredBy = ["#USER","/"]; +const _resolved = "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz"; +const _shasum = "287b6df2fe1190e263c1d15e486d3fa835594d6d"; +const _spec = "remark@8.0.0"; +const _where = "/mnt/d/code/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/wooorm/remark/issues"}; +const bundleDependencies = false; +const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; +const dependencies = {"remark-parse":"^4.0.0","remark-stringify":"^4.0.0","unified":"^6.0.0"}; +const deprecated$1 = false; +const description = "Markdown processor powered by plugins"; +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/wooorm/remark/tree/master/packages/remark"}; +const scripts = {}; +const version$1 = "8.0.0"; +const xo = false; +var _package = { + _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, + files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, + scripts: scripts, + version: version$1, + xo: xo +}; + +var _package$1 = Object.freeze({ + _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, + files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, + scripts: scripts, + version: version$1, + xo: xo, + 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":"./remark-preset-lint-node","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, + dependencies: dependencies$1, + scripts: scripts$1 +}; + +var _package$3 = Object.freeze({ + name: name$1, + description: description$1, + version: version$2, + devDependencies: devDependencies, + dependencies: dependencies$1, + scripts: scripts$1, + default: _package$2 +}); + +var trim_1$2 = 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$1 = trim_1$2.left; +var trim_3$1 = trim_1$2.right; + +/* Expose. */ +var vfileLocation$3 = factory$6; + +/* Factory. */ +function factory$6(file) { + var contents = indices$1(String(file)); + + return { + toPosition: offsetToPositionFactory$1(contents), + toOffset: positionToOffsetFactory$1(contents) + } +} + +/* Factory to get the line and column-based `position` for + * `offset` in the bound indices. */ +function offsetToPositionFactory$1(indices) { + return offsetToPosition + + /* Get the line and column-based `position` for + * `offset` in the bound indices. */ + function offsetToPosition(offset) { + var index = -1; + var length = indices.length; + + if (offset < 0) { + return {} + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } + + return {} + } +} + +/* Factory to get the `offset` for a line and column-based + * `position` in the bound indices. */ +function positionToOffsetFactory$1(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; + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } + + return -1 + } +} + +/* Get indices of line-breaks in `value`. */ +function indices$1(value) { + var result = []; + var index = value.indexOf('\n'); + + while (index !== -1) { + result.push(index + 1); + index = value.indexOf('\n', index + 1); + } + + result.push(value.length + 1); + + return result +} + +/* eslint-disable max-params */ + +/* Expose. */ +var unistUtilIs$2 = is$2; + +/* Assert if `test` passes for `node`. + * When a `parent` node is known the `index` of node */ +function is$2(test, node, index, parent, context) { + var hasParent = parent !== null && parent !== undefined; + var hasIndex = index !== null && index !== undefined; + var check = convert$1(test); + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is$2(null, parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} + +function convert$1(test) { + if (typeof test === 'string') { + return typeFactory$1(test) + } + + if (test === null || test === undefined) { + return ok$2 + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory$1 : matchesFactory$1)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll$1(tests) { + var results = []; + var length = tests.length; + var index = -1; + + while (++index < length) { + results[index] = convert$1(tests[index]); + } + + return results +} + +/* Utility assert each property in `test` is represented + * in `node`, and each values are strictly equal. */ +function matchesFactory$1(test) { + return matches + + function matches(node) { + var key; + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory$1(tests) { + var checks = convertAll$1(tests); + var length = checks.length; + + return matches + + function matches() { + var index = -1; + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +/* Utility to convert a string into a function which checks + * a given node’s type for said string. */ +function typeFactory$1(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +/* Utility to return true. */ +function ok$2() { + return true +} + +var unistUtilVisitParents$2 = visitParents$2; + + + +var CONTINUE$2 = true; +var SKIP$2 = 'skip'; +var EXIT$2 = false; + +visitParents$2.CONTINUE = CONTINUE$2; +visitParents$2.SKIP = SKIP$2; +visitParents$2.EXIT = EXIT$2; + +function visitParents$2(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$2(test, node, index, parents[parents.length - 1] || null)) { + result = visitor(node, parents); + + if (result === EXIT$2) { + return result + } + } + + if (node.children && result !== SKIP$2) { + return all(node.children, parents.concat(node)) === EXIT$2 ? EXIT$2 : 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$2) { + return result + } + + index = typeof result === 'number' ? result : index + step; + } + } +} + +var unistUtilVisit$2 = visit$2; + + + +var CONTINUE$3 = unistUtilVisitParents$2.CONTINUE; +var SKIP$3 = unistUtilVisitParents$2.SKIP; +var EXIT$3 = unistUtilVisitParents$2.EXIT; + +visit$2.CONTINUE = CONTINUE$3; +visit$2.SKIP = SKIP$3; +visit$2.EXIT = EXIT$3; + +function visit$2(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor; + visitor = test; + test = null; + } + + unistUtilVisitParents$2(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) + } +} + +/* Map of allowed verbs. */ +var ALLOWED_VERBS = { + enable: true, + disable: true, + ignore: true +}; + +var unifiedMessageControl = 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; + + if (!name) { + throw new Error('Expected `name` in `options`, got `' + name + '`') + } + + if (!marker) { + throw new Error('Expected `name` in `options`, got `' + name + '`') + } + + if (!test) { + throw new Error('Expected `test` in `options`, got `' + test + '`') + } + + known = options.known; + reset = options.reset; + enable = options.enable || []; + disable = options.disable || []; + sources = options.source; + + if (!sources) { + sources = [name]; + } else if (typeof sources === 'string') { + sources = [sources]; + } + + return transformer + + function transformer(tree, file) { + var toOffset = vfileLocation$3(file).toOffset; + var initial = !reset; + var gaps = detectGaps(tree, file); + var scope = {}; + var globals = []; + + unistUtilVisit$2(tree, test, visitor); + + 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; + + 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; + + if (!verb || !ALLOWED_VERBS[verb] === true) { + file.fail( + 'Unknown keyword `' + + verb + + '`: expected ' + + "`'enable'`, `'disable'`, or `'ignore'`", + mark.node + ); + } + + length = ruleIds.length; + index = -1; + + while (++index < length) { + ruleId = ruleIds[index]; + + if (isKnown(ruleId, verb, mark.node)) { + toggle(pos, verb === 'enable', ruleId); + + if (verb === 'ignore') { + toggle(tail, true, ruleId); + } + } + } + + /* Apply to all rules. */ + if (!length) { + if (verb === 'ignore') { + toggle(pos, false); + toggle(tail, true); + } else { + toggle(pos, verb === 'enable'); + reset = verb !== 'enable'; + } + } + } + + function filter(message) { + 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) { + return true + } + + /* We only ignore messages if they‘re disabled, + * *not* when they’re not in the document. */ + if (!message.line) { + message.line = 1; + } + + if (!message.column) { + message.column = 1; + } + + /* Check whether the warning is inside a gap. */ + pos = toOffset(message); + + while (gapIndex--) { + if (gaps[gapIndex].start <= pos && gaps[gapIndex].end > pos) { + return false + } + } + + /* Check whether allowed by specific and global states. */ + return check(message, ranges, ruleId) && check(message, globals) + } + + /* Helper to check (and possibly warn) if a ruleId is unknown. */ + function isKnown(ruleId, verb, pos) { + var result = known ? known.indexOf(ruleId) !== -1 : true; + + if (!result) { + file.warn('Unknown rule: cannot ' + verb + " `'" + ruleId + "'`", pos); + } + + return result + } + + /* Get the latest state of a rule. When without `ruleId`, gets global state. */ + function getState(ruleId) { + var ranges = ruleId ? scope[ruleId] : globals; + + if (ranges && ranges.length !== 0) { + return ranges[ranges.length - 1].state + } + + if (!ruleId) { + return !reset + } + + if (reset) { + return enable.indexOf(ruleId) !== -1 + } + + return disable.indexOf(ruleId) === -1 + } + + /* Handle a rule. */ + function toggle(pos, state, ruleId) { + var markers = ruleId ? scope[ruleId] : globals; + var currentState; + var previousState; + + if (!markers) { + markers = []; + scope[ruleId] = markers; + } + + previousState = getState(ruleId); + currentState = state; + + if (currentState !== previousState) { + markers.push({state: currentState, position: pos}); + } + + /* Toggle all known rules. */ + if (!ruleId) { + for (ruleId in scope) { + toggle(pos, state, ruleId); + } + } + } + + /* 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; + + while (--index > length) { + range = ranges[index]; + + /* istanbul ignore if - generated marker. */ + if (!range.position || !range.position.line || !range.position.column) { + continue + } + + if ( + range.position.line < message.line || + (range.position.line === message.line && + range.position.column < message.column) + ) { + return range.state === true + } + } + + /* The first marker ocurred after the first + * message, so we check the initial state. */ + if (!id) { + return initial || reset + } + + return reset ? enable.indexOf(id) !== -1 : disable.indexOf(id) === -1 + } + } +} + +/* Detect gaps in `ast`. */ +function detectGaps(tree, file) { + var lastNode = tree.children[tree.children.length - 1]; + var offset = 0; + var isGap = false; + var gaps = []; + + /* Find all gaps. */ + unistUtilVisit$2(tree, one); + + /* Get the end of the document. + * This detects if the last node was the last node. + * If not, there’s an extra gap between the last node + * and the end of the document. */ + if ( + lastNode && + lastNode.position && + lastNode.position.end && + offset === lastNode.position.end.offset && + trim_1$2(file.toString().slice(offset)) !== '' + ) { + update(); + + update( + tree && tree.position && tree.position.end && tree.position.end.offset - 1 + ); + } + + return gaps + + function one(node) { + var pos = node.position; + + update(pos && pos.start && pos.start.offset); + + if (!node.children) { + update(pos && pos.end && pos.end.offset); + } + } + + /* Detect a new position. */ + function update(latest) { + if (latest === null || latest === undefined) { + isGap = true; + return + } + + if (offset >= latest) { + return + } + + if (isGap) { + gaps.push({start: offset, end: latest}); + isGap = false; + } + + offset = latest; + } +} + +/* Expose. */ +var mdastCommentMarker = marker$1; + +/* HTML type. */ +var T_HTML = 'html'; + +/* Expression for eliminating extra spaces */ +var SPACES = /\s+/g; + +/* Expression for parsing parameters. */ +var PARAMETERS = new RegExp( + '\\s+' + + '(' + + '[-a-z0-9_]+' + + ')' + + '(?:' + + '=' + + '(?:' + + '"' + + '(' + + '(?:' + + '\\\\[\\s\\S]' + + '|' + + '[^"]' + + ')+' + + ')' + + '"' + + '|' + + "'" + + '(' + + '(?:' + + '\\\\[\\s\\S]' + + '|' + + "[^']" + + ')+' + + ')' + + "'" + + '|' + + '(' + + '(?:' + + '\\\\[\\s\\S]' + + '|' + + '[^"\'\\s]' + + ')+' + + ')' + + ')' + + ')?', + 'gi' +); + +var MARKER = new RegExp( + '(' + + '\\s*' + + '' + + '\\s*' + + ')' +); + +/* Parse a comment marker */ +function marker$1(node) { + var value; + var match; + var params; + + if (!node || node.type !== T_HTML) { + return null + } + + value = node.value; + match = value.match(MARKER); + + if (!match || match[1].length !== value.length) { + return null + } + + params = parameters(match[3] || ''); + + if (!params) { + return null + } + + return { + name: match[2], + attributes: match[4] || '', + parameters: params, + node: node + } +} + +/* Parse `value` into an object. */ +function parameters(value) { + 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 || ''; + + if (result === 'true' || result === '') { + result = true; + } else if (result === 'false') { + result = false; + } else if (!isNaN(result)) { + result = Number(result); + } + + attributes[$1] = result; + + return '' + } +} + +var immutable$2 = extend$6; + +var hasOwnProperty$1 = Object.prototype.hasOwnProperty; + +function extend$6() { + var target = {}; + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (hasOwnProperty$1.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target +} + +var remarkMessageControl = messageControl$1; + +function messageControl$1(options) { + var settings = options || {}; + + return unifiedMessageControl(immutable$2(options, { + marker: settings.marker || mdastCommentMarker, + test: settings.test || 'html' + })); +} + +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); +} + +function lintMessageControl() { + return remarkMessageControl({name: 'lint', source: 'remark-lint'}) +} + +/** + * An Array.prototype.slice.call(arguments) alternative + * + * @param {Object} args something with a length + * @param {Number} slice + * @param {Number} sliceEnd + * @api public + */ + +var sliced = function (args, slice, sliceEnd) { + var ret = []; + var len = args.length; + + if (0 === len) return ret; + + var start = slice < 0 + ? Math.max(0, slice + len) + : slice || 0; + + if (sliceEnd !== undefined) { + len = sliceEnd < 0 + ? sliceEnd + len + : sliceEnd; + } + + while (len-- > start) { + ret[len - start] = args[len]; + } + + return ret; +}; + +/** + * slice() reference. + */ + +var slice$4 = Array.prototype.slice; + +/** + * Expose `co`. + */ + +var co_1 = co; + +/** + * Wrap the given generator `fn` and + * return a thunk. + * + * @param {Function} fn + * @return {Function} + * @api public + */ + +function co(fn) { + var isGenFun = isGeneratorFunction(fn); + + return function (done) { + var ctx = this; + + // in toThunk() below we invoke co() + // with a generator, so optimize for + // this case + var gen = 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 hasCallback = len && 'function' == typeof args[len - 1]; + done = hasCallback ? args.pop() : error; + gen = fn.apply(this, args); + } else { + done = done || error; + } + + next(); + + // #92 + // wrap the callback in a setImmediate + // so that any of its errors aren't caught by `co` + function exit(err, res) { + setImmediate(function(){ + done.call(ctx, err, res); + }); + } + + function next(err, res) { + var ret; + + // multiple args + if (arguments.length > 2) res = slice$4.call(arguments, 1); + + // error + if (err) { + try { + ret = gen.throw(err); + } catch (e) { + return exit(e); + } + } + + // ok + if (!err) { + try { + ret = gen.next(res); + } catch (e) { + return exit(e); + } + } + + // done + if (ret.done) return exit(null, ret.value); + + // normalize + ret.value = toThunk(ret.value, ctx); + + // run + if ('function' == typeof ret.value) { + var called = false; + try { + ret.value.call(ctx, function(){ + if (called) return; + called = true; + next.apply(ctx, arguments); + }); + } catch (e) { + setImmediate(function(){ + if (called) return; + called = true; + next(e); + }); + } + return; + } + + // invalid + next(new TypeError('You may only yield a function, promise, generator, array, or object, ' + + 'but the following was passed: "' + String(ret.value) + '"')); + } + } +} + +/** + * Convert `obj` into a normalized thunk. + * + * @param {Mixed} obj + * @param {Mixed} ctx + * @return {Function} + * @api private + */ + +function toThunk(obj, ctx) { + + if (isGeneratorFunction(obj)) { + return co(obj.call(ctx)); + } + + if (isGenerator(obj)) { + return co(obj); + } + + if (isPromise(obj)) { + return promiseToThunk(obj); + } + + if ('function' == typeof obj) { + return obj; + } + + if (isObject$3(obj) || Array.isArray(obj)) { + return objectToThunk.call(ctx, obj); + } + + return obj; +} + +/** + * Convert an object of yieldables to a thunk. + * + * @param {Object} obj + * @return {Function} + * @api private + */ + +function objectToThunk(obj){ + var ctx = this; + var isArray = Array.isArray(obj); + + return function(done){ + var keys = Object.keys(obj); + var pending = keys.length; + var results = isArray + ? new Array(pending) // predefine the array length + : new obj.constructor(); + var finished; + + if (!pending) { + setImmediate(function(){ + done(null, results); + }); + return; + } + + // prepopulate object keys to preserve key ordering + if (!isArray) { + for (var i = 0; i < pending; i++) { + results[keys[i]] = undefined; + } + } + + for (var i = 0; i < keys.length; i++) { + run(obj[keys[i]], keys[i]); + } + + function run(fn, key) { + if (finished) return; + try { + fn = toThunk(fn, ctx); + + if ('function' != typeof fn) { + results[key] = fn; + return --pending || done(null, results); + } + + fn.call(ctx, function(err, res){ + if (finished) return; + + if (err) { + finished = true; + return done(err); + } + + results[key] = res; + --pending || done(null, results); + }); + } catch (err) { + finished = true; + done(err); + } + } + } +} + +/** + * Convert `promise` to a thunk. + * + * @param {Object} promise + * @return {Function} + * @api private + */ + +function promiseToThunk(promise) { + return function(fn){ + promise.then(function(res) { + fn(null, res); + }, fn); + } +} + +/** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + +function isPromise(obj) { + return obj && 'function' == typeof obj.then; +} + +/** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGenerator(obj) { + return obj && 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +/** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGeneratorFunction(obj) { + return obj && obj.constructor && 'GeneratorFunction' == obj.constructor.name; +} + +/** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + +function isObject$3(val) { + return val && Object == val.constructor; +} + +/** + * Throw `err` in a new stack. + * + * This is used when co() is invoked + * without supplying a callback, which + * should only be for demonstrational + * purposes. + * + * @param {Error} err + * @api private + */ + +function error(err) { + if (!err) return; + setImmediate(function(){ + throw 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; +} + +/** + * Wrap a synchronous function execution. + * + * @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? + * + * @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 + */ + +function promise(value) { + return value && 'function' == typeof value.then; +} + +var unifiedLintRule = factory$7; + +function factory$7(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$3(file); + + unistUtilVisit$2(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; + + 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 remarkLintDefinitionSpacing = unifiedLintRule('remark-lint:definition-spacing', definitionSpacing); + +var label$2 = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; +var reason$1 = 'Do not use consecutive white-space in definition labels'; + +function definitionSpacing(tree, file) { + var contents = String(file); + + unistUtilVisit$2(tree, ['definition', 'footnoteDefinition'], validate); + + function validate(node) { + var start = unistUtilPosition.start(node).offset; + var end = unistUtilPosition.end(node).offset; + + if ( + !unistUtilGenerated(node) && + /[ \t\n]{2,}/.test(contents.slice(start, end).match(label$2)[1]) + ) { + file.message(reason$1, node); + } + } +} + +var remarkLintFencedCodeFlag = unifiedLintRule('remark-lint:fenced-code-flag', fencedCodeFlag); + +var start$1 = unistUtilPosition.start; +var end$1 = unistUtilPosition.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 = []; + + if (typeof pref === 'object' && !('length' in pref)) { + allowEmpty = Boolean(pref.allowEmpty); + pref = pref.flags; + } + + if (typeof pref === 'object' && 'length' in pref) { + flags = String(pref).split(','); + } + + unistUtilVisit$2(tree, 'code', visitor); + + function visitor(node) { + var value; + + if (!unistUtilGenerated(node)) { + if (node.lang) { + if (flags.length !== 0 && flags.indexOf(node.lang) === -1) { + file.message(reasonInvalid, node); + } + } else { + value = contents.slice(start$1(node).offset, end$1(node).offset); + + if (!allowEmpty && fence.test(value)) { + file.message(reasonMissing, node); + } + } + } + } +} + +var remarkLintFinalDefinition = unifiedLintRule('remark-lint:final-definition', finalDefinition); + +var start$2 = unistUtilPosition.start; + +function finalDefinition(tree, file) { + var last = null; + + unistUtilVisit$2(tree, visitor, true); + + function visitor(node) { + var line = start$2(node).line; + + /* Ignore generated nodes. */ + if (node.type === 'root' || unistUtilGenerated(node)) { + return + } + + if (node.type === 'definition') { + if (last !== null && last > line) { + file.message( + 'Move definitions to the end of the file (after the node at line `' + + last + + '`)', + node + ); + } + } else if (last === null) { + 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'; + +function hardBreakSpaces(tree, file) { + var contents = String(file); + + unistUtilVisit$2(tree, 'break', visitor); + + 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); + } + } + } +} + +var mdastUtilToString = toString$5; + +/* 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) { + return ( + valueOf$1(node) || + (node.children && node.children.map(toString$5).join('')) || + '' + ) +} + +/* 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( + 'remark-lint:no-auto-link-without-protocol', + noAutoLinkWithoutProtocol +); + +var start$3 = unistUtilPosition.start; +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 reason$3 = 'All automatic links must start with a protocol'; + +function noAutoLinkWithoutProtocol(tree, file) { + unistUtilVisit$2(tree, 'link', visitor); + + function visitor(node) { + var children; + + if (!unistUtilGenerated(node)) { + children = node.children; + + 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)) + ) { + file.message(reason$3, node); + } + } + } +} + +var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret); + +function noBlockquoteWithoutCaret(ast, file) { + var contents = file.toString(); + var location = vfileLocation$3(file); + var last = contents.length; + + unistUtilVisit$2(ast, 'blockquote', visitor); + + function visitor(node) { + var start = unistUtilPosition.start(node).line; + var indent = node.position && node.position.indent; + + if (unistUtilGenerated(node) || !indent || indent.length === 0) { + return; + } + + indent.forEach(eachLine); + + function eachLine(column, n) { + var character; + var line = start + n + 1; + var offset = location.toOffset({ + line: line, + column: column + }) - 1; + + while (++offset < last) { + character = contents.charAt(offset); + + if (character === '>') { + return; + } + + /* istanbul ignore else - just for safety */ + if (character !== ' ' && character !== '\t') { + break; + } + } + + file.message('Missing caret in blockquote', { + line: line, + column: column + }); + } + } +} + +var own$6 = {}.hasOwnProperty; + +var unistUtilStringifyPosition$2 = stringify$9; + +function stringify$9(value) { + /* Nothing. */ + if (!value || typeof value !== 'object') { + return null + } + + /* Node. */ + if (own$6.call(value, 'position') || own$6.call(value, 'type')) { + return position$2(value.position) + } + + /* Position. */ + if (own$6.call(value, 'start') || own$6.call(value, 'end')) { + return position$2(value) + } + + /* Point. */ + if (own$6.call(value, 'line') || own$6.call(value, 'column')) { + return point$1(value) + } + + /* ? */ + return null +} + +function point$1(point) { + if (!point || typeof point !== 'object') { + point = {}; + } + + return index$6(point.line) + ':' + index$6(point.column) +} + +function position$2(pos) { + if (!pos || typeof pos !== 'object') { + pos = {}; + } + + return point$1(pos.start) + '-' + point$1(pos.end) +} + +function index$6(value) { + return value && typeof value === 'number' ? value : 1 +} + +var remarkLintNoDuplicateDefinitions = unifiedLintRule( + 'remark-lint:no-duplicate-definitions', + noDuplicateDefinitions +); + +var reason$4 = 'Do not use definitions with the same identifier'; + +function noDuplicateDefinitions(tree, file) { + var map = {}; + + unistUtilVisit$2(tree, ['definition', 'footnoteDefinition'], validate); + + function validate(node) { + var identifier; + var duplicate; + + if (!unistUtilGenerated(node)) { + identifier = node.identifier; + duplicate = map[identifier]; + + if (duplicate && duplicate.type) { + file.message( + reason$4 + ' (' + unistUtilStringifyPosition$2(unistUtilPosition.start(duplicate)) + ')', + node + ); + } + + map[identifier] = node; + } + } +} + +var remarkLintNoFileNameArticles = unifiedLintRule('remark-lint:no-file-name-articles', noFileNameArticles); + +function noFileNameArticles(tree, file) { + var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i); + + if (match) { + file.message('Do not start file names with `' + match[0] + '`'); + } +} + +var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( + 'remark-lint:no-file-name-consecutive-dashes', + noFileNameConsecutiveDashes +); + +var reason$5 = 'Do not use consecutive dashes in a file name'; + +function noFileNameConsecutiveDashes(tree, file) { + if (file.stem && /-{2,}/.test(file.stem)) { + file.message(reason$5); + } +} + +var remarkLintNoFileNameOuterDashes = unifiedLintRule( + 'remark-lint:no-file-name-outer-dashes', + noFileNameOuterDashes +); + +var reason$6 = '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); + } +} + +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' + } + + 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 +} + +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$7 = "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$7, + 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 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$7, + 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 +}); + +var irregularPlurals$2 = ( irregularPlurals$1 && irregularPlurals ) || irregularPlurals$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]); +} + +// 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; + } + + if (irregularPlurals_1.has(word.toLowerCase())) { + plural = irregularPlurals_1.get(word.toLowerCase()); + + 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 remarkLintNoHeadingContentIndent = unifiedLintRule( + 'remark-lint:no-heading-content-indent', + noHeadingContentIndent +); + +var start$4 = unistUtilPosition.start; +var end$3 = unistUtilPosition.end; + +function noHeadingContentIndent(tree, file) { + var contents = String(file); + + unistUtilVisit$2(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)) { + return + } + + depth = node.depth; + children = node.children; + type = mdastUtilHeadingStyle(node, 'atx'); + + if (type === 'atx' || type === 'atx-closed') { + initial = start$4(node); + index = initial.offset; + char = contents.charAt(index); + + while (char && char !== '#') { + char = contents.charAt(++index); + } + + /* istanbul ignore if - CR/LF bug: remarkjs/remark#195. */ + if (!char) { + return + } + + index = depth + (index - initial.offset); + head = start$4(children[0]).column; + + /* Ignore empty headings. */ + if (!head) { + return + } + + diff = head - initial.column - 1 - index; + + if (diff) { + reason = + (diff > 0 ? 'Remove' : 'Add') + + ' ' + + Math.abs(diff) + + ' ' + + plur('space', diff) + + ' before this heading’s content'; + + file.message(reason, start$4(children[0])); + } + } + + /* Closed ATX-heading always must have a space + * between their content and the final hashes, + * thus, there is no `add x spaces`. */ + if (type === 'atx-closed') { + final = end$3(children[children.length - 1]); + diff = end$3(node).column - final.column - 1 - depth; + + if (diff) { + reason = + 'Remove ' + + diff + + ' ' + + plur('space', diff) + + ' after this heading’s content'; + + file.message(reason, final); + } + } + } +} + +var remarkLintNoHeadingIndent = unifiedLintRule('remark-lint:no-heading-indent', noHeadingIndent); + +var start$5 = unistUtilPosition.start; + +function noHeadingIndent(tree, file) { + var contents = String(file); + var length = contents.length; + + unistUtilVisit$2(tree, 'heading', visitor); + + function visitor(node) { + var initial; + var begin; + var index; + var character; + var diff; + + if (unistUtilGenerated(node)) { + return + } + + initial = start$5(node); + begin = initial.offset; + index = begin - 1; + + while (++index < length) { + character = contents.charAt(index); + + if (character !== ' ' && character !== '\t') { + break + } + } + + diff = index - begin; + + if (diff) { + file.message( + 'Remove ' + diff + ' ' + plur('space', diff) + ' before this heading', + { + line: initial.line, + column: initial.column + diff + } + ); + } + } +} + +var remarkLintNoInlinePadding = unifiedLintRule('remark-lint:no-inline-padding', noInlinePadding); + +function noInlinePadding(tree, file) { + unistUtilVisit$2(tree, ['emphasis', 'strong', 'delete', 'image', 'link'], visitor); + + function visitor(node) { + var contents; + + if (!unistUtilGenerated(node)) { + contents = mdastUtilToString(node); + + if ( + contents.charAt(0) === ' ' || + contents.charAt(contents.length - 1) === ' ' + ) { + file.message('Don’t pad `' + node.type + '` with inner spaces', node); + } + } + } +} + +var start$6 = unistUtilPosition.start; + + + +var remarkLintNoMultipleToplevelHeadings = unifiedLintRule( + 'remark-lint:no-multiple-toplevel-headings', + noMultipleToplevelHeadings +); + +function noMultipleToplevelHeadings(tree, file, pref) { + var style = pref ? pref : 1; + var duplicate; + + unistUtilVisit$2(tree, 'heading', visitor); + + function visitor(node) { + if (!unistUtilGenerated(node) && node.depth === style) { + if (duplicate) { + file.message( + 'Don’t use multiple top level headings (' + duplicate + ')', + node + ); + } else { + duplicate = unistUtilStringifyPosition$2(start$6(node)); + } + } + } +} + +var remarkLintNoShellDollars = unifiedLintRule('remark-lint:no-shell-dollars', noShellDollars); + +var reason$7 = 'Do not use dollar signs before shell-commands'; + +/* List of shell script file extensions (also used as code + * flags for syntax highlighting on GitHub): + * https://github.com/github/linguist/blob/5bf8cf5/lib/ + * linguist/languages.yml#L3002. */ +var flags = [ + 'sh', + 'bash', + 'bats', + 'cgi', + 'command', + 'fcgi', + 'ksh', + 'tmux', + 'tool', + 'zsh' +]; + +function noShellDollars(tree, file) { + unistUtilVisit$2(tree, 'code', visitor); + + function visitor(node) { + 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 (length <= 1) { + return + } + + while (++index < length) { + line = lines[index]; + + if (line.trim() && !line.match(/^\s*\$\s*/)) { + return + } + } + + file.message(reason$7, node); + } + } +} + +var remarkLintNoShortcutReferenceImage = unifiedLintRule( + 'remark-lint:no-shortcut-reference-image', + noShortcutReferenceImage +); + +var reason$8 = 'Use the trailing [] on reference images'; + +function noShortcutReferenceImage(tree, file) { + unistUtilVisit$2(tree, 'imageReference', visitor); + + function visitor(node) { + if (!unistUtilGenerated(node) && node.referenceType === 'shortcut') { + file.message(reason$8, node); + } + } +} + +var remarkLintNoTableIndentation = unifiedLintRule('remark-lint:no-table-indentation', noTableIndentation); + +var reason$9 = 'Do not indent table rows'; + +function noTableIndentation(tree, file) { + var contents = String(file); + + unistUtilVisit$2(tree, 'table', visitor); + + function visitor(node) { + if (!unistUtilGenerated(node)) { + node.children.forEach(each); + } + + return unistUtilVisit$2.SKIP + } + + function each(row) { + var fence = contents.slice( + unistUtilPosition.start(row).offset, + unistUtilPosition.start(row.children[0]).offset + ); + + if (fence.indexOf('|') > 1) { + file.message(reason$9, row); + } + } +} + +var remarkLintNoTabs = unifiedLintRule('remark-lint:no-tabs', noTabs); + +var reason$10 = 'Use spaces instead of hard-tabs'; + +function noTabs(tree, file) { + var content = String(file); + var position = vfileLocation$3(file).toPosition; + var index = content.indexOf('\t'); + + while (index !== -1) { + file.message(reason$10, position(index)); + index = content.indexOf('\t', index + 1); + } +} + +var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions); + +var reason$11 = 'Found unused definition'; + +function noUnusedDefinitions(tree, file) { + var map = {}; + var identifier; + var entry; + + unistUtilVisit$2(tree, ['definition', 'footnoteDefinition'], find); + unistUtilVisit$2(tree, ['imageReference', 'linkReference', 'footnoteReference'], mark); + + for (identifier in map) { + entry = map[identifier]; + + if (!entry.used) { + file.message(reason$11, entry.node); + } + } + + function find(node) { + if (!unistUtilGenerated(node)) { + map[node.identifier.toUpperCase()] = {node: node, used: false}; + } + } + + function mark(node) { + var info = map[node.identifier.toUpperCase()]; + + if (!unistUtilGenerated(node) && info) { + info.used = true; + } + } +} + +var rule$1 = unifiedLintRule; + + + + +var remarkLintRuleStyle = rule$1('remark-lint:rule-style', ruleStyle); + +var start$7 = unistUtilPosition.start; +var end$4 = unistUtilPosition.end; + +function ruleStyle(tree, file, pref) { + var contents = String(file); + + 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$2(tree, 'thematicBreak', visitor); + + function visitor(node) { + var initial = start$7(node).offset; + var final = end$4(node).offset; + var rule; + + if (!unistUtilGenerated(node)) { + rule = contents.slice(initial, final); + + if (pref) { + if (rule !== pref) { + file.message('Rules should use `' + pref + '`', node); + } + } else { + pref = rule; + } + } + } +} + +var remarkLintTablePipes = unifiedLintRule('remark-lint:table-pipes', tablePipes); + +var start$8 = unistUtilPosition.start; +var end$5 = unistUtilPosition.end; + +var reasonStart = 'Missing initial pipe in table fence'; +var reasonEnd = 'Missing final pipe in table fence'; + +function tablePipes(tree, file) { + var contents = String(file); + + unistUtilVisit$2(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; + + while (++index < length) { + row = rows[index]; + + if (!unistUtilGenerated(row)) { + cells = row.children; + head = cells[0]; + tail = cells[cells.length - 1]; + initial = contents.slice(start$8(row).offset, start$8(head).offset); + final = contents.slice(end$5(tail).offset, end$5(row).offset); + + if (initial.indexOf('|') === -1) { + file.message(reasonStart, start$8(row)); + } + + if (final.indexOf('|') === -1) { + file.message(reasonEnd, end$5(row)); + } + } + } + } +} + +var remarkLintBlockquoteIndentation = unifiedLintRule( + 'remark-lint:blockquote-indentation', + blockquoteIndentation +); + +function blockquoteIndentation(tree, file, pref) { + pref = typeof pref === 'number' && !isNaN(pref) ? pref : null; + + unistUtilVisit$2(tree, 'blockquote', visitor); + + function visitor(node) { + var diff; + var reason; + + if (unistUtilGenerated(node) || node.children.length === 0) { + return + } + + if (pref) { + diff = pref - check$3(node); + + if (diff !== 0) { + reason = + (diff > 0 ? 'Add' : 'Remove') + + ' ' + + Math.abs(diff) + + ' ' + + plur('space', diff) + + ' between blockquote and content'; + + file.message(reason, unistUtilPosition.start(node.children[0])); + } + } else { + pref = check$3(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(/^ +/); + + if (padding) { + indentation += padding[0].length; + } + + return indentation +} + +var remarkLintCheckboxCharacterStyle = unifiedLintRule( + 'remark-lint:checkbox-character-style', + checkboxCharacterStyle +); + +var start$9 = unistUtilPosition.start; +var end$6 = unistUtilPosition.end; + +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$3(file); + + 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) { + file.fail( + 'Invalid checked checkbox marker `' + + pref.checked + + "`: use either `'x'`, or `'X'`" + ); + } + + unistUtilVisit$2(tree, 'listItem', visitor); + + function visitor(node) { + 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)) { + return + } + + type = types[node.checked]; + initial = start$9(node).offset; + final = (node.children.length ? start$9(node.children[0]) : end$6(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); + + /* The checkbox character is behind a square bracket. */ + character = value.charAt(value.length - 1); + style = pref[type]; + + if (style) { + if (character !== style) { + reason = + type.charAt(0).toUpperCase() + + type.slice(1) + + ' checkboxes should use `' + + style + + '` as a marker'; + + file.message(reason, { + start: location.toPosition(initial + value.length - 1), + end: location.toPosition(initial + value.length) + }); + } + } else { + pref[type] = character; + } + } +} + +var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', codeBlockStyle); + +var start$10 = unistUtilPosition.start; +var end$7 = unistUtilPosition.end; + +var styles = {null: true, fenced: true, indented: true}; + +function codeBlockStyle(tree, file, pref) { + var contents = String(file); + + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + + if (styles[pref] !== true) { + file.fail( + 'Invalid code block style `' + + pref + + "`: use either `'consistent'`, `'fenced'`, or `'indented'`" + ); + } + + unistUtilVisit$2(tree, 'code', visitor); + + function visitor(node) { + var current = check(node); + + if (current) { + if (!pref) { + pref = current; + } else if (pref !== current) { + file.message('Code blocks should be ' + pref, node); + } + } + } + + /* Get the style of `node`. */ + function check(node) { + var initial = start$10(node).offset; + var final = end$7(node).offset; + + if (unistUtilGenerated(node)) { + return null + } + + return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final)) + ? 'fenced' + : 'indented' + } +} + +var remarkLintFencedCodeMarker = unifiedLintRule('remark-lint:fenced-code-marker', fencedCodeMarker); + +var markers = { + '`': true, + '~': true, + null: true +}; + +function fencedCodeMarker(tree, file, pref) { + var contents = String(file); + + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + + if (markers[pref] !== true) { + file.fail( + 'Invalid fenced code marker `' + + pref + + "`: use either `'consistent'`, `` '`' ``, or `'~'`" + ); + } + + unistUtilVisit$2(tree, 'code', visitor); + + function visitor(node) { + var marker; + + if (!unistUtilGenerated(node)) { + marker = contents + .substr(unistUtilPosition.start(node).offset, 4) + .trimLeft() + .charAt(0); + + /* Ignore unfenced code blocks. */ + if (markers[marker] === true) { + if (pref) { + if (marker !== pref) { + file.message( + 'Fenced code should use ' + pref + ' as a marker', + node + ); + } + } else { + pref = marker; + } + } + } + } +} + +var remarkLintFileExtension = unifiedLintRule('remark-lint:file-extension', fileExtension); + +function fileExtension(tree, file, pref) { + var ext = file.extname; + + pref = typeof pref === 'string' ? pref : 'md'; + + if (ext && ext.slice(1) !== pref) { + file.message('Invalid extension: use `' + pref + '`'); + } +} + +var remarkLintFirstHeadingLevel = unifiedLintRule('remark-lint:first-heading-level', firstHeadingLevel); + +var re$4 = / { + if (testProhibited(val, content)) { + file.message(`Use "${val.yes}" instead of "${val.no}"`, node); + } + }); + } +} + +var remarkLintStrongMarker = unifiedLintRule('remark-lint:strong-marker', strongMarker); + +var markers$1 = {'*': true, _: true, null: true}; + +function strongMarker(tree, file, pref) { + var contents = String(file); + + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + + if (markers$1[pref] !== true) { + file.fail( + 'Invalid strong marker `' + + pref + + "`: use either `'consistent'`, `'*'`, or `'_'`" + ); + } + + unistUtilVisit$2(tree, 'strong', visitor); + + function visitor(node) { + var marker = contents.charAt(unistUtilPosition.start(node).offset); + + if (!unistUtilGenerated(node)) { + if (pref) { + if (marker !== pref) { + file.message('Strong should use `' + pref + '` as a marker', node); + } + } else { + pref = marker; + } + } + } +} + +var remarkLintTableCellPadding = unifiedLintRule('remark-lint:table-cell-padding', tableCellPadding); + +var start$11 = unistUtilPosition.start; +var end$8 = unistUtilPosition.end; + +var styles$1 = {null: true, padded: true, compact: true}; + +function tableCellPadding(tree, file, pref) { + var contents = String(file); + + pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; + + if (styles$1[pref] !== true) { + file.fail('Invalid table-cell-padding style `' + pref + '`'); + } + + unistUtilVisit$2(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; + + /* 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; + + /* Check fences (before, between, and after cells) */ + while (++column < cellCount) { + cell = next; + next = cells[column + 1]; + + fence = contents.slice( + cell ? end$8(cell).offset : start$11(row).offset, + next ? start$11(next).offset : end$8(row).offset + ); + + pos = fence.indexOf('|'); + + if (cell && cell.children.length !== 0 && final !== undefined) { + entries.push({node: cell, start: final, end: pos, index: column}); + + /* Detect max space per column. */ + sizes[column] = Math.max(sizes[column] || 0, size(cell)); + } else { + final = undefined; + } + + if (next && next.children.length !== 0) { + final = fence.length - pos - 1; + } else { + final = undefined; + } + } + } + + if (pref) { + style = pref === 'padded' ? 1 : 0; + } else { + style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1; + } + + index = -1; + length = entries.length; + + while (++index < length) { + entry = entries[index]; + checkSide('start', entry, style, sizes); + checkSide('end', entry, style, sizes); + } + + return unistUtilVisit$2.SKIP + } + + function checkSide(side, entry, style, sizes) { + var cell = entry.node; + var spacing = entry[side]; + var index = entry.index; + var reason; + + if (spacing === undefined || spacing === style) { + return + } + + reason = 'Cell should be '; + + if (style === 0) { + reason += 'compact'; + + /* Ignore every cell except the biggest in the column. */ + if (size(cell) < sizes[index]) { + return + } + } else { + reason += 'padded'; + + if (spacing > style) { + reason += ' with 1 space, not ' + spacing; + + /* May be right or center aligned. */ + if (size(cell) < sizes[index]) { + return + } + } + } + + file.message(reason, cell.position[side]); + } +} + +function size(node) { + return end$8(node).offset - start$11(node).offset +} + +var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); + +var start$12 = unistUtilPosition.start; +var end$9 = unistUtilPosition.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; + + unistUtilVisit$2(tree, ['heading', 'table', 'code', 'definition'], ignore); + unistUtilVisit$2(tree, ['link', 'image', 'inlineCode'], inline); + + /* Iterate over every line, and warn for violating lines. */ + while (++index < length) { + lineLength = lines[index].length; + + if (lineLength > style) { + file.message('Line must be at most ' + style + ' characters', { + line: index + 1, + column: lineLength + 1 + }); + } + } + + /* Finally, whitelist some inline spans, but only if they occur at or after + * 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; + + /* istanbul ignore if - Nothing to whitelist when generated. */ + if (unistUtilGenerated(node)) { + return + } + + initial = start$12(node); + final = end$9(node); + + /* No whitelisting when starting after the border, or ending before it. */ + if (initial.column > style || final.column < style) { + return + } + + /* No whitelisting when there’s white-space after + * the link. */ + if ( + next && + start$12(next).line === initial.line && + (!next.value || /^(.+?[ \t].+?)/.test(next.value)) + ) { + return + } + + 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$12(node).line - 1, end$9(node).line); + } + } + + /* Whitelist from `initial` to `final`, zero-based. */ + function whitelist(initial, final) { + while (initial < final) { + lines[initial++] = ''; + } + } +} + +var plugins$1 = [ + remarkLint, + remarkLintCheckboxContentIndent, + remarkLintDefinitionSpacing, + remarkLintFencedCodeFlag, + remarkLintFinalDefinition, + remarkLintFinalNewline, + remarkLintHardBreakSpaces, + remarkLintNoAutoLinkWithoutProtocol, + remarkLintNoBlockquoteWithoutCaret, + remarkLintNoDuplicateDefinitions, + remarkLintNoFileNameArticles, + remarkLintNoFileNameConsecutiveDashes, + remarkLintNoFileNameOuterDashes, + remarkLintNoHeadingContentIndent, + remarkLintNoHeadingIndent, + remarkLintNoInlinePadding, + remarkLintNoMultipleToplevelHeadings, + remarkLintNoShellDollars, + remarkLintNoShortcutReferenceImage, + remarkLintNoTableIndentation, + remarkLintNoTabs, + 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'], + [remarkLintMaximumLineLength, 80] +]; + +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 = { + +}; + +module.exports = cliEntry; diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 212b5275c318ae..1692ec1c30ad7e 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -26,7 +26,7 @@ EXIT /B :: Query registry sub-tree for InstallPath :find-key -FOR /F "delims=" %%a IN ('REG QUERY %1 /s 2> NUL ^| findstr "2." ^| findstr InstallPath') DO IF NOT ERRORLEVEL 1 CALL :find-path %%a +FOR /F "delims=" %%a IN ('REG QUERY %1 /s 2^> NUL ^| findstr "2." ^| findstr InstallPath') DO IF NOT ERRORLEVEL 1 CALL :find-path %%a EXIT /B :: Parse the value of %1 as the path for python.exe diff --git a/tools/node-lint-md-cli-rollup/.gitignore b/tools/node-lint-md-cli-rollup/.gitignore new file mode 100644 index 00000000000000..ab9ffa17b3a6dd --- /dev/null +++ b/tools/node-lint-md-cli-rollup/.gitignore @@ -0,0 +1,3 @@ +/node_modules/ +/remark-preset-lint-node/node_modules/ +/dist/ diff --git a/tools/node-lint-md-cli-rollup/LICENSE b/tools/node-lint-md-cli-rollup/LICENSE new file mode 100644 index 00000000000000..3ffee7a3be6993 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/LICENSE @@ -0,0 +1,32 @@ +Copyright (c) 2018 Refael Ackermann + +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. + +--- + +(The MIT License for `remark` https://github.com/remarkjs/remark/blob/master/LICENSE) + +Copyright (c) 2014-2016 Titus Wormer +Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) + +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. \ 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 new file mode 100644 index 00000000000000..c3b14de9135465 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -0,0 +1,3539 @@ +{ + "name": "node-lint-md-cli-rollup", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "acorn": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "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" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, + "bail": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.3.tgz", + "integrity": "sha512-1X8CnjFVQ+a+KW36uBNMTU5s8+v5FzeqrP7hTG5aTb4aPreSbZJlhwPon9VKMuEVgV++JM+SQrALY3kr7eswdg==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + } + } + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "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" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "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", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "camelcase": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==" + }, + "ccount": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.3.tgz", + "integrity": "sha512-Jt9tIBkRc9POUof7QA/VwWd+58fKkEEfI+/t1/eOlxKM7ZhrczNzMFefge7Ai+39y1pR/pP6cI19guHy3FSLmw==" + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "character-entities": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.2.tgz", + "integrity": "sha512-sMoHX6/nBiy3KKfC78dnEalnpn0Az0oSNvqUWYTtYrhRI5iUIYsROU48G+E+kMFQzqXaJ8kHJZ85n7y6/PHgwQ==" + }, + "character-entities-html4": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.2.tgz", + "integrity": "sha512-sIrXwyna2+5b0eB9W149izTPJk/KkJTg6mEzDGibwBUkyH1SbDa+nf515Ppdi3MaH35lW0JFJDWeq9Luzes1Iw==" + }, + "character-entities-legacy": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.2.tgz", + "integrity": "sha512-9NB2VbXtXYWdXzqrvAHykE/f0QJxzaKIpZ5QzNZrrgQ7Iyxr2vnfS8fCBNVW9nUEZE0lo57nxKRqnzY/dKrwlA==" + }, + "character-reference-invalid": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.2.tgz", + "integrity": "sha512-7I/xceXfKyUJmSAn/jw8ve/9DyOP7XxufNYLI9Px7CmsKgEUaZLUTax6nZxGQtaoiZCjpu6cHPj20xC/vqRReQ==" + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.2.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "lodash.debounce": "^4.0.8", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.5" + }, + "dependencies": { + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "collapse-white-space": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.4.tgz", + "integrity": "sha512-YfQ1tAUZm561vpYD+5eyWN8+UsceQbSrqqlc/6zDY2gtAE+uZLSdkkovhnGpmCThsvKBFakq4EdY/FF93E8XIw==" + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + } + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "estree-walker": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.1.tgz", + "integrity": "sha512-7HgCgz1axW7w5aOvgOQkoR1RMBkllygJrssU3BvymKQ95lxXYv6Pon17fBRDm9qhkvXZGijOULoSF9ShOk/ZLg==", + "dev": true + }, + "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" + } + }, + "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" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "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" + } + }, + "fault": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.2.tgz", + "integrity": "sha512-o2eo/X2syzzERAtN5LcGbiVQ0WwZSlN3qLtadwAz3X8Bu+XWD16dja/KMsjZLiQr+BLGPDnHGkc4yUJf1Xpkpw==", + "requires": { + "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": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^1.1.3", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "fn-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fn-name/-/fn-name-2.0.1.tgz", + "integrity": "sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=" + }, + "for-in": { + "version": "1.0.2", + "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", + "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true + } + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "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" + } + }, + "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" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-alphabetical": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.2.tgz", + "integrity": "sha512-V0xN4BYezDHcBSKb1QHUFMlR4as/XEuCZBzMJUU4n7+Cbt33SmUnSol+pnXFvLxSHNq2CemUXNdaXV6Flg7+xg==" + }, + "is-alphanumeric": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphanumeric/-/is-alphanumeric-1.0.0.tgz", + "integrity": "sha1-Spzvcdr0wAHB2B1j0UDPU/1oifQ=" + }, + "is-alphanumerical": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.2.tgz", + "integrity": "sha512-pyfU/0kHdISIgslFfZN9nfY1Gk3MquQgUm1mJTjdkEPpkAKNWuBTSqFwewOpR7N351VkErCiyV71zX7mlQQqsg==", + "requires": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-decimal": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.2.tgz", + "integrity": "sha512-TRzl7mOCchnhchN+f3ICUCzYvL9ul7R+TYOsZ8xia++knyZAJfv/uA1FvQXsAnYIl1T3B2X5E/J7Wb1QXiIBXg==" + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "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", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "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-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "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" + } + }, + "is-hexadecimal": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.2.tgz", + "integrity": "sha512-but/G3sapV3MNyqiDBLrOi4x8uCIw0RY3o/Vb5GT0sMFHrVV7731wFSVy41T5FO1og7G0gXLJh0MkgPRouko/A==" + }, + "is-hidden": { + "version": "1.1.1", + "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": "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" + } + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "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", + "integrity": "sha512-SzM+T5GKUCtLhlHFKt2SDAX2RFzfS6joT91F2/WSi9LxgFdsnhfPK/UIA+JhRR2xuyLdrCys2PiFDrtn1fU5hQ==" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "is-word-character": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.2.tgz", + "integrity": "sha512-T3FlsX8rCHAH8e7RE7PfOPZVFQlcV3XRF9eOOBQ1uf70OxO7CjjSOjeImMPCADBdYWcStAbVbYvJ1m2D3tb+EA==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "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" + } + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "requires": { + "minimist": "^1.2.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + }, + "load-plugin": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-2.2.2.tgz", + "integrity": "sha512-FYzamtURIJefQykZGtiClYuZkJBUKzmx8Tc74y8JGAulDzbzVm/C+w/MbAljHRr+REL0cRzy3WgnHE+T8gce5g==", + "requires": { + "npm-prefix": "^1.2.0", + "resolve-from": "^4.0.0" + } + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" + }, + "longest-streak": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.2.tgz", + "integrity": "sha512-TmYTeEYxiAmSVdpbnQDXGtvYOIRsCMg89CVZzwzc2o7GFL1CjoiRPjH5ec0NFAVlAx3fVof9dX/t6KKRAo2OWA==" + }, + "magic-string": { + "version": "0.22.5", + "resolved": "https://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", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, + "markdown-escapes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.2.tgz", + "integrity": "sha512-lbRZ2mE3Q9RtLjxZBZ9+IMl68DKIXaVAhwvwn9pmjnPLS0h/6kyBMgNhqi1xFJ/2yv6cSyv0jbiZavZv93JkkA==" + }, + "markdown-extensions": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-1.1.1.tgz", + "integrity": "sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==" + }, + "markdown-table": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.2.tgz", + "integrity": "sha512-NcWuJFHDA8V3wkDgR/j4+gZx+YQwstPgfQDV8ndUeWWzta3dnDTBxpVzqS9lkmJAuV5YX35lmyojl6HO5JXAgw==" + }, + "mdast-comment-marker": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.0.3.tgz", + "integrity": "sha512-FZXxBBYeJ/R6k9zgyVGygHWka6FDJdzSbP6kcvB+L4Yqz62po57rZlnA2I14LIKsb3XPEky4vgP0Y83tZXTw7Q==" + }, + "mdast-util-compact": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.2.tgz", + "integrity": "sha512-d2WS98JSDVbpSsBfVvD9TaDMlqPRz7ohM/11G0rp5jOBb5q96RJ6YLszQ/09AAixyzh23FeIpCGqfaamEADtWg==", + "requires": { + "unist-util-visit": "^1.1.0" + } + }, + "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" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + } + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-prefix": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/npm-prefix/-/npm-prefix-1.2.0.tgz", + "integrity": "sha1-5hlFX3B0ulTMZtbQ033Z8b5ry8A=", + "requires": { + "rc": "^1.1.0", + "shellsubstitute": "^1.1.0", + "untildify": "^2.1.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "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", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "parse-entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.2.tgz", + "integrity": "sha512-5N9lmQ7tmxfXf+hO3X6KRG6w7uYO/HL9fHalSySTdyn63C3WNvTM/1R8tn1u1larNcEbo3Slcy2bsVDQqvEpUg==", + "requires": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "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" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "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": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "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" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + } + }, + "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", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remark": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz", + "integrity": "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw==", + "requires": { + "remark-parse": "^4.0.0", + "remark-stringify": "^4.0.0", + "unified": "^6.0.0" + } + }, + "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==", + "requires": { + "remark-message-control": "^4.0.0" + } + }, + "remark-message-control": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-4.1.0.tgz", + "integrity": "sha512-e1dszks4YKY7hLAkhS2367jBjBpAfvi+kVgSN/tOFrdp3qxITjiNR5fOFnyYF8vvorkQ9uxlKJoZUOW8T7rKDg==", + "requires": { + "mdast-comment-marker": "^1.0.0", + "unified-message-control": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "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==", + "requires": { + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^1.0.0", + "vfile-location": "^2.0.0", + "xtend": "^4.0.1" + } + }, + "remark-preset-lint-node": { + "version": "file:remark-preset-lint-node", + "requires": { + "remark-lint": "^6.0.0", + "remark-lint-blockquote-indentation": "^1.0.0", + "remark-lint-checkbox-character-style": "^1.0.0", + "remark-lint-checkbox-content-indent": "^1.0.0", + "remark-lint-code-block-style": "^1.0.0", + "remark-lint-definition-spacing": "^1.0.0", + "remark-lint-fenced-code-flag": "^1.0.0", + "remark-lint-fenced-code-marker": "^1.0.0", + "remark-lint-file-extension": "^1.0.0", + "remark-lint-final-definition": "^1.0.0", + "remark-lint-final-newline": "^1.0.0", + "remark-lint-first-heading-level": "^1.0.0", + "remark-lint-hard-break-spaces": "^1.0.1", + "remark-lint-heading-style": "^1.0.0", + "remark-lint-maximum-line-length": "^1.0.2", + "remark-lint-no-auto-link-without-protocol": "^1.0.0", + "remark-lint-no-blockquote-without-caret": "^1.0.0", + "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", + "remark-lint-no-file-name-outer-dashes": "^1.0.0", + "remark-lint-no-heading-content-indent": "^1.0.0", + "remark-lint-no-heading-indent": "^1.0.0", + "remark-lint-no-inline-padding": "^1.0.0", + "remark-lint-no-multiple-toplevel-headings": "^1.0.0", + "remark-lint-no-shell-dollars": "^1.0.0", + "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-unused-definitions": "^1.0.0", + "remark-lint-prohibited-strings": "^1.0.0", + "remark-lint-rule-style": "^1.0.0", + "remark-lint-strong-marker": "^1.0.0", + "remark-lint-table-cell-padding": "^1.0.0", + "remark-lint-table-pipes": "^1.0.0" + }, + "dependencies": { + "co": { + "version": "3.1.0", + "bundled": true + }, + "irregular-plurals": { + "version": "1.4.0", + "bundled": true + }, + "mdast-comment-marker": { + "version": "1.0.2", + "bundled": true + }, + "mdast-util-heading-style": { + "version": "1.0.3", + "bundled": true + }, + "mdast-util-to-string": { + "version": "1.0.4", + "bundled": true + }, + "plur": { + "version": "2.1.2", + "bundled": true, + "requires": { + "irregular-plurals": "^1.0.0" + } + }, + "remark-lint": { + "version": "6.0.1", + "bundled": true, + "requires": { + "remark-message-control": "^4.0.0" + } + }, + "remark-lint-blockquote-indentation": { + "version": "1.0.1", + "bundled": true, + "requires": { + "mdast-util-to-string": "^1.0.2", + "plur": "^2.1.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-checkbox-character-style": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-checkbox-content-indent": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-code-block-style": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-definition-spacing": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-fenced-code-flag": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-fenced-code-marker": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-file-extension": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-final-definition": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-final-newline": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-first-heading-level": { + "version": "1.1.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-hard-break-spaces": { + "version": "1.0.2", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-heading-style": { + "version": "1.0.1", + "bundled": true, + "requires": { + "mdast-util-heading-style": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-maximum-line-length": { + "version": "1.0.2", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-auto-link-without-protocol": { + "version": "1.0.1", + "bundled": true, + "requires": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-blockquote-without-caret": { + "version": "1.0.0", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-no-duplicate-definitions": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-file-name-articles": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-file-name-consecutive-dashes": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-file-name-outer-dashes": { + "version": "1.0.2", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-heading-content-indent": { + "version": "1.0.1", + "bundled": true, + "requires": { + "mdast-util-heading-style": "^1.0.2", + "plur": "^2.1.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-heading-indent": { + "version": "1.0.1", + "bundled": true, + "requires": { + "plur": "^2.1.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-inline-padding": { + "version": "1.0.1", + "bundled": true, + "requires": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-multiple-toplevel-headings": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-shell-dollars": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-shortcut-reference-image": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-table-indentation": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-tabs": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-no-unused-definitions": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-prohibited-strings": { + "version": "1.0.3", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.2", + "unist-util-visit": "^1.2.0" + } + }, + "remark-lint-rule-style": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-strong-marker": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-table-cell-padding": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-table-pipes": { + "version": "1.0.1", + "bundled": true, + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-message-control": { + "version": "4.1.0", + "bundled": true, + "requires": { + "mdast-comment-marker": "^1.0.0", + "unified-message-control": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "sliced": { + "version": "1.0.1", + "bundled": true + }, + "trim": { + "version": "0.0.1", + "bundled": true + }, + "unified-lint-rule": { + "version": "1.0.2", + "bundled": true, + "requires": { + "wrapped": "^1.0.1" + } + }, + "unified-message-control": { + "version": "1.0.4", + "bundled": true, + "requires": { + "trim": "0.0.1", + "unist-util-visit": "^1.0.0", + "vfile-location": "^2.0.0" + } + }, + "unist-util-generated": { + "version": "1.1.2", + "bundled": true + }, + "unist-util-is": { + "version": "2.1.2", + "bundled": true + }, + "unist-util-position": { + "version": "3.0.1", + "bundled": true + }, + "unist-util-visit": { + "version": "1.3.1", + "bundled": true, + "requires": { + "unist-util-is": "^2.1.1" + } + }, + "vfile-location": { + "version": "2.0.3", + "bundled": true + }, + "wrapped": { + "version": "1.0.1", + "bundled": true, + "requires": { + "co": "3.1.0", + "sliced": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "bundled": true + } + } + }, + "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==", + "requires": { + "ccount": "^1.0.0", + "is-alphanumeric": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "longest-streak": "^2.0.1", + "markdown-escapes": "^1.0.0", + "markdown-table": "^1.1.0", + "mdast-util-compact": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "stringify-entities": "^1.0.1", + "unherit": "^1.0.4", + "xtend": "^4.0.1" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" + }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "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", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "ret": { + "version": "0.1.15", + "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": "https://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": "https://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.0.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz", + "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=", + "dev": true, + "requires": { + "estree-walker": "^0.3.0", + "micromatch": "^2.3.11" + }, + "dependencies": { + "estree-walker": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz", + "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao=", + "dev": true + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shellsubstitute": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shellsubstitute/-/shellsubstitute-1.2.0.tgz", + "integrity": "sha1-5PcCpQxRiw9v6YRRiQ1wWvKba3A=" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "state-toggle": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", + "integrity": "sha512-Qe8QntFrrpWTnHwvwj2FZTgv+PKIsp0B9VxLzLLbSpPXWOgRgc5LVj/aTiSfK1RqIeF9jeC1UeOH8Q8y60A7og==" + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringify-entities": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz", + "integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==", + "requires": { + "character-entities-html4": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-hexadecimal": "^1.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + } + } + } + }, + "to-vfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-4.0.0.tgz", + "integrity": "sha512-Y7EDM+uoU8TZxF5ej2mUR0dLO4qbuuNRnJKxEht2QJWEq2421pyG1D1x8YxPKmyTc6nHh7Td/jLGFxYo+9vkLA==", + "requires": { + "is-buffer": "^2.0.0", + "vfile": "^3.0.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.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.0.tgz", + "integrity": "sha512-X2DiPHL9Nxgfyu5DNVgtTkZtD4d4Zzf7rVBVI+uXP2pWWIQG8Ri+xAP9KdH/sB6SS0a1niWp5bRF88n4ciwhoA==", + "requires": { + "is-buffer": "^2.0.0", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + } + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "trim-trailing-lines": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.1.tgz", + "integrity": "sha512-bWLv9BbWbbd7mlqqs2oQYnLD/U/ZqeJeJwbO0FG2zA1aTq+HTvxfHNKFa/HGCVyJpDiioUYaBhfiT6rgk+l4mg==" + }, + "trough": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.3.tgz", + "integrity": "sha512-fwkLWH+DimvA4YCy+/nvJd61nWQQ2liO/nF/RjkTpiOGi+zxZzVkhb1mvbHIIW4b/8nDsYI8uTmAlc0nNkRMOw==" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "unherit": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz", + "integrity": "sha512-+XZuV691Cn4zHsK0vkKYwBEwB74T3IZIcxrgn2E4rKwTfFyI1zCh7X7grwh9Re08fdPlarIdyWgI8aVB3F5A5g==", + "requires": { + "inherits": "^2.0.1", + "xtend": "^4.0.1" + } + }, + "unified": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "requires": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^2.0.0", + "x-is-string": "^0.1.0" + } + }, + "unified-args": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unified-args/-/unified-args-6.0.0.tgz", + "integrity": "sha512-1m2pGiTClgcCtCvgtABkJLze8JJiZpzsqujRhzBjZsRwaIIU1Yj36YHY6t2RvidO8d6fucZdk3KX+8eS4+uv9g==", + "requires": { + "camelcase": "^5.0.0", + "chalk": "^2.0.0", + "chokidar": "^2.0.0", + "fault": "^1.0.2", + "json5": "^1.0.0", + "minimist": "^1.2.0", + "text-table": "^0.2.0", + "unified-engine": "^6.0.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "unified-engine": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-6.0.1.tgz", + "integrity": "sha512-iDJYH82TgcezQA4IZzhCNJQx7vBsGk4h9s4Q7Fscrb3qcPsxBqVrVNYez2W3sBVTxuU1bFAhyRpA6ba/R4j93A==", + "requires": { + "concat-stream": "^1.5.1", + "debug": "^3.1.0", + "fault": "^1.0.0", + "fn-name": "^2.0.1", + "glob": "^7.0.3", + "ignore": "^3.2.0", + "is-empty": "^1.0.0", + "is-hidden": "^1.0.1", + "is-object": "^1.0.1", + "js-yaml": "^3.6.1", + "load-plugin": "^2.0.0", + "parse-json": "^4.0.0", + "to-vfile": "^4.0.0", + "trough": "^1.0.0", + "unist-util-inspect": "^4.1.2", + "vfile-reporter": "^5.0.0", + "vfile-statistics": "^1.1.0", + "x-is-string": "^0.1.0", + "xtend": "^4.0.1" + } + } + } + }, + "unified-engine": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-5.1.0.tgz", + "integrity": "sha512-N7b7HG6doQUtkWr+kH35tfUhfc9QiYeiZGG6TcZlexSURf4xRUpYKBbc2f67qJF5oPmn6mMkImkdhr31Q6saoA==", + "requires": { + "concat-stream": "^1.5.1", + "debug": "^3.1.0", + "fault": "^1.0.0", + "fn-name": "^2.0.1", + "glob": "^7.0.3", + "ignore": "^3.2.0", + "is-empty": "^1.0.0", + "is-hidden": "^1.0.1", + "is-object": "^1.0.1", + "js-yaml": "^3.6.1", + "load-plugin": "^2.0.0", + "parse-json": "^4.0.0", + "to-vfile": "^2.0.0", + "trough": "^1.0.0", + "unist-util-inspect": "^4.1.2", + "vfile-reporter": "^4.0.0", + "vfile-statistics": "^1.1.0", + "x-is-function": "^1.0.4", + "x-is-string": "^0.1.0", + "xtend": "^4.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "^2.0.0" + } + }, + "to-vfile": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-2.2.0.tgz", + "integrity": "sha512-saGC8/lWdGrEoBMLUtgzhRHWAkQMP8gdldA3MOAUhBwTGEb1RSMVcflHGSx4ZJsdEZ9o1qDBCPp47LCPrbZWow==", + "requires": { + "is-buffer": "^1.1.4", + "vfile": "^2.0.0", + "x-is-function": "^1.0.4" + } + }, + "vfile-reporter": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-4.0.0.tgz", + "integrity": "sha1-6m8K4TQvSEFXOYXgX5QXNvJ96do=", + "requires": { + "repeat-string": "^1.5.0", + "string-width": "^1.0.0", + "supports-color": "^4.1.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-statistics": "^1.1.0" + } + } + } + }, + "unified-message-control": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-1.0.4.tgz", + "integrity": "sha512-e1dEtN4Z/TvLn/qHm+xeZpzqhJTtfZusFErk336kkZVpqrJYiV9ptxq+SbRPFMlN0OkjDYHmVJ929KYjsMTo3g==", + "requires": { + "trim": "0.0.1", + "unist-util-visit": "^1.0.0", + "vfile-location": "^2.0.0" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unist-util-inspect": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-4.1.3.tgz", + "integrity": "sha512-Fv9R88ZBbDp7mHN+wsbxS1r8VW3unyhZh/F18dcJRQsg0+g3DxNQnMS+AEG/uotB8Md+HMK/TfzSU5lUDWxkZg==", + "requires": { + "is-empty": "^1.0.0" + } + }, + "unist-util-is": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.2.tgz", + "integrity": "sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw==" + }, + "unist-util-remove-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.2.tgz", + "integrity": "sha512-XxoNOBvq1WXRKXxgnSYbtCF76TJrRoe5++pD4cCBsssSiWSnPEktyFrFLE8LTk3JW5mt9hB0Sk5zn4x/JeWY7Q==", + "requires": { + "unist-util-visit": "^1.1.0" + } + }, + "unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==" + }, + "unist-util-visit": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.0.tgz", + "integrity": "sha512-FiGu34ziNsZA3ZUteZxSFaczIjGmksfSgdKqBfOejrrfzyUy5b7YrlzT1Bcvi+djkYDituJDy2XB7tGTeBieKw==", + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz", + "integrity": "sha512-6B0UTiMfdWql4cQ03gDTCSns+64Zkfo2OCbK31Ov0uMizEz+CJeAp0cgZVb5Fhmcd7Bct2iRNywejT0orpbqUA==", + "requires": { + "unist-util-is": "^2.1.2" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + } + } + }, + "untildify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-2.1.0.tgz", + "integrity": "sha1-F+soB5h/dpUunASF/DEdBqgmouA=", + "requires": { + "os-homedir": "^1.0.0" + } + }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==" + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "vfile": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.3.0.tgz", + "integrity": "sha512-ASt4mBUHcTpMKD/l5Q+WJXNtshlWxOogYyGYYrg4lt/vuRjC1EFQtlAofL5VmtVNIZJzWYFJjzGWZ0Gw8pzW1w==", + "requires": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" + } + }, + "vfile-location": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.3.tgz", + "integrity": "sha512-zM5/l4lfw1CBoPx3Jimxoc5RNDAHHpk6AM6LM0pTIkm5SUSsx8ZekZ0PVdf0WEZ7kjlhSt7ZlqbRL6Cd6dBs6A==" + }, + "vfile-message": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.0.1.tgz", + "integrity": "sha512-vSGCkhNvJzO6VcWC6AlJW4NtYOVtS+RgCaqFIYUjoGIlHnFL+i0LbtYvonDWOMcB97uTPT4PRsyYY7REWC9vug==", + "requires": { + "unist-util-stringify-position": "^1.1.1" + } + }, + "vfile-reporter": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-5.0.0.tgz", + "integrity": "sha512-p1zv4/AfRWUtXEJ0dYSPo1JGS1qL4R95YiHKF7V/8BcXq1buSYIwE660QAHmE7u8tVOjgKp2+oW4RHe+AO+K5Q==", + "requires": { + "repeat-string": "^1.5.0", + "string-width": "^2.0.0", + "supports-color": "^5.4.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-statistics": "^1.1.0" + } + }, + "vfile-statistics": { + "version": "1.1.1", + "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 + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "x-is-function": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/x-is-function/-/x-is-function-1.0.4.tgz", + "integrity": "sha1-XSlNw9Joy90GJYDgxd93o5HR+h4=" + }, + "x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +} diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json new file mode 100644 index 00000000000000..881139057e1c5b --- /dev/null +++ b/tools/node-lint-md-cli-rollup/package.json @@ -0,0 +1,23 @@ +{ + "name": "node-lint-md-cli-rollup", + "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" + }, + "dependencies": { + "markdown-extensions": "^1.1.0", + "remark": "^8.0.0", + "remark-lint": "^6.0.2", + "remark-preset-lint-node": "./remark-preset-lint-node", + "unified-args": "^6.0.0", + "unified-engine": "^5.1.0" + }, + "scripts": { + "build": "rollup -c", + "build-node": "npm run build && cp dist/* .." + } +} diff --git a/tools/remark-preset-lint-node/LICENSE b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/LICENSE similarity index 100% rename from tools/remark-preset-lint-node/LICENSE rename to tools/node-lint-md-cli-rollup/remark-preset-lint-node/LICENSE diff --git a/tools/remark-preset-lint-node/README.md b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/README.md similarity index 100% rename from tools/remark-preset-lint-node/README.md rename to tools/node-lint-md-cli-rollup/remark-preset-lint-node/README.md diff --git a/tools/remark-preset-lint-node/index.js b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/index.js similarity index 100% rename from tools/remark-preset-lint-node/index.js rename to tools/node-lint-md-cli-rollup/remark-preset-lint-node/index.js diff --git a/tools/node-lint-md-cli-rollup/remark-preset-lint-node/package-lock.json b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/package-lock.json new file mode 100644 index 00000000000000..568fb7f3cc7467 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/package-lock.json @@ -0,0 +1,504 @@ +{ + "name": "remark-preset-lint-node", + "version": "1.0.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "co": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/co/-/co-3.1.0.tgz", + "integrity": "sha1-TqVOpaCJOBUxheFSEMaNkJK8G3g=" + }, + "irregular-plurals": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-2.0.0.tgz", + "integrity": "sha512-Y75zBYLkh0lJ9qxeHlMjQ7bSbyiSqNW/UOPWDmzC7cXskL1hekSITh1Oc6JV0XCWWZ9DE8VYSB71xocLk3gmGw==" + }, + "mdast-comment-marker": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.0.3.tgz", + "integrity": "sha512-FZXxBBYeJ/R6k9zgyVGygHWka6FDJdzSbP6kcvB+L4Yqz62po57rZlnA2I14LIKsb3XPEky4vgP0Y83tZXTw7Q==" + }, + "mdast-util-heading-style": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mdast-util-heading-style/-/mdast-util-heading-style-1.0.4.tgz", + "integrity": "sha512-n4fUvwpR5Uj1Ti658KxYDq9gR0UF3FK1UVTVig12imrSOssQU2OpUysje8nps5Cb85b6eau5akpWW7Zkxtv1XA==" + }, + "mdast-util-to-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.0.5.tgz", + "integrity": "sha512-2qLt/DEOo5F6nc2VFScQiHPzQ0XXcabquRJxKMhKte8nt42o08HUxNDPk7tt0YPxnWjAT11I1SYi0X0iPnfI5A==" + }, + "plur": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/plur/-/plur-3.0.1.tgz", + "integrity": "sha512-lJl0ojUynAM1BZn58Pas2WT/TXeC1+bS+UqShl0x9+49AtOn7DixRXVzaC8qrDOIxNDmepKnLuMTH7NQmkX0PA==", + "requires": { + "irregular-plurals": "^2.0.0" + } + }, + "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==", + "requires": { + "remark-message-control": "^4.0.0" + } + }, + "remark-lint-blockquote-indentation": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-1.0.2.tgz", + "integrity": "sha512-u3ruA+4ZZOpt3YmTCdCOcYiGBMSQ/b/iJvZs/fibF6rwSBmkod48aGGJVoOLMuIuTYYbbXpzigxS+PeJwN0CDQ==", + "requires": { + "mdast-util-to-string": "^1.0.2", + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-checkbox-character-style": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-1.0.2.tgz", + "integrity": "sha512-8hTvHHGj0Ko5Qx9RjBVj9yPO/pOpSFzWVMvszyhZkuH/uy92bab/bmfUwl0/4f8gqsxqyRS/QC/Sp+KivWvYlw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-checkbox-content-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-1.0.2.tgz", + "integrity": "sha512-9cPEpd3GpN5ZoAEBTl6qkVOIXpJSms+AC6L/gGLHOcfmSaR5jfgzQWE7GkCj6OvUqjV69zrGGHlWLu7uMujf3g==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-code-block-style": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-1.0.2.tgz", + "integrity": "sha512-fTSCga/lJ710zBaD808NwqzAatVoLQFizvXWpetygKwoAfXCyMYQ9DUdDE5jdDhwOu2JPnKbxY+4t6m4SrKKWA==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-definition-spacing": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-1.0.2.tgz", + "integrity": "sha512-Yg1BcI/nydXii1B6kiqKIBsqDW7KlOCBMpJO2jMGmNuEuZe8sv1AWNmaCtiSCdPuDiX0CZRidklrkrZwAthPdw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-fenced-code-flag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-1.0.2.tgz", + "integrity": "sha512-6/412zYtz+qKpFJryEPSMurWr6tO5MTVohJF3byFc3+3SSEZLWY3Dg8gbwFlumZ9T4HgmfUm/LT7Idm96zj0nw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-fenced-code-marker": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-1.0.2.tgz", + "integrity": "sha512-yAP59Q1JoI1jjOFCn0GoNx4uDji99ROLvdwvmz7+9YR9guDArBcR4i9Wem/wN6apauWPk2DbAZFavHvbZaT8HQ==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-file-extension": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-1.0.2.tgz", + "integrity": "sha512-qx0uki74rmALIKE3r5J3neasbXnz6h+l88OngvpwWkELsnJmfk81JdxfEd0tZ++uTj6CN0TZuhMKad9smfNtRw==", + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-final-definition": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-1.0.2.tgz", + "integrity": "sha512-F+n8eauYOJGdcSrnD7w2YgQSERx1rAwXTxStaJ2tLmoXlT7eQgpVGHz1U4Y76cg8OANbq8pT0KTNJ85JNqkq4g==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-final-newline": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-1.0.2.tgz", + "integrity": "sha512-hW/lbDwVKtME3jIcJWJ16wBtoJdFPWIiu0fEI93yzNTjeB1g3VSWJp66dHbtCLYwquRS5fr8UlGx7JxIu1kiuA==", + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-first-heading-level": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/remark-lint-first-heading-level/-/remark-lint-first-heading-level-1.1.2.tgz", + "integrity": "sha512-4LXZmaeQwlkOoK7PVGoI53ohwdaSB54MgQ+FZ353oVxRO1fY+nbNu70/qxvnyu8/23NK4GkCgHvDVb3+unRJNQ==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-hard-break-spaces": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-1.0.3.tgz", + "integrity": "sha512-GiC0uXeFwef6/Pfo+EYBN0WIVlEFffh+9TdeJ4uLt89ZweaRVDPCTJQqkkuXoiXSPnZGD7cGHdkWCfXU1PaU7Q==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-heading-style": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-1.0.2.tgz", + "integrity": "sha512-d0aIbL8PU5LWfZVI8p49vEV5wWIfD/DdUjc+O8j5E0UWUgcRgPGB66xznkOb8AiniXpcaYggRW8hGZsxoYNt1g==", + "requires": { + "mdast-util-heading-style": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-maximum-line-length": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-1.1.0.tgz", + "integrity": "sha512-L+jI6+DReoxHyAWRIxABjX8hPDgxB8B5Lzp0/nDYjWbjl7I4vTsdEvejpmP1K8LVvZ7Ew0XcVHd1zt+p2O8tDg==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-auto-link-without-protocol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-auto-link-without-protocol/-/remark-lint-no-auto-link-without-protocol-1.0.2.tgz", + "integrity": "sha512-3GtkSxOyd6we4b8JdtJsNgt8+3UN+hpw1UiMoE9X96ahc1rqsCFm6miorNUnF/gfPQ1liHBvZUed2SIenDmpkg==", + "requires": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "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=", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + } + }, + "remark-lint-no-duplicate-definitions": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-1.0.2.tgz", + "integrity": "sha512-e5tSoIBChG3UCz4eJ+JPKV915iNeIeT7uKBKzXBPxnMcEgQaT3V7DBDdN8Wn1oPw9fLp/5AjDN5l9x7iddLsRw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-stringify-position": "^1.1.2", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-file-name-articles": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-1.0.2.tgz", + "integrity": "sha512-5FuxJ0Hd2AgVSP1javG51qPbMBWxma1LrCKI6JmBsu/GM7ZYOgemMyH5v4I1ejTPGj7P30xmIjMNSnV8IBMq3g==", + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-file-name-consecutive-dashes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-1.0.2.tgz", + "integrity": "sha512-VvCxG3AfRm6ROFNJ8+tdOOkk61mEKj+PytB8xg5WNQypKWhhJ734mJ3GzXD4XEov7Bdd1GVXJFXlLFtfoAewHw==", + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-file-name-outer-dashes": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-1.0.3.tgz", + "integrity": "sha512-imUWm8Bi9PxV+IQtQC2/BV1Yj0VboC9hPMZh3sae8pZvCjXquTyYiSFa7hQxX6KWCNUiRPHMSlaSVvfvM2e4pQ==", + "requires": { + "unified-lint-rule": "^1.0.0" + } + }, + "remark-lint-no-heading-content-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-1.0.2.tgz", + "integrity": "sha512-g2MVmJhHbfFungca5WGWVB9bBY4YTrY6og20U+6DxkdS4ngoc8ezXUt8zV1HHEn0M/GdKr9F7fYhXcekJd/qaw==", + "requires": { + "mdast-util-heading-style": "^1.0.2", + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-heading-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-1.0.2.tgz", + "integrity": "sha512-BJ9mPGIFn6Pv0KN9Qwy27wQGllM6mPCv6VI6khDcURlzdAaX5hfFarGJVGKEgPWoL8zs8fPRoXMpsAHIonnnyA==", + "requires": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-inline-padding": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-inline-padding/-/remark-lint-no-inline-padding-1.0.2.tgz", + "integrity": "sha512-SHYqEH27yxzgcXSyaIzvqImvktDhXGltRSOEhAHiL2nJktuPt3nosFfGy4/oKAJMWJ2N3aMudXq/zuw1dAkQSg==", + "requires": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-multiple-toplevel-headings": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-1.0.2.tgz", + "integrity": "sha512-Zxkw7wIyMOyYQb5C5NTswSttZPCLqm/60Wnt0TEWzXVDkVk5DrxrCCxbMKgpXve1Co5CXPmMixNr/xYBqzxzWg==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-stringify-position": "^1.1.2", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-shell-dollars": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-1.0.2.tgz", + "integrity": "sha512-eIjBebX9iOFWbMdjol5JJBXI7ku+7UyJpNrd++rl8QenLLZ76beh+xONCzJw/k5dhEw5voBmQLh7VK9HPU/ang==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-shortcut-reference-image": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-1.0.2.tgz", + "integrity": "sha512-IVYv5pgyf70jYcrn+BNHVO37BuQJg26rFOLzi2mj+/8EdFpolJiJcTvkChJgz5yip7317DmQQSNLX6gCExuDrQ==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-table-indentation": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-1.0.2.tgz", + "integrity": "sha512-wH0lMGV3DGf7WeDLYGle7SODkXNKqmFtGuh6sG5oa0XgA17rI/L35Vq5tal4DE/5gQG+l4+/0Iy9FPKdBODSDA==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-no-tabs": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-1.0.2.tgz", + "integrity": "sha512-jPjRLHyzO4lO6orhOmHd6AN6mVc/uMWvYZ3qD41dniktnLyHEbIG6DpPxixjfpmEe0wi73RXMywKHrWshLJwAg==", + "requires": { + "unified-lint-rule": "^1.0.0", + "vfile-location": "^2.0.1" + } + }, + "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", + "integrity": "sha512-Qv4J2hI2S0NJdrlFuQhBVOlGNUSBLpe+2VBm/hSJAnBE7FW2ZGkVwwrs9h7HdZ/vW3LqfBrNcTKTVw+5ZzWTiA==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-prohibited-strings": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-1.0.3.tgz", + "integrity": "sha512-XgxDXQrNjnHd4+cGavdiW8y5ipN+DwJxWIZDUIWuWjEhmRmgUl8nJHXOKjIYZ8inYxuhVit9m1Y9kX12wO3Edw==", + "requires": { + "unified-lint-rule": "^1.0.2", + "unist-util-visit": "^1.2.0" + } + }, + "remark-lint-rule-style": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-1.0.2.tgz", + "integrity": "sha512-D9mMPKA7rtCe4Yx+ryip6FyfNG9uGOaHxRgJClfte7D66QzxiiWtHYyNCXI4rkv8Ax9PrEdpWCPcIl3D2LrXhw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-strong-marker": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-1.0.2.tgz", + "integrity": "sha512-oUSKqYJVLgbXe25NmcTOfQ8wsFasc+qhEoGjPEGPuJMV2aZIGuOEbGVqD5B1ckYGBEwbTuet3btvMohz8HaBDQ==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-table-cell-padding": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-1.0.2.tgz", + "integrity": "sha512-uYm8ia0joAFeK0XLpxVtGW37Ry1XRBDmWH1gDiO2MXWcUip1w1Brvyue4H8JfXB4IM+S5eI/zPR5zN5Wpj9kfA==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-lint-table-pipes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-1.0.2.tgz", + "integrity": "sha512-BGKcOviuUC6fILIOPYFe6awqk57ApzNJpK3OYBrweGoFF55nZ/qf3q6JpzA0chd6wKj7VrcfQEd3QSQQ+8Wcrw==", + "requires": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, + "remark-message-control": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-4.1.0.tgz", + "integrity": "sha512-e1dszks4YKY7hLAkhS2367jBjBpAfvi+kVgSN/tOFrdp3qxITjiNR5fOFnyYF8vvorkQ9uxlKJoZUOW8T7rKDg==", + "requires": { + "mdast-comment-marker": "^1.0.0", + "unified-message-control": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "unified-lint-rule": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-1.0.3.tgz", + "integrity": "sha512-6z+HH3mtlFdj/w3MaQpObrZAd9KRiro370GxBFh13qkV8LYR21lLozA4iQiZPhe7KuX/lHewoGOEgQ4AWrAR3Q==", + "requires": { + "wrapped": "^1.0.1" + } + }, + "unified-message-control": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-1.0.4.tgz", + "integrity": "sha512-e1dEtN4Z/TvLn/qHm+xeZpzqhJTtfZusFErk336kkZVpqrJYiV9ptxq+SbRPFMlN0OkjDYHmVJ929KYjsMTo3g==", + "requires": { + "trim": "0.0.1", + "unist-util-visit": "^1.0.0", + "vfile-location": "^2.0.0" + } + }, + "unist-util-generated": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.2.tgz", + "integrity": "sha512-1HcwiEO62dr0XWGT+abVK4f0aAm8Ik8N08c5nAYVmuSxfvpA9rCcNyX/le8xXj1pJK5nBrGlZefeWB6bN8Pstw==" + }, + "unist-util-is": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.2.tgz", + "integrity": "sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw==" + }, + "unist-util-position": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.1.tgz", + "integrity": "sha512-05QfJDPI7PE1BIUtAxeSV+cDx21xP7+tUZgSval5CA7tr0pHBwybF7OnEa1dOFqg6BfYH/qiMUnWwWj+Frhlww==" + }, + "unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==" + }, + "unist-util-visit": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.0.tgz", + "integrity": "sha512-FiGu34ziNsZA3ZUteZxSFaczIjGmksfSgdKqBfOejrrfzyUy5b7YrlzT1Bcvi+djkYDituJDy2XB7tGTeBieKw==", + "requires": { + "unist-util-visit-parents": "^2.0.0" + } + }, + "unist-util-visit-parents": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz", + "integrity": "sha512-6B0UTiMfdWql4cQ03gDTCSns+64Zkfo2OCbK31Ov0uMizEz+CJeAp0cgZVb5Fhmcd7Bct2iRNywejT0orpbqUA==", + "requires": { + "unist-util-is": "^2.1.2" + } + }, + "vfile-location": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.3.tgz", + "integrity": "sha512-zM5/l4lfw1CBoPx3Jimxoc5RNDAHHpk6AM6LM0pTIkm5SUSsx8ZekZ0PVdf0WEZ7kjlhSt7ZlqbRL6Cd6dBs6A==" + }, + "wrapped": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wrapped/-/wrapped-1.0.1.tgz", + "integrity": "sha1-x4PZ2Aeyc+mwHoUWgKk4yHyQckI=", + "requires": { + "co": "3.1.0", + "sliced": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +} diff --git a/tools/remark-preset-lint-node/package.json b/tools/node-lint-md-cli-rollup/remark-preset-lint-node/package.json similarity index 100% rename from tools/remark-preset-lint-node/package.json rename to tools/node-lint-md-cli-rollup/remark-preset-lint-node/package.json diff --git a/tools/node-lint-md-cli-rollup/rollup.config.js b/tools/node-lint-md-cli-rollup/rollup.config.js new file mode 100644 index 00000000000000..dde544a41161d4 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/rollup.config.js @@ -0,0 +1,44 @@ +'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 + ] +}; diff --git a/tools/node-lint-md-cli-rollup/src/cli-entry.js b/tools/node-lint-md-cli-rollup/src/cli-entry.js new file mode 100644 index 00000000000000..0d204b15a99954 --- /dev/null +++ b/tools/node-lint-md-cli-rollup/src/cli-entry.js @@ -0,0 +1,29 @@ +'use strict'; + +const engine = require('unified-engine'); +const options = require('unified-args/lib/options'); +const extensions = require('markdown-extensions'); +const processor = require('remark'); +const proc = require('remark/package.json'); +const cli = require('../package.json'); +const { plugins } = require('remark-preset-lint-node'); + +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); +}); diff --git a/tools/node_modules/babel-eslint/node_modules/color-name/.eslintrc.json b/tools/node_modules/babel-eslint/node_modules/color-name/.eslintrc.json deleted file mode 100644 index c50c250446ee6d..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/color-name/.eslintrc.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/tools/node_modules/eslint/lib/formatters/codeframe.js b/tools/node_modules/eslint/lib/formatters/codeframe.js index 0b97a0d8180331..a42872c5a1deb2 100644 --- a/tools/node_modules/eslint/lib/formatters/codeframe.js +++ b/tools/node_modules/eslint/lib/formatters/codeframe.js @@ -5,7 +5,7 @@ "use strict"; const chalk = require("chalk"); -const codeFrame = require("babel-code-frame"); +const { codeFrameColumns } = require("@babel/code-frame"); const path = require("path"); //------------------------------------------------------------------------------ @@ -63,7 +63,7 @@ function formatMessage(message, parentResult) { if (sourceCode) { result.push( - codeFrame(sourceCode, message.line, message.column, { highlightCode: false }) + codeFrameColumns(sourceCode, { start: { line: message.line, column: message.column } }, { highlightCode: false }) ); } diff --git a/tools/node_modules/eslint/lib/rules/camelcase.js b/tools/node_modules/eslint/lib/rules/camelcase.js index ec611662135cfd..3005963ab04c2d 100644 --- a/tools/node_modules/eslint/lib/rules/camelcase.js +++ b/tools/node_modules/eslint/lib/rules/camelcase.js @@ -145,7 +145,7 @@ module.exports = { const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name; // prevent checking righthand side of destructured object - if (!assignmentKeyEqualsValue && node.parent.key === node) { + if (node.parent.key === node && node.parent.value !== node) { return; } diff --git a/tools/node_modules/eslint/lib/rules/for-direction.js b/tools/node_modules/eslint/lib/rules/for-direction.js index 817e2c111e9d7d..b93c4c2caa4b66 100644 --- a/tools/node_modules/eslint/lib/rules/for-direction.js +++ b/tools/node_modules/eslint/lib/rules/for-direction.js @@ -18,7 +18,10 @@ module.exports = { url: "https://eslint.org/docs/rules/for-direction" }, fixable: null, - schema: [] + schema: [], + messages: { + incorrectDirection: "The update clause in this loop moves the variable in the wrong direction." + } }, create(context) { @@ -31,7 +34,7 @@ module.exports = { function report(node) { context.report({ node, - message: "The update clause in this loop moves the variable in the wrong direction." + messageId: "incorrectDirection" }); } diff --git a/tools/node_modules/eslint/lib/rules/func-call-spacing.js b/tools/node_modules/eslint/lib/rules/func-call-spacing.js index 83142bae8ca920..9aae3e2517e05b 100644 --- a/tools/node_modules/eslint/lib/rules/func-call-spacing.js +++ b/tools/node_modules/eslint/lib/rules/func-call-spacing.js @@ -57,6 +57,10 @@ module.exports = { maxItems: 2 } ] + }, + messages: { + unexpected: "Unexpected newline between function name and paren.", + missing: "Missing space between function name and paren." } }, @@ -116,7 +120,7 @@ module.exports = { context.report({ node, loc: lastCalleeToken.loc.start, - message: "Unexpected space between function name and paren.", + messageId: "unexpected", fix(fixer) { /* @@ -134,7 +138,7 @@ module.exports = { context.report({ node, loc: lastCalleeToken.loc.start, - message: "Missing space between function name and paren.", + messageId: "missing", fix(fixer) { return fixer.insertTextBefore(parenToken, " "); } @@ -143,7 +147,7 @@ module.exports = { context.report({ node, loc: lastCalleeToken.loc.start, - message: "Unexpected newline between function name and paren.", + messageId: "unexpected", fix(fixer) { return fixer.replaceTextRange([prevToken.range[1], parenToken.range[0]], " "); } diff --git a/tools/node_modules/eslint/lib/rules/func-name-matching.js b/tools/node_modules/eslint/lib/rules/func-name-matching.js index d66f630fcce13e..89c07c3514c6b2 100644 --- a/tools/node_modules/eslint/lib/rules/func-name-matching.js +++ b/tools/node_modules/eslint/lib/rules/func-name-matching.js @@ -87,6 +87,12 @@ module.exports = { additionalItems: false, items: [optionsObject] }] + }, + messages: { + matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`", + matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`", + notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`", + notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`" } }, @@ -132,20 +138,20 @@ module.exports = { * @returns {void} */ function report(node, name, funcName, isProp) { - let message; + let messageId; if (nameMatches === "always" && isProp) { - message = "Function name `{{funcName}}` should match property name `{{name}}`"; + messageId = "matchProperty"; } else if (nameMatches === "always") { - message = "Function name `{{funcName}}` should match variable name `{{name}}`"; + messageId = "matchVariable"; } else if (isProp) { - message = "Function name `{{funcName}}` should not match property name `{{name}}`"; + messageId = "notMatchProperty"; } else { - message = "Function name `{{funcName}}` should not match variable name `{{name}}`"; + messageId = "notMatchVariable"; } context.report({ node, - message, + messageId, data: { name, funcName diff --git a/tools/node_modules/eslint/lib/rules/func-names.js b/tools/node_modules/eslint/lib/rules/func-names.js index 500b95a1c6fd95..31f302918116e6 100644 --- a/tools/node_modules/eslint/lib/rules/func-names.js +++ b/tools/node_modules/eslint/lib/rules/func-names.js @@ -33,16 +33,55 @@ module.exports = { url: "https://eslint.org/docs/rules/func-names" }, - schema: [ - { - enum: ["always", "as-needed", "never"] - } - ] + schema: { + definitions: { + value: { + enum: [ + "always", + "as-needed", + "never" + ] + } + }, + items: [ + { + $ref: "#/definitions/value" + }, + { + type: "object", + properties: { + generators: { + $ref: "#/definitions/value" + } + }, + additionalProperties: false + } + ] + }, + messages: { + unnamed: "Unexpected unnamed {{name}}.", + named: "Unexpected named {{name}}." + } }, create(context) { - const never = context.options[0] === "never"; - const asNeeded = context.options[0] === "as-needed"; + + /** + * Returns the config option for the given node. + * @param {ASTNode} node - A node to get the config for. + * @returns {string} The config option. + */ + function getConfigForNode(node) { + if ( + node.generator && + context.options.length > 1 && + context.options[1].generators + ) { + return context.options[1].generators; + } + + return context.options[0] || "always"; + } /** * Determines whether the current FunctionExpression node is a get, set, or @@ -79,6 +118,32 @@ module.exports = { (parent.type === "AssignmentPattern" && parent.right === node); } + /** + * Reports that an unnamed function should be named + * @param {ASTNode} node - The node to report in the event of an error. + * @returns {void} + */ + function reportUnexpectedUnnamedFunction(node) { + context.report({ + node, + messageId: "unnamed", + data: { name: astUtils.getFunctionNameWithKind(node) } + }); + } + + /** + * Reports that a named function should be unnamed + * @param {ASTNode} node - The node to report in the event of an error. + * @returns {void} + */ + function reportUnexpectedNamedFunction(node) { + context.report({ + node, + messageId: "named", + data: { name: astUtils.getFunctionNameWithKind(node) } + }); + } + return { "FunctionExpression:exit"(node) { @@ -90,23 +155,19 @@ module.exports = { } const hasName = Boolean(node.id && node.id.name); - const name = astUtils.getFunctionNameWithKind(node); + const config = getConfigForNode(node); - if (never) { + if (config === "never") { if (hasName) { - context.report({ - node, - message: "Unexpected named {{name}}.", - data: { name } - }); + reportUnexpectedNamedFunction(node); + } + } else if (config === "as-needed") { + if (!hasName && !hasInferredName(node)) { + reportUnexpectedUnnamedFunction(node); } } else { - if (!hasName && (asNeeded ? !hasInferredName(node) : !isObjectOrClassMethod(node))) { - context.report({ - node, - message: "Unexpected unnamed {{name}}.", - data: { name } - }); + if (!hasName && !isObjectOrClassMethod(node)) { + reportUnexpectedUnnamedFunction(node); } } } diff --git a/tools/node_modules/eslint/lib/rules/func-style.js b/tools/node_modules/eslint/lib/rules/func-style.js index ea6d74fb3a4998..ff48792d29af5d 100644 --- a/tools/node_modules/eslint/lib/rules/func-style.js +++ b/tools/node_modules/eslint/lib/rules/func-style.js @@ -30,7 +30,11 @@ module.exports = { }, additionalProperties: false } - ] + ], + messages: { + expression: "Expected a function expression.", + declaration: "Expected a function declaration." + } }, create(context) { @@ -45,7 +49,7 @@ module.exports = { stack.push(false); if (!enforceDeclarations && node.parent.type !== "ExportDefaultDeclaration") { - context.report({ node, message: "Expected a function expression." }); + context.report({ node, messageId: "expression" }); } }, "FunctionDeclaration:exit"() { @@ -56,7 +60,7 @@ module.exports = { stack.push(false); if (enforceDeclarations && node.parent.type === "VariableDeclarator") { - context.report({ node: node.parent, message: "Expected a function declaration." }); + context.report({ node: node.parent, messageId: "declaration" }); } }, "FunctionExpression:exit"() { @@ -79,7 +83,7 @@ module.exports = { const hasThisExpr = stack.pop(); if (enforceDeclarations && !hasThisExpr && node.parent.type === "VariableDeclarator") { - context.report({ node: node.parent, message: "Expected a function declaration." }); + context.report({ node: node.parent, messageId: "declaration" }); } }; } diff --git a/tools/node_modules/eslint/lib/rules/function-paren-newline.js b/tools/node_modules/eslint/lib/rules/function-paren-newline.js index c483e40da9d749..d78e88038e2030 100644 --- a/tools/node_modules/eslint/lib/rules/function-paren-newline.js +++ b/tools/node_modules/eslint/lib/rules/function-paren-newline.js @@ -41,7 +41,13 @@ module.exports = { } ] } - ] + ], + messages: { + expectedBefore: "Expected newline before ')'.", + expectedAfter: "Expected newline after '('.", + unexpectedBefore: "Unexpected newline before '('.", + unexpectedAfter: "Unexpected newline after ')'." + } }, create(context) { @@ -99,7 +105,7 @@ module.exports = { if (hasLeftNewline && !needsNewlines) { context.report({ node: leftParen, - message: "Unexpected newline after '('.", + messageId: "unexpectedAfter", fix(fixer) { return sourceCode.getText().slice(leftParen.range[1], tokenAfterLeftParen.range[0]).trim() @@ -111,7 +117,7 @@ module.exports = { } else if (!hasLeftNewline && needsNewlines) { context.report({ node: leftParen, - message: "Expected a newline after '('.", + messageId: "expectedAfter", fix: fixer => fixer.insertTextAfter(leftParen, "\n") }); } @@ -119,7 +125,7 @@ module.exports = { if (hasRightNewline && !needsNewlines) { context.report({ node: rightParen, - message: "Unexpected newline before ')'.", + messageId: "unexpectedBefore", fix(fixer) { return sourceCode.getText().slice(tokenBeforeRightParen.range[1], rightParen.range[0]).trim() @@ -131,7 +137,7 @@ module.exports = { } else if (!hasRightNewline && needsNewlines) { context.report({ node: rightParen, - message: "Expected a newline before ')'.", + messageId: "expectedBefore", fix: fixer => fixer.insertTextBefore(rightParen, "\n") }); } diff --git a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js index 68f2863626a76c..97868dd3fa980e 100644 --- a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js +++ b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js @@ -55,7 +55,13 @@ module.exports = { } ] } - ] + ], + messages: { + missingBefore: "Missing space before *.", + missingAfter: "Missing space after *.", + unexpectedBefore: "Unexpected space before *.", + unexpectedAfter: "Unexpected space after *." + } }, create(context) { @@ -119,6 +125,15 @@ module.exports = { ); } + /** + * capitalize a given string. + * @param {string} str the given string. + * @returns {string} the capitalized string. + */ + function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); + } + /** * Checks the spacing between two tokens before or after the star token. * @@ -135,17 +150,11 @@ module.exports = { const after = leftToken.value === "*"; const spaceRequired = modes[kind][side]; const node = after ? leftToken : rightToken; - const type = spaceRequired ? "Missing" : "Unexpected"; - const message = "{{type}} space {{side}} *."; - const data = { - type, - side - }; + const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`; context.report({ node, - message, - data, + messageId, fix(fixer) { if (spaceRequired) { if (after) { diff --git a/tools/node_modules/eslint/lib/rules/getter-return.js b/tools/node_modules/eslint/lib/rules/getter-return.js index 8fd9f1599ce0cf..452ba49f595783 100644 --- a/tools/node_modules/eslint/lib/rules/getter-return.js +++ b/tools/node_modules/eslint/lib/rules/getter-return.js @@ -61,7 +61,11 @@ module.exports = { }, additionalProperties: false } - ] + ], + messages: { + expected: "Expected to return a value in {{name}}.", + expectedAlways: "Expected {{name}} to always return a value." + } }, create(context) { @@ -93,9 +97,7 @@ module.exports = { context.report({ node, loc: getId(node).loc.start, - message: funcInfo.hasReturn - ? "Expected {{name}} to always return a value." - : "Expected to return a value in {{name}}.", + messageId: funcInfo.hasReturn ? "expectedAlways" : "expected", data: { name: astUtils.getFunctionNameWithKind(funcInfo.node) } @@ -161,7 +163,7 @@ module.exports = { if (!options.allowImplicit && !node.argument) { context.report({ node, - message: "Expected to return a value in {{name}}.", + messageId: "expected", data: { name: astUtils.getFunctionNameWithKind(funcInfo.node) } diff --git a/tools/node_modules/eslint/lib/rules/max-params.js b/tools/node_modules/eslint/lib/rules/max-params.js index 902391b74ff791..4089e8ae899359 100644 --- a/tools/node_modules/eslint/lib/rules/max-params.js +++ b/tools/node_modules/eslint/lib/rules/max-params.js @@ -53,7 +53,7 @@ module.exports = { }, create(context) { - + const sourceCode = context.getSourceCode(); const option = context.options[0]; let numParams = 3; @@ -76,6 +76,7 @@ module.exports = { function checkFunction(node) { if (node.params.length > numParams) { context.report({ + loc: astUtils.getFunctionHeadLoc(node, sourceCode), node, message: "{{name}} has too many parameters ({{count}}). Maximum allowed is {{max}}.", data: { diff --git a/tools/node_modules/eslint/lib/rules/no-constant-condition.js b/tools/node_modules/eslint/lib/rules/no-constant-condition.js index 724da974127f51..48b1fbf689f966 100644 --- a/tools/node_modules/eslint/lib/rules/no-constant-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-constant-condition.js @@ -207,6 +207,8 @@ module.exports = { "ForStatement:exit": checkConstantConditionLoopInSet, FunctionDeclaration: enterFunction, "FunctionDeclaration:exit": exitFunction, + FunctionExpression: enterFunction, + "FunctionExpression:exit": exitFunction, YieldExpression: () => loopsInCurrentScope.clear() }; diff --git a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js index 2826dbf493d75b..b70ca82675089d 100644 --- a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js +++ b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -39,7 +39,11 @@ module.exports = { } }, additionalProperties: false - }] + }], + messages: { + useConst: "Number constants declarations must use 'const'.", + noMagic: "No magic number: {{raw}}." + } }, create(context) { @@ -136,7 +140,7 @@ module.exports = { if (enforceConst && parent.parent.kind !== "const") { context.report({ node: fullNumberNode, - message: "Number constants declarations must use 'const'." + messageId: "useConst" }); } } else if ( @@ -145,7 +149,7 @@ module.exports = { ) { context.report({ node: fullNumberNode, - message: "No magic number: {{raw}}.", + messageId: "noMagic", data: { raw } diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE b/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE new file mode 100644 index 00000000000000..620366eb90071c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/code-frame/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-2018 Sebastian McKenzie + +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. diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md b/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md new file mode 100644 index 00000000000000..185f93d2471999 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/code-frame/README.md @@ -0,0 +1,19 @@ +# @babel/code-frame + +> Generate errors that contain a code frame that point to source locations. + +See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/code-frame +``` + +or using yarn: + +```sh +yarn add @babel/code-frame --dev +``` diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js new file mode 100644 index 00000000000000..1f64c6ce7b992d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js @@ -0,0 +1,173 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.codeFrameColumns = codeFrameColumns; +exports.default = _default; + +function _highlight() { + const data = _interopRequireWildcard(require("@babel/highlight")); + + _highlight = function () { + return data; + }; + + return data; +} + +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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +let deprecationWarningShown = false; + +function getDefs(chalk) { + return { + gutter: chalk.grey, + marker: chalk.red.bold, + message: chalk.red.bold + }; +} + +const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; + +function getMarkerLines(loc, source, opts) { + const startLoc = Object.assign({ + column: 0, + line: -1 + }, loc.start); + const endLoc = Object.assign({}, startLoc, loc.end); + const { + linesAbove = 2, + linesBelow = 3 + } = opts || {}; + const startLine = startLoc.line; + const startColumn = startLoc.column; + const endLine = endLoc.line; + const endColumn = endLoc.column; + let start = Math.max(startLine - (linesAbove + 1), 0); + let end = Math.min(source.length, endLine + linesBelow); + + if (startLine === -1) { + start = 0; + } + + if (endLine === -1) { + end = source.length; + } + + const lineDiff = endLine - startLine; + const markerLines = {}; + + if (lineDiff) { + for (let i = 0; i <= lineDiff; i++) { + const lineNumber = i + startLine; + + if (!startColumn) { + markerLines[lineNumber] = true; + } else if (i === 0) { + const sourceLength = source[lineNumber - 1].length; + markerLines[lineNumber] = [startColumn, sourceLength - startColumn]; + } else if (i === lineDiff) { + markerLines[lineNumber] = [0, endColumn]; + } else { + const sourceLength = source[lineNumber - i].length; + markerLines[lineNumber] = [0, sourceLength]; + } + } + } else { + if (startColumn === endColumn) { + if (startColumn) { + markerLines[startLine] = [startColumn, 0]; + } else { + markerLines[startLine] = true; + } + } else { + markerLines[startLine] = [startColumn, endColumn - startColumn]; + } + } + + return { + start, + end, + markerLines + }; +} + +function codeFrameColumns(rawLines, loc, opts = {}) { + const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts); + const chalk = (0, _highlight().getChalk)(opts); + const defs = getDefs(chalk); + + const maybeHighlight = (chalkFn, string) => { + return highlighted ? chalkFn(string) : string; + }; + + if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts); + const lines = rawLines.split(NEWLINE); + const { + start, + end, + markerLines + } = getMarkerLines(loc, lines, opts); + const hasColumns = loc.start && typeof loc.start.column === "number"; + const numberMaxWidth = String(end).length; + let frame = lines.slice(start, end).map((line, index) => { + const number = start + 1 + index; + const paddedNumber = ` ${number}`.slice(-numberMaxWidth); + const gutter = ` ${paddedNumber} | `; + const hasMarker = markerLines[number]; + const lastMarkerLine = !markerLines[number + 1]; + + if (hasMarker) { + let markerLine = ""; + + if (Array.isArray(hasMarker)) { + const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " "); + const numberOfMarkers = hasMarker[1] || 1; + markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join(""); + + if (lastMarkerLine && opts.message) { + markerLine += " " + maybeHighlight(defs.message, opts.message); + } + } + + return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); + } else { + return ` ${maybeHighlight(defs.gutter, gutter)}${line}`; + } + }).join("\n"); + + if (opts.message && !hasColumns) { + frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; + } + + if (highlighted) { + return chalk.reset(frame); + } else { + return frame; + } +} + +function _default(rawLines, lineNumber, colNumber, opts = {}) { + if (!deprecationWarningShown) { + deprecationWarningShown = true; + const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; + + if (process.emitWarning) { + process.emitWarning(message, "DeprecationWarning"); + } else { + const deprecationError = new Error(message); + deprecationError.name = "DeprecationWarning"; + console.warn(new Error(message)); + } + } + + colNumber = Math.max(colNumber, 0); + const location = { + start: { + column: colNumber, + line: lineNumber + } + }; + return codeFrameColumns(rawLines, location, opts); +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json b/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json new file mode 100644 index 00000000000000..f3b551dfa972de --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/code-frame/package.json @@ -0,0 +1,25 @@ +{ + "author": { + "name": "Sebastian McKenzie", + "email": "sebmck@gmail.com" + }, + "bundleDependencies": false, + "dependencies": { + "@babel/highlight": "^7.0.0" + }, + "deprecated": false, + "description": "Generate errors that contain a code frame that point to source locations.", + "devDependencies": { + "chalk": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "homepage": "https://babeljs.io/", + "license": "MIT", + "main": "lib/index.js", + "name": "@babel/code-frame", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame" + }, + "version": "7.0.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE b/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE new file mode 100644 index 00000000000000..620366eb90071c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-2018 Sebastian McKenzie + +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. diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/README.md b/tools/node_modules/eslint/node_modules/@babel/highlight/README.md new file mode 100644 index 00000000000000..72dae6094590f3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/README.md @@ -0,0 +1,19 @@ +# @babel/highlight + +> Syntax highlight JavaScript strings for output in terminals. + +See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/highlight +``` + +or using yarn: + +```sh +yarn add @babel/highlight --dev +``` diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js new file mode 100644 index 00000000000000..6ac5b4a350b8e6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js @@ -0,0 +1,129 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.shouldHighlight = shouldHighlight; +exports.getChalk = getChalk; +exports.default = highlight; + +function _jsTokens() { + const data = _interopRequireWildcard(require("js-tokens")); + + _jsTokens = function () { + return data; + }; + + return data; +} + +function _esutils() { + const data = _interopRequireDefault(require("esutils")); + + _esutils = function () { + return data; + }; + + return data; +} + +function _chalk() { + const data = _interopRequireDefault(require("chalk")); + + _chalk = function () { + return data; + }; + + return data; +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function getDefs(chalk) { + return { + keyword: chalk.cyan, + capitalized: chalk.yellow, + jsx_tag: chalk.yellow, + punctuator: chalk.yellow, + number: chalk.magenta, + string: chalk.green, + regex: chalk.magenta, + comment: chalk.grey, + invalid: chalk.white.bgRed.bold + }; +} + +const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; +const JSX_TAG = /^[a-z][\w-]*$/i; +const BRACKET = /^[()[\]{}]$/; + +function getTokenType(match) { + const [offset, text] = match.slice(-2); + const token = (0, _jsTokens().matchToToken)(match); + + if (token.type === "name") { + if (_esutils().default.keyword.isReservedWordES6(token.value)) { + return "keyword"; + } + + if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == " colorize(str)).join("\n"); + } else { + return args[0]; + } + }); +} + +function shouldHighlight(options) { + return _chalk().default.supportsColor || options.forceColor; +} + +function getChalk(options) { + let chalk = _chalk().default; + + if (options.forceColor) { + chalk = new (_chalk().default.constructor)({ + enabled: true, + level: 1 + }); + } + + return chalk; +} + +function highlight(code, options = {}) { + if (shouldHighlight(options)) { + const chalk = getChalk(options); + const defs = getDefs(chalk); + return highlightTokens(defs, code); + } else { + return code; + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/package.json b/tools/node_modules/eslint/node_modules/@babel/highlight/package.json new file mode 100644 index 00000000000000..ff84c66ec29732 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/package.json @@ -0,0 +1,26 @@ +{ + "author": { + "name": "suchipi", + "email": "me@suchipi.com" + }, + "bundleDependencies": false, + "dependencies": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "deprecated": false, + "description": "Syntax highlight JavaScript strings for output in terminals.", + "devDependencies": { + "strip-ansi": "^4.0.0" + }, + "homepage": "https://babeljs.io/", + "license": "MIT", + "main": "lib/index.js", + "name": "@babel/highlight", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel/tree/master/packages/babel-highlight" + }, + "version": "7.0.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/acorn/AUTHORS b/tools/node_modules/eslint/node_modules/acorn/AUTHORS index b605ab4fbc9cd9..c5ac22cbd7c6ba 100644 --- a/tools/node_modules/eslint/node_modules/acorn/AUTHORS +++ b/tools/node_modules/eslint/node_modules/acorn/AUTHORS @@ -41,6 +41,7 @@ Kevin Irish Kevin Kwok krator laosb +luckyzeng Marek Marijn Haverbeke Martin Carlberg @@ -63,6 +64,7 @@ PlNG Prayag Verma ReadmeCritic r-e-d +Renée Kooi Richard Gibson Rich Harris Sebastian McKenzie diff --git a/tools/node_modules/eslint/node_modules/acorn/README.md b/tools/node_modules/eslint/node_modules/acorn/README.md index 956cd56e2495c3..de53f513f49e2f 100644 --- a/tools/node_modules/eslint/node_modules/acorn/README.md +++ b/tools/node_modules/eslint/node_modules/acorn/README.md @@ -464,4 +464,4 @@ looseParser.extend("readToken", function(nextMethod) { - [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) - [`acorn-es7`](https://github.com/angelozerr/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) - - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus) + - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/07/07/react-on-es6-plus) diff --git a/tools/node_modules/eslint/node_modules/acorn/bin/test262.whitelist b/tools/node_modules/eslint/node_modules/acorn/bin/test262.whitelist index b00d3404e31328..c8c6ce4a82774b 100644 --- a/tools/node_modules/eslint/node_modules/acorn/bin/test262.whitelist +++ b/tools/node_modules/eslint/node_modules/acorn/bin/test262.whitelist @@ -212,10 +212,6 @@ language/module-code/early-export-global.js (default) language/module-code/early-export-global.js (strict mode) language/module-code/early-export-unresolvable.js (default) language/module-code/early-export-unresolvable.js (strict mode) -language/module-code/parse-err-hoist-lex-fun.js (default) -language/module-code/parse-err-hoist-lex-fun.js (strict mode) -language/module-code/parse-err-hoist-lex-gen.js (default) -language/module-code/parse-err-hoist-lex-gen.js (strict mode) language/statements/async-function/early-errors-declaration-body-contains-super-call.js (default) language/statements/async-function/early-errors-declaration-body-contains-super-call.js (strict mode) language/statements/async-function/early-errors-declaration-body-contains-super-property.js (default) @@ -316,7 +312,6 @@ language/statements/if/labelled-fn-stmt-lone.js (default) language/statements/if/labelled-fn-stmt-second.js (default) language/statements/if/let-block-with-newline.js (default) language/statements/if/let-identifier-with-newline.js (default) -language/statements/labeled/decl-async-function.js (default) language/statements/labeled/let-block-with-newline.js (default) language/statements/labeled/let-identifier-with-newline.js (default) language/statements/let/syntax/identifier-let-disallowed-as-boundname.js (default) diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.es.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.es.js index 803febe09f86c8..332c3392d0895f 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.es.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.es.js @@ -869,7 +869,7 @@ pp$1.parseDoStatement = function(node) { pp$1.parseForStatement = function(node) { this.next(); - var awaitAt = (this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")) ? this.lastTokStart : -1; + var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1; this.labels.push(loopLabel); this.enterLexicalScope(); this.expect(types.parenL); @@ -1075,7 +1075,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr) { node.body = this.parseStatement(true); if (node.body.type === "ClassDeclaration" || node.body.type === "VariableDeclaration" && node.body.kind !== "var" || - node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator)) + node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator || node.body.async)) { this.raiseRecoverable(node.body.start, "Invalid labeled declaration"); } this.labels.pop(); node.label = expr; @@ -1193,7 +1193,7 @@ pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) { if (isStatement) { node.id = isStatement === "nullableID" && this.type !== types.name ? null : this.parseIdent(); if (node.id) { - this.checkLVal(node.id, "var"); + this.checkLVal(node.id, this.inModule && !this.inFunction ? "let" : "var"); } } @@ -2341,6 +2341,7 @@ pp$3.parseTemplate = function(ref) { var curElt = this.parseTemplateElement({isTagged: isTagged}); node.quasis = [curElt]; while (!curElt.tail) { + if (this$1.type === types.eof) { this$1.raise(this$1.pos, "Unterminated template literal"); } this$1.expect(types.dollarBraceL); node.expressions.push(this$1.parseExpression()); this$1.expect(types.braceR); @@ -3020,7 +3021,7 @@ types.star.updateContext = function(prevType) { types.name.updateContext = function(prevType) { var allowed = false; - if (this.options.ecmaVersion >= 6) { + if (this.options.ecmaVersion >= 6 && prevType !== types.dot) { if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { allowed = true; } @@ -5268,7 +5269,7 @@ pp$8.readWord = function() { // [dammit]: acorn_loose.js // [walk]: util/walk.js -var version = "5.7.1"; +var version = "5.7.3"; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js index 5ede36dd84242e..dada6a37a56339 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -875,7 +875,7 @@ pp$1.parseDoStatement = function(node) { pp$1.parseForStatement = function(node) { this.next(); - var awaitAt = (this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")) ? this.lastTokStart : -1; + var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1; this.labels.push(loopLabel); this.enterLexicalScope(); this.expect(types.parenL); @@ -1081,7 +1081,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr) { node.body = this.parseStatement(true); if (node.body.type === "ClassDeclaration" || node.body.type === "VariableDeclaration" && node.body.kind !== "var" || - node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator)) + node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator || node.body.async)) { this.raiseRecoverable(node.body.start, "Invalid labeled declaration"); } this.labels.pop(); node.label = expr; @@ -1199,7 +1199,7 @@ pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) { if (isStatement) { node.id = isStatement === "nullableID" && this.type !== types.name ? null : this.parseIdent(); if (node.id) { - this.checkLVal(node.id, "var"); + this.checkLVal(node.id, this.inModule && !this.inFunction ? "let" : "var"); } } @@ -2347,6 +2347,7 @@ pp$3.parseTemplate = function(ref) { var curElt = this.parseTemplateElement({isTagged: isTagged}); node.quasis = [curElt]; while (!curElt.tail) { + if (this$1.type === types.eof) { this$1.raise(this$1.pos, "Unterminated template literal"); } this$1.expect(types.dollarBraceL); node.expressions.push(this$1.parseExpression()); this$1.expect(types.braceR); @@ -3026,7 +3027,7 @@ types.star.updateContext = function(prevType) { types.name.updateContext = function(prevType) { var allowed = false; - if (this.options.ecmaVersion >= 6) { + if (this.options.ecmaVersion >= 6 && prevType !== types.dot) { if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { allowed = true; } @@ -5274,7 +5275,7 @@ pp$8.readWord = function() { // [dammit]: acorn_loose.js // [walk]: util/walk.js -var version = "5.7.1"; +var version = "5.7.3"; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json index 285e963c40756b..5e17c40f378c86 100644 --- a/tools/node_modules/eslint/node_modules/acorn/package.json +++ b/tools/node_modules/eslint/node_modules/acorn/package.json @@ -133,6 +133,9 @@ { "name": "laosb" }, + { + "name": "luckyzeng" + }, { "name": "Marek" }, @@ -199,6 +202,9 @@ { "name": "r-e-d" }, + { + "name": "Renée Kooi" + }, { "name": "Richard Gibson" }, @@ -267,6 +273,10 @@ "name": "Ingvar Stepanyan", "email": "me@rreverser.com", "url": "http://rreverser.com/" + }, + { + "name": "Adrian Heine", + "email": "http://adrianheine.de" } ], "module": "dist/acorn.es.js", @@ -287,5 +297,5 @@ "test": "node test/run.js && node test/lint.js", "test:test262": "node bin/run_test262.js" }, - "version": "5.7.1" + "version": "5.7.3" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/index.js b/tools/node_modules/eslint/node_modules/ansi-regex/index.js index b9574ed7e82013..c4aaecf5050639 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/index.js +++ b/tools/node_modules/eslint/node_modules/ansi-regex/index.js @@ -1,4 +1,10 @@ 'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; + +module.exports = () => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, 'g'); }; diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/license b/tools/node_modules/eslint/node_modules/ansi-regex/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/license +++ b/tools/node_modules/eslint/node_modules/ansi-regex/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -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: +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 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. +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. diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/package.json b/tools/node_modules/eslint/node_modules/ansi-regex/package.json index c584a40cb264d1..d4df7d97af4f3f 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/package.json +++ b/tools/node_modules/eslint/node_modules/ansi-regex/package.json @@ -11,11 +11,11 @@ "deprecated": false, "description": "Regular expression for matching ANSI escape codes", "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" + "ava": "*", + "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -49,37 +49,14 @@ "pattern" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], "name": "ansi-regex", "repository": { "type": "git", "url": "git+https://github.com/chalk/ansi-regex.git" }, "scripts": { - "test": "xo && ava --verbose", + "test": "xo && ava", "view-supported": "node fixtures/view-codes.js" }, - "version": "2.1.1", - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } + "version": "3.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/readme.md b/tools/node_modules/eslint/node_modules/ansi-regex/readme.md index 6a928edf0f6b08..22db1c34055556 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/readme.md +++ b/tools/node_modules/eslint/node_modules/ansi-regex/readme.md @@ -1,12 +1,12 @@ # ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) ## Install ``` -$ npm install --save ansi-regex +$ npm install ansi-regex ``` @@ -15,25 +15,32 @@ $ npm install --save ansi-regex ```js const ansiRegex = require('ansi-regex'); -ansiRegex().test('\u001b[4mcake\u001b[0m'); +ansiRegex().test('\u001B[4mcake\u001B[0m'); //=> true ansiRegex().test('cake'); //=> false -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] ``` + ## FAQ ### Why do you test for codes not in the ECMA 48 standard? -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/tools/node_modules/eslint/node_modules/ansi-styles/index.js b/tools/node_modules/eslint/node_modules/ansi-styles/index.js index 78945278f78a72..90a871c4d78f6f 100644 --- a/tools/node_modules/eslint/node_modules/ansi-styles/index.js +++ b/tools/node_modules/eslint/node_modules/ansi-styles/index.js @@ -1,10 +1,28 @@ 'use strict'; +const colorConvert = require('color-convert'); -function assembleStyles () { - var styles = { - modifiers: { +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { reset: [0, 0], - bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], @@ -12,7 +30,7 @@ function assembleStyles () { hidden: [8, 28], strikethrough: [9, 29] }, - colors: { + color: { black: [30, 39], red: [31, 39], green: [32, 39], @@ -21,9 +39,18 @@ function assembleStyles () { magenta: [35, 39], cyan: [36, 39], white: [37, 39], - gray: [90, 39] + gray: [90, 39], + + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] }, - bgColors: { + bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], @@ -31,34 +58,107 @@ function assembleStyles () { bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], - bgWhite: [47, 49] + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] } }; - // fix humans - styles.colors.grey = styles.colors.gray; + // Fix humans + styles.color.grey = styles.color.gray; - Object.keys(styles).forEach(function (groupName) { - var group = styles[groupName]; + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; - Object.keys(group).forEach(function (styleName) { - var style = group[styleName]; + for (const styleName of Object.keys(group)) { + const style = group[styleName]; - styles[styleName] = group[styleName] = { - open: '\u001b[' + style[0] + 'm', - close: '\u001b[' + style[1] + 'm' + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` }; - }); + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } Object.defineProperty(styles, groupName, { value: group, enumerable: false }); - }); + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } return styles; } +// Make the export immutable Object.defineProperty(module, 'exports', { enumerable: true, get: assembleStyles diff --git a/tools/node_modules/eslint/node_modules/ansi-styles/license b/tools/node_modules/eslint/node_modules/ansi-styles/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/ansi-styles/license +++ b/tools/node_modules/eslint/node_modules/ansi-styles/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -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: +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 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. +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. diff --git a/tools/node_modules/eslint/node_modules/ansi-styles/package.json b/tools/node_modules/eslint/node_modules/ansi-styles/package.json index 5d545b2cd6ed7e..5663ace24b4607 100644 --- a/tools/node_modules/eslint/node_modules/ansi-styles/package.json +++ b/tools/node_modules/eslint/node_modules/ansi-styles/package.json @@ -4,17 +4,26 @@ "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, + "ava": { + "require": "babel-polyfill" + }, "bugs": { "url": "https://github.com/chalk/ansi-styles/issues" }, "bundleDependencies": false, + "dependencies": { + "color-convert": "^1.9.0" + }, "deprecated": false, "description": "ANSI escape codes for styling strings in the terminal", "devDependencies": { - "mocha": "*" + "ava": "*", + "babel-polyfill": "^6.23.0", + "svg-term-cli": "^2.1.1", + "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -43,25 +52,14 @@ "text" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - } - ], "name": "ansi-styles", "repository": { "type": "git", "url": "git+https://github.com/chalk/ansi-styles.git" }, "scripts": { - "test": "mocha" + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", + "test": "xo && ava" }, - "version": "2.2.1" + "version": "3.2.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-styles/readme.md b/tools/node_modules/eslint/node_modules/ansi-styles/readme.md index 3f933f6162e58e..3158e2df59ce66 100644 --- a/tools/node_modules/eslint/node_modules/ansi-styles/readme.md +++ b/tools/node_modules/eslint/node_modules/ansi-styles/readme.md @@ -4,24 +4,33 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. -![](screenshot.png) + ## Install ``` -$ npm install --save ansi-styles +$ npm install ansi-styles ``` ## Usage ```js -var ansi = require('ansi-styles'); +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); -console.log(ansi.green.open + 'Hello world!' + ansi.green.close); -``` +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); +``` ## API @@ -35,11 +44,11 @@ Each style has an `open` and `close` property. - `reset` - `bold` - `dim` -- `italic` *(not widely supported)* +- `italic` *(Not widely supported)* - `underline` - `inverse` - `hidden` -- `strikethrough` *(not widely supported)* +- `strikethrough` *(Not widely supported)* ### Colors @@ -51,7 +60,14 @@ Each style has an `open` and `close` property. - `magenta` - `cyan` - `white` -- `gray` +- `gray` ("bright black") +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` ### Background colors @@ -63,24 +79,69 @@ Each style has an `open` and `close` property. - `bgMagenta` - `bgCyan` - `bgWhite` +- `bgBlackBright` +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` ## Advanced usage -By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example -- `ansi.modifiers` -- `ansi.colors` -- `ansi.bgColors` +```js +console.log(style.color.green.open); +``` +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. ###### Example ```js -console.log(ansi.colors.green.open); +console.log(style.codes.get(36)); +//=> 39 ``` +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/tools/node_modules/eslint/node_modules/babel-code-frame/README.md b/tools/node_modules/eslint/node_modules/babel-code-frame/README.md deleted file mode 100644 index 7ef5368d314945..00000000000000 --- a/tools/node_modules/eslint/node_modules/babel-code-frame/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# babel-code-frame - -> Generate errors that contain a code frame that point to source locations. - -## Install - -```sh -npm install --save-dev babel-code-frame -``` - -## Usage - -```js -import codeFrame from 'babel-code-frame'; - -const rawLines = `class Foo { - constructor() -}`; -const lineNumber = 2; -const colNumber = 16; - -const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ }); - -console.log(result); -``` - -```sh - 1 | class Foo { -> 2 | constructor() - | ^ - 3 | } -``` - -If the column number is not known, you may pass `null` instead. - -## Options - -### `highlightCode` - -`boolean`, defaults to `false`. - -Toggles syntax highlighting the code as JavaScript for terminals. - -### `linesAbove` - -`number`, defaults to `2`. - -Adjust the number of lines to show above the error. - -### `linesBelow` - -`number`, defaults to `3`. - -Adjust the number of lines to show below the error. - -### `forceColor` - -`boolean`, defaults to `false`. - -Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`. diff --git a/tools/node_modules/eslint/node_modules/babel-code-frame/lib/index.js b/tools/node_modules/eslint/node_modules/babel-code-frame/lib/index.js deleted file mode 100644 index ff49b9082ccb43..00000000000000 --- a/tools/node_modules/eslint/node_modules/babel-code-frame/lib/index.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict"; - -exports.__esModule = true; - -exports.default = function (rawLines, lineNumber, colNumber) { - var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - colNumber = Math.max(colNumber, 0); - - var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor; - var chalk = _chalk2.default; - if (opts.forceColor) { - chalk = new _chalk2.default.constructor({ enabled: true }); - } - var maybeHighlight = function maybeHighlight(chalkFn, string) { - return highlighted ? chalkFn(string) : string; - }; - var defs = getDefs(chalk); - if (highlighted) rawLines = highlight(defs, rawLines); - - var linesAbove = opts.linesAbove || 2; - var linesBelow = opts.linesBelow || 3; - - var lines = rawLines.split(NEWLINE); - var start = Math.max(lineNumber - (linesAbove + 1), 0); - var end = Math.min(lines.length, lineNumber + linesBelow); - - if (!lineNumber && !colNumber) { - start = 0; - end = lines.length; - } - - var numberMaxWidth = String(end).length; - - var frame = lines.slice(start, end).map(function (line, index) { - var number = start + 1 + index; - var paddedNumber = (" " + number).slice(-numberMaxWidth); - var gutter = " " + paddedNumber + " | "; - if (number === lineNumber) { - var markerLine = ""; - if (colNumber) { - var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " "); - markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join(""); - } - return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); - } else { - return " " + maybeHighlight(defs.gutter, gutter) + line; - } - }).join("\n"); - - if (highlighted) { - return chalk.reset(frame); - } else { - return frame; - } -}; - -var _jsTokens = require("js-tokens"); - -var _jsTokens2 = _interopRequireDefault(_jsTokens); - -var _esutils = require("esutils"); - -var _esutils2 = _interopRequireDefault(_esutils); - -var _chalk = require("chalk"); - -var _chalk2 = _interopRequireDefault(_chalk); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getDefs(chalk) { - return { - keyword: chalk.cyan, - capitalized: chalk.yellow, - jsx_tag: chalk.yellow, - punctuator: chalk.yellow, - - number: chalk.magenta, - string: chalk.green, - regex: chalk.magenta, - comment: chalk.grey, - invalid: chalk.white.bgRed.bold, - gutter: chalk.grey, - marker: chalk.red.bold - }; -} - -var NEWLINE = /\r\n|[\n\r\u2028\u2029]/; - -var JSX_TAG = /^[a-z][\w-]*$/i; - -var BRACKET = /^[()\[\]{}]$/; - -function getTokenType(match) { - var _match$slice = match.slice(-2), - offset = _match$slice[0], - text = _match$slice[1]; - - var token = (0, _jsTokens.matchToToken)(match); - - if (token.type === "name") { - if (_esutils2.default.keyword.isReservedWordES6(token.value)) { - return "keyword"; - } - - if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == " 1) { - // don't slice `arguments`, it prevents v8 optimizations - for (var a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } - - if (!this.enabled || !str) { - return str; - } - - var nestedStyles = this._styles; - var i = nestedStyles.length; - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - var originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { - ansiStyles.dim.open = ''; - } - - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; - } - - // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. - ansiStyles.dim.open = originalDim; - - return str; -} - -function init() { - var ret = {}; - - Object.keys(styles).forEach(function (name) { - ret[name] = { - get: function () { - return build.call(this, [name]); - } - }; - }); - - return ret; -} - -defineProps(Chalk.prototype, init()); - -module.exports = new Chalk(); -module.exports.styles = ansiStyles; -module.exports.hasColor = hasAnsi; -module.exports.stripColor = stripAnsi; -module.exports.supportsColor = supportsColor; diff --git a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/license b/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/license deleted file mode 100644 index 654d0bfe943437..00000000000000 --- a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -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. diff --git a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/package.json deleted file mode 100644 index f152f2a7546385..00000000000000 --- a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/chalk/chalk/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "deprecated": false, - "description": "Terminal string styling done right. Much color.", - "devDependencies": { - "coveralls": "^2.11.2", - "matcha": "^0.6.0", - "mocha": "*", - "nyc": "^3.0.0", - "require-uncached": "^1.0.2", - "resolve-from": "^1.0.0", - "semver": "^4.3.3", - "xo": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/chalk#readme", - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], - "name": "chalk", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/chalk.git" - }, - "scripts": { - "bench": "matcha benchmark.js", - "coverage": "nyc npm test && nyc report", - "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", - "test": "xo && mocha" - }, - "version": "1.1.3", - "xo": { - "envs": [ - "node", - "mocha" - ] - } -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/readme.md deleted file mode 100644 index 5cf111e353383d..00000000000000 --- a/tools/node_modules/eslint/node_modules/babel-code-frame/node_modules/chalk/readme.md +++ /dev/null @@ -1,213 +0,0 @@ -

-
-
- chalk -
-
-
-

- -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) -[![Coverage Status](https://coveralls.io/repos/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/r/chalk/chalk?branch=master) -[![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) - - -[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. - -**Chalk is a clean and focused alternative.** - -![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png) - - -## Why - -- Highly performant -- Doesn't extend `String.prototype` -- Expressive API -- Ability to nest styles -- Clean and focused -- Auto-detects color support -- Actively maintained -- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015 - - -## Install - -``` -$ npm install --save chalk -``` - - -## Usage - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -var chalk = require('chalk'); - -// style a string -chalk.blue('Hello world!'); - -// combine styled and normal strings -chalk.blue('Hello') + 'World' + chalk.red('!'); - -// compose multiple styles using the chainable API -chalk.blue.bgRed.bold('Hello world!'); - -// pass in multiple arguments -chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); - -// nest styles -chalk.red('Hello', chalk.underline.bgBlue('world') + '!'); - -// nest styles of the same type even (color, underline, background) -chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -); -``` - -Easily define your own themes. - -```js -var chalk = require('chalk'); -var error = chalk.bold.red; -console.log(error('Error!')); -``` - -Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). - -```js -var name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> Hello Sindre -``` - - -## API - -### chalk.`