diff --git a/.eslintrc.js b/.eslintrc.js index ba94036b0f50bc..14c53277a19a47 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -189,34 +189,6 @@ module.exports = { // as well to lib/.eslintrc.yaml. 'no-restricted-syntax': [ 'error', - { - selector: "CallExpression[callee.property.name='deepStrictEqual'][arguments.2.type='Literal']", - message: 'Do not use a literal for the third argument of assert.deepStrictEqual()', - }, - { - selector: "CallExpression[callee.property.name='doesNotThrow']", - message: 'Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead.', - }, - { - selector: "CallExpression[callee.property.name='doesNotReject']", - message: 'Do not use `assert.doesNotReject()`. Write the code without the wrapper and add a comment instead.', - }, - { - selector: "CallExpression[callee.property.name='rejects'][arguments.length<2]", - message: '`assert.rejects()` must be invoked with at least two arguments.', - }, - { - selector: "CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal']", - message: 'Do not use a literal for the third argument of assert.strictEqual()', - }, - { - selector: "CallExpression[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.property.name='throws'][arguments.length<2]", - message: '`assert.throws()` must be invoked with at least two arguments.', - }, { selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]", message: '`setTimeout()` must be invoked with at least two arguments.', @@ -229,22 +201,6 @@ module.exports = { selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]', message: 'Use `new` keyword when throwing an `Error`.', }, - { - selector: "CallExpression[callee.property.name='notDeepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", - message: 'The first argument should be the `actual`, not the `expected` value.', - }, - { - selector: "CallExpression[callee.property.name='notStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", - message: 'The first argument should be the `actual`, not the `expected` value.', - }, - { - selector: "CallExpression[callee.property.name='deepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", - message: 'The first argument should be the `actual`, not the `expected` value.', - }, - { - selector: "CallExpression[callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", - message: 'The first argument should be the `actual`, not the `expected` value.', - }, { selector: "CallExpression[callee.name='isNaN']", message: 'Use Number.isNaN() instead of the global isNaN() function.', diff --git a/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.md b/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.md new file mode 100644 index 00000000000000..3ec3959eb67173 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.md @@ -0,0 +1,54 @@ +--- +name: "\U0001F4D7 Open an issue regarding the Node.js API reference docs" +about: Let us know about any problematic API reference documents +title: "doc: " +labels: doc +--- + +# 📗 API Reference Docs Problem + + + + + +- **Version**: ✍️ +- **Platform**: ✍️ +- **Subsystem**: ✍️ + +## Location + +_Section of the site where the content exists_ + +Affected URL(s): +- https://nodejs.org/api/✍️ + +## Problem description + +_Concise explanation of what you found to be problematic_ + + + +✍️ + +--- + + + +- [ ] I would like to work on this issue and submit a pull request. diff --git a/BUILDING.md b/BUILDING.md index a6cb0695bfdc0a..d0a3813b5794d0 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -255,6 +255,8 @@ Installation via Linux package manager can be achieved with: FreeBSD and OpenBSD users may also need to install `libexecinfo`. +Python 3 users may also need to install `python3-distutils`. + #### macOS prerequisites * Xcode Command Line Tools >= 8 for macOS diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb5f874c1e068..504a60823d431b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ release. -12.18.0
+12.18.1
+12.18.0
12.17.0
12.16.3
12.16.2
diff --git a/Makefile b/Makefile index 3e27af2c7673bb..2c0b1d42fd7568 100644 --- a/Makefile +++ b/Makefile @@ -292,7 +292,7 @@ v8: tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) .PHONY: jstest -jstest: build-addons build-abort-tests build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests +jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ --skip-tests=$(CI_SKIP_TESTS) \ $(CI_JS_SUITES) \ @@ -316,7 +316,6 @@ test: all ## Runs default tests, linters, and builds docs. $(MAKE) -s tooltest $(MAKE) -s test-doc $(MAKE) -s build-addons - $(MAKE) -s build-abort-tests $(MAKE) -s build-js-native-api-tests $(MAKE) -s build-node-api-tests $(MAKE) -s cctest @@ -325,7 +324,6 @@ test: all ## Runs default tests, linters, and builds docs. .PHONY: test-only test-only: all ## For a quick test, does not run linter or build docs. $(MAKE) build-addons - $(MAKE) build-abort-tests $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests $(MAKE) cctest @@ -335,7 +333,6 @@ test-only: all ## For a quick test, does not run linter or build docs. # Used by `make coverage-test` test-cov: all $(MAKE) build-addons - $(MAKE) build-abort-tests $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests $(MAKE) cctest @@ -455,31 +452,6 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \ # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp -ABORT_BINDING_GYPS := \ - $(filter-out test/abort/??_*/binding.gyp, \ - $(wildcard test/abort/*/binding.gyp)) - -ABORT_BINDING_SOURCES := \ - $(filter-out test/abort/??_*/*.c, $(wildcard test/abort/*/*.c)) \ - $(filter-out test/abort/??_*/*.cc, $(wildcard test/abort/*/*.cc)) \ - $(filter-out test/abort/??_*/*.h, $(wildcard test/abort/*/*.h)) - -# Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale. -test/abort/.buildstamp: $(ADDONS_PREREQS) \ - $(ABORT_BINDING_GYPS) $(ABORT_BINDING_SOURCES) \ - src/node_api.h src/node_api_types.h src/js_native_api.h \ - src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h - @$(call run_build_addons,"$$PWD/test/abort",$@) - -.PHONY: build-abort-tests -# .buildstamp needs $(NODE_EXE) but cannot depend on it -# directly because it calls make recursively. The parent make cannot know -# if the subprocess touched anything so it pessimistically assumes that -# .buildstamp is out of date and need a rebuild. -# Just goes to show that recursive make really is harmful... -# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. -build-abort-tests: | $(NODE_EXE) test/abort/.buildstamp - BENCHMARK_NAPI_BINDING_GYPS := $(wildcard benchmark/napi/*/binding.gyp) BENCHMARK_NAPI_BINDING_SOURCES := \ @@ -500,14 +472,12 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -test-build: | all build-addons build-abort-tests build-js-native-api-tests build-node-api-tests +test-build: | all build-addons build-js-native-api-tests build-node-api-tests test-build-js-native-api: all build-js-native-api-tests test-build-node-api: all build-node-api-tests -test-build-abort: all build-abort-tests - .PHONY: test-all test-all: test-build ## Run default tests with both Debug and Release builds. $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release @@ -520,7 +490,7 @@ test-all-suites: | clear-stalled test-build bench-addons-build doc-only ## Run a $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test/* # CI_* variables should be kept synchronized with the ones in vcbuild.bat -CI_NATIVE_SUITES ?= addons js-native-api node-api abort +CI_NATIVE_SUITES ?= addons js-native-api node-api CI_JS_SUITES ?= default ifeq ($(node_use_openssl), false) CI_DOC := doctool @@ -532,7 +502,7 @@ endif # Build and test addons without building anything else # Related CI job: node-test-commit-arm-fanned test-ci-native: LOGLEVEL := info -test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/abort/.buildstamp +test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) @@ -554,7 +524,7 @@ test-ci-js: | clear-stalled .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info -test-ci: | clear-stalled build-addons build-abort-tests build-js-native-api-tests build-node-api-tests doc-only +test-ci: | clear-stalled build-addons build-js-native-api-tests build-node-api-tests doc-only out/Release/cctest --gtest_output=xml:out/junit/cctest.xml $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ @@ -659,17 +629,8 @@ test-node-api-clean: $(RM) -r test/node-api/*/build $(RM) test/node-api/.buildstamp -.PHONY: test-abort -test-abort: test-build-abort - $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test-abort - -.PHONY: test-abort-clean -test-abort-clean: - $(RM) -r test/abort/*/build - $(RM) test/abort/.buildstamp - .PHONY: test-addons -test-addons: test-build test-js-native-api test-node-api test-abort +test-addons: test-build test-js-native-api test-node-api $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons .PHONY: test-addons-clean @@ -679,7 +640,6 @@ test-addons-clean: $(RM) test/addons/.buildstamp test/addons/.docbuildstamp $(MAKE) test-js-native-api-clean $(MAKE) test-node-api-clean - $(MAKE) test-abort-clean test-async-hooks: $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks @@ -688,7 +648,6 @@ test-with-async-hooks: $(MAKE) build-addons $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests - $(MAKE) build-abort-tests $(MAKE) cctest NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ $(CI_JS_SUITES) \ diff --git a/common.gypi b/common.gypi index 7b97fbebe2deac..3b9cc3e885b254 100644 --- a/common.gypi +++ b/common.gypi @@ -34,7 +34,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.37', + 'v8_embedder_string': '-node.38', ##### V8 defaults for Node.js ##### diff --git a/deps/npm/.npmignore b/deps/npm/.npmignore index c42aaf956257d5..f45f47b93829b8 100644 --- a/deps/npm/.npmignore +++ b/deps/npm/.npmignore @@ -24,5 +24,5 @@ html/*.png *.pyc - +Session.vim .nyc_output diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml index cec3aac226b1c1..9fb0d51133692c 100644 --- a/deps/npm/.travis.yml +++ b/deps/npm/.travis.yml @@ -12,9 +12,6 @@ node_js: env: "DEPLOY_VERSION=testing" -notifications: - slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8 - install: - "node . install" diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index c2a38c02d53f97..08cade33b6ff10 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -691,3 +691,7 @@ Vitaliy Markitanov <9357021+vit100@users.noreply.github.com> simon_s John Kennedy Bernard Kitchens +Jarda Snajdr +Naix Geng <1308363651@qq.com> +Dylan Treisman +mum-never-proud diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 5cd9c8d8f88615..bae7de70605601 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,18 @@ +## 6.14.5 (2020-05-01) + +### BUG FIXES + +* [`33ec41f18`](https://github.com/npm/cli/commit/33ec41f18f557146607cb14a7a38c707fce6d42c) [#758](https://github.com/npm/cli/pull/758) fix: relativize file links when inflating shrinkwrap ([@jsnajdr](https://github.com/jsnajdr)) +* [`94ed456df`](https://github.com/npm/cli/commit/94ed456dfb0b122fd4192429024f034d06c3c454) [#1162](https://github.com/npm/cli/pull/1162) fix: npm init help output ([@mum-never-proud](https://github.com/mum-never-proud)) + +### DEPENDENCIES + +* [`5587ac01f`](https://github.com/npm/cli/commit/5587ac01ffd0d2ea830a6bbb67bb34a611ffc409) `npm-registry-fetch@4.0.4` + * [`fc5d94c39`](https://github.com/npm/npm-registry-fetch/commit/fc5d94c39ca218d78df77249ab3a6bf1d9ed9db1) fix: removed default timeout +* [`07a4d8884`](https://github.com/npm/cli/commit/07a4d8884448359bac485a49c05fd2d23d06834b) `graceful-fs@4.2.4` +* [`8228d1f2e`](https://github.com/npm/cli/commit/8228d1f2e427ad9adee617266108acd1ee39b4a5) `mkdirp@0.5.5` +* [`e6d208317`](https://github.com/npm/cli/commit/e6d20831740a84aea766da2a2913cf82a4d56ada) `nopt@4.0.3` + ## 6.14.4 (2020-03-24) ### DEPENDENCIES diff --git a/deps/npm/CONTRIBUTING.md b/deps/npm/CONTRIBUTING.md index 981f0457d5c6bf..c08bd090cb64b4 100644 --- a/deps/npm/CONTRIBUTING.md +++ b/deps/npm/CONTRIBUTING.md @@ -73,7 +73,7 @@ All interactions in the npm repository are covered by the [npm Code of Conduct]( # Make sure you install the dependencies first before running tests. $ npm install -# Run tests for the CLI (it could take awhile). +# Run tests for the CLI (it could take a while). $ npm run test ``` @@ -97,7 +97,7 @@ $ make link ################# # ALTERNATIVELY ################# -# If ou're working on a feature or bug, you can run the same command on your +# If you're working on a feature or bug, you can run the same command on your # working branch and link that code. # Create new branch to work from (there are many ways) @@ -130,7 +130,7 @@ let you know that it's sent the request to start the benchmark suite. ![image](https://user-images.githubusercontent.com/2818462/72312698-e2e57f80-3656-11ea-9fcf-4a8f6b97b0d1.png) -If you've updated your pull-reuqest and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_. +If you've updated your pull-request and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_. ![image](https://user-images.githubusercontent.com/2818462/72313006-ec231c00-3657-11ea-9bd9-227634d67362.png) diff --git a/deps/npm/docs/content/cli-commands/npm.md b/deps/npm/docs/content/cli-commands/npm.md index 01a9308204d196..2d9789dd77c1c6 100644 --- a/deps/npm/docs/content/cli-commands/npm.md +++ b/deps/npm/docs/content/cli-commands/npm.md @@ -57,14 +57,14 @@ on a preinstalled git. If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use -[node-gyp](https://github.com/TooTallNate/node-gyp) for that task. -For a Unix system, [node-gyp](https://github.com/TooTallNate/node-gyp) +[node-gyp](https://github.com/nodejs/node-gyp) for that task. +For a Unix system, [node-gyp](https://github.com/nodejs/node-gyp) needs Python, make and a buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++ are needed. Python 3 is -not supported by [node-gyp](https://github.com/TooTallNate/node-gyp). +not supported by [node-gyp](https://github.com/nodejs/node-gyp). For more information visit -[the node-gyp repository](https://github.com/TooTallNate/node-gyp) and -the [node-gyp Wiki](https://github.com/TooTallNate/node-gyp/wiki). +[the node-gyp repository](https://github.com/nodejs/node-gyp) and +the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki). ### Directories diff --git a/deps/npm/docs/content/using-npm/scripts.md b/deps/npm/docs/content/using-npm/scripts.md index a9ca433fdea08c..befedd0724aa56 100644 --- a/deps/npm/docs/content/using-npm/scripts.md +++ b/deps/npm/docs/content/using-npm/scripts.md @@ -145,9 +145,15 @@ suites, then those executables will be added to the `PATH` for executing the scripts. So, if your package.json has this: ```json -{ "name" : "foo" -, "dependencies" : { "bar" : "0.1.x" } -, "scripts": { "start" : "bar ./test" } } +{ + "name" : "foo", + "dependencies" : { + "bar" : "0.1.x" + }, + "scripts": { + "start" : "bar ./test" + } +} ``` then you could run `npm start` to execute the `bar` script, which is @@ -176,9 +182,15 @@ there is a config param of `[@]:`. For example, if the package.json has this: ```json -{ "name" : "foo" -, "config" : { "port" : "8080" } -, "scripts" : { "start" : "node server.js" } } +{ + "name" : "foo", + "config" : { + "port" : "8080" + }, + "scripts" : { + "start" : "node server.js" + } +} ``` and the server.js is this: @@ -213,10 +225,11 @@ process.env.npm_package_scripts_install === "foo.js" For example, if your package.json contains this: ```json -{ "scripts" : - { "install" : "scripts/install.js" - , "postinstall" : "scripts/postinstall.js" - , "uninstall" : "scripts/uninstall.js" +{ + "scripts" : { + "install" : "scripts/install.js", + "postinstall" : "scripts/install.js", + "uninstall" : "scripts/uninstall.js" } } ``` @@ -232,10 +245,11 @@ If you want to run a make command, you can do so. This works just fine: ```json -{ "scripts" : - { "preinstall" : "./configure" - , "install" : "make && make install" - , "test" : "make test" +{ + "scripts" : { + "preinstall" : "./configure", + "install" : "make && make install", + "test" : "make test" } } ``` diff --git a/deps/npm/docs/public/cli-commands/npm-access/index.html b/deps/npm/docs/public/cli-commands/npm-access/index.html index f3853e530b6b3a..63df3a3728374c 100644 --- a/deps/npm/docs/public/cli-commands/npm-access/index.html +++ b/deps/npm/docs/public/cli-commands/npm-access/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm access

+

npm access

Set access level on published packages

Synopsis

npm access public [<package>]
@@ -148,4 +148,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-adduser/index.html b/deps/npm/docs/public/cli-commands/npm-adduser/index.html index 7b96fcce677001..ada805d205847f 100644 --- a/deps/npm/docs/public/cli-commands/npm-adduser/index.html +++ b/deps/npm/docs/public/cli-commands/npm-adduser/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

+

section: cli-commands title: npm-adduser description: Set access level on published packages

@@ -143,4 +143,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-audit/index.html b/deps/npm/docs/public/cli-commands/npm-audit/index.html index 5d57fac3d4e3e5..78afd583ec1937 100644 --- a/deps/npm/docs/public/cli-commands/npm-audit/index.html +++ b/deps/npm/docs/public/cli-commands/npm-audit/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm audit

+

npm audit

Run a security audit

Synopsis

npm audit [--json|--parseable|--audit-level=(low|moderate|high|critical)]
@@ -165,4 +165,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bin/index.html b/deps/npm/docs/public/cli-commands/npm-bin/index.html index c54afe93556aeb..ba6fd6ea4d2aea 100644 --- a/deps/npm/docs/public/cli-commands/npm-bin/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bin/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm bin

+

npm bin

Display npm bin folder

Synopsis

npm bin [-g|--global]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bugs/index.html b/deps/npm/docs/public/cli-commands/npm-bugs/index.html index d9f5b5282ff212..b93cd6604c1ba8 100644 --- a/deps/npm/docs/public/cli-commands/npm-bugs/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bugs/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm bugs

+

npm bugs

Bugs for a package in a web browser maybe

Synopsis

npm bugs [<pkgname>]
@@ -114,4 +114,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-build/index.html b/deps/npm/docs/public/cli-commands/npm-build/index.html index 8850a4e9d88f3e..b0e8aeaa7b788a 100644 --- a/deps/npm/docs/public/cli-commands/npm-build/index.html +++ b/deps/npm/docs/public/cli-commands/npm-build/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm build

+

npm build

Build a package

Synopsis

npm build [<package-folder>]
@@ -100,4 +100,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-bundle/index.html b/deps/npm/docs/public/cli-commands/npm-bundle/index.html index 9e8457cc5ac1c3..2be5194916c775 100644 --- a/deps/npm/docs/public/cli-commands/npm-bundle/index.html +++ b/deps/npm/docs/public/cli-commands/npm-bundle/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm bundle

+

npm bundle

REMOVED

Description

The npm bundle command has been removed in 1.0, for the simple reason @@ -91,4 +91,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-cache/index.html b/deps/npm/docs/public/cli-commands/npm-cache/index.html index bbf164e0fb1e5a..481cc9e44c585a 100644 --- a/deps/npm/docs/public/cli-commands/npm-cache/index.html +++ b/deps/npm/docs/public/cli-commands/npm-cache/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm cache

+

npm cache

Manipulates packages cache

Synopsis

npm cache add <tarball file>
@@ -145,4 +145,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ci/index.html b/deps/npm/docs/public/cli-commands/npm-ci/index.html index 08b46aff44b0d5..5b671a8a751d5e 100644 --- a/deps/npm/docs/public/cli-commands/npm-ci/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ci/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm ci

+

npm ci

Install a project with a clean slate

Synopsis

npm ci
@@ -122,4 +122,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-completion/index.html b/deps/npm/docs/public/cli-commands/npm-completion/index.html index 0a8d28382f08e5..8ffddbecb65d23 100644 --- a/deps/npm/docs/public/cli-commands/npm-completion/index.html +++ b/deps/npm/docs/public/cli-commands/npm-completion/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm completion

+

npm completion

Tab Completion for npm

Synopsis

source <(npm completion)
@@ -104,4 +104,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-config/index.html b/deps/npm/docs/public/cli-commands/npm-config/index.html index 5f6c38423fd106..7d6227d2d9db79 100644 --- a/deps/npm/docs/public/cli-commands/npm-config/index.html +++ b/deps/npm/docs/public/cli-commands/npm-config/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm config

+

npm config

Manage the npm configuration files

Synopsis

npm config set <key> <value> [-g|--global]
@@ -128,4 +128,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-dedupe/index.html b/deps/npm/docs/public/cli-commands/npm-dedupe/index.html index 0b9b4e795290c3..88d4bddb6f8468 100644 --- a/deps/npm/docs/public/cli-commands/npm-dedupe/index.html +++ b/deps/npm/docs/public/cli-commands/npm-dedupe/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm dedupe

+

npm dedupe

Reduce duplication

Synopsis

npm dedupe
@@ -121,4 +121,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-deprecate/index.html b/deps/npm/docs/public/cli-commands/npm-deprecate/index.html index 503e6ec7fc4660..1bb22d2979f39f 100644 --- a/deps/npm/docs/public/cli-commands/npm-deprecate/index.html +++ b/deps/npm/docs/public/cli-commands/npm-deprecate/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm deprecate

+

npm deprecate

Deprecate a version of a package

Synopsis

npm deprecate <pkg>[@<version>] <message>
@@ -100,4 +100,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html b/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html index 7955f8def330eb..4201cb3f3c74f4 100644 --- a/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html +++ b/deps/npm/docs/public/cli-commands/npm-dist-tag/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

+

section: cli-commands title: npm-dist-tag description: Modify package distribution tags

@@ -149,4 +149,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-docs/index.html b/deps/npm/docs/public/cli-commands/npm-docs/index.html index 42f18e75075ce1..b5dedd56d12a68 100644 --- a/deps/npm/docs/public/cli-commands/npm-docs/index.html +++ b/deps/npm/docs/public/cli-commands/npm-docs/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm docs

+

npm docs

Docs for a package in a web browser maybe

Synopsis

npm docs [<pkgname> [<pkgname> ...]]
@@ -115,4 +115,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-doctor/index.html b/deps/npm/docs/public/cli-commands/npm-doctor/index.html index ac94c50d0edca3..a38eb67e3d21a6 100644 --- a/deps/npm/docs/public/cli-commands/npm-doctor/index.html +++ b/deps/npm/docs/public/cli-commands/npm-doctor/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm doctor

+

npm doctor

Check your environments

Synopsis

npm doctor
@@ -163,4 +163,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-edit/index.html b/deps/npm/docs/public/cli-commands/npm-edit/index.html index bddb1c09c83afc..d0a8bf18f0ffda 100644 --- a/deps/npm/docs/public/cli-commands/npm-edit/index.html +++ b/deps/npm/docs/public/cli-commands/npm-edit/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm edit

+

npm edit

Edit an installed package

Synopsis

npm edit <pkg>[/<subpkg>...]
@@ -110,4 +110,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-explore/index.html b/deps/npm/docs/public/cli-commands/npm-explore/index.html index 97f438294558d4..91374a0fac95cd 100644 --- a/deps/npm/docs/public/cli-commands/npm-explore/index.html +++ b/deps/npm/docs/public/cli-commands/npm-explore/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

+

section: cli-commands title: npm-explore description: Browse an installed package

@@ -114,4 +114,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-fund/index.html b/deps/npm/docs/public/cli-commands/npm-fund/index.html index f58901446cd58a..3d160d633ac550 100644 --- a/deps/npm/docs/public/cli-commands/npm-fund/index.html +++ b/deps/npm/docs/public/cli-commands/npm-fund/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm fund

+

npm fund

Retrieve funding information

Synopsis

    npm fund [<pkg>]
@@ -128,4 +128,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-help-search/index.html b/deps/npm/docs/public/cli-commands/npm-help-search/index.html index abd84b775782d5..e9cc5ffc7ef4d6 100644 --- a/deps/npm/docs/public/cli-commands/npm-help-search/index.html +++ b/deps/npm/docs/public/cli-commands/npm-help-search/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm help-search

+

npm help-search

Search npm help documentation

Synopsis

npm help-search <text>
@@ -105,4 +105,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-help/index.html b/deps/npm/docs/public/cli-commands/npm-help/index.html index e38710dc87f52c..0a8ab53f2a4828 100644 --- a/deps/npm/docs/public/cli-commands/npm-help/index.html +++ b/deps/npm/docs/public/cli-commands/npm-help/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm help

+

npm help

Get help on npm

Synopsis

npm help <term> [<terms..>]
@@ -107,4 +107,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-hook/index.html b/deps/npm/docs/public/cli-commands/npm-hook/index.html index bd3e717c829525..d60bcddbb96af5 100644 --- a/deps/npm/docs/public/cli-commands/npm-hook/index.html +++ b/deps/npm/docs/public/cli-commands/npm-hook/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm hook

+

npm hook

Manage registry hooks

Synopsis

npm hook ls [pkg]
@@ -119,4 +119,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-init/index.html b/deps/npm/docs/public/cli-commands/npm-init/index.html index 0515fcadc6ce4b..9b51a55ff46419 100644 --- a/deps/npm/docs/public/cli-commands/npm-init/index.html +++ b/deps/npm/docs/public/cli-commands/npm-init/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm init

+

npm init

create a package.json file

Synopsis

npm init [--force|-f|--yes|-y|--scope]
@@ -126,4 +126,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html b/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html index 78f717dc33e524..ca152fa1cd238f 100644 --- a/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install-ci-test/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm install-ci-test

+

npm install-ci-test

Install a project with a clean slate and run tests

Synopsis

npm install-ci-test
@@ -93,4 +93,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install-test/index.html b/deps/npm/docs/public/cli-commands/npm-install-test/index.html index d63b61afcf1249..368eb1929d46f3 100644 --- a/deps/npm/docs/public/cli-commands/npm-install-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install-test/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm install-test

+

npm install-test

Install package(s) and run tests

Synopsis

npm install-test (with no args, in package dir)
@@ -102,4 +102,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-install/index.html b/deps/npm/docs/public/cli-commands/npm-install/index.html index 16a98c965a6d08..8e8b3fd7ff4b74 100644 --- a/deps/npm/docs/public/cli-commands/npm-install/index.html +++ b/deps/npm/docs/public/cli-commands/npm-install/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm install

+

npm install

Install a package

Synopsis

npm install (with no args, in package dir)
@@ -468,4 +468,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-link/index.html b/deps/npm/docs/public/cli-commands/npm-link/index.html index 5b568995d6209d..c19007eb504fe0 100644 --- a/deps/npm/docs/public/cli-commands/npm-link/index.html +++ b/deps/npm/docs/public/cli-commands/npm-link/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm link

+

npm link

Synopsis

npm link (in package dir)
@@ -134,4 +134,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-logout/index.html b/deps/npm/docs/public/cli-commands/npm-logout/index.html index 7e4ce934fb5c4c..6a357ee4d358ea 100644 --- a/deps/npm/docs/public/cli-commands/npm-logout/index.html +++ b/deps/npm/docs/public/cli-commands/npm-logout/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm logout

+

npm logout

Log out of the registry

Synopsis

npm logout [--registry=<url>] [--scope=<@scope>]
@@ -109,4 +109,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ls/index.html b/deps/npm/docs/public/cli-commands/npm-ls/index.html index 89ed133f3ab21b..e879abe100bc1f 100644 --- a/deps/npm/docs/public/cli-commands/npm-ls/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ls/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm ls

+
\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-org/index.html b/deps/npm/docs/public/cli-commands/npm-org/index.html index 0a7800216e28e1..456c231887b571 100644 --- a/deps/npm/docs/public/cli-commands/npm-org/index.html +++ b/deps/npm/docs/public/cli-commands/npm-org/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm org

+

npm org

Manage orgs

Synopsis

npm org set <orgname> <username> [developer | admin | owner]
@@ -107,4 +107,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-outdated/index.html b/deps/npm/docs/public/cli-commands/npm-outdated/index.html index 77274aff6bf25d..8fe29cc37003c2 100644 --- a/deps/npm/docs/public/cli-commands/npm-outdated/index.html +++ b/deps/npm/docs/public/cli-commands/npm-outdated/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm outdated

+

npm outdated

Check for outdated packages

Synopsis

npm outdated [[<@scope>/]<pkg> ...]
@@ -178,4 +178,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-owner/index.html b/deps/npm/docs/public/cli-commands/npm-owner/index.html index d128bf2ff1136a..64784997a926d9 100644 --- a/deps/npm/docs/public/cli-commands/npm-owner/index.html +++ b/deps/npm/docs/public/cli-commands/npm-owner/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm owner

+

npm owner

Manage package owners

Synopsis

npm owner add <user> [<@scope>/]<pkg>
@@ -114,4 +114,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-pack/index.html b/deps/npm/docs/public/cli-commands/npm-pack/index.html index 1bdd218cfb3f11..f07ac85d9e5b00 100644 --- a/deps/npm/docs/public/cli-commands/npm-pack/index.html +++ b/deps/npm/docs/public/cli-commands/npm-pack/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm pack

+

npm pack

Create a tarball from a package

Synopsis

npm pack [[<@scope>/]<pkg>...] [--dry-run]
@@ -102,4 +102,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-ping/index.html b/deps/npm/docs/public/cli-commands/npm-ping/index.html index 478c206499f759..b6d0f2b6be43d4 100644 --- a/deps/npm/docs/public/cli-commands/npm-ping/index.html +++ b/deps/npm/docs/public/cli-commands/npm-ping/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm ping

+

npm ping

Ping npm registry

Synopsis

npm ping [--registry <registry>]
@@ -95,4 +95,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-prefix/index.html b/deps/npm/docs/public/cli-commands/npm-prefix/index.html index aa5515abf372bb..4f7aea9576a868 100644 --- a/deps/npm/docs/public/cli-commands/npm-prefix/index.html +++ b/deps/npm/docs/public/cli-commands/npm-prefix/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm prefix

+

npm prefix

Display prefix

Synopsis

npm prefix [-g]
@@ -98,4 +98,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-profile/index.html b/deps/npm/docs/public/cli-commands/npm-profile/index.html index 97617c3fb01b80..dfef3141e6ca16 100644 --- a/deps/npm/docs/public/cli-commands/npm-profile/index.html +++ b/deps/npm/docs/public/cli-commands/npm-profile/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm profile

+

npm profile

Change settings on your registry profile

Synopsis

npm profile get [--json|--parseable] [<property>]
@@ -148,4 +148,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-prune/index.html b/deps/npm/docs/public/cli-commands/npm-prune/index.html index 8dc6092402f5e1..2b6ae9f754aa6e 100644 --- a/deps/npm/docs/public/cli-commands/npm-prune/index.html +++ b/deps/npm/docs/public/cli-commands/npm-prune/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm prune

+

npm prune

Remove extraneous packages

Synopsis

npm prune [[<@scope>/]<pkg>...] [--production] [--dry-run] [--json]
@@ -108,4 +108,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-publish/index.html b/deps/npm/docs/public/cli-commands/npm-publish/index.html index 4ba3e0db658254..f5ddb1f7b6f8bc 100644 --- a/deps/npm/docs/public/cli-commands/npm-publish/index.html +++ b/deps/npm/docs/public/cli-commands/npm-publish/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm publish

+

npm publish

Publish a package

Synopsis

npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>] [--otp otpcode] [--dry-run]
@@ -140,4 +140,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-rebuild/index.html b/deps/npm/docs/public/cli-commands/npm-rebuild/index.html index 1be8c34433293f..667eb2d96b7906 100644 --- a/deps/npm/docs/public/cli-commands/npm-rebuild/index.html +++ b/deps/npm/docs/public/cli-commands/npm-rebuild/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm rebuild

+

npm rebuild

Rebuild a package

Synopsis

npm rebuild [[<@scope>/<name>]...]
@@ -93,4 +93,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-repo/index.html b/deps/npm/docs/public/cli-commands/npm-repo/index.html index 790ee382f5e989..da85949c143802 100644 --- a/deps/npm/docs/public/cli-commands/npm-repo/index.html +++ b/deps/npm/docs/public/cli-commands/npm-repo/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm repo

+

npm repo

Open package repository page in the browser

Synopsis

npm repo [<pkg>]
@@ -101,4 +101,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-restart/index.html b/deps/npm/docs/public/cli-commands/npm-restart/index.html index 0a360a63e88e8f..cde0b9bf741e12 100644 --- a/deps/npm/docs/public/cli-commands/npm-restart/index.html +++ b/deps/npm/docs/public/cli-commands/npm-restart/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm restart

+

npm restart

Restart a package

Synopsis

npm restart [-- <args>]
@@ -113,4 +113,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-root/index.html b/deps/npm/docs/public/cli-commands/npm-root/index.html index 28c9770f184c2a..1018371d5e8844 100644 --- a/deps/npm/docs/public/cli-commands/npm-root/index.html +++ b/deps/npm/docs/public/cli-commands/npm-root/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm root

+

npm root

Display npm root

Synopsis

npm root [-g]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-run-script/index.html b/deps/npm/docs/public/cli-commands/npm-run-script/index.html index 3afd3d51c62c09..3d4e3fed8109d5 100644 --- a/deps/npm/docs/public/cli-commands/npm-run-script/index.html +++ b/deps/npm/docs/public/cli-commands/npm-run-script/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm run-script

+

npm run-script

Run arbitrary package scripts

Synopsis

npm run-script <command> [--silent] [-- <args>...]
@@ -143,4 +143,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-search/index.html b/deps/npm/docs/public/cli-commands/npm-search/index.html index d97c2b26efa3dd..77968fc78a5796 100644 --- a/deps/npm/docs/public/cli-commands/npm-search/index.html +++ b/deps/npm/docs/public/cli-commands/npm-search/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm search

+

npm search

Search for packages

Synopsis

npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...]
@@ -168,4 +168,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html b/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html index 2cff81bb8c896b..7ac4b1117182d4 100644 --- a/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html +++ b/deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm shrinkwrap

+

npm shrinkwrap

Lock down dependency versions for publication

Synopsis

npm shrinkwrap
@@ -101,4 +101,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-star/index.html b/deps/npm/docs/public/cli-commands/npm-star/index.html index d0c887c754a130..5186681c685a79 100644 --- a/deps/npm/docs/public/cli-commands/npm-star/index.html +++ b/deps/npm/docs/public/cli-commands/npm-star/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm star

+

npm star

Mark your favorite packages

Synopsis

npm star [<pkg>...]
@@ -96,4 +96,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-stars/index.html b/deps/npm/docs/public/cli-commands/npm-stars/index.html index 226a132de82039..9edac6d450dd9e 100644 --- a/deps/npm/docs/public/cli-commands/npm-stars/index.html +++ b/deps/npm/docs/public/cli-commands/npm-stars/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm stars

+

npm stars

View packages marked as favorites

Synopsis

npm stars [<user>]
@@ -96,4 +96,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-start/index.html b/deps/npm/docs/public/cli-commands/npm-start/index.html index 387e4fe959e9c9..f16afcecd2b119 100644 --- a/deps/npm/docs/public/cli-commands/npm-start/index.html +++ b/deps/npm/docs/public/cli-commands/npm-start/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm start

+

npm start

Start a package

Synopsis

npm start [-- <args>]
@@ -98,4 +98,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-stop/index.html b/deps/npm/docs/public/cli-commands/npm-stop/index.html index e6fed3aeec6c23..07ba9067e27357 100644 --- a/deps/npm/docs/public/cli-commands/npm-stop/index.html +++ b/deps/npm/docs/public/cli-commands/npm-stop/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm stop

+

npm stop

Stop a package

Synopsis

npm stop [-- <args>]
@@ -94,4 +94,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-team/index.html b/deps/npm/docs/public/cli-commands/npm-team/index.html index 6d6a0bd0866a40..c8776ba911df1a 100644 --- a/deps/npm/docs/public/cli-commands/npm-team/index.html +++ b/deps/npm/docs/public/cli-commands/npm-team/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm team

+

npm team

Manage organization teams and team memberships

Synopsis

npm team create <scope:team>
@@ -125,4 +125,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-test/index.html b/deps/npm/docs/public/cli-commands/npm-test/index.html index 7f47f2ab2d328d..4b7638d884244c 100644 --- a/deps/npm/docs/public/cli-commands/npm-test/index.html +++ b/deps/npm/docs/public/cli-commands/npm-test/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm test

+

npm test

Test a package

Synopsis

npm test [-- <args>]
@@ -96,4 +96,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-token/index.html b/deps/npm/docs/public/cli-commands/npm-token/index.html index 10f880ea2e132e..4ee8f7539b1e4e 100644 --- a/deps/npm/docs/public/cli-commands/npm-token/index.html +++ b/deps/npm/docs/public/cli-commands/npm-token/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm token

+

npm token

Manage your authentication tokens

Synopsis

  npm token list [--json|--parseable]
@@ -133,4 +133,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-uninstall/index.html b/deps/npm/docs/public/cli-commands/npm-uninstall/index.html index 059bac05a46a2d..8bc3b7a03ee84d 100644 --- a/deps/npm/docs/public/cli-commands/npm-uninstall/index.html +++ b/deps/npm/docs/public/cli-commands/npm-uninstall/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm uninstall

+

npm uninstall

Remove a package

Synopsis

npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
@@ -118,4 +118,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-unpublish/index.html b/deps/npm/docs/public/cli-commands/npm-unpublish/index.html index f9ea9a44155b54..e04fc20823049c 100644 --- a/deps/npm/docs/public/cli-commands/npm-unpublish/index.html +++ b/deps/npm/docs/public/cli-commands/npm-unpublish/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm unpublish

+

npm unpublish

Remove a package from the registry

Synopsis

Unpublishing a single version of a package

@@ -106,4 +106,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-update/index.html b/deps/npm/docs/public/cli-commands/npm-update/index.html index e6653d1f1908f8..094b12d0f5f3ad 100644 --- a/deps/npm/docs/public/cli-commands/npm-update/index.html +++ b/deps/npm/docs/public/cli-commands/npm-update/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm update

+

npm update

Update a package

Synopsis

npm update [-g] [<pkg>...]
@@ -167,4 +167,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-version/index.html b/deps/npm/docs/public/cli-commands/npm-version/index.html index d540d9d254764a..9260a0a6b2e161 100644 --- a/deps/npm/docs/public/cli-commands/npm-version/index.html +++ b/deps/npm/docs/public/cli-commands/npm-version/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm version

+

npm version

Bump a package version

Synopsis

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
@@ -180,4 +180,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-view/index.html b/deps/npm/docs/public/cli-commands/npm-view/index.html index c9345b8d0893a6..66bf9750c71cb8 100644 --- a/deps/npm/docs/public/cli-commands/npm-view/index.html +++ b/deps/npm/docs/public/cli-commands/npm-view/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm view

+

npm view

View registry info

Synopsis

npm view [<@scope>/]<name>[@<version>] [<field>[.<subfield>]...]
@@ -145,4 +145,4 @@ 

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm-whoami/index.html b/deps/npm/docs/public/cli-commands/npm-whoami/index.html index e0c37ba0252cc8..7f25283a705b61 100644 --- a/deps/npm/docs/public/cli-commands/npm-whoami/index.html +++ b/deps/npm/docs/public/cli-commands/npm-whoami/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm whoami

+

npm whoami

Display npm username

Synopsis

npm whoami [--registry <registry>]
@@ -92,4 +92,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/cli-commands/npm/index.html b/deps/npm/docs/public/cli-commands/npm/index.html index 0d06bfb33ab2e2..d6c68a00732949 100644 --- a/deps/npm/docs/public/cli-commands/npm/index.html +++ b/deps/npm/docs/public/cli-commands/npm/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm

+

npm

javascript package manager

Synopsis

npm <command> [args]

Version

-

6.14.4

+

6.14.5

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -106,14 +106,14 @@

If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use -node-gyp for that task. -For a Unix system, node-gyp +node-gyp for that task. +For a Unix system, node-gyp needs Python, make and a buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++ are needed. Python 3 is -not supported by node-gyp. +not supported by node-gyp. For more information visit -the node-gyp repository and -the node-gyp Wiki.

+the node-gyp repository and +the node-gyp Wiki.

Directories

See folders to learn about where npm puts stuff.

In particular, npm has two modes of operation:

@@ -211,4 +211,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/folders/index.html b/deps/npm/docs/public/configuring-npm/folders/index.html index a48d6c70ff5ffd..3a7b2078ced93a 100644 --- a/deps/npm/docs/public/configuring-npm/folders/index.html +++ b/deps/npm/docs/public/configuring-npm/folders/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

folders

+

folders

Folder Structures Used by npm

Description

npm puts various things on your computer. That's its job.

@@ -240,4 +240,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/install/index.html b/deps/npm/docs/public/configuring-npm/install/index.html index 1464ac5477af5a..5587e72e588736 100644 --- a/deps/npm/docs/public/configuring-npm/install/index.html +++ b/deps/npm/docs/public/configuring-npm/install/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

install

+

install

Download and Install npm

Description

To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.

@@ -123,4 +123,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/npmrc/index.html b/deps/npm/docs/public/configuring-npm/npmrc/index.html index e1a2c4efda160e..b654a7f6aaf390 100644 --- a/deps/npm/docs/public/configuring-npm/npmrc/index.html +++ b/deps/npm/docs/public/configuring-npm/npmrc/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npmrc

+

npmrc

The npm config files

Description

npm gets its config settings from the command line, environment @@ -145,4 +145,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-json/index.html b/deps/npm/docs/public/configuring-npm/package-json/index.html index 0c18b027fdb734..2edfaff524cf63 100644 --- a/deps/npm/docs/public/configuring-npm/package-json/index.html +++ b/deps/npm/docs/public/configuring-npm/package-json/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

package.json

+

package.json

Specifics of npm's package.json handling

Description

This document is all you need to know about what's required in your package.json @@ -713,4 +713,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-lock-json/index.html b/deps/npm/docs/public/configuring-npm/package-lock-json/index.html index 6ffd16ebed3502..fe061fbb6ad16f 100644 --- a/deps/npm/docs/public/configuring-npm/package-lock-json/index.html +++ b/deps/npm/docs/public/configuring-npm/package-lock-json/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

package-lock.json

+

package-lock.json

A manifestation of the manifest

Description

package-lock.json is automatically generated for any operations where npm @@ -186,4 +186,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/package-locks/index.html b/deps/npm/docs/public/configuring-npm/package-locks/index.html index 535f83b28e08e2..b2e311e1addb33 100644 --- a/deps/npm/docs/public/configuring-npm/package-locks/index.html +++ b/deps/npm/docs/public/configuring-npm/package-locks/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

package-locks

+

package-locks

An explanation of npm lockfiles

Description

Conceptually, the "input" to npm install is a package.json, while its @@ -214,4 +214,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html b/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html index e2ff06feb4c377..7219fb663eadce 100644 --- a/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html +++ b/deps/npm/docs/public/configuring-npm/shrinkwrap-json/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

npm shrinkwrap.json

+

npm shrinkwrap.json

A publishable lockfile

Description

npm-shrinkwrap.json is a file created by npm shrinkwrap. It is identical to @@ -102,4 +102,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5q4.woff b/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5q4.woff deleted file mode 100644 index 9771531d13dd6e..00000000000000 Binary files a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5q4.woff and /dev/null differ diff --git a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5qg.woff2 b/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5qg.woff2 deleted file mode 100644 index 77829329c652e9..00000000000000 Binary files a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldKNThLqRwH-OJ1UHjlKGlZ5qg.woff2 and /dev/null differ diff --git a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_o.woff b/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_o.woff deleted file mode 100644 index 656168951dd20d..00000000000000 Binary files a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_o.woff and /dev/null differ diff --git a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_w.woff2 b/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_w.woff2 deleted file mode 100644 index 8be24ab2809ad5..00000000000000 Binary files a/deps/npm/docs/public/google-fonts/s/inconsolata/v18/QldXNThLqRwH-OJ1UHjlKGHiw71p5_w.woff2 and /dev/null differ diff --git a/deps/npm/docs/public/index.html b/deps/npm/docs/public/index.html index a3bd3a8d519095..21fae68bfdbd5b 100644 --- a/deps/npm/docs/public/index.html +++ b/deps/npm/docs/public/index.html @@ -80,7 +80,7 @@ /* sc-component-id: sc-keyframes-gxCBeh */ @-webkit-keyframes gxCBeh{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}33%{-webkit-transform:rotate(8deg);-ms-transform:rotate(8deg);transform:rotate(8deg);}100%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}} @keyframes gxCBeh{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}33%{-webkit-transform:rotate(8deg);-ms-transform:rotate(8deg);transform:rotate(8deg);}100%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}} /* sc-component-id: sc-keyframes-hlcKXx */ -@-webkit-keyframes hlcKXx{0%{opacity:0;}50%{opacity:1;}100%{opacity:0;}} @keyframes hlcKXx{0%{opacity:0;}50%{opacity:1;}100%{opacity:0;}}
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!

The current stable version of npm is available on GitHub.

To upgrade, run: npm install npm@latest -g

\ No newline at end of file +
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!
npm cli _
The intelligent package manager for the Node Javascript Platform. Install stuff and get coding!

The current stable version of npm is available on GitHub.

To upgrade, run: npm install npm@latest -g

\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/config/index.html b/deps/npm/docs/public/using-npm/config/index.html index 6d7c2995a95c3c..cc245172bb399c 100644 --- a/deps/npm/docs/public/using-npm/config/index.html +++ b/deps/npm/docs/public/using-npm/config/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

config

+

config

More than you probably want to know about npm configuration

Description

npm gets its configuration values from the following sources, sorted by priority:

@@ -1161,4 +1161,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/developers/index.html b/deps/npm/docs/public/using-npm/developers/index.html index a6cbcdf43bc5e3..c6d6c506bac13a 100644 --- a/deps/npm/docs/public/using-npm/developers/index.html +++ b/deps/npm/docs/public/using-npm/developers/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

developers

+

developers

Developer Guide

Description

So, you've decided to use npm to develop (and maybe publish/deploy) @@ -259,4 +259,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/disputes/index.html b/deps/npm/docs/public/using-npm/disputes/index.html index fa98276007062f..93a92cd27028e4 100644 --- a/deps/npm/docs/public/using-npm/disputes/index.html +++ b/deps/npm/docs/public/using-npm/disputes/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

disputes

+

disputes

Handling Module Name Disputes

This document describes the steps that you should take to resolve module name disputes with other npm publishers. It also describes special steps you should @@ -192,4 +192,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/orgs/index.html b/deps/npm/docs/public/using-npm/orgs/index.html index 3ebd3a1444a936..0a6fa3f2b7ebe3 100644 --- a/deps/npm/docs/public/using-npm/orgs/index.html +++ b/deps/npm/docs/public/using-npm/orgs/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

orgs

+

orgs

Working with Teams & Orgs

Description

There are three levels of org users:

@@ -144,4 +144,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/registry/index.html b/deps/npm/docs/public/using-npm/registry/index.html index 6cc806bc43651a..8bc4e9bde235ae 100644 --- a/deps/npm/docs/public/using-npm/registry/index.html +++ b/deps/npm/docs/public/using-npm/registry/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

registry

+

registry

The JavaScript Package Registry

Description

To resolve packages by name and version, npm talks to a registry website @@ -156,4 +156,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/removal/index.html b/deps/npm/docs/public/using-npm/removal/index.html index 723334e4dae6e3..cc5fff6d64ce9d 100644 --- a/deps/npm/docs/public/using-npm/removal/index.html +++ b/deps/npm/docs/public/using-npm/removal/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

removal

+

removal

Cleaning the Slate

Synopsis

So sad to see you go.

@@ -116,4 +116,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/scope/index.html b/deps/npm/docs/public/using-npm/scope/index.html index fe450fd3739bd7..362b542d13bd5b 100644 --- a/deps/npm/docs/public/using-npm/scope/index.html +++ b/deps/npm/docs/public/using-npm/scope/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

scope

+

scope

Scoped packages

Description

All npm packages have a name. Some package names also have a scope. A scope @@ -159,4 +159,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/scripts/index.html b/deps/npm/docs/public/using-npm/scripts/index.html index d2376cf2754a68..4609d564041492 100644 --- a/deps/npm/docs/public/using-npm/scripts/index.html +++ b/deps/npm/docs/public/using-npm/scripts/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

scripts

+

scripts

How npm handles the "scripts" field

Description

The "scripts" property of of your package.json file supports a number of built-in scripts and their preset life cycle events as well as arbitrary scripts. These all can be executed by running npm run-script <stage> or npm run <stage> for short. Pre and post commands with matching names will be run for those as well (e.g. premyscript, myscript, postmyscript). Scripts from dependencies can be run with npm explore <pkg> -- npm run <stage>.

@@ -197,9 +197,15 @@

PATH for executing the scripts. So, if your package.json has this:

-
{ "name" : "foo"
-, "dependencies" : { "bar" : "0.1.x" }
-, "scripts": { "start" : "bar ./test" } }
+
{
+  "name" : "foo",
+  "dependencies" : {
+    "bar" : "0.1.x"
+  },
+  "scripts": {
+    "start" : "bar ./test"
+  }
+}

then you could run npm start to execute the bar script, which is exported into the node_modules/.bin directory on npm install.

package.json vars

@@ -218,9 +224,15 @@

<name>[@<version>]:<key>. For example, if the package.json has this:

-
{ "name" : "foo"
-, "config" : { "port" : "8080" }
-, "scripts" : { "start" : "node server.js" } }
+
{
+  "name" : "foo",
+  "config" : {
+    "port" : "8080"
+  },
+  "scripts" : {
+    "start" : "node server.js"
+  }
+}

and the server.js is this:

http.createServer(...).listen(process.env.npm_package_config_port)

then the user could change the behavior by doing:

@@ -236,10 +248,11 @@

process.env.npm_package_scripts_install === "foo.js"

Examples

For example, if your package.json contains this:

-
{ "scripts" :
-  { "install" : "scripts/install.js"
-  , "postinstall" : "scripts/postinstall.js"
-  , "uninstall" : "scripts/uninstall.js"
+
{
+  "scripts" : {
+    "install" : "scripts/install.js",
+    "postinstall" : "scripts/install.js",
+    "uninstall" : "scripts/uninstall.js"
   }
 }

then scripts/install.js will be called for the install @@ -250,10 +263,11 @@

{ "scripts" :
-  { "preinstall" : "./configure"
-  , "install" : "make && make install"
-  , "test" : "make test"
+
{
+  "scripts" : {
+    "preinstall" : "./configure",
+    "install" : "make && make install",
+    "test" : "make test"
   }
 }

Exiting

@@ -309,4 +323,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/docs/public/using-npm/semver/index.html b/deps/npm/docs/public/using-npm/semver/index.html index 79ff8e1c437f92..fd6017acf9e29e 100644 --- a/deps/npm/docs/public/using-npm/semver/index.html +++ b/deps/npm/docs/public/using-npm/semver/index.html @@ -26,7 +26,7 @@ /* sc-component-id: FoundTypo__Container-sc-1e373sc-0 */ .fMOzaj{margin:80px 0;border-top:1px solid black;padding:20px 0;} /* sc-component-id: Page__Content-sc-4b62ym-0 */ -.gJQTGP{max-width:760px;margin:auto;padding:0 30px 120px;}

semver(7) -- The semantic versioner for npm

+

semver(7) -- The semantic versioner for npm

Install

npm install --save semver

Usage

@@ -435,4 +435,4 @@

\ No newline at end of file +
\ No newline at end of file diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 9d873689f6b7e1..41995abe22bbf1 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -63,7 +63,7 @@ function init (args, cb) { 'This utility will walk you through creating a package.json file.', 'It only covers the most common items, and tries to guess sensible defaults.', '', - 'See `npm help json` for definitive documentation on these fields', + 'See `npm help init` for definitive documentation on these fields', 'and exactly what they do.', '', 'Use `npm install ` afterwards to install a package and', diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index 3d8b333c64441c..72c71929630009 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -74,7 +74,10 @@ function doesChildVersionMatch (child, requested, requestor) { var childReq = child.package._requested if (childReq) { if (childReq.rawSpec === requested.rawSpec) return true - if (childReq.type === requested.type && childReq.saveSpec === requested.saveSpec) return true + if (childReq.type === requested.type) { + if (childReq.saveSpec === requested.saveSpec) return true + if (childReq.fetchSpec === requested.fetchSpec) return true + } } // If _requested didn't exist OR if it didn't match then we'll try using // _from. We pass it through npa to normalize the specifier. @@ -200,6 +203,7 @@ function removeObsoleteDep (child, log) { }) } +exports.packageRelativePath = packageRelativePath function packageRelativePath (tree) { if (!tree) return '' var requested = tree.package._requested || {} @@ -570,7 +574,7 @@ function addDependency (name, versionSpec, tree, log, done) { try { var req = childDependencySpecifier(tree, name, versionSpec) if (tree.swRequires && tree.swRequires[name]) { - var swReq = childDependencySpecifier(tree, name, tree.swRequires[name], tree.package._where) + var swReq = childDependencySpecifier(tree, name, tree.swRequires[name]) } } catch (err) { return done(err) diff --git a/deps/npm/lib/install/get-requested.js b/deps/npm/lib/install/get-requested.js index ab410ffc9b6e3c..df0eec6f6a6313 100644 --- a/deps/npm/lib/install/get-requested.js +++ b/deps/npm/lib/install/get-requested.js @@ -1,12 +1,15 @@ 'use strict' const npa = require('npm-package-arg') const moduleName = require('../utils/module-name.js') - +const packageRelativePath = require('./deps').packageRelativePath module.exports = function (child, reqBy) { if (!child.requiredBy.length) return if (!reqBy) reqBy = child.requiredBy[0] const deps = reqBy.package.dependencies || {} const devDeps = reqBy.package.devDependencies || {} + const optDeps = reqBy.package.optionalDependencies || {} const name = moduleName(child) - return npa.resolve(name, deps[name] || devDeps[name], reqBy.realpath) + const spec = deps[name] || devDeps[name] || optDeps[name] + const where = packageRelativePath(reqBy) + return npa.resolve(name, spec, where) } diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index 1ec4f9ba6dcfd7..122068c2012872 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -89,6 +89,20 @@ function tarballToVersion (name, tb) { return match[2] || match[1] } +function relativizeLink (name, spec, topPath, requested) { + if (!spec.startsWith('file:')) { + return + } + + let requestedPath = requested.fetchSpec + if (requested.type === 'file') { + requestedPath = path.dirname(requestedPath) + } + + const relativized = path.relative(requestedPath, path.resolve(topPath, spec.slice(5))) + return 'file:' + relativized +} + function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) { validate('OSSOOOO|ZSSOOOO', arguments) const usesIntegrity = ( @@ -101,7 +115,14 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) sw.resolved = sw.version sw.version = regTarball } - if (sw.requires) Object.keys(sw.requires).map(_ => { sw.requires[_] = tarballToVersion(_, sw.requires[_]) || sw.requires[_] }) + if (sw.requires) { + Object.keys(sw.requires).forEach(name => { + const spec = sw.requires[name] + sw.requires[name] = tarballToVersion(name, spec) || + relativizeLink(name, spec, topPath, requested) || + spec + }) + } const modernLink = requested.type === 'directory' && !sw.from if (hasModernMeta(onDiskChild) && childIsEquivalent(sw, requested, onDiskChild)) { // The version on disk matches the shrinkwrap entry. diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index 2ba6afd57c0e2f..f9f3511f7c364c 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "March 2020" "" "" +.TH "NPM" "1" "May 2020" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 448c9859a44a62..583bbc0a252990 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "March 2020" "" "" +.TH "NPM\-ACCESS" "1" "May 2020" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 3d005b13029d1a..db0e7e078dbcae 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -3,7 +3,7 @@ section: cli\-commands title: npm\-adduser .SH description: Set access level on published packages -.TH "NPM\-ADDUSER" "1" "March 2020" "" "" +.TH "NPM\-ADDUSER" "1" "May 2020" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SS Synopsis diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index d0a77fdf0d7815..db60498e2a210a 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-AUDIT" "1" "March 2020" "" "" +.TH "NPM\-AUDIT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-audit\fR \- Run a security audit .SS Synopsis diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 26480b0d0ff647..ffc64299daa1f7 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "March 2020" "" "" +.TH "NPM\-BIN" "1" "May 2020" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 1566c8706c1c53..967d15b73c5f6c 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "March 2020" "" "" +.TH "NPM\-BUGS" "1" "May 2020" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SS Synopsis diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index 20919da86c19f8..5c1f2c802e1546 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "March 2020" "" "" +.TH "NPM\-BUILD" "1" "May 2020" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index a2cb2ad35b4f2a..9b3b69753e8755 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "March 2020" "" "" +.TH "NPM\-BUNDLE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SS Description diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 30186d7925cf8f..201c7790106964 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "March 2020" "" "" +.TH "NPM\-CACHE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SS Synopsis diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 625cf2ef7b4eea..807e94b067ad47 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CI" "1" "March 2020" "" "" +.TH "NPM\-CI" "1" "May 2020" "" "" .SH "NAME" \fBnpm-ci\fR \- Install a project with a clean slate .SS Synopsis diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 263e04cba27875..44e041d1032545 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "March 2020" "" "" +.TH "NPM\-COMPLETION" "1" "May 2020" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 2c71ad1410e40c..71016d0ef10dd3 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "March 2020" "" "" +.TH "NPM\-CONFIG" "1" "May 2020" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SS Synopsis diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 53e71c0f405040..3e41436455d37e 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "March 2020" "" "" +.TH "NPM\-DEDUPE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SS Synopsis diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 3d7c160d987b33..aa14c873cc1a6f 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "March 2020" "" "" +.TH "NPM\-DEPRECATE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 9e8fb37ac0db3b..dae13ae00f086f 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -3,7 +3,7 @@ section: cli\-commands title: npm\-dist\-tag .SH description: Modify package distribution tags -.TH "NPM\-DIST\-TAG" "1" "March 2020" "" "" +.TH "NPM\-DIST\-TAG" "1" "May 2020" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SS Synopsis diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index e518a5082fd6de..8b6a846a9b71ff 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "March 2020" "" "" +.TH "NPM\-DOCS" "1" "May 2020" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SS Synopsis diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 4c04a7b6be9d41..188c80ac79ff7b 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "March 2020" "" "" +.TH "NPM\-DOCTOR" "1" "May 2020" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your environments .SS Synopsis diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 9f992f04d55f65..828825f8cb97ff 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "March 2020" "" "" +.TH "NPM\-EDIT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 74159220becef2..5859ed053ff71b 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -3,7 +3,7 @@ section: cli\-commands title: npm\-explore .SH description: Browse an installed package -.TH "NPM\-EXPLORE" "1" "March 2020" "" "" +.TH "NPM\-EXPLORE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index e4c418f8dae881..acb459d745e9bb 100644 --- a/deps/npm/man/man1/npm-fund.1 +++ b/deps/npm/man/man1/npm-fund.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FUND" "1" "March 2020" "" "" +.TH "NPM\-FUND" "1" "May 2020" "" "" .SH "NAME" \fBnpm-fund\fR \- Retrieve funding information .SS Synopsis diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 19c7d7b5f5693d..72c18bd5e6c54b 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "March 2020" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "May 2020" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SS Synopsis diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 6fa907cc9000f2..1aa3d6ddaea9da 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "March 2020" "" "" +.TH "NPM\-HELP" "1" "May 2020" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 index 74169fb4423c60..9d6d0a04616aa6 100644 --- a/deps/npm/man/man1/npm-hook.1 +++ b/deps/npm/man/man1/npm-hook.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HOOK" "1" "March 2020" "" "" +.TH "NPM\-HOOK" "1" "May 2020" "" "" .SH "NAME" \fBnpm-hook\fR \- Manage registry hooks .SS Synopsis diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 5c1b522ccbf7bb..f33cede27f8d5d 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "March 2020" "" "" +.TH "NPM\-INIT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-init\fR \- create a package\.json file .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index e5962b93fdae02..ed5559db37bad3 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "March 2020" "" "" +.TH "NPM" "" "May 2020" "" "" .SH "NAME" \fBnpm\fR .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 73c7400b73d3de..6d65529eab00b1 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "March 2020" "" "" +.TH "NPM" "" "May 2020" "" "" .SH "NAME" \fBnpm\fR .SS Synopsis diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 6bd9a4cd58e440..152becd7eaae61 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "March 2020" "" "" +.TH "NPM\-INSTALL" "1" "May 2020" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 79ad02d88ca0db..84df5b7e446fb1 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "March 2020" "" "" +.TH "NPM\-LINK" "1" "May 2020" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index d9020ea68413cb..3a46bcc3af5c71 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "March 2020" "" "" +.TH "NPM\-LOGOUT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 54ef77772f060f..5e024fadb2f3ba 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "March 2020" "" "" +.TH "NPM\-LS" "1" "May 2020" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SS Synopsis @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf - npm@6\.14\.4 /path/to/npm + npm@6\.14\.5 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index d3f1531252ed66..cc343314f75c3c 100644 --- a/deps/npm/man/man1/npm-org.1 +++ b/deps/npm/man/man1/npm-org.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ORG" "1" "March 2020" "" "" +.TH "NPM\-ORG" "1" "May 2020" "" "" .SH "NAME" \fBnpm-org\fR \- Manage orgs .SS Synopsis diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 808555c7b1b989..d353c5f340a66c 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "March 2020" "" "" +.TH "NPM\-OUTDATED" "1" "May 2020" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index f0e2f07a0cbc9a..34917c9b88340c 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "March 2020" "" "" +.TH "NPM\-OWNER" "1" "May 2020" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SS Synopsis diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index dac6963b4a2672..c9163675ec45d0 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "March 2020" "" "" +.TH "NPM\-PACK" "1" "May 2020" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 28ae935229cda4..0558082b0c4fbd 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "March 2020" "" "" +.TH "NPM\-PING" "1" "May 2020" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 3b695b870e085b..3483ad3708e43d 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "March 2020" "" "" +.TH "NPM\-PREFIX" "1" "May 2020" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SS Synopsis diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index b0990f099e5085..d1580469207b15 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PROFILE" "1" "March 2020" "" "" +.TH "NPM\-PROFILE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-profile\fR \- Change settings on your registry profile .SS Synopsis diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index b51f829ca9c9fc..95d8e15984e1f9 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "March 2020" "" "" +.TH "NPM\-PRUNE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index eec1f60120a4cd..d4ad6b01fb340d 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "March 2020" "" "" +.TH "NPM\-PUBLISH" "1" "May 2020" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 7e0d43fadf134d..41df28b52e6d01 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "March 2020" "" "" +.TH "NPM\-REBUILD" "1" "May 2020" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 68920454a69173..360080640b59f9 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "March 2020" "" "" +.TH "NPM\-REPO" "1" "May 2020" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index d90bebb90633d5..6c72553de428d2 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "March 2020" "" "" +.TH "NPM\-RESTART" "1" "May 2020" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index dab19fcabf5a0e..93ff1323e3f0ce 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "March 2020" "" "" +.TH "NPM\-ROOT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SS Synopsis diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 8a7d2b6e2ff06c..4e38d392d63792 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "March 2020" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "May 2020" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SS Synopsis diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 9b9b7861dab818..e2406f92252aae 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "March 2020" "" "" +.TH "NPM\-SEARCH" "1" "May 2020" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 59b2e499d1e9bf..4f4b95715cff88 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "March 2020" "" "" +.TH "NPM\-SHRINKWRAP" "1" "May 2020" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SS Synopsis diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index e5a18f85be1374..023f409b75c006 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "March 2020" "" "" +.TH "NPM\-STAR" "1" "May 2020" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index bcc7cce20518c1..b2e851319715b0 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "March 2020" "" "" +.TH "NPM\-STARS" "1" "May 2020" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SS Synopsis diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 64a22b7cb9461a..b64ec8b17533fe 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "March 2020" "" "" +.TH "NPM\-START" "1" "May 2020" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 5144671e15fcdd..1e23c9385f6c0d 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "March 2020" "" "" +.TH "NPM\-STOP" "1" "May 2020" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 6e0b1da57d6e06..2419f372b3d10b 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "March 2020" "" "" +.TH "NPM\-TEAM" "1" "May 2020" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SS Synopsis diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index fed0b5d5bb2dd1..b046fa0376d56f 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "March 2020" "" "" +.TH "NPM\-TEST" "1" "May 2020" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index 2ef8c563f1eb30..0a7555c14ec4f4 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TOKEN" "1" "March 2020" "" "" +.TH "NPM\-TOKEN" "1" "May 2020" "" "" .SH "NAME" \fBnpm-token\fR \- Manage your authentication tokens .SS Synopsis diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 72172f08c8f1fb..37ed8caf734e38 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "March 2020" "" "" +.TH "NPM\-UNINSTALL" "1" "May 2020" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 5db95caffc36d5..e776bb047f00dd 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "March 2020" "" "" +.TH "NPM\-UNPUBLISH" "1" "May 2020" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index b236b1eaaaa561..2006a973c2040e 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "March 2020" "" "" +.TH "NPM\-UPDATE" "1" "May 2020" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 22dc7a71ed4b01..57cd4e9f6ff14c 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "March 2020" "" "" +.TH "NPM\-VERSION" "1" "May 2020" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SS Synopsis diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 0bed92ababc3dd..a0b97326a48c76 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "March 2020" "" "" +.TH "NPM\-VIEW" "1" "May 2020" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SS Synopsis diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index c581a1f0a4d363..08dc425b269aeb 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "March 2020" "" "" +.TH "NPM\-WHOAMI" "1" "May 2020" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SS Synopsis diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index a9ea697aea7dc2..fc2e735cc44d66 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "March 2020" "" "" +.TH "NPM" "1" "May 2020" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis @@ -10,7 +10,7 @@ npm [args] .RE .SS Version .P -6\.14\.4 +6\.14\.5 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts @@ -47,14 +47,14 @@ on a preinstalled git\. .P If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use -node\-gyp \fIhttps://github\.com/TooTallNate/node\-gyp\fR for that task\. -For a Unix system, node\-gyp \fIhttps://github\.com/TooTallNate/node\-gyp\fR +node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR for that task\. +For a Unix system, node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR needs Python, make and a buildchain like GCC\. On Windows, Python and Microsoft Visual Studio C++ are needed\. Python 3 is -not supported by node\-gyp \fIhttps://github\.com/TooTallNate/node\-gyp\fR\|\. +not supported by node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR\|\. For more information visit -the node\-gyp repository \fIhttps://github\.com/TooTallNate/node\-gyp\fR and -the node\-gyp Wiki \fIhttps://github\.com/TooTallNate/node\-gyp/wiki\fR\|\. +the node\-gyp repository \fIhttps://github\.com/nodejs/node\-gyp\fR and +the node\-gyp Wiki \fIhttps://github\.com/nodejs/node\-gyp/wiki\fR\|\. .SS Directories .P See npm help \fBfolders\fP to learn about where npm puts stuff\. diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index c88bdecd34f1e8..06fcc5032448ca 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "March 2020" "" "" +.TH "FOLDERS" "5" "May 2020" "" "" .SH "NAME" \fBfolders\fR \- Folder Structures Used by npm .SS Description diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index 9309aa1f17c006..08b410eddca817 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "March 2020" "" "" +.TH "INSTALL" "5" "May 2020" "" "" .SH "NAME" \fBinstall\fR \- Download and Install npm .SS Description diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index bc3f8fdaed0e5b..ed5483983f300a 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "March 2020" "" "" +.TH "NPMRC" "5" "May 2020" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SS Description diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 13d90854131429..7ebe2dcf4a4918 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "March 2020" "" "" +.TH "PACKAGE\.JSON" "5" "May 2020" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SS Description diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index 43c6e419367742..5db9bea393f475 100644 --- a/deps/npm/man/man5/package-lock-json.5 +++ b/deps/npm/man/man5/package-lock-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "March 2020" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "May 2020" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SS Description diff --git a/deps/npm/man/man5/package-locks.5 b/deps/npm/man/man5/package-locks.5 index f610e42ba4ba4a..f7856325abbbe7 100644 --- a/deps/npm/man/man5/package-locks.5 +++ b/deps/npm/man/man5/package-locks.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCKS" "5" "March 2020" "" "" +.TH "PACKAGE\-LOCKS" "5" "May 2020" "" "" .SH "NAME" \fBpackage-locks\fR \- An explanation of npm lockfiles .SS Description diff --git a/deps/npm/man/man5/shrinkwrap-json.5 b/deps/npm/man/man5/shrinkwrap-json.5 index e891c84ecff4ee..227c7e87611217 100644 --- a/deps/npm/man/man5/shrinkwrap-json.5 +++ b/deps/npm/man/man5/shrinkwrap-json.5 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "March 2020" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "May 2020" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SS Description diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 0f653366b1d287..db95234d49e24b 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "March 2020" "" "" +.TH "CONFIG" "7" "May 2020" "" "" .SH "NAME" \fBconfig\fR \- More than you probably want to know about npm configuration .SS Description diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index a84548af27c641..942ce4b431a448 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "March 2020" "" "" +.TH "DEVELOPERS" "7" "May 2020" "" "" .SH "NAME" \fBdevelopers\fR \- Developer Guide .SS Description diff --git a/deps/npm/man/man7/disputes.7 b/deps/npm/man/man7/disputes.7 index a94c70b3d833de..4c5a73a2e57771 100644 --- a/deps/npm/man/man7/disputes.7 +++ b/deps/npm/man/man7/disputes.7 @@ -1,4 +1,4 @@ -.TH "DISPUTES" "7" "March 2020" "" "" +.TH "DISPUTES" "7" "May 2020" "" "" .SH "NAME" \fBdisputes\fR \- Handling Module Name Disputes .P diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index 418537ead8c219..b32c26c19cb3a0 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "March 2020" "" "" +.TH "ORGS" "7" "May 2020" "" "" .SH "NAME" \fBorgs\fR \- Working with Teams & Orgs .SS Description diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index f22059121e843b..5de9a3e0968093 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "March 2020" "" "" +.TH "REGISTRY" "7" "May 2020" "" "" .SH "NAME" \fBregistry\fR \- The JavaScript Package Registry .SS Description diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index 7b7322628f2c65..254a685ad2c24d 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "March 2020" "" "" +.TH "REMOVAL" "7" "May 2020" "" "" .SH "NAME" \fBremoval\fR \- Cleaning the Slate .SS Synopsis diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index 1884347b8b6ab1..680125cf6d5c54 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "March 2020" "" "" +.TH "SCOPE" "7" "May 2020" "" "" .SH "NAME" \fBscope\fR \- Scoped packages .SS Description diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 17b549b05e7c1c..f507049bc186fb 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "March 2020" "" "" +.TH "SCRIPTS" "7" "May 2020" "" "" .SH "NAME" \fBscripts\fR \- How npm handles the "scripts" field .SS Description @@ -194,9 +194,15 @@ executing the scripts\. So, if your package\.json has this: .P .RS 2 .nf -{ "name" : "foo" -, "dependencies" : { "bar" : "0\.1\.x" } -, "scripts": { "start" : "bar \./test" } } +{ + "name" : "foo", + "dependencies" : { + "bar" : "0\.1\.x" + }, + "scripts": { + "start" : "bar \./test" + } +} .fi .RE .P @@ -224,9 +230,15 @@ if the package\.json has this: .P .RS 2 .nf -{ "name" : "foo" -, "config" : { "port" : "8080" } -, "scripts" : { "start" : "node server\.js" } } +{ + "name" : "foo", + "config" : { + "port" : "8080" + }, + "scripts" : { + "start" : "node server\.js" + } +} .fi .RE .P @@ -267,10 +279,11 @@ For example, if your package\.json contains this: .P .RS 2 .nf -{ "scripts" : - { "install" : "scripts/install\.js" - , "postinstall" : "scripts/postinstall\.js" - , "uninstall" : "scripts/uninstall\.js" +{ + "scripts" : { + "install" : "scripts/install\.js", + "postinstall" : "scripts/install\.js", + "uninstall" : "scripts/uninstall\.js" } } .fi @@ -288,10 +301,11 @@ fine: .P .RS 2 .nf -{ "scripts" : - { "preinstall" : "\./configure" - , "install" : "make && make install" - , "test" : "make test" +{ + "scripts" : { + "preinstall" : "\./configure", + "install" : "make && make install", + "test" : "make test" } } .fi diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 419716a83d737a..7e8df25a356581 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "March 2020" "" "" +.TH "SEMVER" "7" "May 2020" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Install diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 8c75ee259e0911..de3df47fd55529 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -21,6 +21,14 @@ if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { function noop () {} +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + var debug = noop if (util.debuglog) debug = util.debuglog('gfs4') @@ -32,14 +40,10 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) } // Once time initialization -if (!global[gracefulQueue]) { +if (!fs[gracefulQueue]) { // This queue can be shared by multiple loaded instances - var queue = [] - Object.defineProperty(global, gracefulQueue, { - get: function() { - return queue - } - }) + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) // Patch fs.close/closeSync to shared queue version, because we need // to retry() whenever a close happens *anywhere* in the program. @@ -79,12 +83,16 @@ if (!global[gracefulQueue]) { if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { process.on('exit', function() { - debug(global[gracefulQueue]) - require('assert').equal(global[gracefulQueue].length, 0) + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) }) } } +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + module.exports = patch(clone(fs)) if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { module.exports = patch(fs) @@ -334,11 +342,11 @@ function patch (fs) { function enqueue (elem) { debug('ENQUEUE', elem[0].name, elem[1]) - global[gracefulQueue].push(elem) + fs[gracefulQueue].push(elem) } function retry () { - var elem = global[gracefulQueue].shift() + var elem = fs[gracefulQueue].shift() if (elem) { debug('RETRY', elem[0].name, elem[1]) elem[0].apply(null, elem[1]) diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index 788876e3220739..32518904d97418 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -1,19 +1,19 @@ { - "_from": "graceful-fs@4.2.3", - "_id": "graceful-fs@4.2.3", + "_from": "graceful-fs@4.2.4", + "_id": "graceful-fs@4.2.4", "_inBundle": false, - "_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "_integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "_location": "/graceful-fs", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "graceful-fs@4.2.3", + "raw": "graceful-fs@4.2.4", "name": "graceful-fs", "escapedName": "graceful-fs", - "rawSpec": "4.2.3", + "rawSpec": "4.2.4", "saveSpec": null, - "fetchSpec": "4.2.3" + "fetchSpec": "4.2.4" }, "_requiredBy": [ "#USER", @@ -41,10 +41,10 @@ "/test-exclude/load-json-file", "/write-file-atomic" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "_shasum": "4a12ff1b60376ef09862c2093edd908328be8423", - "_spec": "graceful-fs@4.2.3", - "_where": "/Users/mperrotte/npminc/cli", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "_shasum": "2256bde14d3632958c465ebc96dc467ca07a29fb", + "_spec": "graceful-fs@4.2.4", + "_where": "/Users/ruyadorno/Documents/workspace/cli", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, @@ -98,5 +98,5 @@ "preversion": "npm test", "test": "node test.js | tap -" }, - "version": "4.2.3" + "version": "4.2.4" } diff --git a/deps/npm/node_modules/mkdirp/README.markdown b/deps/npm/node_modules/mkdirp/README.markdown index 3cc13153851162..fc314bfbd662cf 100644 --- a/deps/npm/node_modules/mkdirp/README.markdown +++ b/deps/npm/node_modules/mkdirp/README.markdown @@ -37,7 +37,7 @@ Create a new directory and any necessary subdirectories at `dir` with octal permission string `opts.mode`. If `opts` is a non-object, it will be treated as the `opts.mode`. -If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. +If `opts.mode` isn't specified, it defaults to `0777`. `cb(err, made)` fires with the error or the first directory `made` that had to be created, if any. @@ -52,7 +52,7 @@ Synchronously create a new directory and any necessary subdirectories at `dir` with octal permission string `opts.mode`. If `opts` is a non-object, it will be treated as the `opts.mode`. -If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. +If `opts.mode` isn't specified, it defaults to `0777`. Returns the first directory that had to be created, if any. diff --git a/deps/npm/node_modules/mkdirp/index.js b/deps/npm/node_modules/mkdirp/index.js index 2f1287071fc0d6..468d7cd8df53be 100644 --- a/deps/npm/node_modules/mkdirp/index.js +++ b/deps/npm/node_modules/mkdirp/index.js @@ -17,7 +17,7 @@ function mkdirP (p, opts, f, made) { var xfs = opts.fs || fs; if (mode === undefined) { - mode = _0777 & (~process.umask()); + mode = _0777 } if (!made) made = null; @@ -62,7 +62,7 @@ mkdirP.sync = function sync (p, opts, made) { var xfs = opts.fs || fs; if (mode === undefined) { - mode = _0777 & (~process.umask()); + mode = _0777 } if (!made) made = null; diff --git a/deps/npm/node_modules/mkdirp/package.json b/deps/npm/node_modules/mkdirp/package.json index 5ff5891b2c06d8..af775065f04fae 100644 --- a/deps/npm/node_modules/mkdirp/package.json +++ b/deps/npm/node_modules/mkdirp/package.json @@ -1,19 +1,19 @@ { - "_from": "mkdirp@0.5.4", - "_id": "mkdirp@0.5.4", + "_from": "mkdirp@0.5.5", + "_id": "mkdirp@0.5.5", "_inBundle": false, - "_integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "_integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "_location": "/mkdirp", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "mkdirp@0.5.4", + "raw": "mkdirp@0.5.5", "name": "mkdirp", "escapedName": "mkdirp", - "rawSpec": "0.5.4", + "rawSpec": "0.5.5", "saveSpec": null, - "fetchSpec": "0.5.4" + "fetchSpec": "0.5.5" }, "_requiredBy": [ "#USER", @@ -32,9 +32,9 @@ "/tar", "/write" ], - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", - "_shasum": "fd01504a6797ec5c9be81ff43d204961ed64a512", - "_spec": "mkdirp@0.5.4", + "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "_shasum": "d91cefd62d1436ca0f41620e251288d420099def", + "_spec": "mkdirp@0.5.5", "_where": "/Users/ruyadorno/Documents/workspace/cli", "author": { "name": "James Halliday", @@ -51,7 +51,7 @@ "dependencies": { "minimist": "^1.2.5" }, - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "deprecated": false, "description": "Recursively mkdir, like `mkdir -p`", "devDependencies": { "mock-fs": "^3.7.0", @@ -79,5 +79,5 @@ "scripts": { "test": "tap test/*.js" }, - "version": "0.5.4" + "version": "0.5.5" } diff --git a/deps/npm/node_modules/nopt/.npmignore b/deps/npm/node_modules/nopt/.npmignore deleted file mode 100644 index 3c3629e647f5dd..00000000000000 --- a/deps/npm/node_modules/nopt/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/deps/npm/node_modules/nopt/.travis.yml b/deps/npm/node_modules/nopt/.travis.yml deleted file mode 100644 index a1cef591c3cfd0..00000000000000 --- a/deps/npm/node_modules/nopt/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - '0.12' - - '4' - - '6' - - '7' -before_install: - - npm install -g npm@latest diff --git a/deps/npm/node_modules/nopt/examples/my-program.js b/deps/npm/node_modules/nopt/examples/my-program.js deleted file mode 100755 index 142447e18e756c..00000000000000 --- a/deps/npm/node_modules/nopt/examples/my-program.js +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env node - -//process.env.DEBUG_NOPT = 1 - -// my-program.js -var nopt = require("../lib/nopt") - , Stream = require("stream").Stream - , path = require("path") - , knownOpts = { "foo" : [String, null] - , "bar" : [Stream, Number] - , "baz" : path - , "bloo" : [ "big", "medium", "small" ] - , "flag" : Boolean - , "pick" : Boolean - } - , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] - , "b7" : ["--bar", "7"] - , "m" : ["--bloo", "medium"] - , "p" : ["--pick"] - , "f" : ["--flag", "true"] - , "g" : ["--flag"] - , "s" : "--flag" - } - // everything is optional. - // knownOpts and shorthands default to {} - // arg list defaults to process.argv - // slice defaults to 2 - , parsed = nopt(knownOpts, shortHands, process.argv, 2) - -console.log("parsed =\n"+ require("util").inspect(parsed)) diff --git a/deps/npm/node_modules/nopt/lib/nopt.js b/deps/npm/node_modules/nopt/lib/nopt.js index 1fb113514f3347..0ec5753d0cb898 100644 --- a/deps/npm/node_modules/nopt/lib/nopt.js +++ b/deps/npm/node_modules/nopt/lib/nopt.js @@ -113,7 +113,12 @@ function clean (data, types, typeDefs) { return d[k] }).filter(function (val) { return val !== remove }) - if (!val.length) delete data[k] + // if we allow Array specifically, then an empty array is how we + // express 'no value here', not null. Allow it. + if (!val.length && type.indexOf(Array) === -1) { + debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(Array)) + delete data[k] + } else if (isArray) { debug(isArray, data[k], val) data[k] = val diff --git a/deps/npm/node_modules/nopt/package.json b/deps/npm/node_modules/nopt/package.json index cea3624f4d14e5..1490f6d25d75cf 100644 --- a/deps/npm/node_modules/nopt/package.json +++ b/deps/npm/node_modules/nopt/package.json @@ -1,51 +1,54 @@ { - "_args": [ - [ - "nopt@4.0.1", - "/Users/rebecca/code/npm" - ] - ], - "_from": "nopt@4.0.1", - "_id": "nopt@4.0.1", + "_from": "nopt@4.0.3", + "_id": "nopt@4.0.3", "_inBundle": false, - "_integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "_integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", "_location": "/nopt", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "nopt@4.0.1", + "raw": "nopt@4.0.3", "name": "nopt", "escapedName": "nopt", - "rawSpec": "4.0.1", + "rawSpec": "4.0.3", "saveSpec": null, - "fetchSpec": "4.0.1" + "fetchSpec": "4.0.3" }, "_requiredBy": [ - "/" + "#USER", + "/", + "/node-gyp" ], - "_resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "_spec": "4.0.1", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "_shasum": "a375cad9d02fd921278d954c2254d5aa57e15e48", + "_spec": "nopt@4.0.3", + "_where": "/Users/ruyadorno/Documents/workspace/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", "url": "http://blog.izs.me/" }, "bin": { - "nopt": "./bin/nopt.js" + "nopt": "bin/nopt.js" }, "bugs": { "url": "https://github.com/npm/nopt/issues" }, + "bundleDependencies": false, "dependencies": { "abbrev": "1", "osenv": "^0.1.4" }, + "deprecated": false, "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", "devDependencies": { - "tap": "^8.0.1" + "tap": "^14.10.6" }, + "files": [ + "bin", + "lib" + ], "homepage": "https://github.com/npm/nopt#readme", "license": "ISC", "main": "lib/nopt.js", @@ -55,7 +58,10 @@ "url": "git+https://github.com/npm/nopt.git" }, "scripts": { + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "preversion": "npm test", "test": "tap test/*.js" }, - "version": "4.0.1" + "version": "4.0.3" } diff --git a/deps/npm/node_modules/nopt/test/basic.js b/deps/npm/node_modules/nopt/test/basic.js deleted file mode 100644 index 5c18ac0fc6a319..00000000000000 --- a/deps/npm/node_modules/nopt/test/basic.js +++ /dev/null @@ -1,303 +0,0 @@ -var nopt = require("../") - , test = require('tap').test - , isWin = process.platform === 'win32' - -test("passing a string results in a string", function (t) { - var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0) - t.same(parsed.key, "myvalue") - t.end() -}) - -// https://github.com/npm/nopt/issues/31 -test("Empty String results in empty string, not true", function (t) { - var parsed = nopt({ empty: String }, {}, ["--empty"], 0) - t.same(parsed.empty, "") - t.end() -}) - -// https://github.com/npm/nopt/issues/65 -test("Empty String should not swallow next flag", function (t) { - var parsed = nopt({ empty: String, foo: String }, {}, ["--empty", "--foo"], 0) - t.same(parsed.empty, "") - t.same(parsed.foo, "") - t.end() -}) - -// https://github.com/npm/nopt/issues/66 -test("Empty String should not be true when type is single item Array", function (t) { - var parsed = nopt({ 'foo': [String] }, {}, ["--foo"], 0) - t.same(parsed.foo, "") - t.end() -}) - -test("~ path is resolved to " + (isWin ? '%USERPROFILE%' : '$HOME'), function (t) { - var path = require("path") - , the - - if (isWin) { - the = { - key: 'USERPROFILE', - dir: 'C:\\temp', - val: '~\\val' - } - } else { - the = { - key: 'HOME', - dir: '/tmp', - val: '~/val' - } - } - if (!process.env[the.key]) process.env[the.key] = v.dir - var parsed = nopt({key: path}, {}, ["--key=" + the.val], 0) - t.same(parsed.key, path.resolve(process.env[the.key], "val")) - t.end() -}) - -// https://github.com/npm/nopt/issues/24 -test("Unknown options are not parsed as numbers", function (t) { - var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0) - t.equal(parsed['leave-as-is'], '1.20') - t.equal(parsed['parse-me'], 1.2) - t.end() -}); - -// https://github.com/npm/nopt/issues/48 -test("Check types based on name of type", function (t) { - var parsed = nopt({"parse-me": {name: "Number"}}, null, ['--parse-me=1.20'], 0) - t.equal(parsed['parse-me'], 1.2) - t.end() -}) - - -test("Missing types are not parsed", function (t) { - var parsed = nopt({"parse-me": {}}, null, ['--parse-me=1.20'], 0) - //should only contain argv - t.equal(Object.keys(parsed).length, 1) - t.end() -}) - -test("Types passed without a name are not parsed", function (t) { - var parsed = nopt({"parse-me": {}}, {}, ['--parse-me=1.20'], 0) - //should only contain argv - t.equal(Object.keys(parsed).length, 1) - t.end() -}) - -test("other tests", function (t) { - - var util = require("util") - , Stream = require("stream") - , path = require("path") - , url = require("url") - - , shorthands = - { s : ["--loglevel", "silent"] - , d : ["--loglevel", "info"] - , dd : ["--loglevel", "verbose"] - , ddd : ["--loglevel", "silly"] - , noreg : ["--no-registry"] - , reg : ["--registry"] - , "no-reg" : ["--no-registry"] - , silent : ["--loglevel", "silent"] - , verbose : ["--loglevel", "verbose"] - , h : ["--usage"] - , H : ["--usage"] - , "?" : ["--usage"] - , help : ["--usage"] - , v : ["--version"] - , f : ["--force"] - , desc : ["--description"] - , "no-desc" : ["--no-description"] - , "local" : ["--no-global"] - , l : ["--long"] - , p : ["--parseable"] - , porcelain : ["--parseable"] - , g : ["--global"] - } - - , types = - { aoa: Array - , nullstream: [null, Stream] - , date: Date - , str: String - , browser : String - , cache : path - , color : ["always", Boolean] - , depth : Number - , description : Boolean - , dev : Boolean - , editor : path - , force : Boolean - , global : Boolean - , globalconfig : path - , group : [String, Number] - , gzipbin : String - , logfd : [Number, Stream] - , loglevel : ["silent","win","error","warn","info","verbose","silly"] - , long : Boolean - , "node-version" : [false, String] - , npaturl : url - , npat : Boolean - , "onload-script" : [false, String] - , outfd : [Number, Stream] - , parseable : Boolean - , pre: Boolean - , prefix: path - , proxy : url - , "rebuild-bundle" : Boolean - , registry : url - , searchopts : String - , searchexclude: [null, String] - , shell : path - , t: [Array, String] - , tag : String - , tar : String - , tmp : path - , "unsafe-perm" : Boolean - , usage : Boolean - , user : String - , username : String - , userconfig : path - , version : Boolean - , viewer: path - , _exit : Boolean - , path: path - } - - ; [["-v", {version:true}, []] - ,["---v", {version:true}, []] - ,["ls -s --no-reg connect -d", - {loglevel:"info",registry:null},["ls","connect"]] - ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]] - ,["ls --registry blargle", {}, ["ls"]] - ,["--no-registry", {registry:null}, []] - ,["--no-color true", {color:false}, []] - ,["--no-color false", {color:true}, []] - ,["--no-color", {color:false}, []] - ,["--color false", {color:false}, []] - ,["--color --logfd 7", {logfd:7,color:true}, []] - ,["--color=true", {color:true}, []] - ,["--logfd=10", {logfd:10}, []] - ,["--tmp=/tmp -tar=gtar", {tmp: isWin ? "C:\\tmp" : "/tmp",tar:"gtar"},[]] - ,["--tmp=tmp -tar=gtar", - {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]] - ,["--logfd x", {}, []] - ,["a -true -- -no-false", {true:true},["a","-no-false"]] - ,["a -no-false", {false:false},["a"]] - ,["a -no-no-true", {true:true}, ["a"]] - ,["a -no-no-no-false", {false:false}, ["a"]] - ,["---NO-no-No-no-no-no-nO-no-no"+ - "-No-no-no-no-no-no-no-no-no"+ - "-no-no-no-no-NO-NO-no-no-no-no-no-no"+ - "-no-body-can-do-the-boogaloo-like-I-do" - ,{"body-can-do-the-boogaloo-like-I-do":false}, []] - ,["we are -no-strangers-to-love "+ - "--you-know=the-rules --and=so-do-i "+ - "---im-thinking-of=a-full-commitment "+ - "--no-you-would-get-this-from-any-other-guy "+ - "--no-gonna-give-you-up "+ - "-no-gonna-let-you-down=true "+ - "--no-no-gonna-run-around false "+ - "--desert-you=false "+ - "--make-you-cry false "+ - "--no-tell-a-lie "+ - "--no-no-and-hurt-you false" - ,{"strangers-to-love":false - ,"you-know":"the-rules" - ,"and":"so-do-i" - ,"you-would-get-this-from-any-other-guy":false - ,"gonna-give-you-up":false - ,"gonna-let-you-down":false - ,"gonna-run-around":false - ,"desert-you":false - ,"make-you-cry":false - ,"tell-a-lie":false - ,"and-hurt-you":false - },["we", "are"]] - ,["-t one -t two -t three" - ,{t: ["one", "two", "three"]} - ,[]] - ,["-t one -t null -t three four five null" - ,{t: ["one", "null", "three"]} - ,["four", "five", "null"]] - ,["-t foo" - ,{t:["foo"]} - ,[]] - ,["--no-t" - ,{t:["false"]} - ,[]] - ,["-no-no-t" - ,{t:["true"]} - ,[]] - ,["-aoa one -aoa null -aoa 100" - ,{aoa:["one", null, '100']} - ,[]] - ,["-str 100" - ,{str:"100"} - ,[]] - ,["--color always" - ,{color:"always"} - ,[]] - ,["--no-nullstream" - ,{nullstream:null} - ,[]] - ,["--nullstream false" - ,{nullstream:null} - ,[]] - ,["--notadate=2011-01-25" - ,{notadate: "2011-01-25"} - ,[]] - ,["--date 2011-01-25" - ,{date: new Date("2011-01-25")} - ,[]] - ,["-cl 1" - ,{config: true, length: 1} - ,[] - ,{config: Boolean, length: Number, clear: Boolean} - ,{c: "--config", l: "--length"}] - ,["--acount bla" - ,{"acount":true} - ,["bla"] - ,{account: Boolean, credentials: Boolean, options: String} - ,{a:"--account", c:"--credentials",o:"--options"}] - ,["--clear" - ,{clear:true} - ,[] - ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean} - ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}] - ,["--file -" - ,{"file":"-"} - ,[] - ,{file:String} - ,{}] - ,["--file -" - ,{"file":true} - ,["-"] - ,{file:Boolean} - ,{}] - ,["--path" - ,{"path":null} - ,[]] - ,["--path ." - ,{"path":process.cwd()} - ,[]] - ].forEach(function (test) { - var argv = test[0].split(/\s+/) - , opts = test[1] - , rem = test[2] - , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0) - , parsed = actual.argv - delete actual.argv - for (var i in opts) { - var e = JSON.stringify(opts[i]) - , a = JSON.stringify(actual[i] === undefined ? null : actual[i]) - if (e && typeof e === "object") { - t.deepEqual(e, a) - } else { - t.equal(e, a) - } - } - t.deepEqual(rem, parsed.remain) - }) - t.end() -}) diff --git a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md index 3599c6b2fcac1b..75b74eec60144d 100644 --- a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md +++ b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [4.0.4](https://github.com/npm/registry-fetch/compare/v4.0.3...v4.0.4) (2020-04-28) + + + ## [4.0.3](https://github.com/npm/registry-fetch/compare/v4.0.2...v4.0.3) (2020-02-13) diff --git a/deps/npm/node_modules/npm-registry-fetch/README.md b/deps/npm/node_modules/npm-registry-fetch/README.md index 80ce64cda78efe..9f9c6d0e808fd2 100644 --- a/deps/npm/node_modules/npm-registry-fetch/README.md +++ b/deps/npm/node_modules/npm-registry-fetch/README.md @@ -581,7 +581,7 @@ See also [`opts.ca`](#opts-ca). ##### `opts.timeout` * Type: Milliseconds -* Default: 30000 (30 seconds) +* Default: 0 (no timeout) Time before a hanging request times out. diff --git a/deps/npm/node_modules/npm-registry-fetch/config.js b/deps/npm/node_modules/npm-registry-fetch/config.js index d7be3f9b38a167..c4e8b687412a58 100644 --- a/deps/npm/node_modules/npm-registry-fetch/config.js +++ b/deps/npm/node_modules/npm-registry-fetch/config.js @@ -76,7 +76,7 @@ module.exports = figgyPudding({ 'spec': {}, 'strict-ssl': {}, 'timeout': { - default: 30 * 1000 + default: 0 }, 'user-agent': { default: `${ diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index ca6c5f90c63527..c1582514e36e1e 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,19 +1,19 @@ { - "_from": "npm-registry-fetch@4.0.3", - "_id": "npm-registry-fetch@4.0.3", + "_from": "npm-registry-fetch@4.0.4", + "_id": "npm-registry-fetch@4.0.4", "_inBundle": false, - "_integrity": "sha512-WGvUx0lkKFhu9MbiGFuT9nG2NpfQ+4dCJwRwwtK2HK5izJEvwDxMeUyqbuMS7N/OkpVCqDorV6rO5E4V9F8lJw==", + "_integrity": "sha512-6jb34hX/iYNQebqWUHtU8YF6Cjb1H6ouTFPClYsyiW6lpFkljTpdeftm53rRojtja1rKAvKNIIiTS5Sjpw4wsA==", "_location": "/npm-registry-fetch", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-registry-fetch@4.0.3", + "raw": "npm-registry-fetch@4.0.4", "name": "npm-registry-fetch", "escapedName": "npm-registry-fetch", - "rawSpec": "4.0.3", + "rawSpec": "4.0.4", "saveSpec": null, - "fetchSpec": "4.0.3" + "fetchSpec": "4.0.4" }, "_requiredBy": [ "#USER", @@ -28,10 +28,10 @@ "/npm-profile", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.3.tgz", - "_shasum": "3c2179e39e04f9348b1c2979545951d36bee8766", - "_spec": "npm-registry-fetch@4.0.3", - "_where": "/Users/darcyclarke/Documents/Repos/npm/cli", + "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.4.tgz", + "_shasum": "2da1ecf3f43d419d96abf313664291a4623d3ea5", + "_spec": "npm-registry-fetch@4.0.4", + "_where": "/Users/ruyadorno/Documents/workspace/cli", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -102,5 +102,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "4.0.3" + "version": "4.0.4" } diff --git a/deps/npm/package.json b/deps/npm/package.json index d367dc98b5982f..bfbed9ea0bab43 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "6.14.4", + "version": "6.14.5", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -61,7 +61,7 @@ "fs-write-stream-atomic": "~1.0.10", "gentle-fs": "^2.3.0", "glob": "^7.1.6", - "graceful-fs": "^4.2.3", + "graceful-fs": "^4.2.4", "has-unicode": "~2.0.1", "hosted-git-info": "^2.8.8", "iferr": "^1.0.2", @@ -91,10 +91,10 @@ "lru-cache": "^5.1.1", "meant": "~1.0.1", "mississippi": "^3.0.0", - "mkdirp": "^0.5.4", + "mkdirp": "^0.5.5", "move-concurrently": "^1.0.1", "node-gyp": "^5.1.0", - "nopt": "~4.0.1", + "nopt": "^4.0.3", "normalize-package-data": "^2.5.0", "npm-audit-report": "^1.3.2", "npm-cache-filename": "~1.0.2", @@ -104,7 +104,7 @@ "npm-packlist": "^1.4.8", "npm-pick-manifest": "^3.0.2", "npm-profile": "^4.0.4", - "npm-registry-fetch": "^4.0.3", + "npm-registry-fetch": "^4.0.4", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", diff --git a/deps/npm/scripts/release.sh b/deps/npm/scripts/release.sh index 31fb6fa1941418..75d2115aadf83a 100644 --- a/deps/npm/scripts/release.sh +++ b/deps/npm/scripts/release.sh @@ -7,6 +7,8 @@ unset CDPATH set -e rm -rf release *.tgz || true +rm node_modules/node-gyp/gyp/pylib/gyp/*.pyc || true +rm node_modules/node-gyp/gyp/pylib/gyp/generator/*.pyc || true mkdir release node ./bin/npm-cli.js pack --loglevel error >/dev/null mv *.tgz release diff --git a/deps/npm/test/tap/install-dep-classification.js b/deps/npm/test/tap/install-dep-classification.js index 257fc99fc123ff..1c9995cedc8a04 100644 --- a/deps/npm/test/tap/install-dep-classification.js +++ b/deps/npm/test/tap/install-dep-classification.js @@ -126,7 +126,7 @@ test('optional dependency identification', function (t) { optional: true }, example: { - version: '1.0.0', + version: 'file:../example-1.0.0.tgz', optional: true } } @@ -150,7 +150,7 @@ test('development dependency identification', function (t) { dev: true }, example: { - version: '1.0.0', + version: 'file:../example-1.0.0.tgz', dev: true } } @@ -173,7 +173,7 @@ test('default dependency identification', function (t) { optional: true }, example: { - version: '1.0.0', + version: 'file:../example-1.0.0.tgz', optional: true } } diff --git a/deps/uv/.gitignore b/deps/uv/.gitignore index 83370a7bb0efcd..7eb49322af01f2 100644 --- a/deps/uv/.gitignore +++ b/deps/uv/.gitignore @@ -67,6 +67,7 @@ ipch # Clion / IntelliJ project files /.idea/ +cmake-build-debug/ *.xcodeproj *.xcworkspace diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 410d9461ad11d5..222367e41ee06e 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -425,3 +425,10 @@ Sk Sajidul Kadir twosee Rikard Falkeborn Yash Ladha +James Ross +Colin Finck +Shohei YOSHIDA +Philip Chimento +Michal Artazov +Jeroen Roovers +MasterDuke17 diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index c82fa2b56d8771..0496d36ae970a1 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -24,6 +24,12 @@ cmake_dependent_option(LIBUV_BUILD_BENCH "Build the benchmarks when building unit tests and we are the root project" ON "LIBUV_BUILD_TESTS" OFF) +# Qemu Build +option(QEMU "build for qemu" OFF) +if(QEMU) + add_definitions(-D__QEMU__=1) +endif() + # Compiler check string(CONCAT is-msvc $, @@ -31,6 +37,18 @@ string(CONCAT is-msvc $) check_c_compiler_flag(/W4 UV_LINT_W4) +check_c_compiler_flag(/wd4100 UV_LINT_NO_UNUSED_PARAMETER_MSVC) +check_c_compiler_flag(/wd4127 UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC) +check_c_compiler_flag(/wd4201 UV_LINT_NO_NONSTANDARD_MSVC) +check_c_compiler_flag(/wd4206 UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC) +check_c_compiler_flag(/wd4210 UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC) +check_c_compiler_flag(/wd4232 UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC) +check_c_compiler_flag(/wd4456 UV_LINT_NO_HIDES_LOCAL) +check_c_compiler_flag(/wd4457 UV_LINT_NO_HIDES_PARAM) +check_c_compiler_flag(/wd4459 UV_LINT_NO_HIDES_GLOBAL) +check_c_compiler_flag(/wd4706 UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC) +check_c_compiler_flag(/wd4996 UV_LINT_NO_UNSAFE_MSVC) + check_c_compiler_flag(-Wall UV_LINT_WALL) # DO NOT use this under MSVC # TODO: Place these into its own function @@ -38,10 +56,21 @@ check_c_compiler_flag(-Wno-unused-parameter UV_LINT_NO_UNUSED_PARAMETER) check_c_compiler_flag(-Wstrict-prototypes UV_LINT_STRICT_PROTOTYPES) check_c_compiler_flag(-Wextra UV_LINT_EXTRA) -set(lint-no-unused-parameter $<$:-Wno-unused-parameter>) +set(lint-no-unused-parameter $<$:-Wno-unused-parameter>) set(lint-strict-prototypes $<$:-Wstrict-prototypes>) set(lint-extra $<$:-Wextra>) set(lint-w4 $<$:/W4>) +set(lint-no-unused-parameter-msvc $<$:/wd4100>) +set(lint-no-conditional-constant-msvc $<$:/wd4127>) +set(lint-no-nonstandard-msvc $<$:/wd4201>) +set(lint-no-nonstandard-empty-tu-msvc $<$:/wd4206>) +set(lint-no-nonstandard-file-scope-msvc $<$:/wd4210>) +set(lint-no-nonstandard-nonstatic-dlimport-msvc $<$:/wd4232>) +set(lint-no-hides-local-msvc $<$:/wd4456>) +set(lint-no-hides-param-msvc $<$:/wd4457>) +set(lint-no-hides-global-msvc $<$:/wd4459>) +set(lint-no-conditional-assignment-msvc $<$:/wd4706>) +set(lint-no-unsafe-msvc $<$:/wd4996>) # Unfortunately, this one is complicated because MSVC and clang-cl support -Wall # but using it is like calling -Weverything string(CONCAT lint-default $< @@ -50,6 +79,17 @@ string(CONCAT lint-default $< list(APPEND uv_cflags ${lint-strict-prototypes} ${lint-extra} ${lint-default} ${lint-w4}) list(APPEND uv_cflags ${lint-no-unused-parameter}) +list(APPEND uv_cflags ${lint-no-unused-parameter-msvc}) +list(APPEND uv_cflags ${lint-no-conditional-constant-msvc}) +list(APPEND uv_cflags ${lint-no-nonstandard-msvc}) +list(APPEND uv_cflags ${lint-no-nonstandard-empty-tu-msvc}) +list(APPEND uv_cflags ${lint-no-nonstandard-file-scope-msvc}) +list(APPEND uv_cflags ${lint-no-nonstandard-nonstatic-dlimport-msvc}) +list(APPEND uv_cflags ${lint-no-hides-local-msvc}) +list(APPEND uv_cflags ${lint-no-hides-param-msvc}) +list(APPEND uv_cflags ${lint-no-hides-global-msvc}) +list(APPEND uv_cflags ${lint-no-conditional-assignment-msvc}) +list(APPEND uv_cflags ${lint-no-unsafe-msvc}) set(uv_sources src/fs-poll.c @@ -64,22 +104,9 @@ set(uv_sources src/version.c) if(WIN32) - if (CMAKE_SYSTEM_VERSION VERSION_GREATER 10) # Windows 10 - set(windows-version 0x0A00) - elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.3) # Windows 8.1 - set(windows-version 0x0603) - elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.2) # Windows 8 - set(windows-version 0x0602) - elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.1) # Windows 7 - set(windows-version 0x0601) - elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.0) # Windows Vista - set(windows-version 0x0600) - else() - message(FATAL_ERROR "Windows Vista is the minimum version supported") - endif() - list(APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=${windows-version}) + list(APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0600) list(APPEND uv_libraries - $<$:psapi> + psapi iphlpapi userenv ws2_32) @@ -155,7 +182,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") endif() if(CMAKE_SYSTEM_NAME STREQUAL "Android") - list(APPEND uv_libs dl) + list(APPEND uv_libraries dl) list(APPEND uv_sources src/unix/android-ifaddrs.c src/unix/linux-core.c @@ -489,7 +516,7 @@ if(LIBUV_BUILD_TESTS) test/test-walk-handles.c test/test-watcher-cross-stop.c) - add_executable(uv_run_tests ${uv_test_sources}) + add_executable(uv_run_tests ${uv_test_sources} uv_win_longpath.manifest) target_compile_definitions(uv_run_tests PRIVATE ${uv_defines} USING_UV_SHARED=1) target_compile_options(uv_run_tests PRIVATE ${uv_cflags}) @@ -501,10 +528,14 @@ if(LIBUV_BUILD_TESTS) set_tests_properties(uv_test PROPERTIES ENVIRONMENT "LIBPATH=${CMAKE_BINARY_DIR}:$ENV{LIBPATH}") endif() - add_executable(uv_run_tests_a ${uv_test_sources}) + add_executable(uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest) target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines}) target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags}) - target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries}) + if(QEMU) + target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries} -static) + else() + target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries}) + endif() add_test(NAME uv_test_a COMMAND uv_run_tests_a WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) @@ -544,3 +575,11 @@ if(WIN32) RUNTIME DESTINATION lib/$ ARCHIVE DESTINATION lib/$) endif() + +message(STATUS "summary of build options: + Install prefix: ${CMAKE_INSTALL_PREFIX} + Target system: ${CMAKE_SYSTEM_NAME} + Compiler: + C compiler: ${CMAKE_C_COMPILER} + CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS} +") diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 3544c6c01b5a31..9b215a5ba0f6b9 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,76 @@ +2020.05.18, Version 1.38.0 (Stable), 1ab9ea3790378f9f25c4e78e9e2b511c75f9c9ed + +Changes since version 1.37.0: + +* test: skip poll_duplex and poll_unidirectional on PASE (Xu Meng) + +* linux: make cpu_times consistently be milliseconds (James Ross) + +* win: DRY uv_poll_start() and uv_poll_stop() (Ben Noordhuis) + +* win: DRY uv_poll_close() (Ben Noordhuis) + +* unix,win: add uv_library_shutdown() (Ben Noordhuis) + +* unix: yield cpu when spinlocking on async handle (Ben Noordhuis) + +* win: remove dep on GetQueuedCompletionStatusEx (Colin Finck) + +* doc: correct source lines (Shohei YOSHIDA) + +* build,android: fix typo (twosee) + +* doc: uv_cancel() handles uv_random_t requests (Philip Chimento) + +* doc: fix unescaped character (Philip Chimento) + +* build,cmake: fix compilation on old MinGW (erw7) + +* build: remove unnessesary MSVC warnings (Bartosz Sosnowski) + +* win: make uv_udp_init_ex() accept UV_UDP_RECVMMSG (Ben Noordhuis) + +* unix: simplify uv__udp_init_ex() (Ben Noordhuis) + +* win: remove MAX_PATH limitations (Bartosz Sosnowski) + +* build, win: add long path aware manifest (Bartosz Sosnowski) + +* doc: check/idle/prepare functions always succeed (Ben Noordhuis) + +* darwin: fix build with non-apple compilers (Ben Noordhuis) + +* win: support environment variables > 32767 chars (Ben Noordhuis) + +* unix: fully initialize struct msghdr (Ben Noordhuis) + +* doc: add uv_replace_allocator thread safety warning (twosee) + +* unix: fix int overflow when copying large files (Michal Artazov) + +* fs: report original error (Bartosz Sosnowski) + +* win, fs: add IO_REPARSE_TAG_APPEXECLINK support (Bartosz Sosnowski) + +* doc: fix formatting (Ben Noordhuis) + +* unix: fix memory leak when uv_loop_init() fails (Anna Henningsen) + +* unix: shrink uv_udp_set_source_membership() stack (Ben Noordhuis) + +* unix,win: fix wrong sizeof argument to memcpy() (Ben Noordhuis) + +* build: check for libraries not provided by libc (Jeroen Roovers) + +* doc: fix the order of arguments to calloc() (MasterDuke17) + +* unix: don't abort when getrlimit() fails (Ben Noordhuis) + +* test: support common user profile on IBMi (Xu Meng) + +* build: test on more platforms via QEMU in CI (gengjiawen) + + 2020.04.20, Version 1.37.0 (Stable), 02a9e1be252b623ee032a3137c0b0c94afbe6809 Changes since version 1.36.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 23fa19dc4fc8e7..d9d2f3d02f52b4 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -409,8 +409,9 @@ uvinclude_HEADERS += include/uv/darwin.h libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1 libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ - src/unix/darwin.c \ src/unix/darwin-proctitle.c \ + src/unix/darwin-stub.h \ + src/unix/darwin.c \ src/unix/fsevents.c \ src/unix/kqueue.c \ src/unix/proctitle.c \ diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index cd7bab08570c8f..6616972ab1b98d 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.37.0], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.38.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) @@ -38,15 +38,17 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_PROG_LIBTOOL m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) LT_INIT -# TODO(bnoordhuis) Check for -pthread vs. -pthreads +AX_PTHREAD([ + LIBS="$LIBS $PTHREAD_LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +]) AC_CHECK_LIB([dl], [dlopen]) -AC_CHECK_LIB([kstat], [kstat_lookup]) -AC_CHECK_LIB([nsl], [gethostbyname]) -AC_CHECK_LIB([perfstat], [perfstat_cpu]) -AC_CHECK_LIB([pthread], [pthread_mutex_init]) -AC_CHECK_LIB([rt], [clock_gettime]) -AC_CHECK_LIB([sendfile], [sendfile]) -AC_CHECK_LIB([socket], [socket]) +AC_SEARCH_LIBS([kstat_lookup], [kstat]) +AC_SEARCH_LIBS([gethostbyname], [nsl]) +AC_SEARCH_LIBS([perfstat_cpu], [perfstat]) +AC_SEARCH_LIBS([clock_gettime], [rt]) +AC_SEARCH_LIBS([sendfile], [sendfile]) +AC_SEARCH_LIBS([socket], [socket]) AC_SYS_LARGEFILE AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])]) AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])]) diff --git a/deps/uv/docs/src/check.rst b/deps/uv/docs/src/check.rst index 36c93cf03d99c0..33aab5516c2649 100644 --- a/deps/uv/docs/src/check.rst +++ b/deps/uv/docs/src/check.rst @@ -33,14 +33,22 @@ API .. c:function:: int uv_check_init(uv_loop_t* loop, uv_check_t* check) - Initialize the handle. + Initialize the handle. This function always succeeds. + + :returns: 0 .. c:function:: int uv_check_start(uv_check_t* check, uv_check_cb cb) - Start the handle with the given callback. + Start the handle with the given callback. This function always succeeds, + except when `cb` is `NULL`. + + :returns: 0 on success, or `UV_EINVAL` when `cb == NULL`. .. c:function:: int uv_check_stop(uv_check_t* check) Stop the handle, the callback will no longer be called. + This function always succeeds. + + :returns: 0 .. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index a475a460307898..73666f3cd87c29 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -492,6 +492,13 @@ API .. versionadded:: 1.19.0 +.. c:function:: int uv_fs_get_system_error(const uv_fs_t* req) + + Returns the platform specific error code - `GetLastError()` value on Windows + and `-(req->result)` on other platforms. + + .. versionadded:: 1.38.0 + .. c:function:: void* uv_fs_get_ptr(const uv_fs_t* req) Returns `req->ptr`. diff --git a/deps/uv/docs/src/idle.rst b/deps/uv/docs/src/idle.rst index 1f51c4a19e4a0b..b7a0507b0de2ac 100644 --- a/deps/uv/docs/src/idle.rst +++ b/deps/uv/docs/src/idle.rst @@ -41,14 +41,22 @@ API .. c:function:: int uv_idle_init(uv_loop_t* loop, uv_idle_t* idle) - Initialize the handle. + Initialize the handle. This function always succeeds. + + :returns: 0 .. c:function:: int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb) - Start the handle with the given callback. + Start the handle with the given callback. This function always succeeds, + except when `cb` is `NULL`. + + :returns: 0 on success, or `UV_EINVAL` when `cb == NULL`. .. c:function:: int uv_idle_stop(uv_idle_t* idle) Stop the handle, the callback will no longer be called. + This function always succeeds. + + :returns: 0 .. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst index 8515cdbc1b040a..906ca8ff75d345 100644 --- a/deps/uv/docs/src/misc.rst +++ b/deps/uv/docs/src/misc.rst @@ -131,11 +131,11 @@ Data types char* model; int speed; struct uv_cpu_times_s { - uint64_t user; - uint64_t nice; - uint64_t sys; - uint64_t idle; - uint64_t irq; + uint64_t user; /* milliseconds */ + uint64_t nice; /* milliseconds */ + uint64_t sys; /* milliseconds */ + uint64_t idle; /* milliseconds */ + uint64_t irq; /* milliseconds */ } cpu_times; } uv_cpu_info_t; @@ -233,6 +233,24 @@ API sure the allocator is changed while no memory was allocated with the previous allocator, or that they are compatible. + .. warning:: Allocator must be thread-safe. + +.. c:function:: void uv_library_shutdown(void); + + .. versionadded:: 1.38.0 + + Release any global state that libuv is holding onto. Libuv will normally + do so automatically when it is unloaded but it can be instructed to perform + cleanup manually. + + .. warning:: Only call :c:func:`uv_library_shutdown()` once. + + .. warning:: Don't call :c:func:`uv_library_shutdown()` when there are + still event loops or I/O requests active. + + .. warning:: Don't call libuv functions after calling + :c:func:`uv_library_shutdown()`. + .. c:function:: uv_buf_t uv_buf_init(char* base, unsigned int len) Constructor for :c:type:`uv_buf_t`. @@ -657,7 +675,7 @@ API .. note:: On IBM i PASE, you are not allowed to change your priority unless you - have the *JOBCTL special authority (even to lower it). + have the \*JOBCTL special authority (even to lower it). .. versionadded:: 1.23.0 diff --git a/deps/uv/docs/src/prepare.rst b/deps/uv/docs/src/prepare.rst index aca58155809cd9..5e0d247660ee14 100644 --- a/deps/uv/docs/src/prepare.rst +++ b/deps/uv/docs/src/prepare.rst @@ -33,14 +33,22 @@ API .. c:function:: int uv_prepare_init(uv_loop_t* loop, uv_prepare_t* prepare) - Initialize the handle. + Initialize the handle. This function always succeeds. + + :returns: 0 .. c:function:: int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb) - Start the handle with the given callback. + Start the handle with the given callback. This function always succeeds, + except when `cb` is `NULL`. + + :returns: 0 on success, or `UV_EINVAL` when `cb == NULL`. .. c:function:: int uv_prepare_stop(uv_prepare_t* prepare) Stop the handle, the callback will no longer be called. + This function always succeeds. + + :returns: 0 .. seealso:: The :c:type:`uv_handle_t` API functions also apply. diff --git a/deps/uv/docs/src/request.rst b/deps/uv/docs/src/request.rst index 56038287b2ae11..5807ccba4a748e 100644 --- a/deps/uv/docs/src/request.rst +++ b/deps/uv/docs/src/request.rst @@ -69,8 +69,8 @@ API Returns 0 on success, or an error code < 0 on failure. Only cancellation of :c:type:`uv_fs_t`, :c:type:`uv_getaddrinfo_t`, - :c:type:`uv_getnameinfo_t` and :c:type:`uv_work_t` requests is - currently supported. + :c:type:`uv_getnameinfo_t`, :c:type:`uv_random_t` and :c:type:`uv_work_t` + requests is currently supported. Cancelled requests have their callbacks invoked some time in the future. It's **not** safe to free the memory associated with the request until the @@ -80,8 +80,9 @@ API * A :c:type:`uv_fs_t` request has its req->result field set to `UV_ECANCELED`. - * A :c:type:`uv_work_t`, :c:type:`uv_getaddrinfo_t` or c:type:`uv_getnameinfo_t` - request has its callback invoked with status == `UV_ECANCELED`. + * A :c:type:`uv_work_t`, :c:type:`uv_getaddrinfo_t`, + :c:type:`uv_getnameinfo_t` or :c:type:`uv_random_t` request has its + callback invoked with status == `UV_ECANCELED`. .. c:function:: size_t uv_req_size(uv_req_type type) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index a3a770db88b90e..fec663136a4ff1 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -265,6 +265,8 @@ typedef void* (*uv_realloc_func)(void* ptr, size_t size); typedef void* (*uv_calloc_func)(size_t count, size_t size); typedef void (*uv_free_func)(void* ptr); +UV_EXTERN void uv_library_shutdown(void); + UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, uv_realloc_func realloc_func, uv_calloc_func calloc_func, @@ -1069,11 +1071,11 @@ UV_EXTERN int uv_cancel(uv_req_t* req); struct uv_cpu_times_s { - uint64_t user; - uint64_t nice; - uint64_t sys; - uint64_t idle; - uint64_t irq; + uint64_t user; /* milliseconds */ + uint64_t nice; /* milliseconds */ + uint64_t sys; /* milliseconds */ + uint64_t idle; /* milliseconds */ + uint64_t irq; /* milliseconds */ }; struct uv_cpu_info_s { @@ -1305,6 +1307,7 @@ struct uv_fs_s { UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*); UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*); +UV_EXTERN int uv_fs_get_system_error(const uv_fs_t*); UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*); UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*); UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*); diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index be97adf6fff794..486658c3933982 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,7 +31,7 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 37 +#define UV_VERSION_MINOR 38 #define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/src/threadpool.c b/deps/uv/src/threadpool.c index a8f433f0510800..0998938f3e0d16 100644 --- a/deps/uv/src/threadpool.c +++ b/deps/uv/src/threadpool.c @@ -160,8 +160,8 @@ static void post(QUEUE* q, enum uv__work_kind kind) { } +void uv__threadpool_cleanup(void) { #ifndef _WIN32 -UV_DESTRUCTOR(static void cleanup(void)) { unsigned int i; if (nthreads == 0) @@ -181,8 +181,8 @@ UV_DESTRUCTOR(static void cleanup(void)) { threads = NULL; nthreads = 0; -} #endif +} static void init_threads(void) { diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c index 417ee5512fa252..6b4594b43e9777 100644 --- a/deps/uv/src/unix/aix.c +++ b/deps/uv/src/unix/aix.c @@ -926,7 +926,7 @@ int uv_get_process_title(char* buffer, size_t size) { } -UV_DESTRUCTOR(static void free_args_mem(void)) { +void uv__process_title_cleanup(void) { uv__free(args_mem); /* Keep valgrind happy. */ args_mem = NULL; } diff --git a/deps/uv/src/unix/async.c b/deps/uv/src/unix/async.c index 26d337e0a44c0e..5f58fb88d628ec 100644 --- a/deps/uv/src/unix/async.c +++ b/deps/uv/src/unix/async.c @@ -32,6 +32,7 @@ #include #include #include +#include /* sched_yield() */ #ifdef __linux__ #include @@ -81,20 +82,32 @@ int uv_async_send(uv_async_t* handle) { /* Only call this from the event loop thread. */ static int uv__async_spin(uv_async_t* handle) { + int i; int rc; for (;;) { - /* rc=0 -- handle is not pending. - * rc=1 -- handle is pending, other thread is still working with it. - * rc=2 -- handle is pending, other thread is done. + /* 997 is not completely chosen at random. It's a prime number, acyclical + * by nature, and should therefore hopefully dampen sympathetic resonance. */ - rc = cmpxchgi(&handle->pending, 2, 0); - - if (rc != 1) - return rc; - - /* Other thread is busy with this handle, spin until it's done. */ - cpu_relax(); + for (i = 0; i < 997; i++) { + /* rc=0 -- handle is not pending. + * rc=1 -- handle is pending, other thread is still working with it. + * rc=2 -- handle is pending, other thread is done. + */ + rc = cmpxchgi(&handle->pending, 2, 0); + + if (rc != 1) + return rc; + + /* Other thread is busy with this handle, spin until it's done. */ + cpu_relax(); + } + + /* Yield the CPU. We may have preempted the other thread while it's + * inside the critical section and if it's running on the same CPU + * as us, we'll just burn CPU cycles until the end of our time slice. + */ + sched_yield(); } } diff --git a/deps/uv/src/unix/bsd-proctitle.c b/deps/uv/src/unix/bsd-proctitle.c index 0ce47c8f64e25d..723b81c01c201f 100644 --- a/deps/uv/src/unix/bsd-proctitle.c +++ b/deps/uv/src/unix/bsd-proctitle.c @@ -37,6 +37,13 @@ static void init_process_title_mutex_once(void) { } +void uv__process_title_cleanup(void) { + /* TODO(bnoordhuis) uv_mutex_destroy(&process_title_mutex) + * and reset process_title_mutex_once? + */ +} + + char** uv_setup_args(int argc, char** argv) { process_title = argc > 0 ? uv__strdup(argv[0]) : NULL; return argv; diff --git a/deps/uv/src/unix/darwin-proctitle.c b/deps/uv/src/unix/darwin-proctitle.c index 2daf3e3474acff..5288083ef04fd7 100644 --- a/deps/uv/src/unix/darwin-proctitle.c +++ b/deps/uv/src/unix/darwin-proctitle.c @@ -30,8 +30,7 @@ #include #if !TARGET_OS_IPHONE -# include -# include +#include "darwin-stub.h" #endif diff --git a/deps/uv/src/unix/darwin-stub.h b/deps/uv/src/unix/darwin-stub.h new file mode 100644 index 00000000000000..b93cf67c596285 --- /dev/null +++ b/deps/uv/src/unix/darwin-stub.h @@ -0,0 +1,97 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_DARWIN_STUB_H_ +#define UV_DARWIN_STUB_H_ + +#include + +struct CFArrayCallBacks; +struct CFRunLoopSourceContext; +struct FSEventStreamContext; + +typedef double CFAbsoluteTime; +typedef double CFTimeInterval; +typedef int FSEventStreamEventFlags; +typedef int OSStatus; +typedef long CFIndex; +typedef struct CFArrayCallBacks CFArrayCallBacks; +typedef struct CFRunLoopSourceContext CFRunLoopSourceContext; +typedef struct FSEventStreamContext FSEventStreamContext; +typedef uint32_t FSEventStreamCreateFlags; +typedef uint64_t FSEventStreamEventId; +typedef unsigned CFStringEncoding; +typedef void* CFAllocatorRef; +typedef void* CFArrayRef; +typedef void* CFBundleRef; +typedef void* CFDictionaryRef; +typedef void* CFRunLoopRef; +typedef void* CFRunLoopSourceRef; +typedef void* CFStringRef; +typedef void* CFTypeRef; +typedef void* FSEventStreamRef; + +typedef void (*FSEventStreamCallback)(const FSEventStreamRef, + void*, + size_t, + void*, + const FSEventStreamEventFlags*, + const FSEventStreamEventId*); + +struct CFRunLoopSourceContext { + CFIndex version; + void* info; + void* pad[7]; + void (*perform)(void*); +}; + +struct FSEventStreamContext { + CFIndex version; + void* info; + void* pad[3]; +}; + +static const CFStringEncoding kCFStringEncodingUTF8 = 0x8000100; +static const OSStatus noErr = 0; + +static const FSEventStreamEventId kFSEventStreamEventIdSinceNow = -1; + +static const int kFSEventStreamCreateFlagNoDefer = 2; +static const int kFSEventStreamCreateFlagFileEvents = 16; + +static const int kFSEventStreamEventFlagEventIdsWrapped = 8; +static const int kFSEventStreamEventFlagHistoryDone = 16; +static const int kFSEventStreamEventFlagItemChangeOwner = 0x4000; +static const int kFSEventStreamEventFlagItemCreated = 0x100; +static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x2000; +static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x400; +static const int kFSEventStreamEventFlagItemIsDir = 0x20000; +static const int kFSEventStreamEventFlagItemModified = 0x1000; +static const int kFSEventStreamEventFlagItemRemoved = 0x200; +static const int kFSEventStreamEventFlagItemRenamed = 0x800; +static const int kFSEventStreamEventFlagItemXattrMod = 0x8000; +static const int kFSEventStreamEventFlagKernelDropped = 4; +static const int kFSEventStreamEventFlagMount = 64; +static const int kFSEventStreamEventFlagRootChanged = 32; +static const int kFSEventStreamEventFlagUnmount = 128; +static const int kFSEventStreamEventFlagUserDropped = 2; + +#endif /* UV_DARWIN_STUB_H_ */ diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index bc7fd8509daa1d..5f5d36ac448a40 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -1110,9 +1110,10 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { int dst_flags; int result; int err; - size_t bytes_to_send; - int64_t in_offset; - ssize_t bytes_written; + off_t bytes_to_send; + off_t in_offset; + off_t bytes_written; + size_t bytes_chunk; dstfd = -1; err = 0; @@ -1211,7 +1212,10 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { bytes_to_send = src_statsbuf.st_size; in_offset = 0; while (bytes_to_send != 0) { - uv_fs_sendfile(NULL, &fs_req, dstfd, srcfd, in_offset, bytes_to_send, NULL); + bytes_chunk = SSIZE_MAX; + if (bytes_to_send < (off_t) bytes_chunk) + bytes_chunk = bytes_to_send; + uv_fs_sendfile(NULL, &fs_req, dstfd, srcfd, in_offset, bytes_chunk, NULL); bytes_written = fs_req.result; uv_fs_req_cleanup(&fs_req); @@ -2082,3 +2086,7 @@ int uv_fs_statfs(uv_loop_t* loop, PATH; POST; } + +int uv_fs_get_system_error(const uv_fs_t* req) { + return -req->result; +} diff --git a/deps/uv/src/unix/fsevents.c b/deps/uv/src/unix/fsevents.c index 448921f813d789..a51f29b3f6db55 100644 --- a/deps/uv/src/unix/fsevents.c +++ b/deps/uv/src/unix/fsevents.c @@ -41,34 +41,33 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) { #else /* TARGET_OS_IPHONE */ +#include "darwin-stub.h" + #include #include #include #include -#include -#include - -/* These are macros to avoid "initializer element is not constant" errors - * with old versions of gcc. - */ -#define kFSEventsModified (kFSEventStreamEventFlagItemFinderInfoMod | \ - kFSEventStreamEventFlagItemModified | \ - kFSEventStreamEventFlagItemInodeMetaMod | \ - kFSEventStreamEventFlagItemChangeOwner | \ - kFSEventStreamEventFlagItemXattrMod) - -#define kFSEventsRenamed (kFSEventStreamEventFlagItemCreated | \ - kFSEventStreamEventFlagItemRemoved | \ - kFSEventStreamEventFlagItemRenamed) - -#define kFSEventsSystem (kFSEventStreamEventFlagUserDropped | \ - kFSEventStreamEventFlagKernelDropped | \ - kFSEventStreamEventFlagEventIdsWrapped | \ - kFSEventStreamEventFlagHistoryDone | \ - kFSEventStreamEventFlagMount | \ - kFSEventStreamEventFlagUnmount | \ - kFSEventStreamEventFlagRootChanged) +static const int kFSEventsModified = + kFSEventStreamEventFlagItemChangeOwner | + kFSEventStreamEventFlagItemFinderInfoMod | + kFSEventStreamEventFlagItemInodeMetaMod | + kFSEventStreamEventFlagItemModified | + kFSEventStreamEventFlagItemXattrMod; + +static const int kFSEventsRenamed = + kFSEventStreamEventFlagItemCreated | + kFSEventStreamEventFlagItemRemoved | + kFSEventStreamEventFlagItemRenamed; + +static const int kFSEventsSystem = + kFSEventStreamEventFlagUserDropped | + kFSEventStreamEventFlagKernelDropped | + kFSEventStreamEventFlagEventIdsWrapped | + kFSEventStreamEventFlagHistoryDone | + kFSEventStreamEventFlagMount | + kFSEventStreamEventFlagUnmount | + kFSEventStreamEventFlagRootChanged; typedef struct uv__fsevents_event_s uv__fsevents_event_t; typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t; @@ -148,7 +147,7 @@ static void (*pFSEventStreamRelease)(FSEventStreamRef); static void (*pFSEventStreamScheduleWithRunLoop)(FSEventStreamRef, CFRunLoopRef, CFStringRef); -static Boolean (*pFSEventStreamStart)(FSEventStreamRef); +static int (*pFSEventStreamStart)(FSEventStreamRef); static void (*pFSEventStreamStop)(FSEventStreamRef); #define UV__FSEVENTS_PROCESS(handle, block) \ @@ -215,7 +214,7 @@ static void uv__fsevents_push_event(uv_fs_event_t* handle, /* Runs in CF thread, when there're events in FSEventStream */ -static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, +static void uv__fsevents_event_cb(const FSEventStreamRef streamRef, void* info, size_t numEvents, void* eventPaths, @@ -340,11 +339,8 @@ static int uv__fsevents_create_stream(uv_loop_t* loop, CFArrayRef paths) { FSEventStreamCreateFlags flags; /* Initialize context */ - ctx.version = 0; + memset(&ctx, 0, sizeof(ctx)); ctx.info = loop; - ctx.retain = NULL; - ctx.release = NULL; - ctx.copyDescription = NULL; latency = 0.05; diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 598554b607ec42..402ee877d076b6 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -106,10 +106,8 @@ int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset); #if defined(__clang__) || \ defined(__GNUC__) || \ defined(__INTEL_COMPILER) -# define UV_DESTRUCTOR(declaration) __attribute__((destructor)) declaration # define UV_UNUSED(declaration) __attribute__((unused)) declaration #else -# define UV_DESTRUCTOR(declaration) declaration # define UV_UNUSED(declaration) declaration #endif diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index f8d9ff5868ab58..99cbb1c8fd7ea4 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -768,7 +768,8 @@ static int read_times(FILE* statfile_fp, unsigned int numcpus, uv_cpu_info_t* ci) { struct uv_cpu_times_s ts; - uint64_t clock_ticks; + unsigned int ticks; + unsigned int multiplier; uint64_t user; uint64_t nice; uint64_t sys; @@ -779,9 +780,10 @@ static int read_times(FILE* statfile_fp, uint64_t len; char buf[1024]; - clock_ticks = sysconf(_SC_CLK_TCK); - assert(clock_ticks != (uint64_t) -1); - assert(clock_ticks != 0); + ticks = (unsigned int)sysconf(_SC_CLK_TCK); + multiplier = ((uint64_t)1000L / ticks); + assert(ticks != (unsigned int) -1); + assert(ticks != 0); rewind(statfile_fp); @@ -823,11 +825,11 @@ static int read_times(FILE* statfile_fp, &irq)) abort(); - ts.user = clock_ticks * user; - ts.nice = clock_ticks * nice; - ts.sys = clock_ticks * sys; - ts.idle = clock_ticks * idle; - ts.irq = clock_ticks * irq; + ts.user = user * multiplier; + ts.nice = nice * multiplier; + ts.sys = sys * multiplier; + ts.idle = idle * multiplier; + ts.irq = irq * multiplier; ci[num++].cpu_times = ts; } assert(num == numcpus); diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c index c2a03d770f3764..e5b2889560a516 100644 --- a/deps/uv/src/unix/loop.c +++ b/deps/uv/src/unix/loop.c @@ -106,6 +106,8 @@ int uv_loop_init(uv_loop_t* loop) { fail_signal_init: uv__platform_loop_delete(loop); + uv__free(loop->watchers); + loop->nwatchers = 0; return err; } diff --git a/deps/uv/src/unix/no-proctitle.c b/deps/uv/src/unix/no-proctitle.c index 165740ca3ff9d5..32aa0af1f92f07 100644 --- a/deps/uv/src/unix/no-proctitle.c +++ b/deps/uv/src/unix/no-proctitle.c @@ -29,6 +29,9 @@ char** uv_setup_args(int argc, char** argv) { return argv; } +void uv__process_title_cleanup(void) { +} + int uv_set_process_title(const char* title) { return 0; } diff --git a/deps/uv/src/unix/proctitle.c b/deps/uv/src/unix/proctitle.c index d124d3c7fcfee0..4ee991fcc32466 100644 --- a/deps/uv/src/unix/proctitle.c +++ b/deps/uv/src/unix/proctitle.c @@ -145,7 +145,7 @@ int uv_get_process_title(char* buffer, size_t size) { } -UV_DESTRUCTOR(static void free_args_mem(void)) { +void uv__process_title_cleanup(void) { uv__free(args_mem); /* Keep valgrind happy. */ args_mem = NULL; } diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c index 1e7e8ac574dfa4..1c83e095bcdead 100644 --- a/deps/uv/src/unix/signal.c +++ b/deps/uv/src/unix/signal.c @@ -77,7 +77,7 @@ static void uv__signal_global_init(void) { } -UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { +void uv__signal_cleanup(void) { /* We can only use signal-safe functions here. * That includes read/write and close, fortunately. * We do all of this directly here instead of resetting @@ -98,7 +98,7 @@ UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { static void uv__signal_global_reinit(void) { - uv__signal_global_fini(); + uv__signal_cleanup(); if (uv__make_pipe(uv__signal_lock_pipefd, 0)) abort(); diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c index f10c351ebba27a..c9a18d1e8d440a 100644 --- a/deps/uv/src/unix/thread.c +++ b/deps/uv/src/unix/thread.c @@ -172,10 +172,11 @@ static size_t thread_stack_size(void) { #if defined(__APPLE__) || defined(__linux__) struct rlimit lim; - if (getrlimit(RLIMIT_STACK, &lim)) - abort(); - - if (lim.rlim_cur != RLIM_INFINITY) { + /* getrlimit() can fail on some aarch64 systems due to a glibc bug where + * the system call wrapper invokes the wrong system call. Don't treat + * that as fatal, just use the default stack size instead. + */ + if (0 == getrlimit(RLIMIT_STACK, &lim) && lim.rlim_cur != RLIM_INFINITY) { /* pthread_attr_setstacksize() expects page-aligned values. */ lim.rlim_cur -= lim.rlim_cur % (rlim_t) getpagesize(); diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c index 3aa11c5beeb4ad..7cf80ef3b9f648 100644 --- a/deps/uv/src/unix/udp.c +++ b/deps/uv/src/unix/udp.c @@ -42,6 +42,11 @@ # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif +union uv__sockaddr { + struct sockaddr_in6 in6; + struct sockaddr_in in; + struct sockaddr addr; +}; static void uv__udp_run_completed(uv_udp_t* handle); static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents); @@ -202,6 +207,9 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) { msgs[k].msg_hdr.msg_iovlen = 1; msgs[k].msg_hdr.msg_name = peers + k; msgs[k].msg_hdr.msg_namelen = sizeof(peers[0]); + msgs[k].msg_hdr.msg_control = NULL; + msgs[k].msg_hdr.msg_controllen = 0; + msgs[k].msg_hdr.msg_flags = 0; } do @@ -564,11 +572,7 @@ int uv__udp_bind(uv_udp_t* handle, static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, int domain, unsigned int flags) { - union { - struct sockaddr_in6 in6; - struct sockaddr_in in; - struct sockaddr addr; - } taddr; + union uv__sockaddr taddr; socklen_t addrlen; if (handle->io_watcher.fd != -1) @@ -921,8 +925,10 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle, mreq.gsr_interface = 0; } - memcpy(&mreq.gsr_group, multicast_addr, sizeof(mreq.gsr_group)); - memcpy(&mreq.gsr_source, source_addr, sizeof(mreq.gsr_source)); + STATIC_ASSERT(sizeof(mreq.gsr_group) >= sizeof(*multicast_addr)); + STATIC_ASSERT(sizeof(mreq.gsr_source) >= sizeof(*source_addr)); + memcpy(&mreq.gsr_group, multicast_addr, sizeof(*multicast_addr)); + memcpy(&mreq.gsr_source, source_addr, sizeof(*source_addr)); if (membership == UV_JOIN_GROUP) optname = MCAST_JOIN_SOURCE_GROUP; @@ -944,29 +950,17 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle, #endif -int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { - int domain; - int err; - int extra_flags; +int uv__udp_init_ex(uv_loop_t* loop, + uv_udp_t* handle, + unsigned flags, + int domain) { int fd; - /* Use the lower 8 bits for the domain */ - domain = flags & 0xFF; - if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) - return UV_EINVAL; - - /* Use the higher bits for extra flags */ - extra_flags = flags & ~0xFF; - if (extra_flags & ~UV_UDP_RECVMMSG) - return UV_EINVAL; - + fd = -1; if (domain != AF_UNSPEC) { - err = uv__socket(domain, SOCK_DGRAM, 0); - if (err < 0) - return err; - fd = err; - } else { - fd = -1; + fd = uv__socket(domain, SOCK_DGRAM, 0); + if (fd < 0) + return fd; } uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP); @@ -978,18 +972,10 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { QUEUE_INIT(&handle->write_queue); QUEUE_INIT(&handle->write_completed_queue); - if (extra_flags & UV_UDP_RECVMMSG) - handle->flags |= UV_HANDLE_UDP_RECVMMSG; - return 0; } -int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { - return uv_udp_init_ex(loop, handle, AF_UNSPEC); -} - - int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { int err; @@ -1047,40 +1033,31 @@ int uv_udp_set_source_membership(uv_udp_t* handle, uv_membership membership) { #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__) int err; - struct sockaddr_storage mcast_addr; - struct sockaddr_in* mcast_addr4; - struct sockaddr_in6* mcast_addr6; - struct sockaddr_storage src_addr; - struct sockaddr_in* src_addr4; - struct sockaddr_in6* src_addr6; - - mcast_addr4 = (struct sockaddr_in*)&mcast_addr; - mcast_addr6 = (struct sockaddr_in6*)&mcast_addr; - src_addr4 = (struct sockaddr_in*)&src_addr; - src_addr6 = (struct sockaddr_in6*)&src_addr; - - err = uv_ip4_addr(multicast_addr, 0, mcast_addr4); + union uv__sockaddr mcast_addr; + union uv__sockaddr src_addr; + + err = uv_ip4_addr(multicast_addr, 0, &mcast_addr.in); if (err) { - err = uv_ip6_addr(multicast_addr, 0, mcast_addr6); + err = uv_ip6_addr(multicast_addr, 0, &mcast_addr.in6); if (err) return err; - err = uv_ip6_addr(source_addr, 0, src_addr6); + err = uv_ip6_addr(source_addr, 0, &src_addr.in6); if (err) return err; return uv__udp_set_source_membership6(handle, - mcast_addr6, + &mcast_addr.in6, interface_addr, - src_addr6, + &src_addr.in6, membership); } - err = uv_ip4_addr(source_addr, 0, src_addr4); + err = uv_ip4_addr(source_addr, 0, &src_addr.in); if (err) return err; return uv__udp_set_source_membership4(handle, - mcast_addr4, + &mcast_addr.in, interface_addr, - src_addr4, + &src_addr.in, membership); #else return UV_ENOSYS; diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 5cb1a8c898f7ae..a25d6aaef7217f 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -293,6 +293,36 @@ int uv_tcp_bind(uv_tcp_t* handle, } +int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned flags) { + unsigned extra_flags; + int domain; + int rc; + + /* Use the lower 8 bits for the domain. */ + domain = flags & 0xFF; + if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) + return UV_EINVAL; + + /* Use the higher bits for extra flags. */ + extra_flags = flags & ~0xFF; + if (extra_flags & ~UV_UDP_RECVMMSG) + return UV_EINVAL; + + rc = uv__udp_init_ex(loop, handle, flags, domain); + + if (rc == 0) + if (extra_flags & UV_UDP_RECVMMSG) + handle->flags |= UV_HANDLE_UDP_RECVMMSG; + + return rc; +} + + +int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { + return uv_udp_init_ex(loop, handle, AF_UNSPEC); +} + + int uv_udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int flags) { @@ -821,3 +851,19 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { uv__free(cpu_infos); } + + +#ifdef __GNUC__ /* Also covers __clang__ and __INTEL_COMPILER. */ +__attribute__((destructor)) +#endif +void uv_library_shutdown(void) { + static int was_shutdown; + + if (was_shutdown) + return; + + uv__process_title_cleanup(); + uv__signal_cleanup(); + uv__threadpool_cleanup(); + was_shutdown = 1; +} diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h index f08fb8ae091e72..0b0f5f86a01a12 100644 --- a/deps/uv/src/uv-common.h +++ b/deps/uv/src/uv-common.h @@ -139,6 +139,11 @@ int uv__tcp_connect(uv_connect_t* req, unsigned int addrlen, uv_connect_cb cb); +int uv__udp_init_ex(uv_loop_t* loop, + uv_udp_t* handle, + unsigned flags, + int domain); + int uv__udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int addrlen, @@ -201,6 +206,10 @@ int uv__next_timeout(const uv_loop_t* loop); void uv__run_timers(uv_loop_t* loop); void uv__timer_close(uv_timer_t* handle); +void uv__process_title_cleanup(void); +void uv__signal_cleanup(void); +void uv__threadpool_cleanup(void); + #define uv__has_active_reqs(loop) \ ((loop)->active_reqs.count > 0) diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c index 6ded90cdcc7f86..9974a115534320 100644 --- a/deps/uv/src/win/core.c +++ b/deps/uv/src/win/core.c @@ -449,12 +449,12 @@ static void uv__poll(uv_loop_t* loop, DWORD timeout) { timeout_time = loop->time + timeout; for (repeat = 0; ; repeat++) { - success = GetQueuedCompletionStatusEx(loop->iocp, - overlappeds, - ARRAY_SIZE(overlappeds), - &count, - timeout, - FALSE); + success = pGetQueuedCompletionStatusEx(loop->iocp, + overlappeds, + ARRAY_SIZE(overlappeds), + &count, + timeout, + FALSE); if (success) { for (i = 0; i < count; i++) { diff --git a/deps/uv/src/win/error.c b/deps/uv/src/win/error.c index 32ac5e596fea82..3ec984c83eb077 100644 --- a/deps/uv/src/win/error.c +++ b/deps/uv/src/win/error.c @@ -72,6 +72,7 @@ int uv_translate_sys_error(int sys_errno) { case ERROR_NOACCESS: return UV_EACCES; case WSAEACCES: return UV_EACCES; case ERROR_ELEVATION_REQUIRED: return UV_EACCES; + case ERROR_CANT_ACCESS_FILE: return UV_EACCES; case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE; case WSAEADDRINUSE: return UV_EADDRINUSE; case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL; diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c index acf8e1107e9786..0126c5ededf376 100644 --- a/deps/uv/src/win/fs-event.c +++ b/deps/uv/src/win/fs-event.c @@ -83,6 +83,7 @@ static void uv_relative_path(const WCHAR* filename, static int uv_split_path(const WCHAR* filename, WCHAR** dir, WCHAR** file) { size_t len, i; + DWORD dir_len; if (filename == NULL) { if (dir != NULL) @@ -97,12 +98,16 @@ static int uv_split_path(const WCHAR* filename, WCHAR** dir, if (i == 0) { if (dir) { - *dir = (WCHAR*)uv__malloc((MAX_PATH + 1) * sizeof(WCHAR)); + dir_len = GetCurrentDirectoryW(0, NULL); + if (dir_len == 0) { + return -1; + } + *dir = (WCHAR*)uv__malloc(dir_len * sizeof(WCHAR)); if (!*dir) { uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); } - if (!GetCurrentDirectoryW(MAX_PATH, *dir)) { + if (!GetCurrentDirectoryW(dir_len, *dir)) { uv__free(*dir); *dir = NULL; return -1; @@ -155,9 +160,11 @@ int uv_fs_event_start(uv_fs_event_t* handle, int name_size, is_path_dir, size; DWORD attr, last_error; WCHAR* dir = NULL, *dir_to_watch, *pathw = NULL; - WCHAR short_path_buffer[MAX_PATH]; + DWORD short_path_buffer_len; + WCHAR *short_path_buffer; WCHAR* short_path, *long_path; + short_path = NULL; if (uv__is_active(handle)) return UV_EINVAL; @@ -230,13 +237,23 @@ int uv_fs_event_start(uv_fs_event_t* handle, */ /* Convert to short path. */ + short_path_buffer = NULL; + short_path_buffer_len = GetShortPathNameW(pathw, NULL, 0); + if (short_path_buffer_len == 0) { + goto short_path_done; + } + short_path_buffer = uv__malloc(short_path_buffer_len * sizeof(WCHAR)); + if (short_path_buffer == NULL) { + goto short_path_done; + } if (GetShortPathNameW(pathw, short_path_buffer, - ARRAY_SIZE(short_path_buffer))) { - short_path = short_path_buffer; - } else { - short_path = NULL; + short_path_buffer_len) == 0) { + uv__free(short_path_buffer); + short_path_buffer = NULL; } +short_path_done: + short_path = short_path_buffer; if (uv_split_path(pathw, &dir, &handle->filew) != 0) { last_error = GetLastError(); @@ -346,6 +363,8 @@ int uv_fs_event_start(uv_fs_event_t* handle, if (uv__is_active(handle)) uv__handle_stop(handle); + uv__free(short_path); + return uv_translate_sys_error(last_error); } diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 834c44a26d44cb..9577bc02d3cf24 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -257,6 +257,7 @@ INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, req->loop = loop; req->flags = 0; req->fs_type = fs_type; + req->sys_errno_ = 0; req->result = 0; req->ptr = NULL; req->path = NULL; @@ -321,6 +322,8 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, WCHAR* w_target; DWORD w_target_len; DWORD bytes; + size_t i; + size_t len; if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, @@ -405,6 +408,38 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, w_target += 4; w_target_len -= 4; + } else if (reparse_data->ReparseTag == IO_REPARSE_TAG_APPEXECLINK) { + /* String #3 in the list has the target filename. */ + if (reparse_data->AppExecLinkReparseBuffer.StringCount < 3) { + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + w_target = reparse_data->AppExecLinkReparseBuffer.StringList; + /* The StringList buffer contains a list of strings separated by "\0", */ + /* with "\0\0" terminating the list. Move to the 3rd string in the list: */ + for (i = 0; i < 2; ++i) { + len = wcslen(w_target); + if (len == 0) { + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + w_target += len + 1; + } + w_target_len = wcslen(w_target); + if (w_target_len == 0) { + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + /* Make sure it is an absolute path. */ + if (!(w_target_len >= 3 && + ((w_target[0] >= L'a' && w_target[0] <= L'z') || + (w_target[0] >= L'A' && w_target[0] <= L'Z')) && + w_target[1] == L':' && + w_target[2] == L'\\')) { + SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); + return -1; + } + } else { /* Reparse tag does not indicate a symlink. */ SetLastError(ERROR_SYMLINK_NOT_SUPPORTED); @@ -2840,7 +2875,8 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, INIT(UV_FS_OPEN); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.info.file_flags = flags; @@ -2865,8 +2901,10 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_cb cb) { INIT(UV_FS_READ); - if (bufs == NULL || nbufs == 0) + if (bufs == NULL || nbufs == 0) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; + } req->file.fd = fd; @@ -2875,8 +2913,10 @@ int uv_fs_read(uv_loop_t* loop, if (nbufs > ARRAY_SIZE(req->fs.info.bufsml)) req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs)); - if (req->fs.info.bufs == NULL) + if (req->fs.info.bufs == NULL) { + SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY); return UV_ENOMEM; + } memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs)); @@ -2894,8 +2934,10 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_cb cb) { INIT(UV_FS_WRITE); - if (bufs == NULL || nbufs == 0) + if (bufs == NULL || nbufs == 0) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; + } req->file.fd = fd; @@ -2904,8 +2946,10 @@ int uv_fs_write(uv_loop_t* loop, if (nbufs > ARRAY_SIZE(req->fs.info.bufsml)) req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs)); - if (req->fs.info.bufs == NULL) + if (req->fs.info.bufs == NULL) { + SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY); return UV_ENOMEM; + } memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs)); @@ -2921,7 +2965,8 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_UNLINK); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -2935,7 +2980,8 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, INIT(UV_FS_MKDIR); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.info.mode = mode; @@ -2951,8 +2997,10 @@ int uv_fs_mkdtemp(uv_loop_t* loop, INIT(UV_FS_MKDTEMP); err = fs__capture_path(req, tpl, NULL, TRUE); - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } POST; } @@ -2966,8 +3014,10 @@ int uv_fs_mkstemp(uv_loop_t* loop, INIT(UV_FS_MKSTEMP); err = fs__capture_path(req, tpl, NULL, TRUE); - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } POST; } @@ -2979,7 +3029,8 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { INIT(UV_FS_RMDIR); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -2993,7 +3044,8 @@ int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, INIT(UV_FS_SCANDIR); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.info.file_flags = flags; @@ -3008,8 +3060,10 @@ int uv_fs_opendir(uv_loop_t* loop, INIT(UV_FS_OPENDIR); err = fs__capture_path(req, path, NULL, cb != NULL); - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } POST; } @@ -3022,6 +3076,7 @@ int uv_fs_readdir(uv_loop_t* loop, if (dir == NULL || dir->dirents == NULL || dir->dir_handle == INVALID_HANDLE_VALUE) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; } @@ -3034,8 +3089,10 @@ int uv_fs_closedir(uv_loop_t* loop, uv_dir_t* dir, uv_fs_cb cb) { INIT(UV_FS_CLOSEDIR); - if (dir == NULL) + if (dir == NULL) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; + } req->ptr = dir; POST; } @@ -3047,7 +3104,8 @@ int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_LINK); err = fs__capture_path(req, path, new_path, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3061,7 +3119,8 @@ int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_SYMLINK); err = fs__capture_path(req, path, new_path, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.info.file_flags = flags; @@ -3076,7 +3135,8 @@ int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_READLINK); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3090,12 +3150,14 @@ int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_REALPATH); if (!path) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; } err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3109,7 +3171,8 @@ int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, INIT(UV_FS_CHOWN); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3130,8 +3193,10 @@ int uv_fs_lchown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, INIT(UV_FS_LCHOWN); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } + POST; } @@ -3142,7 +3207,8 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { INIT(UV_FS_STAT); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3155,7 +3221,8 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { INIT(UV_FS_LSTAT); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3176,7 +3243,8 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, INIT(UV_FS_RENAME); err = fs__capture_path(req, path, new_path, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } POST; @@ -3219,13 +3287,15 @@ int uv_fs_copyfile(uv_loop_t* loop, if (flags & ~(UV_FS_COPYFILE_EXCL | UV_FS_COPYFILE_FICLONE | UV_FS_COPYFILE_FICLONE_FORCE)) { + SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); return UV_EINVAL; } err = fs__capture_path(req, path, new_path, cb != NULL); - - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } req->fs.info.file_flags = flags; POST; @@ -3252,8 +3322,10 @@ int uv_fs_access(uv_loop_t* loop, INIT(UV_FS_ACCESS); err = fs__capture_path(req, path, NULL, cb != NULL); - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } req->fs.info.mode = flags; POST; @@ -3267,7 +3339,8 @@ int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, INIT(UV_FS_CHMOD); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.info.mode = mode; @@ -3291,7 +3364,8 @@ int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, INIT(UV_FS_UTIME); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.time.atime = atime; @@ -3316,7 +3390,8 @@ int uv_fs_lutime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, INIT(UV_FS_LUTIME); err = fs__capture_path(req, path, NULL, cb != NULL); if (err) { - return uv_translate_sys_error(err); + SET_REQ_WIN32_ERROR(req, err); + return req->result; } req->fs.time.atime = atime; @@ -3333,8 +3408,14 @@ int uv_fs_statfs(uv_loop_t* loop, INIT(UV_FS_STATFS); err = fs__capture_path(req, path, NULL, cb != NULL); - if (err) - return uv_translate_sys_error(err); + if (err) { + SET_REQ_WIN32_ERROR(req, err); + return req->result; + } POST; } + +int uv_fs_get_system_error(const uv_fs_t* req) { + return req->sys_errno_; +} diff --git a/deps/uv/src/win/poll.c b/deps/uv/src/win/poll.c index 3c6678600e40cc..87858590c8525a 100644 --- a/deps/uv/src/win/poll.c +++ b/deps/uv/src/win/poll.c @@ -134,32 +134,6 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { } -static int uv__fast_poll_cancel_poll_req(uv_loop_t* loop, uv_poll_t* handle) { - AFD_POLL_INFO afd_poll_info; - int result; - - afd_poll_info.Exclusive = TRUE; - afd_poll_info.NumberOfHandles = 1; - afd_poll_info.Timeout.QuadPart = INT64_MAX; - afd_poll_info.Handles[0].Handle = (HANDLE) handle->socket; - afd_poll_info.Handles[0].Status = 0; - afd_poll_info.Handles[0].Events = AFD_POLL_ALL; - - result = uv_msafd_poll(handle->socket, - &afd_poll_info, - uv__get_afd_poll_info_dummy(), - uv__get_overlapped_dummy()); - - if (result == SOCKET_ERROR) { - DWORD error = WSAGetLastError(); - if (error != WSA_IO_PENDING) - return error; - } - - return 0; -} - - static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, uv_req_t* req) { unsigned char mask_events; @@ -226,44 +200,6 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, } -static int uv__fast_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { - assert(handle->type == UV_POLL); - assert(!(handle->flags & UV_HANDLE_CLOSING)); - assert((events & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT)) == 0); - - handle->events = events; - - if (handle->events != 0) { - uv__handle_start(handle); - } else { - uv__handle_stop(handle); - } - - if ((handle->events & ~(handle->submitted_events_1 | - handle->submitted_events_2)) != 0) { - uv__fast_poll_submit_poll_req(handle->loop, handle); - } - - return 0; -} - - -static int uv__fast_poll_close(uv_loop_t* loop, uv_poll_t* handle) { - handle->events = 0; - uv__handle_closing(handle); - - if (handle->submitted_events_1 == 0 && - handle->submitted_events_2 == 0) { - uv_want_endgame(loop, (uv_handle_t*) handle); - return 0; - } else { - /* Cancel outstanding poll requests by executing another, unique poll - * request that forces the outstanding ones to return. */ - return uv__fast_poll_cancel_poll_req(loop, handle); - } -} - - static SOCKET uv__fast_poll_create_peer_socket(HANDLE iocp, WSAPROTOCOL_INFOW* protocol_info) { SOCKET sock = 0; @@ -469,41 +405,6 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, } -static int uv__slow_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { - assert(handle->type == UV_POLL); - assert(!(handle->flags & UV_HANDLE_CLOSING)); - assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0); - - handle->events = events; - - if (handle->events != 0) { - uv__handle_start(handle); - } else { - uv__handle_stop(handle); - } - - if ((handle->events & - ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { - uv__slow_poll_submit_poll_req(handle->loop, handle); - } - - return 0; -} - - -static int uv__slow_poll_close(uv_loop_t* loop, uv_poll_t* handle) { - handle->events = 0; - uv__handle_closing(handle); - - if (handle->submitted_events_1 == 0 && - handle->submitted_events_2 == 0) { - uv_want_endgame(loop, (uv_handle_t*) handle); - } - - return 0; -} - - int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { return uv_poll_init_socket(loop, handle, (SOCKET) uv__get_osfhandle(fd)); } @@ -582,35 +483,43 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, } -int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb) { - int err; +static int uv__poll_set(uv_poll_t* handle, int events, uv_poll_cb cb) { + int submitted_events; - if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { - err = uv__fast_poll_set(handle->loop, handle, events); - } else { - err = uv__slow_poll_set(handle->loop, handle, events); - } + assert(handle->type == UV_POLL); + assert(!(handle->flags & UV_HANDLE_CLOSING)); + assert((events & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT)) == 0); + + handle->events = events; + handle->poll_cb = cb; - if (err) { - return uv_translate_sys_error(err); + if (handle->events == 0) { + uv__handle_stop(handle); + return 0; } - handle->poll_cb = cb; + uv__handle_start(handle); + submitted_events = handle->submitted_events_1 | handle->submitted_events_2; + + if (handle->events & ~submitted_events) { + if (handle->flags & UV_HANDLE_POLL_SLOW) { + uv__slow_poll_submit_poll_req(handle->loop, handle); + } else { + uv__fast_poll_submit_poll_req(handle->loop, handle); + } + } return 0; } -int uv_poll_stop(uv_poll_t* handle) { - int err; +int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb) { + return uv__poll_set(handle, events, cb); +} - if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { - err = uv__fast_poll_set(handle->loop, handle, 0); - } else { - err = uv__slow_poll_set(handle->loop, handle, 0); - } - return uv_translate_sys_error(err); +int uv_poll_stop(uv_poll_t* handle) { + return uv__poll_set(handle, 0, handle->poll_cb); } @@ -624,11 +533,43 @@ void uv_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, uv_req_t* req) { int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle) { - if (!(handle->flags & UV_HANDLE_POLL_SLOW)) { - return uv__fast_poll_close(loop, handle); - } else { - return uv__slow_poll_close(loop, handle); + AFD_POLL_INFO afd_poll_info; + DWORD error; + int result; + + handle->events = 0; + uv__handle_closing(handle); + + if (handle->submitted_events_1 == 0 && + handle->submitted_events_2 == 0) { + uv_want_endgame(loop, (uv_handle_t*) handle); + return 0; + } + + if (handle->flags & UV_HANDLE_POLL_SLOW) + return 0; + + /* Cancel outstanding poll requests by executing another, unique poll + * request that forces the outstanding ones to return. */ + afd_poll_info.Exclusive = TRUE; + afd_poll_info.NumberOfHandles = 1; + afd_poll_info.Timeout.QuadPart = INT64_MAX; + afd_poll_info.Handles[0].Handle = (HANDLE) handle->socket; + afd_poll_info.Handles[0].Status = 0; + afd_poll_info.Handles[0].Events = AFD_POLL_ALL; + + result = uv_msafd_poll(handle->socket, + &afd_poll_info, + uv__get_afd_poll_info_dummy(), + uv__get_overlapped_dummy()); + + if (result == SOCKET_ERROR) { + error = WSAGetLastError(); + if (error != WSA_IO_PENDING) + return uv_translate_sys_error(error); } + + return 0; } diff --git a/deps/uv/src/win/signal.c b/deps/uv/src/win/signal.c index 276dc609733320..3d9f92cfb17017 100644 --- a/deps/uv/src/win/signal.c +++ b/deps/uv/src/win/signal.c @@ -46,6 +46,11 @@ void uv_signals_init(void) { } +void uv__signal_cleanup(void) { + /* TODO(bnoordhuis) Undo effects of uv_signal_init()? */ +} + + static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) { /* Compare signums first so all watchers with the same signnum end up * adjacent. */ diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c index 3daa55f62db063..1c4977af968a46 100644 --- a/deps/uv/src/win/udp.c +++ b/deps/uv/src/win/udp.c @@ -125,17 +125,10 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, } -int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { - int domain; - - /* Use the lower 8 bits for the domain */ - domain = flags & 0xFF; - if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) - return UV_EINVAL; - - if (flags & ~0xFF) - return UV_EINVAL; - +int uv__udp_init_ex(uv_loop_t* loop, + uv_udp_t* handle, + unsigned flags, + int domain) { uv__handle_init(loop, (uv_handle_t*) handle, UV_UDP); handle->socket = INVALID_SOCKET; handle->reqs_pending = 0; @@ -174,11 +167,6 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { } -int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { - return uv_udp_init_ex(loop, handle, AF_UNSPEC); -} - - void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle) { uv_udp_recv_stop(handle); closesocket(handle->socket); @@ -786,8 +774,10 @@ int uv__udp_set_source_membership6(uv_udp_t* handle, mreq.gsr_interface = 0; } - memcpy(&mreq.gsr_group, multicast_addr, sizeof(mreq.gsr_group)); - memcpy(&mreq.gsr_source, source_addr, sizeof(mreq.gsr_source)); + STATIC_ASSERT(sizeof(mreq.gsr_group) >= sizeof(*multicast_addr)); + STATIC_ASSERT(sizeof(mreq.gsr_source) >= sizeof(*source_addr)); + memcpy(&mreq.gsr_group, multicast_addr, sizeof(*multicast_addr)); + memcpy(&mreq.gsr_source, source_addr, sizeof(*source_addr)); if (membership == UV_JOIN_GROUP) optname = MCAST_JOIN_SOURCE_GROUP; diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index aaa7ba0325b0e5..9e1e7f73e3168b 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -60,9 +60,6 @@ #endif -/* Maximum environment variable size, including the terminating null */ -#define MAX_ENV_VAR_LENGTH 32767 - /* A RtlGenRandom() by any other name... */ extern BOOLEAN NTAPI SystemFunction036(PVOID Buffer, ULONG BufferLength); @@ -154,20 +151,26 @@ int uv_exepath(char* buffer, size_t* size_ptr) { int uv_cwd(char* buffer, size_t* size) { DWORD utf16_len; - WCHAR utf16_buffer[MAX_PATH]; + WCHAR *utf16_buffer; int r; if (buffer == NULL || size == NULL) { return UV_EINVAL; } - utf16_len = GetCurrentDirectoryW(MAX_PATH, utf16_buffer); + utf16_len = GetCurrentDirectoryW(0, NULL); if (utf16_len == 0) { return uv_translate_sys_error(GetLastError()); - } else if (utf16_len > MAX_PATH) { - /* This should be impossible; however the CRT has a code path to deal with - * this scenario, so I added a check anyway. */ - return UV_EIO; + } + utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR)); + if (utf16_buffer == NULL) { + return UV_ENOMEM; + } + + utf16_len = GetCurrentDirectoryW(utf16_len, utf16_buffer); + if (utf16_len == 0) { + uv__free(utf16_buffer); + return uv_translate_sys_error(GetLastError()); } /* utf16_len contains the length, *not* including the terminating null. */ @@ -191,8 +194,10 @@ int uv_cwd(char* buffer, size_t* size) { NULL, NULL); if (r == 0) { + uv__free(utf16_buffer); return uv_translate_sys_error(GetLastError()); } else if (r > (int) *size) { + uv__free(utf16_buffer); *size = r; return UV_ENOBUFS; } @@ -206,6 +211,8 @@ int uv_cwd(char* buffer, size_t* size) { *size > INT_MAX ? INT_MAX : (int) *size, NULL, NULL); + uv__free(utf16_buffer); + if (r == 0) { return uv_translate_sys_error(GetLastError()); } @@ -216,43 +223,61 @@ int uv_cwd(char* buffer, size_t* size) { int uv_chdir(const char* dir) { - WCHAR utf16_buffer[MAX_PATH]; - size_t utf16_len; + WCHAR *utf16_buffer; + size_t utf16_len, new_utf16_len; WCHAR drive_letter, env_var[4]; if (dir == NULL) { return UV_EINVAL; } + utf16_len = MultiByteToWideChar(CP_UTF8, + 0, + dir, + -1, + NULL, + 0); + if (utf16_len == 0) { + return uv_translate_sys_error(GetLastError()); + } + utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR)); + if (utf16_buffer == NULL) { + return UV_ENOMEM; + } + if (MultiByteToWideChar(CP_UTF8, 0, dir, -1, utf16_buffer, - MAX_PATH) == 0) { - DWORD error = GetLastError(); - /* The maximum length of the current working directory is 260 chars, - * including terminating null. If it doesn't fit, the path name must be too - * long. */ - if (error == ERROR_INSUFFICIENT_BUFFER) { - return UV_ENAMETOOLONG; - } else { - return uv_translate_sys_error(error); - } + utf16_len) == 0) { + uv__free(utf16_buffer); + return uv_translate_sys_error(GetLastError()); } if (!SetCurrentDirectoryW(utf16_buffer)) { + uv__free(utf16_buffer); return uv_translate_sys_error(GetLastError()); } /* Windows stores the drive-local path in an "hidden" environment variable, * which has the form "=C:=C:\Windows". SetCurrentDirectory does not update * this, so we'll have to do it. */ - utf16_len = GetCurrentDirectoryW(MAX_PATH, utf16_buffer); + new_utf16_len = GetCurrentDirectoryW(utf16_len, utf16_buffer); + if (new_utf16_len > utf16_len ) { + uv__free(utf16_buffer); + utf16_buffer = uv__malloc(new_utf16_len * sizeof(WCHAR)); + if (utf16_buffer == NULL) { + /* When updating the environment variable fails, return UV_OK anyway. + * We did successfully change current working directory, only updating + * hidden env variable failed. */ + return 0; + } + new_utf16_len = GetCurrentDirectoryW(new_utf16_len, utf16_buffer); + } if (utf16_len == 0) { - return uv_translate_sys_error(GetLastError()); - } else if (utf16_len > MAX_PATH) { - return UV_EIO; + uv__free(utf16_buffer); + return 0; } /* The returned directory should not have a trailing slash, unless it points @@ -284,11 +309,10 @@ int uv_chdir(const char* dir) { env_var[2] = L':'; env_var[3] = L'\0'; - if (!SetEnvironmentVariableW(env_var, utf16_buffer)) { - return uv_translate_sys_error(GetLastError()); - } + SetEnvironmentVariableW(env_var, utf16_buffer); } + uv__free(utf16_buffer); return 0; } @@ -361,6 +385,10 @@ char** uv_setup_args(int argc, char** argv) { } +void uv__process_title_cleanup(void) { +} + + int uv_set_process_title(const char* title) { int err; int length; @@ -1163,20 +1191,29 @@ int uv_os_homedir(char* buffer, size_t* size) { int uv_os_tmpdir(char* buffer, size_t* size) { - wchar_t path[MAX_PATH + 2]; + wchar_t *path; DWORD bufsize; size_t len; if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL; - len = GetTempPathW(ARRAY_SIZE(path), path); + len = 0; + len = GetTempPathW(0, NULL); + if (len == 0) { + return uv_translate_sys_error(GetLastError()); + } + /* Include space for terminating null char. */ + len += 1; + path = uv__malloc(len * sizeof(wchar_t)); + if (path == NULL) { + return UV_ENOMEM; + } + len = GetTempPathW(len, path); if (len == 0) { + uv__free(path); return uv_translate_sys_error(GetLastError()); - } else if (len > ARRAY_SIZE(path)) { - /* This should not be possible */ - return UV_EIO; } /* The returned directory should not have a trailing slash, unless it points @@ -1191,8 +1228,10 @@ int uv_os_tmpdir(char* buffer, size_t* size) { bufsize = WideCharToMultiByte(CP_UTF8, 0, path, -1, NULL, 0, NULL, NULL); if (bufsize == 0) { + uv__free(path); return uv_translate_sys_error(GetLastError()); } else if (bufsize > *size) { + uv__free(path); *size = bufsize; return UV_ENOBUFS; } @@ -1206,6 +1245,7 @@ int uv_os_tmpdir(char* buffer, size_t* size) { *size, NULL, NULL); + uv__free(path); if (bufsize == 0) return uv_translate_sys_error(GetLastError()); @@ -1325,7 +1365,7 @@ int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16) { int uv__getpwuid_r(uv_passwd_t* pwd) { HANDLE token; wchar_t username[UNLEN + 1]; - wchar_t path[MAX_PATH]; + wchar_t *path; DWORD bufsize; int r; @@ -1336,15 +1376,24 @@ int uv__getpwuid_r(uv_passwd_t* pwd) { if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token) == 0) return uv_translate_sys_error(GetLastError()); - bufsize = ARRAY_SIZE(path); - if (!GetUserProfileDirectoryW(token, path, &bufsize)) { + bufsize = 0; + GetUserProfileDirectoryW(token, NULL, &bufsize); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { r = GetLastError(); CloseHandle(token); + return uv_translate_sys_error(r); + } - /* This should not be possible */ - if (r == ERROR_INSUFFICIENT_BUFFER) - return UV_ENOMEM; + path = uv__malloc(bufsize * sizeof(wchar_t)); + if (path == NULL) { + CloseHandle(token); + return UV_ENOMEM; + } + if (!GetUserProfileDirectoryW(token, path, &bufsize)) { + r = GetLastError(); + CloseHandle(token); + uv__free(path); return uv_translate_sys_error(r); } @@ -1354,6 +1403,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) { bufsize = ARRAY_SIZE(username); if (!GetUserNameW(username, &bufsize)) { r = GetLastError(); + uv__free(path); /* This should not be possible */ if (r == ERROR_INSUFFICIENT_BUFFER) @@ -1364,6 +1414,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) { pwd->homedir = NULL; r = uv__convert_utf16_to_utf8(path, -1, &pwd->homedir); + uv__free(path); if (r != 0) return r; @@ -1461,7 +1512,9 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) { int uv_os_getenv(const char* name, char* buffer, size_t* size) { - wchar_t var[MAX_ENV_VAR_LENGTH]; + wchar_t fastvar[512]; + wchar_t* var; + DWORD varlen; wchar_t* name_w; DWORD bufsize; size_t len; @@ -1475,25 +1528,52 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) { if (r != 0) return r; - SetLastError(ERROR_SUCCESS); - len = GetEnvironmentVariableW(name_w, var, MAX_ENV_VAR_LENGTH); + var = fastvar; + varlen = ARRAY_SIZE(fastvar); + + for (;;) { + SetLastError(ERROR_SUCCESS); + len = GetEnvironmentVariableW(name_w, var, varlen); + + if (len < varlen) + break; + + /* Try repeatedly because we might have been preempted by another thread + * modifying the environment variable just as we're trying to read it. + */ + if (var != fastvar) + uv__free(var); + + varlen = 1 + len; + var = uv__malloc(varlen * sizeof(*var)); + + if (var == NULL) { + r = UV_ENOMEM; + goto fail; + } + } + uv__free(name_w); - assert(len < MAX_ENV_VAR_LENGTH); /* len does not include the null */ + name_w = NULL; if (len == 0) { r = GetLastError(); - if (r != ERROR_SUCCESS) - return uv_translate_sys_error(r); + if (r != ERROR_SUCCESS) { + r = uv_translate_sys_error(r); + goto fail; + } } /* Check how much space we need */ bufsize = WideCharToMultiByte(CP_UTF8, 0, var, -1, NULL, 0, NULL, NULL); if (bufsize == 0) { - return uv_translate_sys_error(GetLastError()); + r = uv_translate_sys_error(GetLastError()); + goto fail; } else if (bufsize > *size) { *size = bufsize; - return UV_ENOBUFS; + r = UV_ENOBUFS; + goto fail; } /* Convert to UTF-8 */ @@ -1506,11 +1586,23 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) { NULL, NULL); - if (bufsize == 0) - return uv_translate_sys_error(GetLastError()); + if (bufsize == 0) { + r = uv_translate_sys_error(GetLastError()); + goto fail; + } *size = bufsize - 1; - return 0; + r = 0; + +fail: + + if (name_w != NULL) + uv__free(name_w); + + if (var != fastvar) + uv__free(var); + + return r; } diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h index 322a212dd73c19..cbe1437a42e6bd 100644 --- a/deps/uv/src/win/winapi.h +++ b/deps/uv/src/win/winapi.h @@ -4152,6 +4152,10 @@ typedef const UNICODE_STRING *PCUNICODE_STRING; struct { UCHAR DataBuffer[1]; } GenericReparseBuffer; + struct { + ULONG StringCount; + WCHAR StringList[1]; + } AppExecLinkReparseBuffer; }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; #endif @@ -4517,6 +4521,9 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { #ifndef IO_REPARSE_TAG_SYMLINK # define IO_REPARSE_TAG_SYMLINK (0xA000000CL) #endif +#ifndef IO_REPARSE_TAG_APPEXECLINK +# define IO_REPARSE_TAG_APPEXECLINK (0x8000001BL) +#endif typedef VOID (NTAPI *PIO_APC_ROUTINE) (PVOID ApcContext, diff --git a/deps/uv/test/task.h b/deps/uv/test/task.h index 27b731032e10b3..e95e3bde5a7e3e 100644 --- a/deps/uv/test/task.h +++ b/deps/uv/test/task.h @@ -230,6 +230,7 @@ typedef enum { do { \ close_loop(uv_default_loop()); \ ASSERT(0 == uv_loop_close(uv_default_loop())); \ + uv_library_shutdown(); \ } while (0) /* Just sugar for wrapping the main() for a task or helper. */ diff --git a/deps/uv/test/test-connection-fail.c b/deps/uv/test/test-connection-fail.c index 8338cacdec3c5f..5904810252995f 100644 --- a/deps/uv/test/test-connection-fail.c +++ b/deps/uv/test/test-connection-fail.c @@ -120,6 +120,11 @@ static void connection_fail(uv_connect_cb connect_cb) { * expect an error. */ TEST_IMPL(connection_fail) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + connection_fail(on_connect_with_close); ASSERT(timer_close_cb_calls == 0); @@ -136,6 +141,11 @@ TEST_IMPL(connection_fail) { * attempt. */ TEST_IMPL(connection_fail_doesnt_auto_close) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; r = uv_timer_init(uv_default_loop(), &timer); diff --git a/deps/uv/test/test-env-vars.c b/deps/uv/test/test-env-vars.c index f61c1c6c115cae..ecaba337ca1088 100644 --- a/deps/uv/test/test-env-vars.c +++ b/deps/uv/test/test-env-vars.c @@ -142,5 +142,29 @@ TEST_IMPL(env_vars) { r = uv_os_unsetenv(name2); ASSERT(r == 0); + for (i = 1; i <= 4; i++) { + size_t n; + char* p; + + n = i * 32768; + size = n + 1; + + p = malloc(size); + ASSERT_NOT_NULL(p); + + memset(p, 'x', n); + p[n] = '\0'; + + ASSERT_EQ(0, uv_os_setenv(name, p)); + ASSERT_EQ(0, uv_os_getenv(name, p, &size)); + ASSERT_EQ(n, size); + + for (n = 0; n < size; n++) + ASSERT_EQ('x', p[n]); + + ASSERT_EQ(0, uv_os_unsetenv(name)); + free(p); + } + return 0; } diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 2966a53b79d349..ae9923a9a16ec3 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -315,7 +315,7 @@ static void chown_root_cb(uv_fs_t* req) { * User may grant qsecofr's privileges, including changing * the file's ownership to uid 0. */ - ASSERT(req->result == 0); + ASSERT(req->result == 0 || req->result == UV_EPERM); # else ASSERT(req->result == UV_EPERM); # endif @@ -2453,6 +2453,57 @@ TEST_IMPL(fs_non_symlink_reparse_point) { MAKE_VALGRIND_HAPPY(); return 0; } + +TEST_IMPL(fs_lstat_windows_store_apps) { + uv_loop_t* loop; + char localappdata[MAX_PATH]; + char windowsapps_path[MAX_PATH]; + char file_path[MAX_PATH]; + size_t len; + int r; + uv_fs_t req; + uv_fs_t stat_req; + uv_dirent_t dirent; + + loop = uv_default_loop(); + ASSERT_NOT_NULL(loop); + len = sizeof(localappdata); + r = uv_os_getenv("LOCALAPPDATA", localappdata, &len); + if (r == UV_ENOENT) { + MAKE_VALGRIND_HAPPY(); + return TEST_SKIP; + } + ASSERT_EQ(r, 0); + r = snprintf(windowsapps_path, + sizeof(localappdata), + "%s\\Microsoft\\WindowsApps", + localappdata); + ASSERT_GT(r, 0); + if (uv_fs_opendir(loop, &req, windowsapps_path, NULL) != 0) { + /* If we cannot read the directory, skip the test. */ + MAKE_VALGRIND_HAPPY(); + return TEST_SKIP; + } + if (uv_fs_scandir(loop, &req, windowsapps_path, 0, NULL) <= 0) { + MAKE_VALGRIND_HAPPY(); + return TEST_SKIP; + } + while (uv_fs_scandir_next(&req, &dirent) != UV_EOF) { + if (dirent.type != UV_DIRENT_LINK) { + continue; + } + if (snprintf(file_path, + sizeof(file_path), + "%s\\%s", + windowsapps_path, + dirent.name) < 0) { + continue; + } + ASSERT_EQ(uv_fs_lstat(loop, &stat_req, file_path, NULL), 0); + } + MAKE_VALGRIND_HAPPY(); + return 0; +} #endif @@ -4347,3 +4398,21 @@ TEST_IMPL(fs_statfs) { return 0; } + +TEST_IMPL(fs_get_system_error) { + uv_fs_t req; + int r; + int system_error; + + r = uv_fs_statfs(NULL, &req, "non_existing_file", NULL); + ASSERT(r != 0); + + system_error = uv_fs_get_system_error(&req); +#ifdef _WIN32 + ASSERT(system_error == ERROR_FILE_NOT_FOUND); +#else + ASSERT(system_error == ENOENT); +#endif + + return 0; +} diff --git a/deps/uv/test/test-get-currentexe.c b/deps/uv/test/test-get-currentexe.c index 8c730334c205b3..5e4a083f3060b7 100644 --- a/deps/uv/test/test-get-currentexe.c +++ b/deps/uv/test/test-get-currentexe.c @@ -31,6 +31,11 @@ extern char executable_path[]; TEST_IMPL(get_currentexe) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + char buffer[PATHMAX]; char path[PATHMAX]; size_t size; diff --git a/deps/uv/test/test-get-passwd.c b/deps/uv/test/test-get-passwd.c index 9b5273b315db6f..abe8be36a332b5 100644 --- a/deps/uv/test/test-get-passwd.c +++ b/deps/uv/test/test-get-passwd.c @@ -24,6 +24,11 @@ #include TEST_IMPL(get_passwd) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + uv_passwd_t pwd; size_t len; int r; diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c index 03dc126956162c..f2b4e03cd74cdb 100644 --- a/deps/uv/test/test-getaddrinfo.c +++ b/deps/uv/test/test-getaddrinfo.c @@ -106,6 +106,10 @@ TEST_IMPL(getaddrinfo_fail) { TEST_IMPL(getaddrinfo_fail_sync) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif uv_getaddrinfo_t req; /* Use a FQDN by ending in a period */ @@ -144,6 +148,10 @@ TEST_IMPL(getaddrinfo_basic) { TEST_IMPL(getaddrinfo_basic_sync) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif uv_getaddrinfo_t req; ASSERT(0 == uv_getaddrinfo(uv_default_loop(), diff --git a/deps/uv/test/test-getnameinfo.c b/deps/uv/test/test-getnameinfo.c index b1391616d13e54..3767ffd9aea5de 100644 --- a/deps/uv/test/test-getnameinfo.c +++ b/deps/uv/test/test-getnameinfo.c @@ -66,6 +66,11 @@ TEST_IMPL(getnameinfo_basic_ip4) { TEST_IMPL(getnameinfo_basic_ip4_sync) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + ASSERT(0 == uv_ip4_addr(address_ip4, port, &addr4)); ASSERT(0 == uv_getnameinfo(uv_default_loop(), diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index eb6665716f0718..24a8a657489a4e 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -346,6 +346,7 @@ TEST_DECLARE (fs_symlink_dir) #ifdef _WIN32 TEST_DECLARE (fs_symlink_junction) TEST_DECLARE (fs_non_symlink_reparse_point) +TEST_DECLARE (fs_lstat_windows_store_apps) TEST_DECLARE (fs_open_flags) #endif #if defined(_WIN32) && !defined(USING_UV_SHARED) @@ -409,6 +410,7 @@ TEST_DECLARE (fs_open_readonly_acl) TEST_DECLARE (fs_fchmod_archive_readonly) TEST_DECLARE (fs_invalid_mkdir_name) #endif +TEST_DECLARE (fs_get_system_error) TEST_DECLARE (strscpy) TEST_DECLARE (threadpool_queue_work_simple) TEST_DECLARE (threadpool_queue_work_einval) @@ -978,6 +980,7 @@ TASK_LIST_START #ifdef _WIN32 TEST_ENTRY (fs_symlink_junction) TEST_ENTRY (fs_non_symlink_reparse_point) + TEST_ENTRY (fs_lstat_windows_store_apps) TEST_ENTRY (fs_open_flags) #endif #if defined(_WIN32) && !defined(USING_UV_SHARED) @@ -1036,6 +1039,7 @@ TASK_LIST_START TEST_ENTRY (fs_fchmod_archive_readonly) TEST_ENTRY (fs_invalid_mkdir_name) #endif + TEST_ENTRY (fs_get_system_error) TEST_ENTRY (get_osfhandle_valid_handle) TEST_ENTRY (open_osfhandle_valid_handle) TEST_ENTRY (strscpy) diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c index 65cfa1b3dcd4c4..f547ddfd7696ff 100644 --- a/deps/uv/test/test-platform-output.c +++ b/deps/uv/test/test-platform-output.c @@ -25,6 +25,11 @@ TEST_IMPL(platform_output) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + char buffer[512]; size_t rss; size_t size; diff --git a/deps/uv/test/test-poll.c b/deps/uv/test/test-poll.c index b3308446f1d81f..edd75d38266768 100644 --- a/deps/uv/test/test-poll.c +++ b/deps/uv/test/test-poll.c @@ -592,10 +592,19 @@ static void start_poll_test(void) { MAKE_VALGRIND_HAPPY(); } - + +/* Issuing a shutdown() on IBM i PASE with parameter SHUT_WR + * also sends a normal close sequence to the partner program. + * This leads to timing issues and ECONNRESET failures in the + * test 'poll_duplex' and 'poll_unidirectional'. + * + * https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/apis/shutdn.htm + */ TEST_IMPL(poll_duplex) { #if defined(NO_SELF_CONNECT) RETURN_SKIP(NO_SELF_CONNECT); +#elif defined(__PASE__) + RETURN_SKIP("API shutdown() may lead to timing issue on IBM i PASE"); #endif test_mode = DUPLEX; start_poll_test(); @@ -606,6 +615,8 @@ TEST_IMPL(poll_duplex) { TEST_IMPL(poll_unidirectional) { #if defined(NO_SELF_CONNECT) RETURN_SKIP(NO_SELF_CONNECT); +#elif defined(__PASE__) + RETURN_SKIP("API shutdown() may lead to timing issue on IBM i PASE"); #endif test_mode = UNIDIRECTIONAL; start_poll_test(); diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index 314a3562b02034..5e1c6d613003c0 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -1452,7 +1452,7 @@ TEST_IMPL(spawn_setuid_fails) { options.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; r = uv_spawn(uv_default_loop(), &process, &options); -#if defined(__CYGWIN__) || defined(__PASE__) +#if defined(__CYGWIN__) ASSERT(r == UV_EINVAL); #else ASSERT(r == UV_EPERM); @@ -1497,7 +1497,7 @@ TEST_IMPL(spawn_setgid_fails) { #endif r = uv_spawn(uv_default_loop(), &process, &options); -#if defined(__CYGWIN__) || defined(__MVS__) || defined(__PASE__) +#if defined(__CYGWIN__) || defined(__MVS__) ASSERT(r == UV_EINVAL); #else ASSERT(r == UV_EPERM); @@ -1689,7 +1689,7 @@ TEST_IMPL(spawn_reads_child_path) { */ #if defined(__APPLE__) static const char dyld_path_var[] = "DYLD_LIBRARY_PATH"; -#elif defined __MVS__ +#elif defined(__MVS__) || defined(__PASE__) static const char dyld_path_var[] = "LIBPATH"; #else static const char dyld_path_var[] = "LD_LIBRARY_PATH"; diff --git a/deps/uv/test/test-tcp-write-after-connect.c b/deps/uv/test/test-tcp-write-after-connect.c index 8198e7e184d5e4..8a698f44bd5db5 100644 --- a/deps/uv/test/test-tcp-write-after-connect.c +++ b/deps/uv/test/test-tcp-write-after-connect.c @@ -43,6 +43,11 @@ static void connect_cb(uv_connect_t *req, int status) { TEST_IMPL(tcp_write_after_connect) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + struct sockaddr_in sa; ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &sa)); ASSERT(0 == uv_loop_init(&loop)); diff --git a/deps/uv/test/test-thread.c b/deps/uv/test/test-thread.c index ffb392ceebc764..f53bce0601cea9 100644 --- a/deps/uv/test/test-thread.c +++ b/deps/uv/test/test-thread.c @@ -78,6 +78,10 @@ static void getaddrinfo_do(struct getaddrinfo_req* req) { static void getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, struct addrinfo* res) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif struct getaddrinfo_req* req; ASSERT(status == 0); diff --git a/deps/uv/test/test-udp-multicast-interface.c b/deps/uv/test/test-udp-multicast-interface.c index 0b3c0e62da559f..9d36098d0d0ac2 100644 --- a/deps/uv/test/test-udp-multicast-interface.c +++ b/deps/uv/test/test-udp-multicast-interface.c @@ -54,6 +54,11 @@ static void sv_send_cb(uv_udp_send_t* req, int status) { TEST_IMPL(udp_multicast_interface) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; uv_udp_send_t req; uv_buf_t buf; diff --git a/deps/uv/test/test-udp-multicast-interface6.c b/deps/uv/test/test-udp-multicast-interface6.c index 40b05536dc7430..23a68a00f85625 100644 --- a/deps/uv/test/test-udp-multicast-interface6.c +++ b/deps/uv/test/test-udp-multicast-interface6.c @@ -54,6 +54,11 @@ static void sv_send_cb(uv_udp_send_t* req, int status) { TEST_IMPL(udp_multicast_interface6) { +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif + int r; uv_udp_send_t req; uv_buf_t buf; diff --git a/deps/uv/test/test-udp-multicast-join6.c b/deps/uv/test/test-udp-multicast-join6.c index 5de27a7fb292db..40aa577d0a1b12 100644 --- a/deps/uv/test/test-udp-multicast-join6.c +++ b/deps/uv/test/test-udp-multicast-join6.c @@ -193,6 +193,10 @@ TEST_IMPL(udp_multicast_join6) { ASSERT(r == 0); +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif r = uv_udp_recv_start(&server, alloc_cb, cl_recv_cb); ASSERT(r == 0); diff --git a/deps/uv/test/test-udp-options.c b/deps/uv/test/test-udp-options.c index d8c9d68d81b428..3ea51baf40b736 100644 --- a/deps/uv/test/test-udp-options.c +++ b/deps/uv/test/test-udp-options.c @@ -128,12 +128,16 @@ TEST_IMPL(udp_no_autobind) { ASSERT(UV_EBADF == uv_udp_set_ttl(&h, 1)); #endif ASSERT(UV_EBADF == uv_udp_set_multicast_loop(&h, 1)); +/* TODO(gengjiawen): Fix test on QEMU. */ +#if defined(__QEMU__) + RETURN_SKIP("Test does not currently work in QEMU"); +#endif ASSERT(UV_EBADF == uv_udp_set_multicast_interface(&h, "0.0.0.0")); uv_close((uv_handle_t*) &h, NULL); /* Test a non-lazily initialized socket. */ - ASSERT(0 == uv_udp_init_ex(loop, &h2, AF_INET)); + ASSERT(0 == uv_udp_init_ex(loop, &h2, AF_INET | UV_UDP_RECVMMSG)); ASSERT(0 == uv_udp_set_multicast_ttl(&h2, 32)); ASSERT(0 == uv_udp_set_broadcast(&h2, 1)); diff --git a/deps/uv/uv_win_longpath.manifest b/deps/uv/uv_win_longpath.manifest new file mode 100644 index 00000000000000..8976e6dfca7657 --- /dev/null +++ b/deps/uv/uv_win_longpath.manifest @@ -0,0 +1,8 @@ + + + + + true + + + diff --git a/deps/uvwasi/include/uvwasi.h b/deps/uvwasi/include/uvwasi.h index f2d2d1a9fd8945..0090313c8af2eb 100644 --- a/deps/uvwasi/include/uvwasi.h +++ b/deps/uvwasi/include/uvwasi.h @@ -5,13 +5,12 @@ extern "C" { #endif -#include "uv.h" +#include "wasi_serdes.h" #include "wasi_types.h" -#include "fd_table.h" #define UVWASI_VERSION_MAJOR 0 #define UVWASI_VERSION_MINOR 0 -#define UVWASI_VERSION_PATCH 8 +#define UVWASI_VERSION_PATCH 9 #define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \ (UVWASI_VERSION_MINOR << 8) | \ (UVWASI_VERSION_PATCH)) @@ -35,16 +34,18 @@ typedef struct uvwasi_mem_s { uvwasi_realloc realloc; } uvwasi_mem_t; +struct uvwasi_fd_table_t; + typedef struct uvwasi_s { - struct uvwasi_fd_table_t fds; - size_t argc; + struct uvwasi_fd_table_t* fds; + uvwasi_size_t argc; char** argv; char* argv_buf; - size_t argv_buf_size; - size_t envc; + uvwasi_size_t argv_buf_size; + uvwasi_size_t envc; char** env; char* env_buf; - size_t env_buf_size; + uvwasi_size_t env_buf_size; const uvwasi_mem_t* allocator; } uvwasi_t; @@ -54,12 +55,12 @@ typedef struct uvwasi_preopen_s { } uvwasi_preopen_t; typedef struct uvwasi_options_s { - size_t fd_table_size; - size_t preopenc; + uvwasi_size_t fd_table_size; + uvwasi_size_t preopenc; uvwasi_preopen_t* preopens; - size_t argc; - char** argv; - char** envp; + uvwasi_size_t argc; + const char** argv; + const char** envp; uvwasi_fd_t in; uvwasi_fd_t out; uvwasi_fd_t err; @@ -69,17 +70,18 @@ typedef struct uvwasi_options_s { /* Embedder API. */ uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options); void uvwasi_destroy(uvwasi_t* uvwasi); +/* Use int instead of uv_file to avoid needing uv.h */ uvwasi_errno_t uvwasi_embedder_remap_fd(uvwasi_t* uvwasi, const uvwasi_fd_t fd, - uv_file new_host_fd); + int new_host_fd); const char* uvwasi_embedder_err_code_to_string(uvwasi_errno_t code); /* WASI system call API. */ uvwasi_errno_t uvwasi_args_get(uvwasi_t* uvwasi, char** argv, char* argv_buf); uvwasi_errno_t uvwasi_args_sizes_get(uvwasi_t* uvwasi, - size_t* argc, - size_t* argv_buf_size); + uvwasi_size_t* argc, + uvwasi_size_t* argv_buf_size); uvwasi_errno_t uvwasi_clock_res_get(uvwasi_t* uvwasi, uvwasi_clockid_t clock_id, uvwasi_timestamp_t* resolution); @@ -91,8 +93,8 @@ uvwasi_errno_t uvwasi_environ_get(uvwasi_t* uvwasi, char** environment, char* environ_buf); uvwasi_errno_t uvwasi_environ_sizes_get(uvwasi_t* uvwasi, - size_t* environ_count, - size_t* environ_buf_size); + uvwasi_size_t* environ_count, + uvwasi_size_t* environ_buf_size); uvwasi_errno_t uvwasi_fd_advise(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_filesize_t offset, @@ -129,33 +131,33 @@ uvwasi_errno_t uvwasi_fd_filestat_set_times(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_iovec_t* iovs, - size_t iovs_len, + uvwasi_size_t iovs_len, uvwasi_filesize_t offset, - size_t* nread); + uvwasi_size_t* nread); uvwasi_errno_t uvwasi_fd_prestat_get(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_prestat_t* buf); uvwasi_errno_t uvwasi_fd_prestat_dir_name(uvwasi_t* uvwasi, uvwasi_fd_t fd, char* path, - size_t path_len); + uvwasi_size_t path_len); uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_ciovec_t* iovs, - size_t iovs_len, + uvwasi_size_t iovs_len, uvwasi_filesize_t offset, - size_t* nwritten); + uvwasi_size_t* nwritten); uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_iovec_t* iovs, - size_t iovs_len, - size_t* nread); + uvwasi_size_t iovs_len, + uvwasi_size_t* nread); uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, uvwasi_fd_t fd, void* buf, - size_t buf_len, + uvwasi_size_t buf_len, uvwasi_dircookie_t cookie, - size_t* bufused); + uvwasi_size_t* bufused); uvwasi_errno_t uvwasi_fd_renumber(uvwasi_t* uvwasi, uvwasi_fd_t from, uvwasi_fd_t to); @@ -171,23 +173,23 @@ uvwasi_errno_t uvwasi_fd_tell(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_ciovec_t* iovs, - size_t iovs_len, - size_t* nwritten); + uvwasi_size_t iovs_len, + uvwasi_size_t* nwritten); uvwasi_errno_t uvwasi_path_create_directory(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len); + uvwasi_size_t path_len); uvwasi_errno_t uvwasi_path_filestat_get(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_lookupflags_t flags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_filestat_t* buf); uvwasi_errno_t uvwasi_path_filestat_set_times(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_lookupflags_t flags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_timestamp_t st_atim, uvwasi_timestamp_t st_mtim, uvwasi_fstflags_t fst_flags); @@ -195,15 +197,15 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, uvwasi_fd_t old_fd, uvwasi_lookupflags_t old_flags, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t new_fd, const char* new_path, - size_t new_path_len); + uvwasi_size_t new_path_len); uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, uvwasi_fd_t dirfd, uvwasi_lookupflags_t dirflags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_oflags_t o_flags, uvwasi_rights_t fs_rights_base, uvwasi_rights_t fs_rights_inheriting, @@ -212,53 +214,55 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len, + uvwasi_size_t path_len, char* buf, - size_t buf_len, - size_t* bufused); + uvwasi_size_t buf_len, + uvwasi_size_t* bufused); uvwasi_errno_t uvwasi_path_remove_directory(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len); + uvwasi_size_t path_len); uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, uvwasi_fd_t old_fd, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t new_fd, const char* new_path, - size_t new_path_len); + uvwasi_size_t new_path_len); uvwasi_errno_t uvwasi_path_symlink(uvwasi_t* uvwasi, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t fd, const char* new_path, - size_t new_path_len); + uvwasi_size_t new_path_len); uvwasi_errno_t uvwasi_path_unlink_file(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len); + uvwasi_size_t path_len); uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi, const uvwasi_subscription_t* in, uvwasi_event_t* out, - size_t nsubscriptions, - size_t* nevents); + uvwasi_size_t nsubscriptions, + uvwasi_size_t* nevents); uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval); uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig); -uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len); +uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, + void* buf, + uvwasi_size_t buf_len); uvwasi_errno_t uvwasi_sched_yield(uvwasi_t* uvwasi); uvwasi_errno_t uvwasi_sock_recv(uvwasi_t* uvwasi, uvwasi_fd_t sock, const uvwasi_iovec_t* ri_data, - size_t ri_data_len, + uvwasi_size_t ri_data_len, uvwasi_riflags_t ri_flags, - size_t* ro_datalen, + uvwasi_size_t* ro_datalen, uvwasi_roflags_t* ro_flags); uvwasi_errno_t uvwasi_sock_send(uvwasi_t* uvwasi, uvwasi_fd_t sock, const uvwasi_ciovec_t* si_data, - size_t si_data_len, + uvwasi_size_t si_data_len, uvwasi_siflags_t si_flags, - size_t* so_datalen); + uvwasi_size_t* so_datalen); uvwasi_errno_t uvwasi_sock_shutdown(uvwasi_t* uvwasi, uvwasi_fd_t sock, uvwasi_sdflags_t how); diff --git a/deps/uvwasi/include/wasi_serdes.h b/deps/uvwasi/include/wasi_serdes.h new file mode 100644 index 00000000000000..f927b82bac9cbc --- /dev/null +++ b/deps/uvwasi/include/wasi_serdes.h @@ -0,0 +1,145 @@ +#ifndef __UVWASI_SERDES_H__ +#define __UVWASI_SERDES_H__ + +#include "wasi_types.h" + +/* Basic uint{8,16,32,64}_t read/write functions. */ + +#define BASIC_TYPE_(name, type) \ + void uvwasi_serdes_write_##name(void* ptr, size_t offset, type value); \ + type uvwasi_serdes_read_##name(const void* ptr, size_t offset); \ + +#define BASIC_TYPE(type) BASIC_TYPE_(type, type) +#define BASIC_TYPE_UVWASI(type) BASIC_TYPE_(type, uvwasi_##type) + +#define UVWASI_SERDES_SIZE_uint8_t sizeof(uint8_t) +BASIC_TYPE(uint8_t) +#define UVWASI_SERDES_SIZE_uint16_t sizeof(uint16_t) +BASIC_TYPE(uint16_t) +#define UVWASI_SERDES_SIZE_uint32_t sizeof(uint32_t) +BASIC_TYPE(uint32_t) +#define UVWASI_SERDES_SIZE_uint64_t sizeof(uint64_t) +BASIC_TYPE(uint64_t) + +#define UVWASI_SERDES_SIZE_advice_t sizeof(uvwasi_advice_t) +BASIC_TYPE_UVWASI(advice_t) +#define UVWASI_SERDES_SIZE_clockid_t sizeof(uvwasi_clockid_t) +BASIC_TYPE_UVWASI(clockid_t) +#define UVWASI_SERDES_SIZE_device_t sizeof(uvwasi_device_t) +BASIC_TYPE_UVWASI(device_t) +#define UVWASI_SERDES_SIZE_dircookie_t sizeof(uvwasi_dircookie_t) +BASIC_TYPE_UVWASI(dircookie_t) +#define UVWASI_SERDES_SIZE_eventrwflags_t sizeof(uvwasi_eventrwflags_t) +BASIC_TYPE_UVWASI(eventrwflags_t) +#define UVWASI_SERDES_SIZE_eventtype_t sizeof(uvwasi_eventtype_t) +BASIC_TYPE_UVWASI(eventtype_t) +#define UVWASI_SERDES_SIZE_exitcode_t sizeof(uvwasi_exitcode_t) +BASIC_TYPE_UVWASI(exitcode_t) +#define UVWASI_SERDES_SIZE_fd_t sizeof(uvwasi_fd_t) +BASIC_TYPE_UVWASI(fd_t) +#define UVWASI_SERDES_SIZE_fdflags_t sizeof(uvwasi_fdflags_t) +BASIC_TYPE_UVWASI(fdflags_t) +#define UVWASI_SERDES_SIZE_filesize_t sizeof(uvwasi_filesize_t) +BASIC_TYPE_UVWASI(filesize_t) +#define UVWASI_SERDES_SIZE_fstflags_t sizeof(uvwasi_fstflags_t) +BASIC_TYPE_UVWASI(fstflags_t) +#define UVWASI_SERDES_SIZE_inode_t sizeof(uvwasi_inode_t) +BASIC_TYPE_UVWASI(inode_t) +#define UVWASI_SERDES_SIZE_linkcount_t sizeof(uvwasi_linkcount_t) +BASIC_TYPE_UVWASI(linkcount_t) +#define UVWASI_SERDES_SIZE_lookupflags_t sizeof(uvwasi_lookupflags_t) +BASIC_TYPE_UVWASI(lookupflags_t) +#define UVWASI_SERDES_SIZE_oflags_t sizeof(uvwasi_oflags_t) +BASIC_TYPE_UVWASI(oflags_t) +#define UVWASI_SERDES_SIZE_preopentype_t sizeof(uvwasi_preopentype_t) +BASIC_TYPE_UVWASI(preopentype_t) +#define UVWASI_SERDES_SIZE_riflags_t sizeof(uvwasi_riflags_t) +BASIC_TYPE_UVWASI(riflags_t) +#define UVWASI_SERDES_SIZE_rights_t sizeof(uvwasi_rights_t) +BASIC_TYPE_UVWASI(rights_t) +#define UVWASI_SERDES_SIZE_roflags_t sizeof(uvwasi_roflags_t) +BASIC_TYPE_UVWASI(roflags_t) +#define UVWASI_SERDES_SIZE_sdflags_t sizeof(uvwasi_sdflags_t) +BASIC_TYPE_UVWASI(sdflags_t) +#define UVWASI_SERDES_SIZE_siflags_t sizeof(uvwasi_siflags_t) +BASIC_TYPE_UVWASI(siflags_t) +#define UVWASI_SERDES_SIZE_size_t sizeof(uvwasi_size_t) +BASIC_TYPE_UVWASI(size_t) +#define UVWASI_SERDES_SIZE_inode_t sizeof(uvwasi_inode_t) +BASIC_TYPE_UVWASI(inode_t) +#define UVWASI_SERDES_SIZE_signal_t sizeof(uvwasi_signal_t) +BASIC_TYPE_UVWASI(signal_t) +#define UVWASI_SERDES_SIZE_subclockflags_t sizeof(uvwasi_subclockflags_t) +BASIC_TYPE_UVWASI(subclockflags_t) +#define UVWASI_SERDES_SIZE_timestamp_t sizeof(uvwasi_timestamp_t) +BASIC_TYPE_UVWASI(timestamp_t) +#define UVWASI_SERDES_SIZE_userdata_t sizeof(uvwasi_userdata_t) +BASIC_TYPE_UVWASI(userdata_t) +#define UVWASI_SERDES_SIZE_whence_t sizeof(uvwasi_whence_t) +BASIC_TYPE_UVWASI(whence_t) + +#undef BASIC_TYPE_UVWASI +#undef BASIC_TYPE +#undef BASIC_TYPE_ + +/* WASI structure read/write functions. */ + +#define STRUCT(name) \ + void uvwasi_serdes_write_##name(void* ptr, \ + size_t offset, \ + const uvwasi_##name* value); \ + void uvwasi_serdes_read_##name(const void* ptr, \ + size_t offset, \ + uvwasi_##name* value); + +/* iovs currently only need to be read from WASM memory. */ +#define IOVS_STRUCT(name) \ + uvwasi_errno_t uvwasi_serdes_read_##name(const void* ptr, \ + size_t end, \ + size_t offset, \ + uvwasi_##name* value); + +#define UVWASI_SERDES_SIZE_ciovec_t 8 +IOVS_STRUCT(ciovec_t) + +#define UVWASI_SERDES_SIZE_iovec_t 8 +IOVS_STRUCT(iovec_t) + +#define UVWASI_SERDES_SIZE_fdstat_t 24 +STRUCT(fdstat_t) + +#define UVWASI_SERDES_SIZE_filestat_t 64 +STRUCT(filestat_t) + +#define UVWASI_SERDES_SIZE_prestat_t 8 +STRUCT(prestat_t) + +#define UVWASI_SERDES_SIZE_event_t 32 +STRUCT(event_t) + +#define UVWASI_SERDES_SIZE_subscription_t 48 +STRUCT(subscription_t) + +#undef STRUCT +#undef IOVS_STRUCT + +uvwasi_errno_t uvwasi_serdes_readv_ciovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_ciovec_t* iovs, + uvwasi_size_t iovs_len); + +uvwasi_errno_t uvwasi_serdes_readv_iovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_iovec_t* iovs, + uvwasi_size_t iovs_len); + +/* Helper functions for memory bounds checking. */ +int uvwasi_serdes_check_bounds(size_t offset, size_t end, size_t size); +int uvwasi_serdes_check_array_bounds(size_t offset, + size_t end, + size_t size, + size_t count); + +#endif /* __UVWASI_SERDES_H__ */ diff --git a/deps/uvwasi/include/wasi_types.h b/deps/uvwasi/include/wasi_types.h index 2f93b412624c06..57c2dd2f3ce589 100644 --- a/deps/uvwasi/include/wasi_types.h +++ b/deps/uvwasi/include/wasi_types.h @@ -6,6 +6,8 @@ /* API: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md */ +typedef uint32_t uvwasi_size_t; + typedef uint8_t uvwasi_advice_t; #define UVWASI_ADVICE_NORMAL 0 #define UVWASI_ADVICE_SEQUENTIAL 1 @@ -16,7 +18,7 @@ typedef uint8_t uvwasi_advice_t; typedef struct uvwasi_ciovec_s { const void* buf; - size_t buf_len; + uvwasi_size_t buf_len; } uvwasi_ciovec_t; typedef uint32_t uvwasi_clockid_t; @@ -152,7 +154,7 @@ typedef uint64_t uvwasi_inode_t; typedef struct uvwasi_iovec_s { void* buf; - size_t buf_len; + uvwasi_size_t buf_len; } uvwasi_iovec_t; typedef uint64_t uvwasi_linkcount_t; @@ -173,7 +175,7 @@ typedef struct uvwasi_prestat_s { uvwasi_preopentype_t pr_type; union uvwasi_prestat_u { struct uvwasi_prestat_dir_t { - size_t pr_name_len; + uvwasi_size_t pr_name_len; } dir; } u; } uvwasi_prestat_t; diff --git a/deps/uvwasi/src/debug.h b/deps/uvwasi/src/debug.h new file mode 100644 index 00000000000000..16bc2732ec90cd --- /dev/null +++ b/deps/uvwasi/src/debug.h @@ -0,0 +1,13 @@ +#ifndef __UVWASI_DEBUG_H__ +#define __UVWASI_DEBUG_H__ + +#ifdef UVWASI_DEBUG_LOG +# define __STDC_FORMAT_MACROS +# include +# define DEBUG(fmt, ...) \ + do { fprintf(stderr, fmt, __VA_ARGS__); } while (0) +#else +# define DEBUG(fmt, ...) +#endif + +#endif /* __UVWASI_DEBUG_H__ */ diff --git a/deps/uvwasi/src/fd_table.c b/deps/uvwasi/src/fd_table.c index 3d134e3b7e5e2e..877faf4ca19cd0 100644 --- a/deps/uvwasi/src/fd_table.c +++ b/deps/uvwasi/src/fd_table.c @@ -181,26 +181,25 @@ uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi, if (uvwasi == NULL || options == NULL || options->fd_table_size < 3) return UVWASI_EINVAL; - table = &uvwasi->fds; - table->fds = NULL; + table = uvwasi__malloc(uvwasi, sizeof(*table)); + if (table == NULL) + return UVWASI_ENOMEM; + table->used = 0; table->size = options->fd_table_size; table->fds = uvwasi__calloc(uvwasi, options->fd_table_size, sizeof(struct uvwasi_fd_wrap_t*)); - - if (table->fds == NULL) + if (table->fds == NULL) { + uvwasi__free(uvwasi, table); return UVWASI_ENOMEM; + } r = uv_rwlock_init(&table->rwlock); if (r != 0) { err = uvwasi__translate_uv_error(r); - /* Free table->fds and set it to NULL here. This is done explicitly instead - of jumping to error_exit because uvwasi_fd_table_free() relies on fds - being NULL to know whether or not to destroy the rwlock. - */ uvwasi__free(uvwasi, table->fds); - table->fds = NULL; + uvwasi__free(uvwasi, table); return err; } @@ -217,6 +216,7 @@ uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) goto error_exit; + uvwasi->fds = table; return UVWASI_ESUCCESS; error_exit: uvwasi_fd_table_free(uvwasi, table); @@ -228,12 +228,14 @@ void uvwasi_fd_table_free(uvwasi_t* uvwasi, struct uvwasi_fd_table_t* table) { struct uvwasi_fd_wrap_t* entry; uint32_t i; - if (table == NULL) + if (uvwasi == NULL || table == NULL) return; for (i = 0; i < table->size; i++) { entry = table->fds[i]; - if (entry == NULL) continue; + + if (entry == NULL) + continue; uv_mutex_destroy(&entry->mutex); uvwasi__free(uvwasi, entry); @@ -246,6 +248,8 @@ void uvwasi_fd_table_free(uvwasi_t* uvwasi, struct uvwasi_fd_table_t* table) { table->used = 0; uv_rwlock_destroy(&table->rwlock); } + + uvwasi__free(uvwasi, table); } diff --git a/deps/uvwasi/include/fd_table.h b/deps/uvwasi/src/fd_table.h similarity index 100% rename from deps/uvwasi/include/fd_table.h rename to deps/uvwasi/src/fd_table.h diff --git a/deps/uvwasi/src/path_resolver.c b/deps/uvwasi/src/path_resolver.c index ee0e60f7e8f4ea..af13c1553ca874 100644 --- a/deps/uvwasi/src/path_resolver.c +++ b/deps/uvwasi/src/path_resolver.c @@ -15,7 +15,7 @@ #endif /* _WIN32 */ -static int uvwasi__is_absolute_path(const char* path, size_t path_len) { +static int uvwasi__is_absolute_path(const char* path, uvwasi_size_t path_len) { /* It's expected that only Unix style paths will be generated by WASI. */ return path != NULL && path_len > 0 && path[0] == '/'; } @@ -33,9 +33,9 @@ static char* uvwasi__strchr_slash(const char* s) { uvwasi_errno_t uvwasi__normalize_path(const char* path, - size_t path_len, + uvwasi_size_t path_len, char* normalized_path, - size_t normalized_len) { + uvwasi_size_t normalized_len) { const char* cur; char* ptr; char* next; @@ -125,9 +125,9 @@ uvwasi_errno_t uvwasi__normalize_path(const char* path, static int uvwasi__is_path_sandboxed(const char* path, - size_t path_len, + uvwasi_size_t path_len, const char* fd_path, - size_t fd_path_len) { + uvwasi_size_t fd_path_len) { char* ptr; int remaining_len; @@ -173,9 +173,9 @@ static uvwasi_errno_t uvwasi__normalize_absolute_path( const uvwasi_t* uvwasi, const struct uvwasi_fd_wrap_t* fd, const char* path, - size_t path_len, + uvwasi_size_t path_len, char** normalized_path, - size_t* normalized_len + uvwasi_size_t* normalized_len ) { /* This function resolves an absolute path to the provided file descriptor. If the file descriptor's path is relative, then this operation will fail @@ -224,9 +224,9 @@ static uvwasi_errno_t uvwasi__normalize_relative_path( const uvwasi_t* uvwasi, const struct uvwasi_fd_wrap_t* fd, const char* path, - size_t path_len, + uvwasi_size_t path_len, char** normalized_path, - size_t* normalized_len + uvwasi_size_t* normalized_len ) { /* This function resolves a relative path to the provided file descriptor. The relative path is concatenated to the file descriptor's path, and then @@ -298,9 +298,9 @@ static uvwasi_errno_t uvwasi__resolve_path_to_host( const uvwasi_t* uvwasi, const struct uvwasi_fd_wrap_t* fd, const char* path, - size_t path_len, + uvwasi_size_t path_len, char** resolved_path, - size_t* resolved_len + uvwasi_size_t* resolved_len ) { /* Return the normalized path, but resolved to the host's real path. */ char* res_path; @@ -309,7 +309,7 @@ static uvwasi_errno_t uvwasi__resolve_path_to_host( int fake_path_len; int stripped_len; #ifdef _WIN32 - size_t i; + uvwasi_size_t i; #endif /* _WIN32 */ real_path_len = strlen(fd->real_path); @@ -351,6 +351,7 @@ static uvwasi_errno_t uvwasi__resolve_path_to_host( #ifdef _WIN32 /* Replace / with \ on Windows. */ + res_path = *resolved_path; for (i = real_path_len; i < *resolved_len; i++) { if (res_path[i] == '/') res_path[i] = '\\'; @@ -364,8 +365,8 @@ static uvwasi_errno_t uvwasi__resolve_path_to_host( uvwasi_errno_t uvwasi__resolve_path(const uvwasi_t* uvwasi, const struct uvwasi_fd_wrap_t* fd, const char* path, - size_t path_len, - char* resolved_path, + uvwasi_size_t path_len, + char** resolved_path, uvwasi_lookupflags_t flags) { uv_fs_t req; uvwasi_errno_t err; @@ -373,9 +374,9 @@ uvwasi_errno_t uvwasi__resolve_path(const uvwasi_t* uvwasi, char* host_path; char* normalized_path; char* link_target; - size_t input_len; - size_t host_path_len; - size_t normalized_len; + uvwasi_size_t input_len; + uvwasi_size_t host_path_len; + uvwasi_size_t normalized_len; int follow_count; int r; @@ -418,14 +419,6 @@ uvwasi_errno_t uvwasi__resolve_path(const uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) goto exit; - /* TODO(cjihrig): Currently performing a bounds check here. The TODO is to - stop allocating resolved_path in every caller and instead return the - path allocated in this function. */ - if (host_path_len > PATH_MAX_BYTES) { - err = UVWASI_ENOBUFS; - goto exit; - } - if ((flags & UVWASI_LOOKUP_SYMLINK_FOLLOW) == UVWASI_LOOKUP_SYMLINK_FOLLOW) { r = uv_fs_readlink(NULL, &req, host_path, NULL); @@ -482,11 +475,14 @@ uvwasi_errno_t uvwasi__resolve_path(const uvwasi_t* uvwasi, } exit: - if (err == UVWASI_ESUCCESS) - memcpy(resolved_path, host_path, host_path_len + 1); + if (err == UVWASI_ESUCCESS) { + *resolved_path = host_path; + } else { + *resolved_path = NULL; + uvwasi__free(uvwasi, host_path); + } uvwasi__free(uvwasi, link_target); uvwasi__free(uvwasi, normalized_path); - uvwasi__free(uvwasi, host_path); return err; } diff --git a/deps/uvwasi/src/path_resolver.h b/deps/uvwasi/src/path_resolver.h index d5f95eafbfbf83..5040c69ac40cb7 100644 --- a/deps/uvwasi/src/path_resolver.h +++ b/deps/uvwasi/src/path_resolver.h @@ -1,28 +1,19 @@ #ifndef __UVWASI_PATH_RESOLVER_H__ #define __UVWASI_PATH_RESOLVER_H__ +#include "fd_table.h" #include "uvwasi.h" -/* TODO(cjihrig): PATH_MAX_BYTES shouldn't be stack allocated. On Windows, paths - can be 32k long, and this PATH_MAX_BYTES is an artificial limitation. */ -#ifdef _WIN32 -/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ -# define PATH_MAX_BYTES (MAX_PATH * 4) -#else -# include -# define PATH_MAX_BYTES (PATH_MAX) -#endif - uvwasi_errno_t uvwasi__normalize_path(const char* path, - size_t path_len, + uvwasi_size_t path_len, char* normalized_path, - size_t normalized_len); + uvwasi_size_t normalized_len); uvwasi_errno_t uvwasi__resolve_path(const uvwasi_t* uvwasi, const struct uvwasi_fd_wrap_t* fd, const char* path, - size_t path_len, - char* resolved_path, + uvwasi_size_t path_len, + char** resolved_path, uvwasi_lookupflags_t flags); #endif /* __UVWASI_PATH_RESOLVER_H__ */ diff --git a/deps/uvwasi/src/poll_oneoff.c b/deps/uvwasi/src/poll_oneoff.c new file mode 100644 index 00000000000000..97b8ef332da71f --- /dev/null +++ b/deps/uvwasi/src/poll_oneoff.c @@ -0,0 +1,267 @@ +#include "uv.h" +#include "poll_oneoff.h" +#include "uv_mapping.h" +#include "uvwasi_alloc.h" + + +static void poll_cb(uv_poll_t* handle, int status, int events) { + struct uvwasi_poll_oneoff_state_t* state; + struct uvwasi__poll_fdevent_t* event; + + uv_poll_stop(handle); + event = uv_handle_get_data((uv_handle_t*) handle); + event->revents = events; + + if (status != 0) + event->error = UVWASI_EIO; + + state = uv_loop_get_data(handle->loop); + state->result++; +} + + +static void timeout_cb(uv_timer_t* handle) { + struct uvwasi_poll_oneoff_state_t* state; + uvwasi_size_t i; + + state = uv_loop_get_data(handle->loop); + + for (i = 0; i < state->handle_cnt; i++) + uv_poll_stop(&state->poll_handles[i]); +} + + +uvwasi_errno_t uvwasi__poll_oneoff_state_init( + uvwasi_t* uvwasi, + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_size_t max_fds + ) { + uvwasi_errno_t err; + int r; + + if (uvwasi == NULL || state == NULL) + return UVWASI_EINVAL; + + state->uvwasi = NULL; + state->timeout = 0; + state->has_timer = 0; + state->fdevents = NULL; + state->poll_handles = NULL; + state->max_fds = 0; + state->fdevent_cnt = 0; + state->handle_cnt = 0; + state->result = 0; + + r = uv_loop_init(&state->loop); + if (r != 0) + return uvwasi__translate_uv_error(r); + + if (max_fds > 0) { + state->fdevents = uvwasi__calloc(uvwasi, + max_fds, + sizeof(*state->fdevents)); + if (state->fdevents == NULL) { + err = UVWASI_ENOMEM; + goto error_exit; + } + + state->poll_handles = uvwasi__calloc(uvwasi, + max_fds, + sizeof(*state->poll_handles)); + if (state->poll_handles == NULL) { + err = UVWASI_ENOMEM; + goto error_exit; + } + } + + uv_loop_set_data(&state->loop, (void*) state); + state->uvwasi = uvwasi; + state->max_fds = max_fds; + + return UVWASI_ESUCCESS; + +error_exit: + uv_loop_close(&state->loop); + uvwasi__free(state->uvwasi, state->fdevents); + uvwasi__free(state->uvwasi, state->poll_handles); + return err; +} + + +uvwasi_errno_t uvwasi__poll_oneoff_state_cleanup( + struct uvwasi_poll_oneoff_state_t* state + ) { + struct uvwasi__poll_fdevent_t* event; + uvwasi_size_t i; + int r; + + if (state == NULL) + return UVWASI_EINVAL; + + if (state->has_timer != 0) { + state->timeout = 0; + state->has_timer = 0; + uv_close((uv_handle_t*) &state->timer, NULL); + } + + for (i = 0; i < state->fdevent_cnt; i++) { + event = &state->fdevents[i]; + + if (event->is_duplicate_fd == 0 && event->wrap != NULL) + uv_mutex_unlock(&event->wrap->mutex); + } + + for (i = 0; i < state->handle_cnt; i++) + uv_close((uv_handle_t*) &state->poll_handles[i], NULL); + + state->max_fds = 0; + state->fdevent_cnt = 0; + state->handle_cnt = 0; + + uvwasi__free(state->uvwasi, state->fdevents); + uvwasi__free(state->uvwasi, state->poll_handles); + state->fdevents = NULL; + state->poll_handles = NULL; + state->uvwasi = NULL; + + r = uv_loop_close(&state->loop); + if (r != 0) + return uvwasi__translate_uv_error(r); + + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi__poll_oneoff_state_set_timer( + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_timestamp_t timeout + ) { + int r; + + if (state == NULL) + return UVWASI_EINVAL; + + r = uv_timer_init(&state->loop, &state->timer); + if (r != 0) + return uvwasi__translate_uv_error(r); + + /* Convert WASI timeout from nanoseconds to milliseconds for libuv. */ + state->timeout = timeout / 1000000; + state->has_timer = 1; + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi__poll_oneoff_state_add_fdevent( + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_subscription_t* subscription + ) { + struct uvwasi__poll_fdevent_t* event; + struct uvwasi__poll_fdevent_t* dup; + uv_poll_t* poll_handle; + uvwasi_eventtype_t type; + uvwasi_rights_t rights; + uvwasi_fd_t fd; + uvwasi_errno_t err; + uvwasi_size_t i; + int r; + + if (state == NULL) + return UVWASI_EINVAL; + + event = &state->fdevents[state->fdevent_cnt]; + fd = subscription->u.fd_readwrite.fd; + type = subscription->type; + + if (type == UVWASI_EVENTTYPE_FD_READ) { + event->events = UV_DISCONNECT | UV_READABLE; + rights = UVWASI_RIGHT_POLL_FD_READWRITE | UVWASI_RIGHT_FD_READ; + } else if (type == UVWASI_EVENTTYPE_FD_WRITE) { + event->events = UV_DISCONNECT | UV_WRITABLE; + rights = UVWASI_RIGHT_POLL_FD_READWRITE | UVWASI_RIGHT_FD_WRITE; + } else { + return UVWASI_EINVAL; + } + + /* Check if the same file descriptor is already being polled. If so, use the + wrap and poll handle from the first descriptor. The reasons are that libuv + does not support polling the same fd more than once at the same time, and + uvwasi has the fd's mutex locked. */ + event->is_duplicate_fd = 0; + for (i = 0; i < state->fdevent_cnt; i++) { + dup = &state->fdevents[i]; + if (dup->wrap->id == fd) { + event->is_duplicate_fd = 1; + event->wrap = dup->wrap; + event->poll_handle = dup->poll_handle; + err = event->error; + goto poll_config_done; + } + } + + /* Get the file descriptor. If UVWASI_EBADF is returned, continue on, but + don't do any polling with the handle. */ + err = uvwasi_fd_table_get(state->uvwasi->fds, fd, &event->wrap, rights, 0); + if (err == UVWASI_EBADF) + event->wrap = NULL; + else if (err != UVWASI_ESUCCESS) + return err; + + if (err == UVWASI_ESUCCESS) { + /* The fd is valid, so setup the poll handle. */ + poll_handle = &state->poll_handles[state->handle_cnt]; + r = uv_poll_init(&state->loop, poll_handle, event->wrap->fd); + + if (r != 0) { + /* If uv_poll_init() fails (for example on Windows because only sockets + are supported), set the error for this event to UVWASI_EBADF, but don't + do any polling with the handle. */ + uv_mutex_unlock(&event->wrap->mutex); + return uvwasi__translate_uv_error(r); + } else { + r = uv_poll_start(poll_handle, + event->events, + poll_cb); + if (r != 0) { + uv_mutex_unlock(&event->wrap->mutex); + uv_close((uv_handle_t*) poll_handle, NULL); + return uvwasi__translate_uv_error(r); + } + + uv_handle_set_data((uv_handle_t*) poll_handle, + (void*) &state->fdevents[state->fdevent_cnt]); + event->poll_handle = poll_handle; + state->handle_cnt++; + } + } + +poll_config_done: + event->type = type; + event->userdata = subscription->userdata; + event->error = err; + event->revents = 0; + state->fdevent_cnt++; + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi__poll_oneoff_run( + struct uvwasi_poll_oneoff_state_t* state + ) { + int r; + + if (state->has_timer == 1) { + r = uv_timer_start(&state->timer, timeout_cb, state->timeout, 0); + if (r != 0) + return uvwasi__translate_uv_error(r); + + if (state->fdevent_cnt > 0) + uv_unref((uv_handle_t*) &state->timer); + } + + r = uv_run(&state->loop, UV_RUN_DEFAULT); + if (r != 0) + return uvwasi__translate_uv_error(r); + + return UVWASI_ESUCCESS; +} diff --git a/deps/uvwasi/src/poll_oneoff.h b/deps/uvwasi/src/poll_oneoff.h new file mode 100644 index 00000000000000..64a315af1b334b --- /dev/null +++ b/deps/uvwasi/src/poll_oneoff.h @@ -0,0 +1,60 @@ +#ifndef __UVWASI_POLL_ONEOFF_H__ +#define __UVWASI_POLL_ONEOFF_H__ + +#include "fd_table.h" +#include "wasi_types.h" + +struct uvwasi_s; + +struct uvwasi__poll_fdevent_t { + struct uvwasi_fd_wrap_t* wrap; + uvwasi_userdata_t userdata; + uvwasi_eventtype_t type; + uvwasi_errno_t error; + uv_poll_t* poll_handle; + int is_duplicate_fd; + int events; + int revents; +}; + +struct uvwasi_poll_oneoff_state_t { + struct uvwasi_s* uvwasi; + struct uvwasi__poll_fdevent_t* fdevents; + uv_poll_t* poll_handles; + uv_timer_t timer; + uint64_t timeout; + uv_loop_t loop; + uvwasi_size_t max_fds; + int has_timer; + uvwasi_size_t fdevent_cnt; + uvwasi_size_t handle_cnt; + int result; +}; + + +uvwasi_errno_t uvwasi__poll_oneoff_state_init( + struct uvwasi_s* uvwasi, + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_size_t max_fds + ); + +uvwasi_errno_t uvwasi__poll_oneoff_state_cleanup( + struct uvwasi_poll_oneoff_state_t* state + ); + +uvwasi_errno_t uvwasi__poll_oneoff_state_set_timer( + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_timestamp_t timeout + ); + +uvwasi_errno_t uvwasi__poll_oneoff_state_add_fdevent( + struct uvwasi_poll_oneoff_state_t* state, + uvwasi_subscription_t* subscription + ); + +uvwasi_errno_t uvwasi__poll_oneoff_run( + struct uvwasi_poll_oneoff_state_t* state + ); + + +#endif /* __UVWASI_POLL_ONEOFF_H__ */ diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c index 0ee66be36a3951..fc8f0ee4844b9e 100644 --- a/deps/uvwasi/src/uvwasi.c +++ b/deps/uvwasi/src/uvwasi.c @@ -20,7 +20,9 @@ #include "fd_table.h" #include "clocks.h" #include "path_resolver.h" +#include "poll_oneoff.h" #include "wasi_rights.h" +#include "debug.h" /* IBMi PASE does not support posix_fadvise() */ #ifdef __PASE__ @@ -109,9 +111,9 @@ static uvwasi_errno_t uvwasi__lseek(uv_file fd, static uvwasi_errno_t uvwasi__setup_iovs(const uvwasi_t* uvwasi, uv_buf_t** buffers, const uvwasi_iovec_t* iovs, - size_t iovs_len) { + uvwasi_size_t iovs_len) { uv_buf_t* bufs; - size_t i; + uvwasi_size_t i; if ((iovs_len * sizeof(*bufs)) / (sizeof(*bufs)) != iovs_len) return UVWASI_ENOMEM; @@ -131,9 +133,9 @@ static uvwasi_errno_t uvwasi__setup_iovs(const uvwasi_t* uvwasi, static uvwasi_errno_t uvwasi__setup_ciovs(const uvwasi_t* uvwasi, uv_buf_t** buffers, const uvwasi_ciovec_t* iovs, - size_t iovs_len) { + uvwasi_size_t iovs_len) { uv_buf_t* bufs; - size_t i; + uvwasi_size_t i; if ((iovs_len * sizeof(*bufs)) / (sizeof(*bufs)) != iovs_len) return UVWASI_ENOMEM; @@ -154,12 +156,12 @@ uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) { uv_fs_t realpath_req; uv_fs_t open_req; uvwasi_errno_t err; - size_t args_size; - size_t size; - size_t offset; - size_t env_count; - size_t env_buf_size; - size_t i; + uvwasi_size_t args_size; + uvwasi_size_t size; + uvwasi_size_t offset; + uvwasi_size_t env_count; + uvwasi_size_t env_buf_size; + uvwasi_size_t i; int r; if (uvwasi == NULL || options == NULL || options->fd_table_size == 0) @@ -173,7 +175,7 @@ uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) { uvwasi->argv = NULL; uvwasi->env_buf = NULL; uvwasi->env = NULL; - uvwasi->fds.fds = NULL; + uvwasi->fds = NULL; args_size = 0; for (i = 0; i < options->argc; ++i) @@ -270,7 +272,7 @@ uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) { } err = uvwasi_fd_table_insert_preopen(uvwasi, - &uvwasi->fds, + uvwasi->fds, open_req.result, options->preopens[i].mapped_path, realpath_req.ptr); @@ -293,11 +295,12 @@ void uvwasi_destroy(uvwasi_t* uvwasi) { if (uvwasi == NULL) return; - uvwasi_fd_table_free(uvwasi, &uvwasi->fds); + uvwasi_fd_table_free(uvwasi, uvwasi->fds); uvwasi__free(uvwasi, uvwasi->argv_buf); uvwasi__free(uvwasi, uvwasi->argv); uvwasi__free(uvwasi, uvwasi->env_buf); uvwasi__free(uvwasi, uvwasi->env); + uvwasi->fds = NULL; uvwasi->argv_buf = NULL; uvwasi->argv = NULL; uvwasi->env_buf = NULL; @@ -314,7 +317,7 @@ uvwasi_errno_t uvwasi_embedder_remap_fd(uvwasi_t* uvwasi, if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) return err; @@ -325,7 +328,12 @@ uvwasi_errno_t uvwasi_embedder_remap_fd(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_args_get(uvwasi_t* uvwasi, char** argv, char* argv_buf) { - size_t i; + uvwasi_size_t i; + + DEBUG("uvwasi_args_get(uvwasi=%p, argv=%p, argv_buf=%p)\n", + uvwasi, + argv, + argv_buf); if (uvwasi == NULL || argv == NULL || argv_buf == NULL) return UVWASI_EINVAL; @@ -340,8 +348,13 @@ uvwasi_errno_t uvwasi_args_get(uvwasi_t* uvwasi, char** argv, char* argv_buf) { uvwasi_errno_t uvwasi_args_sizes_get(uvwasi_t* uvwasi, - size_t* argc, - size_t* argv_buf_size) { + uvwasi_size_t* argc, + uvwasi_size_t* argv_buf_size) { + DEBUG("uvwasi_args_sizes_get(uvwasi=%p, argc=%p, argv_buf_size=%p)\n", + uvwasi, + argc, + argv_buf_size); + if (uvwasi == NULL || argc == NULL || argv_buf_size == NULL) return UVWASI_EINVAL; @@ -354,6 +367,11 @@ uvwasi_errno_t uvwasi_args_sizes_get(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_clock_res_get(uvwasi_t* uvwasi, uvwasi_clockid_t clock_id, uvwasi_timestamp_t* resolution) { + DEBUG("uvwasi_clock_res_get(uvwasi=%p, clock_id=%d, resolution=%p)\n", + uvwasi, + clock_id, + resolution); + if (uvwasi == NULL || resolution == NULL) return UVWASI_EINVAL; @@ -376,6 +394,13 @@ uvwasi_errno_t uvwasi_clock_time_get(uvwasi_t* uvwasi, uvwasi_clockid_t clock_id, uvwasi_timestamp_t precision, uvwasi_timestamp_t* time) { + DEBUG("uvwasi_clock_time_get(uvwasi=%p, clock_id=%d, " + "precision=%"PRIu64", time=%p)\n", + uvwasi, + clock_id, + precision, + time); + if (uvwasi == NULL || time == NULL) return UVWASI_EINVAL; @@ -398,7 +423,12 @@ uvwasi_errno_t uvwasi_clock_time_get(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_environ_get(uvwasi_t* uvwasi, char** environment, char* environ_buf) { - size_t i; + uvwasi_size_t i; + + DEBUG("uvwasi_environ_get(uvwasi=%p, environment=%p, environ_buf=%p)\n", + uvwasi, + environment, + environ_buf); if (uvwasi == NULL || environment == NULL || environ_buf == NULL) return UVWASI_EINVAL; @@ -413,8 +443,14 @@ uvwasi_errno_t uvwasi_environ_get(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_environ_sizes_get(uvwasi_t* uvwasi, - size_t* environ_count, - size_t* environ_buf_size) { + uvwasi_size_t* environ_count, + uvwasi_size_t* environ_buf_size) { + DEBUG("uvwasi_environ_sizes_get(uvwasi=%p, environ_count=%p, " + "environ_buf_size=%p)\n", + uvwasi, + environ_count, + environ_buf_size); + if (uvwasi == NULL || environ_count == NULL || environ_buf_size == NULL) return UVWASI_EINVAL; @@ -436,6 +472,14 @@ uvwasi_errno_t uvwasi_fd_advise(uvwasi_t* uvwasi, int r; #endif /* POSIX_FADV_NORMAL */ + DEBUG("uvwasi_fd_advise(uvwasi=%p, fd=%d, offset=%"PRIu64", len=%"PRIu64", " + "advice=%d)\n", + uvwasi, + fd, + offset, + len, + advice); + if (uvwasi == NULL) return UVWASI_EINVAL; @@ -474,7 +518,7 @@ uvwasi_errno_t uvwasi_fd_advise(uvwasi_t* uvwasi, return UVWASI_EINVAL; } - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_ADVISE, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_ADVISE, 0); if (err != UVWASI_ESUCCESS) return err; @@ -502,10 +546,17 @@ uvwasi_errno_t uvwasi_fd_allocate(uvwasi_t* uvwasi, uvwasi_errno_t err; int r; + DEBUG("uvwasi_fd_allocate(uvwasi=%p, fd=%d, offset=%"PRIu64", " + "len=%"PRIu64")\n", + uvwasi, + fd, + offset, + len); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_ALLOCATE, @@ -552,12 +603,14 @@ uvwasi_errno_t uvwasi_fd_close(uvwasi_t* uvwasi, uvwasi_fd_t fd) { uv_fs_t req; int r; + DEBUG("uvwasi_fd_close(uvwasi=%p, fd=%d)\n", uvwasi, fd); + if (uvwasi == NULL) return UVWASI_EINVAL; - uvwasi_fd_table_lock(&uvwasi->fds); + uvwasi_fd_table_lock(uvwasi->fds); - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get_nolock(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) goto exit; @@ -570,10 +623,10 @@ uvwasi_errno_t uvwasi_fd_close(uvwasi_t* uvwasi, uvwasi_fd_t fd) { goto exit; } - err = uvwasi_fd_table_remove_nolock(uvwasi, &uvwasi->fds, fd); + err = uvwasi_fd_table_remove_nolock(uvwasi, uvwasi->fds, fd); exit: - uvwasi_fd_table_unlock(&uvwasi->fds); + uvwasi_fd_table_unlock(uvwasi->fds); return err; } @@ -584,10 +637,12 @@ uvwasi_errno_t uvwasi_fd_datasync(uvwasi_t* uvwasi, uvwasi_fd_t fd) { uv_fs_t req; int r; + DEBUG("uvwasi_fd_datasync(uvwasi=%p, fd=%d)\n", uvwasi, fd); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_DATASYNC, @@ -615,10 +670,12 @@ uvwasi_errno_t uvwasi_fd_fdstat_get(uvwasi_t* uvwasi, int r; #endif + DEBUG("uvwasi_fd_fdstat_get(uvwasi=%p, fd=%d, buf=%p)\n", uvwasi, fd, buf); + if (uvwasi == NULL || buf == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) return err; @@ -646,7 +703,12 @@ uvwasi_errno_t uvwasi_fd_fdstat_set_flags(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_fdflags_t flags) { #ifdef _WIN32 - /* TODO(cjihrig): Missing Windows support. */ + DEBUG("uvwasi_fd_fdstat_set_flags(uvwasi=%p, fd=%d, flags=%d)\n", + uvwasi, + fd, + flags); + + /* TODO(cjihrig): Windows is not supported. */ return UVWASI_ENOSYS; #else struct uvwasi_fd_wrap_t* wrap; @@ -654,10 +716,15 @@ uvwasi_errno_t uvwasi_fd_fdstat_set_flags(uvwasi_t* uvwasi, int mapped_flags; int r; + DEBUG("uvwasi_fd_fdstat_set_flags(uvwasi=%p, fd=%d, flags=%d)\n", + uvwasi, + fd, + flags); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS, @@ -710,10 +777,17 @@ uvwasi_errno_t uvwasi_fd_fdstat_set_rights(uvwasi_t* uvwasi, struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; + DEBUG("uvwasi_fd_fdstat_set_rights(uvwasi=%p, fd=%d, " + "fs_rights_base=%"PRIu64", fs_rights_inheriting=%"PRIu64")\n", + uvwasi, + fd, + fs_rights_base, + fs_rights_inheriting); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) return err; @@ -746,10 +820,12 @@ uvwasi_errno_t uvwasi_fd_filestat_get(uvwasi_t* uvwasi, uvwasi_errno_t err; int r; + DEBUG("uvwasi_fd_filestat_get(uvwasi=%p, fd=%d, buf=%p)\n", uvwasi, fd, buf); + if (uvwasi == NULL || buf == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_FILESTAT_GET, @@ -781,10 +857,15 @@ uvwasi_errno_t uvwasi_fd_filestat_set_size(uvwasi_t* uvwasi, uvwasi_errno_t err; int r; + DEBUG("uvwasi_fd_filestat_set_size(uvwasi=%p, fd=%d, st_size=%"PRIu64")\n", + uvwasi, + fd, + st_size); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_FILESTAT_SET_SIZE, @@ -814,6 +895,14 @@ uvwasi_errno_t uvwasi_fd_filestat_set_times(uvwasi_t* uvwasi, uvwasi_errno_t err; int r; + DEBUG("uvwasi_fd_filestat_set_times(uvwasi=%p, fd=%d, st_atim=%"PRIu64", " + "st_mtim=%"PRIu64", fst_flags=%d)\n", + uvwasi, + fd, + st_atim, + st_mtim, + fst_flags); + if (uvwasi == NULL) return UVWASI_EINVAL; @@ -822,7 +911,7 @@ uvwasi_errno_t uvwasi_fd_filestat_set_times(uvwasi_t* uvwasi, return UVWASI_EINVAL; } - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_FILESTAT_SET_TIMES, @@ -845,9 +934,9 @@ uvwasi_errno_t uvwasi_fd_filestat_set_times(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_iovec_t* iovs, - size_t iovs_len, + uvwasi_size_t iovs_len, uvwasi_filesize_t offset, - size_t* nread) { + uvwasi_size_t* nread) { struct uvwasi_fd_wrap_t* wrap; uv_buf_t* bufs; uv_fs_t req; @@ -855,10 +944,19 @@ uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi, size_t uvread; int r; + DEBUG("uvwasi_fd_pread(uvwasi=%p, fd=%d, iovs=%p, iovs_len=%zu, " + "offset=%"PRIu64", nread=%p)\n", + uvwasi, + fd, + iovs, + iovs_len, + offset, + nread); + if (uvwasi == NULL || iovs == NULL || nread == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_READ | UVWASI_RIGHT_FD_SEEK, @@ -881,7 +979,7 @@ uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi, if (r < 0) return uvwasi__translate_uv_error(r); - *nread = uvread; + *nread = (uvwasi_size_t) uvread; return UVWASI_ESUCCESS; } @@ -892,10 +990,15 @@ uvwasi_errno_t uvwasi_fd_prestat_get(uvwasi_t* uvwasi, struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; + DEBUG("uvwasi_fd_prestat_get(uvwasi=%p, fd=%d, buf=%p)\n", + uvwasi, + fd, + buf); + if (uvwasi == NULL || buf == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) return err; if (wrap->preopen != 1) { @@ -915,15 +1018,21 @@ uvwasi_errno_t uvwasi_fd_prestat_get(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_prestat_dir_name(uvwasi_t* uvwasi, uvwasi_fd_t fd, char* path, - size_t path_len) { + uvwasi_size_t path_len) { struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; size_t size; + DEBUG("uvwasi_fd_prestat_dir_name(uvwasi=%p, fd=%d, path=%p, path_len=%zu)\n", + uvwasi, + fd, + path, + path_len); + if (uvwasi == NULL || path == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, 0, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, 0, 0); if (err != UVWASI_ESUCCESS) return err; if (wrap->preopen != 1) { @@ -932,7 +1041,7 @@ uvwasi_errno_t uvwasi_fd_prestat_dir_name(uvwasi_t* uvwasi, } size = strlen(wrap->path) + 1; - if (size > path_len) { + if (size > (size_t) path_len) { err = UVWASI_ENOBUFS; goto exit; } @@ -948,9 +1057,9 @@ uvwasi_errno_t uvwasi_fd_prestat_dir_name(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_ciovec_t* iovs, - size_t iovs_len, + uvwasi_size_t iovs_len, uvwasi_filesize_t offset, - size_t* nwritten) { + uvwasi_size_t* nwritten) { struct uvwasi_fd_wrap_t* wrap; uv_buf_t* bufs; uv_fs_t req; @@ -958,10 +1067,19 @@ uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi, size_t uvwritten; int r; + DEBUG("uvwasi_fd_pwrite(uvwasi=%p, fd=%d, iovs=%p, iovs_len=%zu, " + "offset=%"PRIu64", nwritten=%p)\n", + uvwasi, + fd, + iovs, + iovs_len, + offset, + nwritten); + if (uvwasi == NULL || iovs == NULL || nwritten == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_WRITE | UVWASI_RIGHT_FD_SEEK, @@ -984,7 +1102,7 @@ uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi, if (r < 0) return uvwasi__translate_uv_error(r); - *nwritten = uvwritten; + *nwritten = (uvwasi_size_t) uvwritten; return UVWASI_ESUCCESS; } @@ -992,8 +1110,8 @@ uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_iovec_t* iovs, - size_t iovs_len, - size_t* nread) { + uvwasi_size_t iovs_len, + uvwasi_size_t* nread) { struct uvwasi_fd_wrap_t* wrap; uv_buf_t* bufs; uv_fs_t req; @@ -1001,10 +1119,17 @@ uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi, size_t uvread; int r; + DEBUG("uvwasi_fd_read(uvwasi=%p, fd=%d, iovs=%p, iovs_len=%zu, nread=%p)\n", + uvwasi, + fd, + iovs, + iovs_len, + nread); + if (uvwasi == NULL || iovs == NULL || nread == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_READ, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_READ, 0); if (err != UVWASI_ESUCCESS) return err; @@ -1023,7 +1148,7 @@ uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi, if (r < 0) return uvwasi__translate_uv_error(r); - *nread = uvread; + *nread = (uvwasi_size_t) uvread; return UVWASI_ESUCCESS; } @@ -1031,9 +1156,9 @@ uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, uvwasi_fd_t fd, void* buf, - size_t buf_len, + uvwasi_size_t buf_len, uvwasi_dircookie_t cookie, - size_t* bufused) { + uvwasi_size_t* bufused) { /* TODO(cjihrig): Support Windows where seekdir() and telldir() are used. */ /* TODO(cjihrig): Avoid opening and closing the directory on each call. */ struct uvwasi_fd_wrap_t* wrap; @@ -1049,10 +1174,19 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, int i; int r; + DEBUG("uvwasi_fd_readdir(uvwasi=%p, fd=%d, buf=%p, buf_len=%zu, " + "cookie=%"PRIu64", bufused=%p)\n", + uvwasi, + fd, + buf, + buf_len, + cookie, + bufused); + if (uvwasi == NULL || buf == NULL || bufused == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_READDIR, @@ -1171,10 +1305,12 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_renumber(uvwasi_t* uvwasi, uvwasi_fd_t from, uvwasi_fd_t to) { + DEBUG("uvwasi_fd_renumber(uvwasi=%p, from=%d, to=%d)\n", uvwasi, from, to); + if (uvwasi == NULL) return UVWASI_EINVAL; - return uvwasi_fd_table_renumber(uvwasi, &uvwasi->fds, to, from); + return uvwasi_fd_table_renumber(uvwasi, uvwasi->fds, to, from); } @@ -1186,10 +1322,18 @@ uvwasi_errno_t uvwasi_fd_seek(uvwasi_t* uvwasi, struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; + DEBUG("uvwasi_fd_seek(uvwasi=%p, fd=%d, offset=%"PRId64", " + "whence=%d, newoffset=%p)\n", + uvwasi, + fd, + offset, + whence, + newoffset); + if (uvwasi == NULL || newoffset == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_SEEK, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_SEEK, 0); if (err != UVWASI_ESUCCESS) return err; @@ -1205,10 +1349,12 @@ uvwasi_errno_t uvwasi_fd_sync(uvwasi_t* uvwasi, uvwasi_fd_t fd) { uvwasi_errno_t err; int r; + DEBUG("uvwasi_fd_sync(uvwasi=%p, fd=%d)\n", uvwasi, fd); + if (uvwasi == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_SYNC, @@ -1233,10 +1379,12 @@ uvwasi_errno_t uvwasi_fd_tell(uvwasi_t* uvwasi, struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; + DEBUG("uvwasi_fd_tell(uvwasi=%p, fd=%d, offset=%p)\n", uvwasi, fd, offset); + if (uvwasi == NULL || offset == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_TELL, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_TELL, 0); if (err != UVWASI_ESUCCESS) return err; @@ -1249,8 +1397,8 @@ uvwasi_errno_t uvwasi_fd_tell(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi, uvwasi_fd_t fd, const uvwasi_ciovec_t* iovs, - size_t iovs_len, - size_t* nwritten) { + uvwasi_size_t iovs_len, + uvwasi_size_t* nwritten) { struct uvwasi_fd_wrap_t* wrap; uv_buf_t* bufs; uv_fs_t req; @@ -1258,10 +1406,18 @@ uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi, size_t uvwritten; int r; + DEBUG("uvwasi_fd_write(uvwasi=%p, fd=%d, iovs=%p, iovs_len=%zu, " + "nwritten=%p)\n", + uvwasi, + fd, + iovs, + iovs_len, + nwritten); + if (uvwasi == NULL || iovs == NULL || nwritten == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_WRITE, 0); + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_WRITE, 0); if (err != UVWASI_ESUCCESS) return err; @@ -1280,7 +1436,7 @@ uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi, if (r < 0) return uvwasi__translate_uv_error(r); - *nwritten = uvwritten; + *nwritten = (uvwasi_size_t) uvwritten; return UVWASI_ESUCCESS; } @@ -1288,17 +1444,24 @@ uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_create_directory(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len) { - char resolved_path[PATH_MAX_BYTES]; + uvwasi_size_t path_len) { + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uv_fs_t req; uvwasi_errno_t err; int r; + DEBUG("uvwasi_path_create_directory(uvwasi=%p, fd=%d, path='%s', " + "path_len=%zu)\n", + uvwasi, + fd, + path, + path_len); + if (uvwasi == NULL || path == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_CREATE_DIRECTORY, @@ -1306,12 +1469,13 @@ uvwasi_errno_t uvwasi_path_create_directory(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; - err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, resolved_path, 0); + err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, &resolved_path, 0); if (err != UVWASI_ESUCCESS) goto exit; r = uv_fs_mkdir(NULL, &req, resolved_path, 0777, NULL); uv_fs_req_cleanup(&req); + uvwasi__free(uvwasi, resolved_path); if (r != 0) { err = uvwasi__translate_uv_error(r); @@ -1329,18 +1493,27 @@ uvwasi_errno_t uvwasi_path_filestat_get(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_lookupflags_t flags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_filestat_t* buf) { - char resolved_path[PATH_MAX_BYTES]; + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uv_fs_t req; uvwasi_errno_t err; int r; + DEBUG("uvwasi_path_filestat_get(uvwasi=%p, fd=%d, flags=%d, path='%s', " + "path_len=%zu, buf=%p)\n", + uvwasi, + fd, + flags, + path, + path_len, + buf); + if (uvwasi == NULL || path == NULL || buf == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_FILESTAT_GET, @@ -1352,12 +1525,13 @@ uvwasi_errno_t uvwasi_path_filestat_get(uvwasi_t* uvwasi, wrap, path, path_len, - resolved_path, + &resolved_path, flags); if (err != UVWASI_ESUCCESS) goto exit; r = uv_fs_stat(NULL, &req, resolved_path, NULL); + uvwasi__free(uvwasi, resolved_path); if (r != 0) { uv_fs_req_cleanup(&req); err = uvwasi__translate_uv_error(r); @@ -1377,17 +1551,28 @@ uvwasi_errno_t uvwasi_path_filestat_set_times(uvwasi_t* uvwasi, uvwasi_fd_t fd, uvwasi_lookupflags_t flags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_timestamp_t st_atim, uvwasi_timestamp_t st_mtim, uvwasi_fstflags_t fst_flags) { /* TODO(cjihrig): libuv does not currently support nanosecond precision. */ - char resolved_path[PATH_MAX_BYTES]; + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uv_fs_t req; uvwasi_errno_t err; int r; + DEBUG("uvwasi_path_filestat_set_times(uvwasi=%p, fd=%d, flags=%d, path='%s', " + "path_len=%zu, st_atim=%"PRIu64", st_mtim=%"PRIu64", fst_flags=%d)\n", + uvwasi, + fd, + flags, + path, + path_len, + st_atim, + st_mtim, + fst_flags); + if (uvwasi == NULL || path == NULL) return UVWASI_EINVAL; @@ -1396,7 +1581,7 @@ uvwasi_errno_t uvwasi_path_filestat_set_times(uvwasi_t* uvwasi, return UVWASI_EINVAL; } - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES, @@ -1408,13 +1593,14 @@ uvwasi_errno_t uvwasi_path_filestat_set_times(uvwasi_t* uvwasi, wrap, path, path_len, - resolved_path, + &resolved_path, flags); if (err != UVWASI_ESUCCESS) goto exit; /* TODO(cjihrig): st_atim and st_mtim should not be unconditionally passed. */ r = uv_fs_utime(NULL, &req, resolved_path, st_atim, st_mtim, NULL); + uvwasi__free(uvwasi, resolved_path); uv_fs_req_cleanup(&req); if (r != 0) { @@ -1433,25 +1619,36 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, uvwasi_fd_t old_fd, uvwasi_lookupflags_t old_flags, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t new_fd, const char* new_path, - size_t new_path_len) { - char resolved_old_path[PATH_MAX_BYTES]; - char resolved_new_path[PATH_MAX_BYTES]; + uvwasi_size_t new_path_len) { + char* resolved_old_path; + char* resolved_new_path; struct uvwasi_fd_wrap_t* old_wrap; struct uvwasi_fd_wrap_t* new_wrap; uvwasi_errno_t err; uv_fs_t req; int r; + DEBUG("uvwasi_path_link(uvwasi=%p, old_fd=%d, old_flags=%d, old_path='%s', " + "old_path_len=%zu, new_fd=%d, new_path='%s', new_path_len=%zu)\n", + uvwasi, + old_fd, + old_flags, + old_path, + old_path_len, + new_fd, + new_path, + new_path_len); + if (uvwasi == NULL || old_path == NULL || new_path == NULL) return UVWASI_EINVAL; - uvwasi_fd_table_lock(&uvwasi->fds); + uvwasi_fd_table_lock(uvwasi->fds); if (old_fd == new_fd) { - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, old_fd, &old_wrap, UVWASI_RIGHT_PATH_LINK_SOURCE | @@ -1459,17 +1656,17 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, 0); new_wrap = old_wrap; } else { - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, old_fd, &old_wrap, UVWASI_RIGHT_PATH_LINK_SOURCE, 0); if (err != UVWASI_ESUCCESS) { - uvwasi_fd_table_unlock(&uvwasi->fds); + uvwasi_fd_table_unlock(uvwasi->fds); return err; } - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, new_fd, &new_wrap, UVWASI_RIGHT_PATH_LINK_TARGET, @@ -1478,16 +1675,19 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, uv_mutex_unlock(&old_wrap->mutex); } - uvwasi_fd_table_unlock(&uvwasi->fds); + uvwasi_fd_table_unlock(uvwasi->fds); if (err != UVWASI_ESUCCESS) return err; + resolved_old_path = NULL; + resolved_new_path = NULL; + err = uvwasi__resolve_path(uvwasi, old_wrap, old_path, old_path_len, - resolved_old_path, + &resolved_old_path, old_flags); if (err != UVWASI_ESUCCESS) goto exit; @@ -1496,7 +1696,7 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, new_wrap, new_path, new_path_len, - resolved_new_path, + &resolved_new_path, 0); if (err != UVWASI_ESUCCESS) goto exit; @@ -1513,6 +1713,9 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi, uv_mutex_unlock(&new_wrap->mutex); if (old_fd != new_fd) uv_mutex_unlock(&old_wrap->mutex); + + uvwasi__free(uvwasi, resolved_old_path); + uvwasi__free(uvwasi, resolved_new_path); return err; } @@ -1521,13 +1724,13 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, uvwasi_fd_t dirfd, uvwasi_lookupflags_t dirflags, const char* path, - size_t path_len, + uvwasi_size_t path_len, uvwasi_oflags_t o_flags, uvwasi_rights_t fs_rights_base, uvwasi_rights_t fs_rights_inheriting, uvwasi_fdflags_t fs_flags, uvwasi_fd_t* fd) { - char resolved_path[PATH_MAX_BYTES]; + char* resolved_path; uvwasi_rights_t needed_inheriting; uvwasi_rights_t needed_base; uvwasi_rights_t max_base; @@ -1542,6 +1745,20 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, int write; int r; + DEBUG("uvwasi_path_open(uvwasi=%p, dirfd=%d, dirflags=%d, path='%s', " + "path_len=%zu, o_flags=%d, fs_rights_base=%"PRIu64", " + "fs_rights_inheriting=%"PRIu64", fs_flags=%d, fd=%p)\n", + uvwasi, + dirfd, + dirflags, + path, + path_len, + o_flags, + fs_rights_base, + fs_rights_inheriting, + fs_flags, + fd); + if (uvwasi == NULL || path == NULL || fd == NULL) return UVWASI_EINVAL; @@ -1591,7 +1808,7 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, if (write && (flags & (UV_FS_O_APPEND | UV_FS_O_TRUNC)) == 0) needed_inheriting |= UVWASI_RIGHT_FD_SEEK; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, dirfd, &dirfd_wrap, needed_base, @@ -1603,7 +1820,7 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, dirfd_wrap, path, path_len, - resolved_path, + &resolved_path, dirflags); if (err != UVWASI_ESUCCESS) { uv_mutex_unlock(&dirfd_wrap->mutex); @@ -1614,8 +1831,10 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, uv_mutex_unlock(&dirfd_wrap->mutex); uv_fs_req_cleanup(&req); - if (r < 0) + if (r < 0) { + uvwasi__free(uvwasi, resolved_path); return uvwasi__translate_uv_error(r); + } /* Not all platforms support UV_FS_O_DIRECTORY, so get the file type and check it here. */ @@ -1634,7 +1853,7 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, goto close_file_and_error_exit; err = uvwasi_fd_table_insert(uvwasi, - &uvwasi->fds, + uvwasi->fds, r, resolved_path, resolved_path, @@ -1648,11 +1867,13 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, *fd = wrap->id; uv_mutex_unlock(&wrap->mutex); + uvwasi__free(uvwasi, resolved_path); return UVWASI_ESUCCESS; close_file_and_error_exit: uv_fs_close(NULL, &req, r, NULL); uv_fs_req_cleanup(&req); + uvwasi__free(uvwasi, resolved_path); return err; } @@ -1660,21 +1881,31 @@ uvwasi_errno_t uvwasi_path_open(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len, + uvwasi_size_t path_len, char* buf, - size_t buf_len, - size_t* bufused) { - char resolved_path[PATH_MAX_BYTES]; + uvwasi_size_t buf_len, + uvwasi_size_t* bufused) { + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; uv_fs_t req; size_t len; int r; + DEBUG("uvwasi_path_readlink(uvwasi=%p, fd=%d, path='%s', path_len=%zu, " + "buf=%p, buf_len=%zu, bufused=%p)\n", + uvwasi, + fd, + path, + path_len, + buf, + buf_len, + bufused); + if (uvwasi == NULL || path == NULL || buf == NULL || bufused == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_READLINK, @@ -1682,7 +1913,7 @@ uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; - err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, resolved_path, 0); + err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, &resolved_path, 0); if (err != UVWASI_ESUCCESS) { uv_mutex_unlock(&wrap->mutex); return err; @@ -1690,6 +1921,7 @@ uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, r = uv_fs_readlink(NULL, &req, resolved_path, NULL); uv_mutex_unlock(&wrap->mutex); + uvwasi__free(uvwasi, resolved_path); if (r != 0) { uv_fs_req_cleanup(&req); return uvwasi__translate_uv_error(r); @@ -1712,17 +1944,24 @@ uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_remove_directory(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len) { - char resolved_path[PATH_MAX_BYTES]; + uvwasi_size_t path_len) { + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uv_fs_t req; uvwasi_errno_t err; int r; + DEBUG("uvwasi_path_remove_directory(uvwasi=%p, fd=%d, path='%s', " + "path_len=%zu)\n", + uvwasi, + fd, + path, + path_len); + if (uvwasi == NULL || path == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_REMOVE_DIRECTORY, @@ -1730,7 +1969,7 @@ uvwasi_errno_t uvwasi_path_remove_directory(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; - err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, resolved_path, 0); + err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, &resolved_path, 0); if (err != UVWASI_ESUCCESS) { uv_mutex_unlock(&wrap->mutex); return err; @@ -1738,6 +1977,7 @@ uvwasi_errno_t uvwasi_path_remove_directory(uvwasi_t* uvwasi, r = uv_fs_rmdir(NULL, &req, resolved_path, NULL); uv_mutex_unlock(&wrap->mutex); + uvwasi__free(uvwasi, resolved_path); uv_fs_req_cleanup(&req); if (r != 0) @@ -1750,25 +1990,35 @@ uvwasi_errno_t uvwasi_path_remove_directory(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, uvwasi_fd_t old_fd, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t new_fd, const char* new_path, - size_t new_path_len) { - char resolved_old_path[PATH_MAX_BYTES]; - char resolved_new_path[PATH_MAX_BYTES]; + uvwasi_size_t new_path_len) { + char* resolved_old_path; + char* resolved_new_path; struct uvwasi_fd_wrap_t* old_wrap; struct uvwasi_fd_wrap_t* new_wrap; uvwasi_errno_t err; uv_fs_t req; int r; + DEBUG("uvwasi_path_rename(uvwasi=%p, old_fd=%d, old_path='%s', " + "old_path_len=%zu, new_fd=%d, new_path='%s', new_path_len=%zu)\n", + uvwasi, + old_fd, + old_path, + old_path_len, + new_fd, + new_path, + new_path_len); + if (uvwasi == NULL || old_path == NULL || new_path == NULL) return UVWASI_EINVAL; - uvwasi_fd_table_lock(&uvwasi->fds); + uvwasi_fd_table_lock(uvwasi->fds); if (old_fd == new_fd) { - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, old_fd, &old_wrap, UVWASI_RIGHT_PATH_RENAME_SOURCE | @@ -1776,17 +2026,17 @@ uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, 0); new_wrap = old_wrap; } else { - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, old_fd, &old_wrap, UVWASI_RIGHT_PATH_RENAME_SOURCE, 0); if (err != UVWASI_ESUCCESS) { - uvwasi_fd_table_unlock(&uvwasi->fds); + uvwasi_fd_table_unlock(uvwasi->fds); return err; } - err = uvwasi_fd_table_get_nolock(&uvwasi->fds, + err = uvwasi_fd_table_get_nolock(uvwasi->fds, new_fd, &new_wrap, UVWASI_RIGHT_PATH_RENAME_TARGET, @@ -1795,16 +2045,19 @@ uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, uv_mutex_unlock(&old_wrap->mutex); } - uvwasi_fd_table_unlock(&uvwasi->fds); + uvwasi_fd_table_unlock(uvwasi->fds); if (err != UVWASI_ESUCCESS) return err; + resolved_old_path = NULL; + resolved_new_path = NULL; + err = uvwasi__resolve_path(uvwasi, old_wrap, old_path, old_path_len, - resolved_old_path, + &resolved_old_path, 0); if (err != UVWASI_ESUCCESS) goto exit; @@ -1813,7 +2066,7 @@ uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, new_wrap, new_path, new_path_len, - resolved_new_path, + &resolved_new_path, 0); if (err != UVWASI_ESUCCESS) goto exit; @@ -1831,26 +2084,37 @@ uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi, if (old_fd != new_fd) uv_mutex_unlock(&old_wrap->mutex); + uvwasi__free(uvwasi, resolved_old_path); + uvwasi__free(uvwasi, resolved_new_path); return err; } uvwasi_errno_t uvwasi_path_symlink(uvwasi_t* uvwasi, const char* old_path, - size_t old_path_len, + uvwasi_size_t old_path_len, uvwasi_fd_t fd, const char* new_path, - size_t new_path_len) { - char resolved_new_path[PATH_MAX_BYTES]; + uvwasi_size_t new_path_len) { + char* resolved_new_path; struct uvwasi_fd_wrap_t* wrap; uvwasi_errno_t err; uv_fs_t req; int r; + DEBUG("uvwasi_path_symlink(uvwasi=%p, old_path='%s', old_path_len=%zu, " + "fd=%d, new_path='%s', new_path_len=%zu)\n", + uvwasi, + old_path, + old_path_len, + fd, + new_path, + new_path_len); + if (uvwasi == NULL || old_path == NULL || new_path == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_SYMLINK, @@ -1862,7 +2126,7 @@ uvwasi_errno_t uvwasi_path_symlink(uvwasi_t* uvwasi, wrap, new_path, new_path_len, - resolved_new_path, + &resolved_new_path, 0); if (err != UVWASI_ESUCCESS) { uv_mutex_unlock(&wrap->mutex); @@ -1872,6 +2136,7 @@ uvwasi_errno_t uvwasi_path_symlink(uvwasi_t* uvwasi, /* Windows support may require setting the flags option. */ r = uv_fs_symlink(NULL, &req, old_path, resolved_new_path, 0, NULL); uv_mutex_unlock(&wrap->mutex); + uvwasi__free(uvwasi, resolved_new_path); uv_fs_req_cleanup(&req); if (r != 0) return uvwasi__translate_uv_error(r); @@ -1883,17 +2148,23 @@ uvwasi_errno_t uvwasi_path_symlink(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_path_unlink_file(uvwasi_t* uvwasi, uvwasi_fd_t fd, const char* path, - size_t path_len) { - char resolved_path[PATH_MAX_BYTES]; + uvwasi_size_t path_len) { + char* resolved_path; struct uvwasi_fd_wrap_t* wrap; uv_fs_t req; uvwasi_errno_t err; int r; + DEBUG("uvwasi_path_unlink_file(uvwasi=%p, fd=%d, path='%s', path_len=%zu)\n", + uvwasi, + fd, + path, + path_len); + if (uvwasi == NULL || path == NULL) return UVWASI_EINVAL; - err = uvwasi_fd_table_get(&uvwasi->fds, + err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_PATH_UNLINK_FILE, @@ -1901,7 +2172,7 @@ uvwasi_errno_t uvwasi_path_unlink_file(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; - err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, resolved_path, 0); + err = uvwasi__resolve_path(uvwasi, wrap, path, path_len, &resolved_path, 0); if (err != UVWASI_ESUCCESS) { uv_mutex_unlock(&wrap->mutex); return err; @@ -1909,6 +2180,7 @@ uvwasi_errno_t uvwasi_path_unlink_file(uvwasi_t* uvwasi, r = uv_fs_unlink(NULL, &req, resolved_path, NULL); uv_mutex_unlock(&wrap->mutex); + uvwasi__free(uvwasi, resolved_path); uv_fs_req_cleanup(&req); if (r != 0) @@ -1921,14 +2193,127 @@ uvwasi_errno_t uvwasi_path_unlink_file(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi, const uvwasi_subscription_t* in, uvwasi_event_t* out, - size_t nsubscriptions, - size_t* nevents) { - /* TODO(cjihrig): Implement this. */ - return UVWASI_ENOTSUP; + uvwasi_size_t nsubscriptions, + uvwasi_size_t* nevents) { + struct uvwasi_poll_oneoff_state_t state; + struct uvwasi__poll_fdevent_t* fdevent; + uvwasi_userdata_t timer_userdata; + uvwasi_timestamp_t min_timeout; + uvwasi_timestamp_t cur_timeout; + uvwasi_timestamp_t now; + uvwasi_subscription_t sub; + uvwasi_event_t* event; + uvwasi_errno_t err; + int has_timeout; + uvwasi_size_t i; + + DEBUG("uvwasi_poll_oneoff(uvwasi=%p, in=%p, out=%p, nsubscriptions=%zu, " + "nevents=%p)\n", + uvwasi, + in, + out, + nsubscriptions, + nevents); + + if (uvwasi == NULL || in == NULL || out == NULL || + nsubscriptions == 0 || nevents == NULL) { + return UVWASI_EINVAL; + } + + *nevents = 0; + err = uvwasi__poll_oneoff_state_init(uvwasi, &state, nsubscriptions); + if (err != UVWASI_ESUCCESS) + return err; + + has_timeout = 0; + min_timeout = 0; + + for (i = 0; i < nsubscriptions; i++) { + sub = in[i]; + + switch (sub.type) { + case UVWASI_EVENTTYPE_CLOCK: + if (sub.u.clock.flags == UVWASI_SUBSCRIPTION_CLOCK_ABSTIME) { + /* Convert absolute time to relative delay. */ + err = uvwasi__clock_gettime_realtime(&now); + if (err != UVWASI_ESUCCESS) + goto exit; + + cur_timeout = sub.u.clock.timeout - now; + } else { + cur_timeout = sub.u.clock.timeout; + } + + if (has_timeout == 0 || cur_timeout < min_timeout) { + min_timeout = cur_timeout; + timer_userdata = sub.userdata; + has_timeout = 1; + } + + break; + case UVWASI_EVENTTYPE_FD_READ: + case UVWASI_EVENTTYPE_FD_WRITE: + err = uvwasi__poll_oneoff_state_add_fdevent(&state, &sub); + if (err != UVWASI_ESUCCESS) + goto exit; + + break; + default: + err = UVWASI_EINVAL; + goto exit; + } + } + + if (has_timeout == 1) { + err = uvwasi__poll_oneoff_state_set_timer(&state, min_timeout); + if (err != UVWASI_ESUCCESS) + goto exit; + } + + /* Handle poll() errors, then timeouts, then happy path. */ + err = uvwasi__poll_oneoff_run(&state); + if (err != UVWASI_ESUCCESS) { + goto exit; + } else if (state.result == 0) { + event = &out[0]; + event->userdata = timer_userdata; + event->error = UVWASI_ESUCCESS; + event->type = UVWASI_EVENTTYPE_CLOCK; + *nevents = 1; + } else { + for (i = 0; i < state.fdevent_cnt; i++) { + fdevent = &state.fdevents[i]; + event = &out[*nevents]; + + event->userdata = fdevent->userdata; + event->error = fdevent->error; + event->type = fdevent->type; + event->u.fd_readwrite.nbytes = 0; + event->u.fd_readwrite.flags = 0; + + if (fdevent->error != UVWASI_ESUCCESS) + ; + else if ((fdevent->revents & UV_DISCONNECT) != 0) + event->u.fd_readwrite.flags = UVWASI_EVENT_FD_READWRITE_HANGUP; + else if ((fdevent->revents & (UV_READABLE | UV_WRITABLE)) != 0) + ; /* TODO(cjihrig): Set nbytes if type is UVWASI_EVENTTYPE_FD_READ. */ + else + continue; + + *nevents = *nevents + 1; + } + } + + err = UVWASI_ESUCCESS; + +exit: + uvwasi__poll_oneoff_state_cleanup(&state); + return err; } uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval) { + DEBUG("uvwasi_proc_exit(uvwasi=%p, rval=%d)\n", uvwasi, rval); exit(rval); return UVWASI_ESUCCESS; /* This doesn't happen. */ } @@ -1937,6 +2322,8 @@ uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval) { uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig) { int r; + DEBUG("uvwasi_proc_raise(uvwasi=%p, sig=%d)\n", uvwasi, sig); + if (uvwasi == NULL) return UVWASI_EINVAL; @@ -1952,9 +2339,16 @@ uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig) { } -uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len) { +uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, + void* buf, + uvwasi_size_t buf_len) { int r; + DEBUG("uvwasi_random_get(uvwasi=%p, buf=%p, buf_len=%zu)\n", + uvwasi, + buf, + buf_len); + if (uvwasi == NULL || buf == NULL) return UVWASI_EINVAL; @@ -1967,6 +2361,8 @@ uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len) { uvwasi_errno_t uvwasi_sched_yield(uvwasi_t* uvwasi) { + DEBUG("uvwasi_sched_yield(uvwasi=%p)\n", uvwasi); + if (uvwasi == NULL) return UVWASI_EINVAL; @@ -1984,12 +2380,13 @@ uvwasi_errno_t uvwasi_sched_yield(uvwasi_t* uvwasi) { uvwasi_errno_t uvwasi_sock_recv(uvwasi_t* uvwasi, uvwasi_fd_t sock, const uvwasi_iovec_t* ri_data, - size_t ri_data_len, + uvwasi_size_t ri_data_len, uvwasi_riflags_t ri_flags, - size_t* ro_datalen, + uvwasi_size_t* ro_datalen, uvwasi_roflags_t* ro_flags) { /* TODO(cjihrig): Waiting to implement, pending https://github.com/WebAssembly/WASI/issues/4 */ + DEBUG("uvwasi_sock_recv(uvwasi=%p, unimplemented)\n", uvwasi); return UVWASI_ENOTSUP; } @@ -1997,11 +2394,12 @@ uvwasi_errno_t uvwasi_sock_recv(uvwasi_t* uvwasi, uvwasi_errno_t uvwasi_sock_send(uvwasi_t* uvwasi, uvwasi_fd_t sock, const uvwasi_ciovec_t* si_data, - size_t si_data_len, + uvwasi_size_t si_data_len, uvwasi_siflags_t si_flags, - size_t* so_datalen) { + uvwasi_size_t* so_datalen) { /* TODO(cjihrig): Waiting to implement, pending https://github.com/WebAssembly/WASI/issues/4 */ + DEBUG("uvwasi_sock_send(uvwasi=%p, unimplemented)\n", uvwasi); return UVWASI_ENOTSUP; } @@ -2011,6 +2409,7 @@ uvwasi_errno_t uvwasi_sock_shutdown(uvwasi_t* uvwasi, uvwasi_sdflags_t how) { /* TODO(cjihrig): Waiting to implement, pending https://github.com/WebAssembly/WASI/issues/4 */ + DEBUG("uvwasi_sock_shutdown(uvwasi=%p, unimplemented)\n", uvwasi); return UVWASI_ENOTSUP; } diff --git a/deps/uvwasi/src/wasi_serdes.c b/deps/uvwasi/src/wasi_serdes.c new file mode 100644 index 00000000000000..96253fc5af0623 --- /dev/null +++ b/deps/uvwasi/src/wasi_serdes.c @@ -0,0 +1,259 @@ +#include "wasi_serdes.h" +#include "wasi_types.h" + +void uvwasi_serdes_write_uint64_t(void* ptr, + size_t offset, + uint64_t value) { + uvwasi_serdes_write_uint32_t(ptr, offset, (uint32_t) value); + uvwasi_serdes_write_uint32_t(ptr, offset + 4, value >> 32); +} + +void uvwasi_serdes_write_uint32_t(void* ptr, + size_t offset, + uint32_t value) { + uvwasi_serdes_write_uint16_t(ptr, offset, (uint16_t) value); + uvwasi_serdes_write_uint16_t(ptr, offset + 2, value >> 16); +} + +void uvwasi_serdes_write_uint16_t(void* ptr, + size_t offset, + uint16_t value) { + uvwasi_serdes_write_uint8_t(ptr, offset, (uint8_t) value); + uvwasi_serdes_write_uint8_t(ptr, offset + 1, value >> 8); +} + +void uvwasi_serdes_write_uint8_t(void* ptr, + size_t offset, + uint8_t value) { + ((uint8_t*) ptr)[offset] = value; +} + +uint64_t uvwasi_serdes_read_uint64_t(const void* ptr, size_t offset) { + uint64_t low = uvwasi_serdes_read_uint32_t(ptr, offset); + uint64_t high = uvwasi_serdes_read_uint32_t(ptr, offset + 4); + return low | (high << 32); +} + +uint32_t uvwasi_serdes_read_uint32_t(const void* ptr, size_t offset) { + uint32_t low = uvwasi_serdes_read_uint16_t(ptr, offset); + uint32_t high = uvwasi_serdes_read_uint16_t(ptr, offset + 2); + return low | (high << 16); +} + +uint16_t uvwasi_serdes_read_uint16_t(const void* ptr, size_t offset) { + uint16_t low = uvwasi_serdes_read_uint8_t(ptr, offset); + uint16_t high = uvwasi_serdes_read_uint8_t(ptr, offset + 1); + return low | (high << 8); +} + +uint8_t uvwasi_serdes_read_uint8_t(const void* ptr, size_t offset) { + return ((const uint8_t*) ptr)[offset]; +} + +#define TYPE_SWITCH switch (value->type) + +#define ALL_TYPES(STRUCT, FIELD, ALIAS) \ + \ + ALIAS(advice_t, uint8_t) \ + ALIAS(clockid_t, uint32_t) \ + ALIAS(device_t, uint64_t) \ + ALIAS(dircookie_t, uint64_t) \ + ALIAS(errno_t, uint16_t) \ + ALIAS(eventrwflags_t, uint16_t) \ + ALIAS(eventtype_t, uint8_t) \ + ALIAS(exitcode_t, uint32_t) \ + ALIAS(fd_t, uint32_t) \ + ALIAS(fdflags_t, uint16_t) \ + ALIAS(filesize_t, uint64_t) \ + ALIAS(filetype_t, uint8_t) \ + ALIAS(fstflags_t, uint16_t) \ + ALIAS(inode_t, uint64_t) \ + ALIAS(linkcount_t, uint64_t) \ + ALIAS(lookupflags_t, uint32_t) \ + ALIAS(oflags_t, uint16_t) \ + ALIAS(preopentype_t, uint8_t) \ + ALIAS(riflags_t, uint16_t) \ + ALIAS(rights_t, uint64_t) \ + ALIAS(roflags_t, uint16_t) \ + ALIAS(sdflags_t, uint8_t) \ + ALIAS(siflags_t, uint16_t) \ + ALIAS(signal_t, uint8_t) \ + ALIAS(size_t, uint32_t) \ + ALIAS(subclockflags_t, uint16_t) \ + ALIAS(timestamp_t, uint64_t) \ + ALIAS(userdata_t, uint64_t) \ + ALIAS(whence_t, uint8_t) \ + \ + STRUCT(fdstat_t) { \ + FIELD( 0, filetype_t, fs_filetype); \ + FIELD( 2, fdflags_t, fs_flags); \ + FIELD( 8, rights_t, fs_rights_base); \ + FIELD(16, rights_t, fs_rights_inheriting); \ + } \ + \ + STRUCT(filestat_t) { \ + FIELD( 0, device_t, st_dev); \ + FIELD( 8, inode_t, st_ino); \ + FIELD(16, filetype_t, st_filetype); \ + FIELD(24, linkcount_t, st_nlink); \ + FIELD(32, filesize_t, st_size); \ + FIELD(40, timestamp_t, st_atim); \ + FIELD(48, timestamp_t, st_mtim); \ + FIELD(56, timestamp_t, st_ctim); \ + } \ + \ + STRUCT(prestat_t) { \ + FIELD(0, preopentype_t, pr_type); \ + FIELD(4, uint32_t, u.dir.pr_name_len); \ + } \ + \ + STRUCT(event_t) { \ + FIELD( 0, userdata_t, userdata); \ + FIELD( 8, errno_t, error); \ + FIELD(10, eventtype_t, type); \ + TYPE_SWITCH { \ + case UVWASI_EVENTTYPE_FD_READ: \ + case UVWASI_EVENTTYPE_FD_WRITE: \ + FIELD(16, filesize_t, u.fd_readwrite.nbytes); \ + FIELD(24, eventrwflags_t, u.fd_readwrite.flags); \ + } \ + } \ + \ + STRUCT(subscription_t) { \ + FIELD(0, userdata_t, userdata); \ + FIELD(8, eventtype_t, type); \ + TYPE_SWITCH { \ + case UVWASI_EVENTTYPE_CLOCK: \ + FIELD(16, clockid_t, u.clock.clock_id); \ + FIELD(24, timestamp_t, u.clock.timeout); \ + FIELD(32, timestamp_t, u.clock.precision); \ + FIELD(40, subclockflags_t, u.clock.flags); \ + break; \ + case UVWASI_EVENTTYPE_FD_READ: \ + case UVWASI_EVENTTYPE_FD_WRITE: \ + FIELD(16, fd_t, u.fd_readwrite.fd); \ + } \ + } \ + +#define WRITE_STRUCT(name) \ + void uvwasi_serdes_write_##name(void* ptr, \ + size_t offset, \ + const uvwasi_##name* value) \ + +#define READ_STRUCT(name) \ + void uvwasi_serdes_read_##name(const void* ptr, \ + size_t offset, \ + uvwasi_##name* value) \ + +#define WRITE_FIELD(field_offset, type, field) \ + do { \ + uvwasi_serdes_write_##type(ptr, offset + field_offset, value->field); \ + } while (0) \ + +#define READ_FIELD(field_offset, type, field) \ + do { \ + value->field = uvwasi_serdes_read_##type(ptr, offset + field_offset); \ + } while (0) \ + +#define WRITE_ALIAS(new_name, old_name) \ + void uvwasi_serdes_write_##new_name(void* ptr, \ + size_t offset, \ + uvwasi_##new_name value) { \ + uvwasi_serdes_write_##old_name(ptr, offset, value); \ + } \ + +#define READ_ALIAS(new_name, old_name) \ + uvwasi_##new_name uvwasi_serdes_read_##new_name(const void* ptr, \ + size_t offset) { \ + return uvwasi_serdes_read_##old_name(ptr, offset); \ + } \ + +ALL_TYPES(WRITE_STRUCT, WRITE_FIELD, WRITE_ALIAS) +ALL_TYPES(READ_STRUCT, READ_FIELD, READ_ALIAS) + + +uvwasi_errno_t uvwasi_serdes_read_ciovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_ciovec_t* value) { + uint32_t buf_ptr; + + buf_ptr = uvwasi_serdes_read_uint32_t(ptr, offset); + value->buf_len = uvwasi_serdes_read_size_t(ptr, offset + 4); + + if (!uvwasi_serdes_check_bounds(buf_ptr, end, value->buf_len)) + return UVWASI_EOVERFLOW; + + value->buf = ((uint8_t*) ptr + buf_ptr); + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi_serdes_read_iovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_iovec_t* value) { + uint32_t buf_ptr; + + buf_ptr = uvwasi_serdes_read_uint32_t(ptr, offset); + value->buf_len = uvwasi_serdes_read_size_t(ptr, offset + 4); + + if (!uvwasi_serdes_check_bounds(buf_ptr, end, value->buf_len)) + return UVWASI_EOVERFLOW; + + value->buf = ((uint8_t*) ptr + buf_ptr); + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi_serdes_readv_ciovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_ciovec_t* iovs, + uvwasi_size_t iovs_len) { + uvwasi_errno_t err; + uvwasi_size_t i; + + for (i = 0; i < iovs_len; i++) { + err = uvwasi_serdes_read_ciovec_t(ptr, end, offset, &iovs[i]); + if (err != UVWASI_ESUCCESS) + return err; + offset += UVWASI_SERDES_SIZE_ciovec_t; + } + + return UVWASI_ESUCCESS; +} + + +uvwasi_errno_t uvwasi_serdes_readv_iovec_t(const void* ptr, + size_t end, + size_t offset, + uvwasi_iovec_t* iovs, + uvwasi_size_t iovs_len) { + uvwasi_errno_t err; + uvwasi_size_t i; + + for (i = 0; i < iovs_len; i++) { + err = uvwasi_serdes_read_iovec_t(ptr, end, offset, &iovs[i]); + if (err != UVWASI_ESUCCESS) + return err; + offset += UVWASI_SERDES_SIZE_iovec_t; + } + + return UVWASI_ESUCCESS; +} + + +int uvwasi_serdes_check_bounds(size_t offset, size_t end, size_t size) { + return end > offset && size <= (end - offset); +} + + +int uvwasi_serdes_check_array_bounds(size_t offset, + size_t end, + size_t size, + size_t count) { + return end > offset && + ((count * size) / size == count) && + (count * size <= end - offset); +} diff --git a/deps/uvwasi/uvwasi.gyp b/deps/uvwasi/uvwasi.gyp index 42769095ecbafd..d4189eeee2fc94 100644 --- a/deps/uvwasi/uvwasi.gyp +++ b/deps/uvwasi/uvwasi.gyp @@ -12,9 +12,11 @@ 'src/clocks.c', 'src/fd_table.c', 'src/path_resolver.c', + 'src/poll_oneoff.c', 'src/uv_mapping.c', 'src/uvwasi.c', 'src/wasi_rights.c', + 'src/wasi_serdes.c', ], 'dependencies': [ '../uv/uv.gyp:libuv', diff --git a/deps/v8/src/json/json-parser.cc b/deps/v8/src/json/json-parser.cc index e49775704db86c..ae120f54bd1bc7 100644 --- a/deps/v8/src/json/json-parser.cc +++ b/deps/v8/src/json/json-parser.cc @@ -828,7 +828,7 @@ MaybeHandle JsonParser::ParseJsonValue() { Map maybe_feedback = JSObject::cast(*element_stack.back()).map(); // Don't consume feedback from objects with a map that's detached // from the transition tree. - if (!maybe_feedback.GetBackPointer().IsUndefined(isolate_)) { + if (!maybe_feedback.IsDetached(isolate_)) { feedback = handle(maybe_feedback, isolate_); } } diff --git a/deps/v8/src/objects/map-inl.h b/deps/v8/src/objects/map-inl.h index 48bb86e2dab454..6204a5043bbf8c 100644 --- a/deps/v8/src/objects/map-inl.h +++ b/deps/v8/src/objects/map-inl.h @@ -119,6 +119,12 @@ bool Map::CanHaveFastTransitionableElementsKind() const { return CanHaveFastTransitionableElementsKind(instance_type()); } +bool Map::IsDetached(Isolate* isolate) const { + if (is_prototype_map()) return true; + return instance_type() == JS_OBJECT_TYPE && NumberOfOwnDescriptors() > 0 && + GetBackPointer().IsUndefined(isolate); +} + // static void Map::GeneralizeIfCanHaveTransitionableFastElementsKind( Isolate* isolate, InstanceType instance_type, @@ -697,7 +703,10 @@ void Map::AppendDescriptor(Isolate* isolate, Descriptor* desc) { DEF_GETTER(Map, GetBackPointer, HeapObject) { Object object = constructor_or_backpointer(isolate); - if (object.IsMap(isolate)) { + // This is the equivalent of IsMap() but avoids reading the instance type so + // it can be used concurrently without acquire load. + if (object.IsHeapObject() && HeapObject::cast(object).map(isolate) == + GetReadOnlyRoots(isolate).meta_map()) { return Map::cast(object); } // Can't use ReadOnlyRoots(isolate) as this isolate could be produced by diff --git a/deps/v8/src/objects/map.cc b/deps/v8/src/objects/map.cc index a672d6580a0837..e5594ae78ccfa0 100644 --- a/deps/v8/src/objects/map.cc +++ b/deps/v8/src/objects/map.cc @@ -646,7 +646,7 @@ Map Map::FindRootMap(Isolate* isolate) const { // Initial map always owns descriptors and doesn't have unused entries // in the descriptor array. DCHECK(result.owns_descriptors()); - DCHECK_EQ(result.NumberOfOwnDescriptors(), + DCHECK_LE(result.NumberOfOwnDescriptors(), result.instance_descriptors().number_of_descriptors()); return result; } @@ -1192,7 +1192,7 @@ Map Map::FindElementsKindTransitionedMap(Isolate* isolate, DisallowHeapAllocation no_allocation; DisallowDeoptimization no_deoptimization(isolate); - if (is_prototype_map()) return Map(); + if (IsDetached(isolate)) return Map(); ElementsKind kind = elements_kind(); bool packed = IsFastPackedElementsKind(kind); @@ -1325,7 +1325,7 @@ static Handle AddMissingElementsTransitions(Isolate* isolate, ElementsKind kind = map->elements_kind(); TransitionFlag flag; - if (map->is_prototype_map()) { + if (map->IsDetached(isolate)) { flag = OMIT_TRANSITION; } else { flag = INSERT_TRANSITION; @@ -1687,15 +1687,15 @@ void Map::ConnectTransition(Isolate* isolate, Handle parent, child->may_have_interesting_symbols()); if (!parent->GetBackPointer().IsUndefined(isolate)) { parent->set_owns_descriptors(false); - } else { + } else if (!parent->IsDetached(isolate)) { // |parent| is initial map and it must keep the ownership, there must be no // descriptors in the descriptors array that do not belong to the map. DCHECK(parent->owns_descriptors()); DCHECK_EQ(parent->NumberOfOwnDescriptors(), parent->instance_descriptors().number_of_descriptors()); } - if (parent->is_prototype_map()) { - DCHECK(child->is_prototype_map()); + if (parent->IsDetached(isolate)) { + DCHECK(child->IsDetached(isolate)); if (FLAG_trace_maps) { LOG(isolate, MapEvent("Transition", *parent, *child, "prototype", *name)); } @@ -1722,7 +1722,9 @@ Handle Map::CopyReplaceDescriptors( result->set_may_have_interesting_symbols(true); } - if (!map->is_prototype_map()) { + if (map->is_prototype_map()) { + result->InitializeDescriptors(isolate, *descriptors, *layout_descriptor); + } else { if (flag == INSERT_TRANSITION && TransitionsAccessor(isolate, map).CanHaveMoreTransitions()) { result->InitializeDescriptors(isolate, *descriptors, *layout_descriptor); @@ -1733,19 +1735,11 @@ Handle Map::CopyReplaceDescriptors( descriptors->GeneralizeAllFields(); result->InitializeDescriptors(isolate, *descriptors, LayoutDescriptor::FastPointerLayout()); - // If we were trying to insert a transition but failed because there are - // too many transitions already, mark the object as a prototype to avoid - // tracking transitions from the detached map. - if (flag == INSERT_TRANSITION) { - result->set_is_prototype_map(true); - } } - } else { - result->InitializeDescriptors(isolate, *descriptors, *layout_descriptor); } if (FLAG_trace_maps && // Mirror conditions above that did not call ConnectTransition(). - (map->is_prototype_map() || + (map->IsDetached(isolate) || !(flag == INSERT_TRANSITION && TransitionsAccessor(isolate, map).CanHaveMoreTransitions()))) { LOG(isolate, MapEvent("ReplaceDescriptors", *map, *result, reason, @@ -1926,7 +1920,7 @@ Handle Map::AsLanguageMode(Isolate* isolate, Handle initial_map, } Handle Map::CopyForElementsTransition(Isolate* isolate, Handle map) { - DCHECK(!map->is_prototype_map()); + DCHECK(!map->IsDetached(isolate)); Handle new_map = CopyDropDescriptors(isolate, map); if (map->owns_descriptors()) { @@ -2126,7 +2120,7 @@ Handle Map::TransitionToDataProperty(Isolate* isolate, Handle map, StoreOrigin store_origin) { RuntimeCallTimerScope stats_scope( isolate, *map, - map->is_prototype_map() + map->IsDetached(isolate) ? RuntimeCallCounterId::kPrototypeMap_TransitionToDataProperty : RuntimeCallCounterId::kMap_TransitionToDataProperty); @@ -2238,7 +2232,7 @@ Handle Map::TransitionToAccessorProperty(Isolate* isolate, Handle map, PropertyAttributes attributes) { RuntimeCallTimerScope stats_scope( isolate, - map->is_prototype_map() + map->IsDetached(isolate) ? RuntimeCallCounterId::kPrototypeMap_TransitionToAccessorProperty : RuntimeCallCounterId::kMap_TransitionToAccessorProperty); diff --git a/deps/v8/src/objects/map.h b/deps/v8/src/objects/map.h index ef16019685f1c2..f87dcd06f9b1ab 100644 --- a/deps/v8/src/objects/map.h +++ b/deps/v8/src/objects/map.h @@ -428,6 +428,11 @@ class Map : public HeapObject { inline bool has_sealed_elements() const; inline bool has_frozen_elements() const; + // Weakly checks whether a map is detached from all transition trees. If this + // returns true, the map is guaranteed to be detached. If it returns false, + // there is no guarantee it is attached. + inline bool IsDetached(Isolate* isolate) const; + // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a // map with DICTIONARY_ELEMENTS was found in the prototype chain. bool DictionaryElementsInPrototypeChainOnly(Isolate* isolate); diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index d071820a298369..034879316aae06 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -68,7 +68,7 @@ function before(asyncId) { } // After is called just after the resource's callback has finished. function after(asyncId) { } -// Destroy is called when an AsyncWrap instance is destroyed. +// Destroy is called when the resource is destroyed. function destroy(asyncId) { } // promiseResolve is called only for promise resources, when the @@ -635,7 +635,7 @@ see the details of the V8 [PromiseHooks][] API. Library developers that handle their own asynchronous resources performing tasks like I/O, connection pooling, or managing callback queues may use the -`AsyncWrap` JavaScript API so that all the appropriate callbacks are called. +`AsyncResource` JavaScript API so that all the appropriate callbacks are called. ### Class: `AsyncResource` @@ -1085,6 +1085,21 @@ In this example, the store is only available in the callback function and the functions called by `foo`. Outside of `run`, calling `getStore` will return `undefined`. +### Troubleshooting + +In most cases your application or library code should have no issues with +`AsyncLocalStorage`. But in rare cases you may face situations when the +current store is lost in one of asynchronous operations. Then you should +consider the following options. + +If your code is callback-based, it is enough to promisify it with +[`util.promisify()`][], so it starts working with native promises. + +If you need to keep using callback-based API, or your code assumes +a custom thenable implementation, you should use [`AsyncResource`][] class +to associate the asynchronous operation with the correct execution context. + +[`AsyncResource`]: #async_hooks_class_asyncresource [`after` callback]: #async_hooks_after_asyncid [`before` callback]: #async_hooks_before_asyncid [`destroy` callback]: #async_hooks_destroy_asyncid @@ -1094,3 +1109,4 @@ functions called by `foo`. Outside of `run`, calling `getStore` will return [PromiseHooks]: https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit [`Worker`]: worker_threads.html#worker_threads_class_worker [promise execution tracking]: #async_hooks_promise_execution_tracking +[`util.promisify()`]: util.html#util_util_promisify_original diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b839f0cebad093..3b4c8432e6e971 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -569,7 +569,7 @@ Array entries outside that range will be truncated to fit into it. const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); ``` -A `TypeError` will be thrown if `array` is not an `Array` or other type +A `TypeError` will be thrown if `array` is not an `Array` or another type appropriate for `Buffer.from()` variants. `Buffer.from(array)` and [`Buffer.from(string)`][] may also use the internal @@ -623,7 +623,8 @@ console.log(buf.length); ``` A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`][] or a -[`SharedArrayBuffer`][] or other type appropriate for `Buffer.from()` variants. +[`SharedArrayBuffer`][] or another type appropriate for `Buffer.from()` +variants. ### Class Method: `Buffer.from(buffer)` + +A synchronous read or close call was attempted on an [`fs.Dir`][] which has +ongoing asynchronous operations. + ### `ERR_DNS_SET_SERVERS_FAILED` @@ -2014,6 +2023,20 @@ An attempt was made to load a module with an unknown or unsupported format. An invalid or unknown process signal was passed to an API expecting a valid signal (such as [`subprocess.kill()`][]). + +### `ERR_UNSUPPORTED_DIR_IMPORT` + +`import` a directory URL is unsupported. Instead, you can +[self-reference a package using its name][] and [define a custom subpath][] in +the `"exports"` field of the `package.json` file. + + +```js +import './'; // unsupported +import './index.js'; // supported +import 'package-name'; // supported +``` + ### `ERR_UNSUPPORTED_ESM_URL_SCHEME` @@ -2082,6 +2105,11 @@ meaning of the error depends on the specific function. The WASI instance has already started. + +### `ERR_WASI_NOT_STARTED` + +The WASI instance has not been started. + ### `ERR_WORKER_INIT_FAILED` @@ -2549,3 +2577,5 @@ such as `process.stdout.on('data')`. [Subresource Integrity specification]: https://www.w3.org/TR/SRI/#the-integrity-attribute [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch [vm]: vm.html +[self-reference a package using its name]: esm.html#esm_self_referencing_a_package_using_its_name +[define a custom subpath]: esm.html#esm_subpath_exports diff --git a/doc/api/esm.md b/doc/api/esm.md index 5949758d26ca5e..faa62b1fb87f1e 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -13,6 +13,27 @@ ECMAScript modules are [the official standard format][] to package JavaScript code for reuse. Modules are defined using a variety of [`import`][] and [`export`][] statements. +The following example of an ES module exports a function: + +```js +// addTwo.mjs +function addTwo(num) { + return num + 2; +} + +export { addTwo }; +``` + +The following example of an ES module imports the function from `addTwo.mjs`: + +```js +// app.mjs +import { addTwo } from './addTwo.mjs'; + +// Prints: 6 +console.log(addTwo(4)); +``` + Node.js fully supports ECMAScript modules as they are currently specified and provides limited interoperability between them and the existing module format, [CommonJS][]. @@ -183,25 +204,75 @@ versions of Node.js, but its capabilities are limited: it only defines the main entry point of the package. The `"exports"` field provides an alternative to `"main"` where the package -main entry point can be defined while also encapsulating the package, preventing -any other entry points besides those defined in `"exports"`. If package entry -points are defined in both `"main"` and `"exports"`, the latter takes precedence -in versions of Node.js that support `"exports"`. [Conditional Exports][] can -also be used within `"exports"` to define different package entry points per -environment, including whether the package is referenced via `require` or via -`import`. +main entry point can be defined while also encapsulating the package, +**preventing any other entry points besides those defined in `"exports"`**. +This encapsulation allows module authors to define a public interface for +their package. If both `"exports"` and `"main"` are defined, the `"exports"` field takes -precedence over `"main"`. +precedence over `"main"`. `"exports"` are not specific to ES modules or +CommonJS; `"main"` will be overridden by `"exports"` if it exists. As such +`"main"` cannot be used as a fallback for CommonJS but it can be used as a +fallback for legacy versions of Node.js that do not support the `"exports"` +field. + +[Conditional Exports][] can be used within `"exports"` to define different +package entry points per environment, including whether the package is +referenced via `require` or via `import`. For more information about supporting +both CommonJS and ES Modules in a single package please consult +[the dual CommonJS/ES module packages section][]. + +**Warning**: Introducing the `"exports"` field prevents consumers of a package +from using any entry points that are not defined, including the `package.json` +(e.g. `require('your-package/package.json')`. **This will likely be a breaking +change.** + +To make the introduction of `"exports"` non-breaking, ensure that every +previously supported entry point is exported. It is best to explicitly specify +entry points so that the package’s public API is well-defined. For example, +a project that previous exported `main`, `lib`, +`feature`, and the `package.json` could use the following `package.exports`: -Both `"main"` and `"exports"` entry points are not specific to ES modules or -CommonJS; `"main"` will be overridden by `"exports"` in a `require` so it is -not a CommonJS fallback. +```json +{ + "name": "my-mod", + "exports": { + ".": "./lib/index.js", + "./lib": "./lib/index.js", + "./lib/index": "./lib/index.js", + "./lib/index.js": "./lib/index.js", + "./feature": "./feature/index.js", + "./feature/index.js": "./feature/index.js", + "./package.json": "./package.json" + } +} +``` + +Alternatively a project could choose to export entire folders: + +```json +{ + "name": "my-mod", + "exports": { + ".": "./lib/index.js", + "./lib": "./lib/index.js", + "./lib/": "./lib/", + "./feature": "./feature/index.js", + "./feature/": "./feature/", + "./package.json": "./package.json" + } +} +``` -This is important with regard to `require`, since `require` of ES module files -throws an error in all versions of Node.js. To create a package that works both -in modern Node.js via `import` and `require` and also legacy Node.js versions, -see [the dual CommonJS/ES module packages section][]. +As a last resort, package encapsulation can be disabled entirely by creating an +export for the root of the package `"./": "./"`. This will expose every file in +the package at the cost of disabling the encapsulation and potential tooling +benefits this provides. As the ES Module loader in Node.js enforces the use of +[the full specifier path][], exporting the root rather than being explicit +about entry is less expressive than either of the prior examples. Not only +will encapsulation be lost but module consumers will be unable to +`import feature from 'my-mod/feature'` as they will need to provide the full +path `import feature from 'my-mod/feature/index.js`. #### Main Entry Point Export @@ -1510,8 +1581,9 @@ The resolver can throw the following errors: > 1. If _resolvedURL_ contains any percent encodings of _"/"_ or _"\\"_ (_"%2f"_ > and _"%5C"_ respectively), then > 1. Throw an _Invalid Module Specifier_ error. -> 1. If _resolvedURL_ does not end with a trailing _"/"_ and the file at -> _resolvedURL_ does not exist, then +> 1. If the file at _resolvedURL_ is a directory, then +> 1. Throw an _Unsupported Directory Import_ error. +> 1. If the file at _resolvedURL_ does not exist, then > 1. Throw a _Module Not Found_ error. > 1. Set _resolvedURL_ to the real path of _resolvedURL_. > 1. Let _format_ be the result of **ESM_FORMAT**(_resolvedURL_). @@ -1750,6 +1822,7 @@ success! [dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook [import an ES or CommonJS module for its side effects only]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only [special scheme]: https://url.spec.whatwg.org/#special-scheme +[the full specifier path]: #esm_mandatory_file_extensions [the official standard format]: https://tc39.github.io/ecma262/#sec-modules [the dual CommonJS/ES module packages section]: #esm_dual_commonjs_es_module_packages [transpiler loader example]: #esm_transpiler_loader diff --git a/doc/api/fs.md b/doc/api/fs.md index 53e650ac074891..d446c56a64d81e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3789,8 +3789,8 @@ Change the file system timestamps of the object referenced by `path`. The `atime` and `mtime` arguments follow these rules: -* Values can be either numbers representing Unix epoch time, `Date`s, or a - numeric string like `'123456789.0'`. +* Values can be either numbers representing Unix epoch time in seconds, + `Date`s, or a numeric string like `'123456789.0'`. * If the value can not be converted to a number, or is `NaN`, `Infinity` or `-Infinity`, an `Error` will be thrown. @@ -5321,6 +5321,24 @@ The following constants are exported by `fs.constants`. Not every constant will be available on every operating system. +To use more than one constant, use the bitwise OR `|` operator. + +Example: + +```js +const fs = require('fs'); + +const { + O_RDWR, + O_CREAT, + O_EXCL +} = fs.constants; + +fs.open('/path/to/my/file', O_RDWR | O_CREAT | O_EXCL, (err, fd) => { + // ... +}); +``` + ### File Access Constants The following constants are meant for use with [`fs.access()`][]. diff --git a/doc/api/http.md b/doc/api/http.md index 039b83616f3a0c..e9180a7d375d94 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1003,6 +1003,21 @@ ensure the response is a properly formatted HTTP response message. correctly; * `rawPacket`: the raw packet of current request. +In some cases, the client has already received the response and/or the socket +has already been destroyed, like in case of `ECONNRESET` errors. Before +trying to send data to the socket, it is better to check that it is still +writable. + +```js +server.on('clientError', (err, socket) => { + if (err.code === 'ECONNRESET' || !socket.writable) { + return; + } + + socket.end('HTTP/1.1 400 Bad Request\r\n\r\n'); +}); +``` + ### Event: `'close'` -* `data` {string|Buffer} +* `data` {string|Buffer|Uint8Array} * `encoding` {string} * `callback` {Function} * Returns: {this} @@ -3379,7 +3379,7 @@ does not indicate whether the data has been flushed, for this use added: v8.4.0 --> -* `chunk` {string|Buffer} +* `chunk` {string|Buffer|Uint8Array} * `encoding` {string} * `callback` {Function} * Returns: {boolean} diff --git a/doc/api/modules.md b/doc/api/modules.md index 8b06b02f2f2c6b..1b5f9a2b708777 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -688,6 +688,7 @@ node entry.js ```js Module { id: '.', + path: '/absolute/path/to', exports: {}, parent: null, filename: '/absolute/path/to/entry.js', @@ -899,6 +900,16 @@ added: v0.1.16 The module that first required this one. +### `module.path` + + +* {string} + +The directory name of the module. This is usually the same as the +[`path.dirname()`][] of the [`module.id`][]. + ### `module.paths` > Stability: 2 - Stable -The Performance Timing API provides an implementation of the -[W3C Performance Timeline][] specification. The purpose of the API -is to support collection of high resolution performance metrics. -This is the same Performance API as implemented in modern Web browsers. +This module provides an implementation of a subset of the W3C +[Web Performance APIs][] as well as additional APIs for +Node.js-specific performance measurements. + +Node.js supports the following [Web Performance APIs][]: + +* [High Resolution Time][] +* [Performance Timeline][] +* [User Timing][] ```js const { PerformanceObserver, performance } = require('perf_hooks'); @@ -28,11 +33,14 @@ doSomeLongRunningProcess(() => { }); ``` -## Class: `Performance` +## `perf_hooks.performance` +An object that can be used to collect performance metrics from the current +Node.js instance. It is similar to [`window.performance`][] in browsers. + ### `performance.clearMarks([name])` -Provides timing details for Node.js itself. +_This property is an extension by Node.js. It is not available in Web browsers._ + +Provides timing details for Node.js itself. The constructor of this class +is not exposed to users. ### `performanceNodeTiming.bootstrapComplete` -Tracks the event loop delay at a given sampling rate. +Tracks the event loop delay at a given sampling rate. The constructor of +this class not exposed to users. + +_This property is an extension by Node.js. It is not available in Web browsers._ #### `histogram.disable()` {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 translateLevel$1(level) { + if (level === 0) { + return false; + } -function isQuoted (val) { - return (val.charAt(0) === '"' && val.slice(-1) === '"') || - (val.charAt(0) === "'" && val.slice(-1) === "'") + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; } -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 supportsColor$1(haveStream, streamIsTTY) { + if (forceColor$1 === 0) { + return 0; + } -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; + if (hasFlag$1('color=16m') || + hasFlag$1('color=full') || + hasFlag$1('color=truecolor')) { + return 3; + } -var singleComment = 1; -var multiComment = 2; + if (hasFlag$1('color=256')) { + return 2; + } -function stripWithoutWhitespace() { - return ''; -} + if (haveStream && !streamIsTTY && forceColor$1 === undefined) { + return 0; + } -function stripWithWhitespace(str, start, end) { - return str.slice(start, end).replace(/\S/g, ' '); -} + const min = forceColor$1 || 0; -var stripJsonComments = function (str, opts) { - opts = opts || {}; + if (env$1.TERM === 'dumb') { + return min; + } - var currentChar; - var nextChar; - var insideString = false; - var insideComment = false; - var offset = 0; - var ret = ''; - var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } - for (var i = 0; i < str.length; i++) { - currentChar = str[i]; - nextChar = str[i + 1]; + return 1; + } - if (!insideComment && currentChar === '"') { - var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\'; - if (!escaped) { - insideString = !insideString; - } + if ('CI' in env$1) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') { + return 1; } - if (insideString) { - continue; - } + return min; + } - 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; - } + if ('TEAMCITY_VERSION' in env$1) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0; } - return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset)); -}; + if ('GITHUB_ACTIONS' in env$1) { + return 1; + } -var utils = createCommonjsModule(function (module, exports) { + if (env$1.COLORTERM === 'truecolor') { + return 3; + } + if ('TERM_PROGRAM' in env$1) { + const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + switch (env$1.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + if (/-256(color)?$/i.test(env$1.TERM)) { + return 2; + } + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) { + return 1; + } -var parse = exports.parse = function (content) { + if ('COLORTERM' in env$1) { + return 1; + } - //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. + return min; +} - if(/^\s*{/.test(content)) - return JSON.parse(stripJsonComments(content)) - return ini.parse(content) +function getSupportLevel$1(stream) { + const level = supportsColor$1(stream, stream && stream.isTTY); + return translateLevel$1(level); +} +var supportsColor_1$1 = { + supportsColor: getSupportLevel$1, + stdout: translateLevel$1(supportsColor$1(true, tty.isatty(1))), + stderr: translateLevel$1(supportsColor$1(true, tty.isatty(2))) }; -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 node = createCommonjsModule(function (module, exports) { +/** + * Module dependencies. + */ - var file = path$1.join.apply(null, args); - try { - return fs$1.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('__'); +/** + * This is the Node.js implementation of `debug()`. + */ - // Trim empty strings from keypath array - var _emptyStringIndex; - while ((_emptyStringIndex=keypath.indexOf('')) > -1) { - keypath.splice(_emptyStringIndex, 1); - } +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; - var cursor = obj; - keypath.forEach(function _buildSubObj(_subkey,i){ +/** + * Colors. + */ - // (check for _subkey first so we ignore empty strings) - // (check for cursor to avoid assignment to primitive objects) - if (!_subkey || typeof cursor !== 'object') - return +exports.colors = [6, 2, 3, 4, 5, 1]; - // 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]; +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = supportsColor_1$1; + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} - // Build sub-object if nothing already exists at the keypath - if (cursor[_subkey] === undefined) - cursor[_subkey] = {}; +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ - // Increment cursor used to track the object at the current depth - cursor = cursor[_subkey]; +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); - }); + // Coerce string value into JS value + let 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`. + */ - return obj -}; +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} -var find = exports.find = function () { - var rel = path$1.join.apply(null, [].slice.call(arguments)); +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ - function find(start, rel) { - var file = path$1.join(start, rel); - try { - fs$1.statSync(file); - return file - } catch (err) { - if(path$1.dirname(start) !== start) // root - return find(path$1.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; +function formatArgs(args) { + const {namespace: name, useColors} = this; -var deepExtend_1 = createCommonjsModule(function (module) { + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; -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); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); } else { - throw new Error('Unexpected situation'); + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; } + return new Date().toISOString() + ' '; } /** - * Recursive cloning array. + * Invokes `util.format()` with the specified arguments and writes to stderr. */ -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]; +function log(...args) { + return process.stderr.write(util$2.format(...args) + '\n'); } /** - * Extening object that entered in first argument. - * - * Returns extended object or false if have no target object or incorrect type. + * Save `namespaces`. * - * 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]); + * @param {String} namespaces + * @api private */ -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]; +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; } +} - var target = arguments[0]; - - // convert arguments to array and cut off target object - var args = Array.prototype.slice.call(arguments, 1); +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ - var val, src; +function load() { + return process.env.DEBUG; +} - 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; - } +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ - Object.keys(obj).forEach(function (key) { - src = safeGetProperty(target, key); // source value - val = safeGetProperty(obj, key); // new value +function init(debug) { + debug.inspectOpts = {}; - // recursion prevention - if (val === target) { - return; + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} - /** - * 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; +module.exports = common$1(exports); - // just clone arrays (and recursive clone objects inside) - } else if (Array.isArray(val)) { - target[key] = deepCloneArray(val); - return; +const {formatters} = module.exports; - // custom cloning and overwrite for specific objects - } else if (isSpecificValue(val)) { - target[key] = cloneSpecificValue(val); - return; +/** + * Map %o to `util.inspect()`, all on a single line. + */ - // 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; +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util$2.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; - // source value and new value is objects both, extending... - } else { - target[key] = deepExtend(src, val); - return; - } - }); - }); +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ - return target; +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util$2.inspect(v, this.inspectOpts); }; }); +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 minimist = function (args, opts) { - if (!opts) opts = {}; - - var flags = { bools : {}, strings : {}, unknownFn: null }; +var src = createCommonjsModule(function (module) { +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ - if (typeof opts['unknown'] === 'function') { - flags.unknownFn = opts['unknown']; - } +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = browser; +} else { + module.exports = node; +} +}); - 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; - })); - }); - }); +const resolveFrom = (fromDirectory, moduleId, silent) => { + if (typeof fromDirectory !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); + } - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } - var defaults = opts['default'] || {}; - - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); - - var notFlags = []; + try { + fromDirectory = fs$1.realpathSync(fromDirectory); + } catch (error) { + if (error.code === 'ENOENT') { + fromDirectory = path$1.resolve(fromDirectory); + } else if (silent) { + return; + } else { + throw error; + } + } - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); - } + const fromFile = path$1.join(fromDirectory, 'noop.js'); - function argDefined(key, arg) { - return (flags.allBools && /^--[^=]+$/.test(arg)) || - flags.strings[key] || flags.bools[key] || aliases[key]; - } + const resolveFileName = () => module$1._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: module$1._nodeModulePaths(fromDirectory) + }); - function setArg (key, val, arg) { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg) === false) return; - } + if (silent) { + try { + return resolveFileName(); + } catch (error) { + 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); - }); - } + return resolveFileName(); +}; - function setKey (obj, keys, value) { - var o = obj; - for (var i = 0; i < keys.length-1; i++) { - var key = keys[i]; - if (key === '__proto__') return; - if (o[key] === undefined) o[key] = {}; - if (o[key] === Object.prototype || o[key] === Number.prototype - || o[key] === String.prototype) o[key] = {}; - if (o[key] === Array.prototype) o[key] = []; - o = o[key]; - } +var resolveFrom_1 = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId); +var silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true); +resolveFrom_1.silent = silent; - var key = keys[keys.length - 1]; - if (key === '__proto__') return; - if (o === Object.prototype || o === Number.prototype - || o === String.prototype) o = {}; - if (o === Array.prototype) o = []; - 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 ]; +class FiggyPudding { + constructor (specs, opts, providers) { + this.__specs = specs || {}; + Object.keys(this.__specs).forEach(alias => { + if (typeof this.__specs[alias] === 'string') { + const key = this.__specs[alias]; + const realSpec = this.__specs[key]; + if (realSpec) { + const aliasArr = realSpec.aliases || []; + aliasArr.push(alias, key); + realSpec.aliases = [...(new Set(aliasArr))]; + this.__specs[alias] = realSpec; + } else { + throw new Error(`Alias refers to invalid key: ${key} -> ${alias}`) } + } + }); + this.__opts = opts || {}; + this.__providers = reverse((providers).filter( + x => x != null && typeof x === 'object' + )); + this.__isFiggyPudding = true; + } + get (key) { + return pudGet(this, key, true) + } + get [Symbol.toStringTag] () { return 'FiggyPudding' } + forEach (fn, thisArg = this) { + for (let [key, value] of this.entries()) { + fn.call(thisArg, value, key, this); } - - 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; - } + } + toJSON () { + const obj = {}; + this.forEach((val, key) => { + obj[key] = val; + }); + return obj + } + * entries (_matcher) { + for (let key of Object.keys(this.__specs)) { + yield [key, this.get(key)]; + } + const matcher = _matcher || this.__opts.other; + if (matcher) { + const seen = new Set(); + for (let p of this.__providers) { + const iter = p.entries ? p.entries(matcher) : entries(p); + for (let [key, val] of iter) { + if (matcher(key) && !seen.has(key)) { + seen.add(key); + yield [key, val]; + } } + } } - - 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]); - }); + } + * [Symbol.iterator] () { + for (let [key, value] of this.entries()) { + yield [key, value]; + } + } + * keys () { + for (let [key] of this.entries()) { + yield key; + } + } + * values () { + for (let [, value] of this.entries()) { + yield value; + } + } + concat (...moreConfig) { + return new Proxy(new FiggyPudding( + this.__specs, + this.__opts, + reverse(this.__providers).concat(moreConfig) + ), proxyHandler) + } +} +try { + const util = util$2; + FiggyPudding.prototype[util.inspect.custom] = function (depth, opts) { + return ( + this[Symbol.toStringTag] + ' ' + ) + util.inspect(this.toJSON(), opts) + }; +} catch (e) {} + +function BadKeyError (key) { + throw Object.assign(new Error( + `invalid config key requested: ${key}` + ), {code: 'EBADKEY'}) +} + +function pudGet (pud, key, validate) { + let spec = pud.__specs[key]; + if (validate && !spec && (!pud.__opts.other || !pud.__opts.other(key))) { + BadKeyError(key); + } else { + if (!spec) { spec = {}; } + let ret; + for (let p of pud.__providers) { + ret = tryGet(key, p); + if (ret === undefined && spec.aliases && spec.aliases.length) { + for (let alias of spec.aliases) { + if (alias === key) { continue } + ret = tryGet(alias, p); + if (ret !== undefined) { + break + } } - }); - - if (opts['--']) { - argv['--'] = new Array(); - notFlags.forEach(function(key) { - argv['--'].push(key); - }); + } + if (ret !== undefined) { + break + } } - else { - notFlags.forEach(function(key) { - argv._.push(key); - }); + if (ret === undefined && spec.default !== undefined) { + if (typeof spec.default === 'function') { + return spec.default(pud) + } else { + return spec.default + } + } else { + return ret } + } +} - return argv; -}; +function tryGet (key, p) { + let ret; + if (p.__isFiggyPudding) { + ret = pudGet(p, key, false); + } else if (typeof p.get === 'function') { + ret = p.get(key); + } else { + ret = p[key]; + } + return ret +} -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); +const proxyHandler = { + has (obj, prop) { + return prop in obj.__specs && pudGet(obj, prop, false) !== undefined + }, + ownKeys (obj) { + return Object.keys(obj.__specs) + }, + get (obj, prop) { + if ( + typeof prop === 'symbol' || + prop.slice(0, 2) === '__' || + prop in FiggyPudding.prototype + ) { + return obj[prop] + } + return obj.get(prop) + }, + set (obj, prop, value) { + if ( + typeof prop === 'symbol' || + prop.slice(0, 2) === '__' + ) { + obj[prop] = value; + return true + } else { + throw new Error('figgyPudding options cannot be modified. Use .concat() instead.') + } + }, + deleteProperty () { + throw new Error('figgyPudding options cannot be deleted. Use .concat() and shadow them instead.') + } +}; - var key = keys[keys.length - 1]; - return key in o; +var figgyPudding_1 = figgyPudding; +function figgyPudding (specs, opts) { + function factory (...providers) { + return new Proxy(new FiggyPudding( + specs, + opts, + providers + ), proxyHandler) + } + return factory } -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); +function reverse (arr) { + const ret = []; + arr.forEach(x => ret.unshift(x)); + return ret } -var join = path$1.join; +function entries (obj) { + return Object.keys(obj).map(k => [k, obj[k]]) +} -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; +var pathExists = fp => new Promise(resolve => { + fs$1.access(fp, err => { + resolve(!err); + }); +}); - if (process.platform === 'win32') { - return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; +var sync = fp => { + try { + fs$1.accessSync(fp); + return true; + } catch (err) { + return false; } +}; +pathExists.sync = sync; - if (process.platform === 'darwin') { - return home || (user ? '/Users/' + user : null); - } +const pTry = (fn, ...arguments_) => new Promise(resolve => { + resolve(fn(...arguments_)); +}); + +var pTry_1 = pTry; +// TODO: remove this in the next major version +var default_1 = pTry; +pTry_1.default = default_1; - if (process.platform === 'linux') { - return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); +const pLimit = concurrency => { + if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { + return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); } - return home || null; + const queue = []; + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.length > 0) { + queue.shift()(); + } + }; + + const run = (fn, resolve, ...args) => { + activeCount++; + + const result = pTry_1(fn, ...args); + + resolve(result); + + result.then(next, next); + }; + + const enqueue = (fn, resolve, ...args) => { + if (activeCount < concurrency) { + run(fn, resolve, ...args); + } else { + queue.push(run.bind(null, fn, resolve, ...args)); + } + }; + + const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount + }, + pendingCount: { + get: () => queue.length + }, + clearQueue: { + value: () => { + queue.length = 0; + } + } + }); + + return generator; +}; + +var pLimit_1 = pLimit; +var default_1$1 = pLimit; +pLimit_1.default = default_1$1; + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } } -var osHomedir = typeof os.homedir === 'function' ? os.homedir : homedir; +// The input can also be a promise, so we `Promise.resolve()` it +const testElement = (el, tester) => Promise.resolve(el).then(tester); -var home$1 = osHomedir(); +// The input can also be a promise, so we `Promise.all()` them both +const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0]))); -var untildify = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); +var pLocate = (iterable, tester, opts) => { + opts = Object.assign({ + concurrency: Infinity, + preserveOrder: true + }, opts); + + const limit = pLimit_1(opts.concurrency); + + // Start all the promises concurrently with optional limit + const items = [...iterable].map(el => [el, limit(testElement, el, tester)]); + + // Check the promises either serially or concurrently + const checkLimit = pLimit_1(opts.preserveOrder ? 1 : Infinity); + + return Promise.all(items.map(el => checkLimit(finder, el))) + .then(() => {}) + .catch(err => err instanceof EndError ? err.value : Promise.reject(err)); +}; + +var locatePath = (iterable, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + + return pLocate(iterable, el => pathExists(path$1.resolve(options.cwd, el)), options); +}; + +var sync$1 = (iterable, options) => { + options = Object.assign({ + cwd: process.cwd() + }, options); + + for (const el of iterable) { + if (pathExists.sync(path$1.resolve(options.cwd, el))) { + return el; + } } +}; +locatePath.sync = sync$1; + +var findUp = (filename, opts = {}) => { + const startDir = path$1.resolve(opts.cwd || ''); + const {root} = path$1.parse(startDir); + + const filenames = [].concat(filename); + + return new Promise(resolve => { + (function find(dir) { + locatePath(filenames, {cwd: dir}).then(file => { + if (file) { + resolve(path$1.join(dir, file)); + } else if (dir === root) { + resolve(null); + } else { + find(path$1.dirname(dir)); + } + }); + })(startDir); + }); +}; + +var sync$2 = (filename, opts = {}) => { + let dir = path$1.resolve(opts.cwd || ''); + const {root} = path$1.parse(dir); + + const filenames = [].concat(filename); + + // eslint-disable-next-line no-constant-condition + while (true) { + const file = locatePath.sync(filenames, {cwd: dir}); - return home$1 ? str.replace(/^~($|\/|\\)/, home$1 + '$1') : str; + if (file) { + return path$1.join(dir, file); + } + + if (dir === root) { + return null; + } + + dir = path$1.dirname(dir); + } }; +findUp.sync = sync$2; + +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 ? ' = ' : '='; -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] || ''); + 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 { - return escape.substring(1) + varExpression; + out += safe(k) + separator + safe(val) + eol; } }); -}; -var npmPrefix = function () { - var rcPrefix = rc('npm', null, []).prefix; + 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; + +const NpmConfig = figgyPudding_1({}, { + // Open up the pudding object. + other () { return true } +}); + +const ConfigOpts = figgyPudding_1({ + cache: { default: path$1.join(os.homedir(), '.npm') }, + configNames: { default: ['npmrc', '.npmrc'] }, + envPrefix: { default: /^npm_config_/i }, + cwd: { default: () => process.cwd() }, + globalconfig: { + default: () => path$1.join(getGlobalPrefix(), 'etc', 'npmrc') + }, + userconfig: { default: path$1.join(os.homedir(), '.npmrc') } +}); - if (rcPrefix) { - return untildify(shellsubstitute(rcPrefix, process.env)); +var read = getNpmConfig; +function getNpmConfig (_opts, _builtin) { + const builtin = ConfigOpts(_builtin); + const env = {}; + for (let key of Object.keys(process.env)) { + if (!key.match(builtin.envPrefix)) continue + const newKey = key.toLowerCase() + .replace(builtin.envPrefix, '') + .replace(/(?!^)_/g, '-'); + env[newKey] = process.env[key]; + } + const cli = NpmConfig(_opts); + const userConfPath = ( + builtin.userconfig || + cli.userconfig || + env.userconfig + ); + const user = userConfPath && maybeReadIni(userConfPath); + const globalConfPath = ( + builtin.globalconfig || + cli.globalconfig || + env.globalconfig + ); + const global = globalConfPath && maybeReadIni(globalConfPath); + const projConfPath = findUp.sync(builtin.configNames, { cwd: builtin.cwd }); + let proj = {}; + if (projConfPath && projConfPath !== userConfPath) { + proj = maybeReadIni(projConfPath); + } + const newOpts = NpmConfig(builtin, global, user, proj, env, cli); + if (newOpts.cache) { + return newOpts.concat({ + cache: path$1.resolve( + ( + (cli.cache || env.cache) + ? builtin.cwd + : proj.cache + ? path$1.dirname(projConfPath) + : user.cache + ? path$1.dirname(userConfPath) + : global.cache + ? path$1.dirname(globalConfPath) + : path$1.dirname(userConfPath) + ), + newOpts.cache + ) + }) + } else { + return newOpts } - else if (process.platform == 'win32') { - return path$1.dirname(process.execPath); +} + +function maybeReadIni (f) { + let txt; + try { + txt = fs$1.readFileSync(f, 'utf8'); + } catch (err) { + if (err.code === 'ENOENT') { + return '' + } else { + throw err + } } - else { - return path$1.resolve(process.execPath, '../..'); + return ini.parse(txt) +} + +function getGlobalPrefix () { + if (process.env.PREFIX) { + return process.env.PREFIX + } else if (process.platform === 'win32') { + // c:\node\node.exe --> prefix=c:\node\ + return path$1.dirname(process.execPath) + } else { + // /usr/local/bin/node --> prefix=/usr/local + let pref = path$1.dirname(path$1.dirname(process.execPath)); + // destdir only is respected on Unix + if (process.env.DESTDIR) { + pref = path$1.join(process.env.DESTDIR, pref); + } + return pref } +} + +var libnpmconfig = { + read: read }; var resolve = resolveFrom_1.silent; -var npmPrefix$1 = npmPrefix(); +var readNpmConfig = libnpmconfig.read; var loadPlugin_1 = loadPlugin; loadPlugin.resolve = resolvePlugin; var electron = process.versions.electron !== undefined; +var windows = process.platform === 'win32'; + var argv = process.argv[1] || /* istanbul ignore next */ ''; var nvm = process.env.NVM_BIN; -var globally = electron || argv.indexOf(npmPrefix$1) === 0; -var windows = process.platform === 'win32'; -var prefix = windows ? /* istanbul ignore next */ '' : 'lib'; -var globals = path$1.resolve(npmPrefix$1, prefix, 'node_modules'); +var appData = process.env.APPDATA; + +/* istanbul ignore next */ +var globalsLibrary = windows ? '' : 'lib'; + +var builtinNpmConfig; + +// The prefix config defaults to the location where node is installed. +// On Windows, this is in a place called `%AppData%`, which we have to +// pass to `libnpmconfig` explicitly: +/* istanbul ignore next */ +if (windows && appData) { + builtinNpmConfig = {prefix: path$1.join(appData, 'npm')}; +} + +var npmPrefix = readNpmConfig(null, builtinNpmConfig).prefix; + +// If there is no prefix defined, use the defaults +// See: +/* istanbul ignore next */ +if (!npmPrefix) { + npmPrefix = windows + ? path$1.dirname(process.execPath) + : path$1.resolve(process.execPath, '../..'); +} + +var globally = electron || argv.indexOf(npmPrefix) === 0; +var globals = path$1.resolve(npmPrefix, globalsLibrary, 'node_modules'); // 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`). +// install global node modules. +// To find the actual modules, the user has to set `prefix` somewhere in an +// `.npmrc` (which is picked up by `libnpmconfig`). // 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. +// versions of Node. +// Luckily NVM leaks some environment variables that we can pick up on to try +// and detect the actual modules. /* istanbul ignore next */ if (electron && nvm && !fs$1.existsSync(globals)) { - globals = path$1.resolve(nvm, '..', prefix, 'node_modules'); + globals = path$1.resolve(nvm, '..', globalsLibrary, 'node_modules'); } -// Load the plug-in found using `resolvePlugin`. +// Load the plugin found using `resolvePlugin`. function loadPlugin(name, options) { return commonjsRequire(resolvePlugin(name, options) || name) } @@ -6326,8 +8643,9 @@ function resolvePlugin(name, options) { if (name.charAt(0) === '@') { slash = name.indexOf('/'); - // Let’s keep the algorithm simple. No need to care if this is a - // “valid” scope (I think?). But we do check for the slash. + // Let’s keep the algorithm simple. + // No need to care if this is a “valid” scope (I think?). + // But we do check for the slash. if (slash !== -1) { scope = name.slice(0, slash + 1); name = name.slice(slash + 1); @@ -6357,6 +8675,15 @@ function resolvePlugin(name, options) { return null } +var isPlainObj = value => { + if (Object.prototype.toString.call(value) !== '[object Object]') { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === null || prototype === Object.prototype; +}; + var format = createCommonjsModule(function (module) { (function() { @@ -6499,47 +8826,14 @@ function create(EConstructor) { } } -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 debug = src('unified-engine:find-up'); +var findUp$1 = FindUp; -var findUp = FindUp; - -var read = fs$1.readFile; +var read$1 = fs$1.readFile; var resolve$1 = path$1.resolve; var relative = path$1.relative; -var join$1 = path$1.join; +var join = path$1.join; var dirname = path$1.dirname; FindUp.prototype.load = load$2; @@ -6576,7 +8870,7 @@ function load$2(filePath, callback) { givenFile = [callback]; self.givenFile = givenFile; debug('Checking given file `%s`', givenFilePath); - read(givenFilePath, loadGiven); + read$1(givenFilePath, loadGiven); } return @@ -6613,13 +8907,13 @@ function load$2(filePath, callback) { try { result = create(buf, givenFilePath); debug('Read given file `%s`', givenFilePath); - } catch (error2) { + } catch (error_) { result = fault_1( 'Cannot parse given file `%s`\n%s', relative(cwd, givenFilePath), - error2.stack + error_.stack ); - debug(error2.message); + debug(error_.message); } } @@ -6641,7 +8935,7 @@ function load$2(filePath, callback) { // We do not use `readdir` because on huge directories, that could be // *very* slow. if (++index < length) { - read(join$1(directory, names[index]), done); + read$1(join(directory, names[index]), done); } else { parent = dirname(directory); @@ -6659,7 +8953,7 @@ function load$2(filePath, callback) { function done(error, buf) { var name = names[index]; - var fp = join$1(directory, name); + var fp = join(directory, name); var contents; /* istanbul ignore if - Hard to test. */ @@ -6679,9 +8973,9 @@ function load$2(filePath, callback) { try { contents = create(buf, fp); - } catch (error2) { + } catch (error_) { return found( - fault_1('Cannot parse file `%s`\n%s', relative(cwd, fp), error2.message) + fault_1('Cannot parse file `%s`\n%s', relative(cwd, fp), error_.message) ) } @@ -6710,7 +9004,11 @@ function load$2(filePath, callback) { } function apply(cb, result) { - if (isObject$1(result) && typeof result[0] === 'function') { + if ( + result !== null && + typeof result === 'object' && + typeof result[0] === 'function' + ) { result.push(cb); } else if (result instanceof Error) { cb(result); @@ -6732,8 +9030,6 @@ var resolve = loadPlugin_1.resolve; - - module.exports = Config; var own = {}.hasOwnProperty; @@ -6743,13 +9039,13 @@ var dirname = path$1.dirname; var relative = path$1.relative; var loaders = { - '.json': loadJSON, + '.json': loadJson, '.js': loadScript, - '.yaml': loadYAML, - '.yml': loadYAML + '.yaml': loadYaml, + '.yml': loadYaml }; -var defaultLoader = loadJSON; +var defaultLoader = loadJson; Config.prototype.load = load; @@ -6777,7 +9073,7 @@ function Config(options) { this.given = {settings: options.settings, plugins: options.plugins}; this.create = create.bind(this); - this.findUp = new findUp({ + this.findUp = new findUp$1({ filePath: options.rcPath, cwd: options.cwd, detect: options.detectConfig, @@ -6787,14 +9083,14 @@ function Config(options) { } function load(filePath, callback) { - var searchPath = filePath || path$1.resolve(this.cwd, 'stdin.js'); var self = this; + var searchPath = filePath || path$1.resolve(this.cwd, 'stdin.js'); self.findUp.load(searchPath, done); - function done(error, res) { - if (error || res) { - return callback(error, res) + function done(error, file) { + if (error || file) { + return callback(error, file) } callback(null, self.create()); @@ -6821,13 +9117,17 @@ function create(buf, filePath) { if (contents === undefined) { if (defaults) { - merge(result, defaults, null, immutable(options, {root: self.cwd})); + merge(result, defaults, Object.assign({}, options, {root: self.cwd})); } } else { - merge(result, contents, null, immutable(options, {root: dirname(filePath)})); + merge( + result, + contents, + Object.assign({}, options, {root: dirname(filePath)}) + ); } - merge(result, self.given, null, immutable(options, {root: self.cwd})); + merge(result, self.given, Object.assign({}, options, {root: self.cwd})); return result } @@ -6848,11 +9148,11 @@ function loadScript(buf, filePath) { return submodule.exports } -function loadYAML(buf, filePath) { +function loadYaml(buf, filePath) { return jsYaml$1.safeLoad(buf, {filename: basename(filePath)}) } -function loadJSON(buf, filePath) { +function loadJson(buf, filePath) { var result = parseJson$1(buf, filePath); if (basename(filePath) === 'package.json') { @@ -6862,12 +9162,12 @@ function loadJSON(buf, filePath) { return result } -function merge(target, raw, val, options) { +function merge(target, raw, options) { var root = options.root; var cwd = options.cwd; var prefix = options.prefix; - if (isObject$1(raw)) { + if (typeof raw === 'object' && raw !== null) { addPreset(raw); } else { throw new Error('Expected preset, not `' + raw + '`') @@ -6878,7 +9178,7 @@ function merge(target, raw, val, options) { function addPreset(result) { var plugins = result.plugins; - if (plugins === null || plugins === undefined) ; else if (isObject$1(plugins)) { + if (plugins === null || plugins === undefined) ; else if (typeof plugins === 'object' && plugins !== null) { if ('length' in plugins) { addEach(plugins); } else { @@ -6890,7 +9190,7 @@ function merge(target, raw, val, options) { ) } - target.settings = immutable(target.settings, result.settings); + target.settings = Object.assign({}, target.settings, result.settings); } function addEach(result) { @@ -6901,7 +9201,7 @@ function merge(target, raw, val, options) { while (++index < length) { value = result[index]; - if (isObject$1(value) && 'length' in value) { + if (value !== null && typeof value === 'object' && 'length' in value) { use.apply(null, value); } else { use(value); @@ -6918,22 +9218,22 @@ function merge(target, raw, val, options) { } function use(usable, value) { - if (xIsString(usable)) { + if (typeof usable === 'string') { addModule(usable, value); } else if (typeof usable === 'function') { addPlugin(usable, value); } else { - merge(target, usable, value, options); + merge(target, usable, options); } } function addModule(id, value) { var fp = resolve(id, {cwd: root, prefix: prefix}); - var res; + var result; if (fp) { try { - res = commonjsRequire(fp); + result = commonjsRequire(fp); } catch (error) { throw fault_1( 'Cannot parse script `%s`\n%s', @@ -6943,15 +9243,15 @@ function merge(target, raw, val, options) { } try { - if (typeof res === 'function') { - addPlugin(res, value); + if (typeof result === 'function') { + addPlugin(result, value); } else { - merge(target, res, value, immutable(options, {root: dirname(fp)})); + merge(target, result, Object.assign({}, options, {root: dirname(fp)})); } - } catch (error) { + } catch (_) { throw fault_1( 'Error: Expected preset or plugin, not %s, at `%s`', - res, + result, relative(root, fp) ) } @@ -6976,8 +9276,8 @@ function merge(target, raw, val, options) { } function reconfigure(entry, value) { - if (value !== false && entry[1] !== false && isObject$1(value)) { - value = immutable(entry[1], value); + if (isPlainObj(entry[1]) && isPlainObj(value)) { + value = Object.assign({}, entry[1], value); } entry[1] = value; @@ -7294,11 +9594,11 @@ const makeRegex = (pattern, negative, ignorecase) => { : new RegExp(source) }; -const isString$1 = subject => typeof subject === 'string'; +const isString = subject => typeof subject === 'string'; // > A blank line matches no files, so it can serve as a separator for readability. const checkPattern = pattern => pattern - && isString$1(pattern) + && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment. @@ -7353,7 +9653,7 @@ const throwError$1 = (message, Ctor) => { }; const checkPath = (path, originalPath, doThrow) => { - if (!isString$1(path)) { + if (!isString(path)) { return doThrow( `path must be a string, but got \`${originalPath}\``, TypeError @@ -7417,7 +9717,7 @@ class Ignore { this._added = false; makeArray( - isString$1(pattern) + isString(pattern) ? splitPattern(pattern) : pattern ).forEach(this._addPattern, this); @@ -7586,14 +9886,16 @@ var ignore$1 = Ignore$1; Ignore$1.prototype.check = check; +var sep = path$1.sep; var dirname$1 = path$1.dirname; var relative$1 = path$1.relative; var resolve$2 = path$1.resolve; function Ignore$1(options) { this.cwd = options.cwd; + this.ignorePathResolveFrom = options.ignorePathResolveFrom; - this.findUp = new findUp({ + this.findUp = new findUp$1({ filePath: options.ignorePath, cwd: options.cwd, detect: options.detectIgnore, @@ -7613,8 +9915,24 @@ function check(filePath, callback) { if (error) { callback(error); } else if (ignore) { - normal = relative$1(ignore.filePath, resolve$2(self.cwd, filePath)); - callback(null, normal ? ignore.ignores(normal) : false); + normal = relative$1( + resolve$2( + self.cwd, + self.ignorePathResolveFrom === 'cwd' ? '.' : ignore.filePath + ), + resolve$2(self.cwd, filePath) + ); + + if ( + normal === '' || + normal === '..' || + normal.charAt(0) === sep || + normal.slice(0, 3) === '..' + sep + ) { + callback(null, false); + } else { + callback(null, ignore.ignores(normal)); + } } else { callback(null, false); } @@ -9226,7 +11544,7 @@ if (typeof Object.create === 'function') { var inherits = createCommonjsModule(function (module) { try { - var util = util$1; + var util = util$2; /* istanbul ignore next */ if (typeof util.inherits !== 'function') throw ''; module.exports = util.inherits; @@ -9510,7 +11828,7 @@ var common$2 = { childrenIgnored: childrenIgnored_1 }; -var sync = globSync; +var sync$3 = globSync; globSync.GlobSync = GlobSync; var setopts$1 = common$2.setopts; var ownProp$1 = common$2.ownProp; @@ -10170,19 +12488,19 @@ function glob (pattern, options, cb) { if (options.sync) { if (cb) throw new TypeError('callback provided to sync glob') - return sync(pattern, options) + return sync$3(pattern, options) } return new Glob(pattern, options, cb) } -glob.sync = sync; -var GlobSync$1 = glob.GlobSync = sync.GlobSync; +glob.sync = sync$3; +var GlobSync$1 = glob.GlobSync = sync$3.GlobSync; // old api surface glob.glob = glob; -function extend$2 (origin, add) { +function extend$1 (origin, add) { if (add === null || typeof add !== 'object') { return origin } @@ -10196,7 +12514,7 @@ function extend$2 (origin, add) { } glob.hasMagic = function (pattern, options_) { - var options = extend$2({}, options_); + var options = extend$1({}, options_); options.noprocess = true; var g = new Glob(pattern, options); @@ -11062,7 +13380,7 @@ var proto$1 = VFile.prototype; // stem can be set. var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; -proto$1.toString = toString$1; +proto$1.toString = toString; // Access full path (`~/index.min.js`). Object.defineProperty(proto$1, 'path', {get: getPath, set: setPath}); @@ -11189,7 +13507,7 @@ function setStem(stem) { } // Get the value of the file. -function toString$1(encoding) { +function toString(encoding) { var value = this.contents || ''; return isBuffer(value) ? value.toString(encoding) : String(value) } @@ -11275,7 +13593,7 @@ function toVFile(options) { return vfile(options) } -var read$1 = readSync; +var read$2 = readSync; var write = writeSync; // Create a virtual file and read it in, synchronously. @@ -11296,16 +13614,16 @@ function writeSync(description, options) { return file } -var sync$1 = { - read: read$1, +var sync$4 = { + read: read$2, write: write }; -var read_1 = read$2; +var read_1 = read$3; var write_1 = write$1; // Create a virtual file and read it in, asynchronously. -function read$2(description, options, callback) { +function read$3(description, options, callback) { var file = core$2(description); if (!callback && typeof options === 'function') { @@ -11394,32 +13712,23 @@ var async = { var fs = core$2; core$2.read = async.read; -core$2.readSync = sync$1.read; +core$2.readSync = sync$4.read; core$2.write = async.write; -core$2.writeSync = sync$1.write; +core$2.writeSync = sync$4.write; var toVfile = fs; -var isHidden = hidden; - -function hidden(filename) { - if (typeof filename !== 'string') { - throw new Error('Expected string') - } - - return filename.charAt(0) === '.' -} - var readdir = fs$1.readdir; var stat = fs$1.stat; -var join$2 = path$1.join; +var sep$1 = path$1.sep; +var join$1 = path$1.join; var relative$2 = path$1.relative; var resolve$3 = path$1.resolve; var basename = path$1.basename; var extname = path$1.extname; var magic = glob_1.hasMagic; -var finder = find; +var finder$1 = find; // Search `patterns`, a mix of globs, paths, and files. function find(input, options, callback) { @@ -11452,7 +13761,7 @@ function expand$1(input, options, next) { } function each(file) { - if (xIsString(file)) { + if (typeof file === 'string') { if (magic(file)) { expected++; glob_1(file, {cwd: cwd}, one); @@ -11519,23 +13828,27 @@ function search(input, options, next) { return each function each(file) { - var ext = xIsString(file) ? extname(file) : file.extname; + var ext = typeof file === 'string' ? extname(file) : file.extname; var part; // Normalise globs. - if (xIsString(file)) { + if (typeof file === 'string') { file = file.split('/').join(path$1.sep); } part = base(file); - if (nested && (isHidden(part) || part === 'node_modules')) { + if (nested && (part.charAt(0) === '.' || part === 'node_modules')) { return } expected++; - statAndIgnore(file, immutable(options, {extraIgnore: extraIgnore}), handle); + statAndIgnore( + file, + Object.assign({}, options, {extraIgnore: extraIgnore}), + handle + ); function handle(error, result) { var ignored = result && result.ignored; @@ -11564,7 +13877,7 @@ function search(input, options, next) { if (ignored) { try { file.fail('Cannot process specified file: it’s ignored'); - } catch (error2) {} + } catch (_) {} } if (error && error.code === 'ENOENT') { @@ -11572,7 +13885,7 @@ function search(input, options, next) { file.fail( error.syscall === 'stat' ? 'No such file or directory' : error ); - } catch (error2) {} + } catch (_) {} } one(null, [file]); @@ -11589,11 +13902,15 @@ function search(input, options, next) { try { file.fail('Cannot read directory'); - } catch (error2) {} + } catch (_) {} one(null, [file]); } else { - search(basenames.map(concat), immutable(options, {nested: true}), one); + search( + basenames.map(concat), + Object.assign({}, options, {nested: true}), + one + ); } } @@ -11612,7 +13929,7 @@ function search(input, options, next) { } function concat(value) { - return join$2(filePath(file), value) + return join$1(filePath(file), value) } } } @@ -11620,8 +13937,9 @@ function search(input, options, next) { function statAndIgnore(file, options, callback) { var ignore = options.ignore; var extraIgnore = options.extraIgnore; - var fp = resolve$3(options.cwd, filePath(file)); - var normal = relative$2(options.cwd, fp); + var cwd = options.cwd; + var fp = resolve$3(cwd, filePath(file)); + var normal = relative$2(cwd, fp); var expected = 1; var actual = 0; var stats; @@ -11653,18 +13971,25 @@ function statAndIgnore(file, options, callback) { } else if (actual === expected) { callback(null, { stats: stats, - ignored: ignored || (normal ? extraIgnore.ignores(normal) : false) + ignored: + ignored || + (normal === '' || + normal === '..' || + normal.charAt(0) === sep$1 || + normal.slice(0, 3) === '..' + sep$1 + ? false + : extraIgnore.ignores(normal)) }); } } } function base(file) { - return xIsString(file) ? basename(file) : file.basename + return typeof file === 'string' ? basename(file) : file.basename } function filePath(file) { - return xIsString(file) ? file : file.path + return typeof file === 'string' ? file : file.path } function oneFileMode(result) { @@ -11684,7 +14009,7 @@ function fileSystem(context, settings, next) { if (input.length === 0) { next(); } else { - finder( + finder$1( input, { cwd: settings.cwd, @@ -11695,7 +14020,8 @@ function fileSystem(context, settings, next) { cwd: settings.cwd, detectIgnore: settings.detectIgnore, ignoreName: settings.ignoreName, - ignorePath: settings.ignorePath + ignorePath: settings.ignorePath, + ignorePathResolveFrom: settings.ignorePathResolveFrom }) }, onfound @@ -11734,7 +14060,7 @@ function fileSystem(context, settings, next) { } } -var toString$2 = Object.prototype.toString; +var toString$1 = Object.prototype.toString; var isModern = ( typeof Buffer.alloc === 'function' && @@ -11743,7 +14069,7 @@ var isModern = ( ); function isArrayBuffer (input) { - return toString$2.call(input).slice(8, -1) === 'ArrayBuffer' + return toString$1.call(input).slice(8, -1) === 'ArrayBuffer' } function fromArrayBuffer (obj, byteOffset, length) { @@ -12642,8 +14968,7 @@ function stdin(context, settings, next) { } } -var inherits$1 = util$1.inherits; - +var inherits$1 = util$2.inherits; @@ -12713,7 +15038,7 @@ function add(file) { var self = this; var origin; - if (xIsString(file)) { + if (typeof file === 'string') { file = toVfile(file); } @@ -12757,13 +15082,13 @@ function one() { var debug$2 = src('unified-engine:file-pipeline:read'); -var read_1$1 = read$3; +var read_1$1 = read$4; var resolve$4 = path$1.resolve; var readFile = fs$1.readFile; // Fill a file with its contents when not already filled. -function read$3(context, file, fileSet, next) { +function read$4(context, file, fileSet, next) { var filePath = file.path; if (file.contents || file.data.unifiedEngineStreamIn) { @@ -12788,14 +15113,6 @@ function read$3(context, file, fileSet, next) { } } -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. * @@ -12810,7 +15127,7 @@ var has = Object.prototype.hasOwnProperty; * @type {Function} */ -var toString$3 = Object.prototype.toString; +var toString$2 = Object.prototype.toString; /** * Test whether a value is "empty". @@ -12842,7 +15159,7 @@ function isEmpty(val) { if (val instanceof Error) return val.message === '' // Objects... - if (val.toString == toString$3) { + if (val.toString == toString$2) { switch (val.toString()) { // Maps, Sets, Files and Errors... @@ -12873,14 +15190,12 @@ function isEmpty(val) { * @type {Function} */ -var lib = isEmpty; +var lib$3 = isEmpty; var debug$3 = src('unified-engine:file-pipeline:configure'); - - var configure_1$1 = configure$1; // Collect configuration for a file based on the context. @@ -12925,18 +15240,18 @@ function configure$1(context, file, fileSet, next) { } // Allow for default arguments in es2020. - if (options === null || (isObject$1(options) && lib(options))) { + if (options === null || (typeof options === 'object' && lib$3(options))) { options = undefined; } - name = fnName(plugin) || 'function'; + name = plugin.displayName || plugin.name || 'function'; debug$3('Using plugin `%s`, with options `%j`', name, options); try { processor.use(plugin, options, fileSet); - } catch (error2) { + } catch (error_) { /* istanbul ignore next - Should not happen anymore! */ - return next(error2) + return next(error_) } } @@ -12970,8 +15285,8 @@ function parse$3(context, file) { message.fatal = true; } - // Add the preferred extension to ensure the file, when compiled, is correctly - // recognised. + // Add the preferred extension to ensure the file, when serialized, is + // correctly recognised. // Only add it if there is a path — not if the file is for example stdin. if (file.path) { file.extname = context.extensions[0]; @@ -13071,8 +15386,8 @@ function queue(context, file, fileSet, next) { var color = true; try { - color = 'inspect' in util$1; -} catch (error) { + color = 'inspect' in util$2; +} catch (_) { /* istanbul ignore next - browser */ color = false; } @@ -13240,7 +15555,7 @@ function formatNode(node) { ignore$2.indexOf(key) !== -1 || value === null || value === undefined || - (typeof value === 'object' && lib(value)) + (typeof value === 'object' && lib$3(value)) ) { continue } @@ -13273,6 +15588,7 @@ var debug$7 = src('unified-engine:file-pipeline:stringify'); + var stringify_1 = stringify$2; // Stringify a tree. @@ -13313,14 +15629,17 @@ function stringify$2(context, file) { value = processor.stringify(tree, file); } - file.contents = value; + if (value === undefined || value === null) ; else if (typeof value === 'string' || isBuffer(value)) { + file.contents = value; + } else { + file.result = value; + } - debug$7('Compiled document'); + debug$7('Serialized document'); } var debug$8 = src('unified-engine:file-pipeline:copy'); - var copy_1 = copy; var stat$1 = fs$1.stat; @@ -13335,7 +15654,7 @@ function copy(context, file, fileSet, next) { var outpath = output; var currentPath = file.path; - if (!xIsString(outpath)) { + if (typeof outpath !== 'string') { debug$8('Not copying'); return next() } @@ -13455,25 +15774,9 @@ function fileSystem$1(context, file, fileSet, next) { // This pipeline ensures each of the pipes always runs: even if the read pipe // fails, queue and write run. var filePipeline = trough_1() - .use( - chunk( - trough_1() - .use(read_1$1) - .use(configure_1$1) - .use(parse_1) - .use(transform_1) - ) - ) + .use(chunk(trough_1().use(read_1$1).use(configure_1$1).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$1) - ) - ); + .use(chunk(trough_1().use(stringify_1).use(copy_1).use(stdout_1).use(fileSystem_1$1))); // Factory to run a pipe. // Wraps a pipe to trigger an error on the `file` in `context`, but still call @@ -13558,31 +15861,39 @@ function transform$1(context, settings, next) { } } -const {env: env$1} = process; +var hasFlag$2 = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; -let forceColor$1; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false') || - hasFlag('color=never')) { - forceColor$1 = 0; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor$1 = 1; -} -if ('FORCE_COLOR' in env$1) { - if (env$1.FORCE_COLOR === true || env$1.FORCE_COLOR === 'true') { - forceColor$1 = 1; - } else if (env$1.FORCE_COLOR === false || env$1.FORCE_COLOR === 'false') { - forceColor$1 = 0; +const {env: env$2} = process; + +let forceColor$2; +if (hasFlag$2('no-color') || + hasFlag$2('no-colors') || + hasFlag$2('color=false') || + hasFlag$2('color=never')) { + forceColor$2 = 0; +} else if (hasFlag$2('color') || + hasFlag$2('colors') || + hasFlag$2('color=true') || + hasFlag$2('color=always')) { + forceColor$2 = 1; +} +if ('FORCE_COLOR' in env$2) { + if (env$2.FORCE_COLOR === true || env$2.FORCE_COLOR === 'true') { + forceColor$2 = 1; + } else if (env$2.FORCE_COLOR === false || env$2.FORCE_COLOR === 'false') { + forceColor$2 = 0; } else { - forceColor$1 = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3); + forceColor$2 = env$2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$2.FORCE_COLOR, 10), 3); } } -function translateLevel$1(level) { +function translateLevel$2(level) { if (level === 0) { return false; } @@ -13595,28 +15906,28 @@ function translateLevel$1(level) { }; } -function supportsColor$1(stream) { - if (forceColor$1 === 0) { +function supportsColor$2(stream) { + if (forceColor$2 === 0) { return 0; } - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { + if (hasFlag$2('color=16m') || + hasFlag$2('color=full') || + hasFlag$2('color=truecolor')) { return 3; } - if (hasFlag('color=256')) { + if (hasFlag$2('color=256')) { return 2; } - if (stream && !stream.isTTY && forceColor$1 === undefined) { + if (stream && !stream.isTTY && forceColor$2 === undefined) { return 0; } - const min = forceColor$1 || 0; + const min = forceColor$2 || 0; - if (env$1.TERM === 'dumb') { + if (env$2.TERM === 'dumb') { return min; } @@ -13639,26 +15950,26 @@ function supportsColor$1(stream) { return 1; } - if ('CI' in env$1) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') { + if ('CI' in env$2) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') { return 1; } return min; } - if ('TEAMCITY_VERSION' in env$1) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0; + if ('TEAMCITY_VERSION' in env$2) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0; } - if (env$1.COLORTERM === 'truecolor') { + if (env$2.COLORTERM === 'truecolor') { return 3; } - if ('TERM_PROGRAM' in env$1) { - const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + if ('TERM_PROGRAM' in env$2) { + const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - switch (env$1.TERM_PROGRAM) { + switch (env$2.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Apple_Terminal': @@ -13667,30 +15978,30 @@ function supportsColor$1(stream) { } } - if (/-256(color)?$/i.test(env$1.TERM)) { + if (/-256(color)?$/i.test(env$2.TERM)) { return 2; } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) { + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) { return 1; } - if ('COLORTERM' in env$1) { + if ('COLORTERM' in env$2) { return 1; } return min; } -function getSupportLevel$1(stream) { - const level = supportsColor$1(stream); - return translateLevel$1(level); +function getSupportLevel$2(stream) { + const level = supportsColor$2(stream); + return translateLevel$2(level); } -var supportsColor_1$1 = { - supportsColor: getSupportLevel$1, - stdout: getSupportLevel$1(process.stdout), - stderr: getSupportLevel$1(process.stderr) +var supportsColor_1$2 = { + supportsColor: getSupportLevel$2, + stdout: getSupportLevel$2(process.stdout), + stderr: getSupportLevel$2(process.stderr) }; var ansiRegex = ({onlyFirst = false} = {}) => { @@ -13752,8 +16063,8 @@ const isFullwidthCodePoint = codePoint => { }; var isFullwidthCodePoint_1 = isFullwidthCodePoint; -var default_1 = isFullwidthCodePoint; -isFullwidthCodePoint_1.default = default_1; +var default_1$2 = isFullwidthCodePoint; +isFullwidthCodePoint_1.default = default_1$2; var emojiRegex = function () { // https://mths.be/emoji @@ -13797,8 +16108,8 @@ const stringWidth = string => { var stringWidth_1 = stringWidth; // TODO: remove this in the next major version -var default_1$1 = stringWidth; -stringWidth_1.default = default_1$1; +var default_1$3 = stringWidth; +stringWidth_1.default = default_1$3; /*! * repeat-string @@ -13903,7 +16214,7 @@ function compare(a, b, property) { return (a[property] || '').localeCompare(b[property] || '') } -var supported = supportsColor_1$1.stderr.hasBasic; +var supported = supportsColor_1$2.stderr.hasBasic; @@ -14233,16 +16544,16 @@ function plural$1(value, count) { var log_1 = log; -var prefix$1 = 'vfile-reporter'; +var prefix = 'vfile-reporter'; function log(context, settings, next) { var reporter = settings.reporter || vfileReporter; var diagnostics; - if (xIsString(reporter)) { + if (typeof reporter === 'string') { try { - reporter = loadPlugin_1(reporter, {cwd: settings.cwd, prefix: prefix$1}); - } catch (error) { + reporter = loadPlugin_1(reporter, {cwd: settings.cwd, prefix: prefix}); + } catch (_) { next(new Error('Could not find reporter `' + reporter + '`')); return } @@ -14250,7 +16561,7 @@ function log(context, settings, next) { diagnostics = reporter( context.files.filter(given), - immutable(settings.reporterOptions, { + Object.assign({}, settings.reporterOptions, { quiet: settings.quiet, silent: settings.silent, color: settings.color @@ -14283,7 +16594,7 @@ var PassThrough = stream.PassThrough; -var lib$1 = run; +var lib$4 = run; // Run the file set pipeline once. // `callback` is invoked with a fatal error, or with a status code (`0` on @@ -14299,7 +16610,7 @@ function run(options, callback) { try { stdin = process.stdin; - } catch (error) { + } catch (_) { // Obscure bug in Node (seen on Windows). // See: , // . @@ -14388,6 +16699,7 @@ function run(options, callback) { : detectIgnore; settings.ignoreName = options.ignoreName || null; settings.ignorePath = options.ignorePath || null; + settings.ignorePathResolveFrom = options.ignorePathResolveFrom || 'dir'; settings.ignorePatterns = options.ignorePatterns || []; settings.silentlyIgnore = Boolean(options.silentlyIgnore); @@ -14428,20 +16740,10 @@ function extension(ext) { return ext.charAt(0) === '.' ? ext : '.' + ext } -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -var escapeStringRegexp = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - -var colorName = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], +var colorName$1 = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], "aquamarine": [127, 255, 212], "azure": [240, 255, 255], "beige": [245, 245, 220], @@ -14586,25 +16888,23 @@ var colorName = { "white": [255, 255, 255], "whitesmoke": [245, 245, 245], "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] + "yellowgreen": [154, 205, 50] }; -var conversions = createCommonjsModule(function (module) { /* MIT license */ +/* eslint-disable no-mixed-operators */ // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). // do not use box values types (i.e. Number(), String(), etc.) -var reverseKeywords = {}; -for (var key in colorName) { - if (colorName.hasOwnProperty(key)) { - reverseKeywords[colorName[key]] = key; - } +const reverseKeywords = {}; +for (const key of Object.keys(colorName$1)) { + reverseKeywords[colorName$1[key]] = key; } -var convert = module.exports = { +const convert$1 = { rgb: {channels: 3, labels: 'rgb'}, hsl: {channels: 3, labels: 'hsl'}, hsv: {channels: 3, labels: 'hsv'}, @@ -14622,40 +16922,38 @@ var convert = module.exports = { gray: {channels: 1, labels: ['gray']} }; -// hide .channels and .labels properties -for (var model in convert) { - if (convert.hasOwnProperty(model)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } +var conversions$1 = convert$1; - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } +// Hide .channels and .labels properties +for (const model of Object.keys(convert$1)) { + if (!('channels' in convert$1[model])) { + throw new Error('missing channels property: ' + model); + } - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } + if (!('labels' in convert$1[model])) { + throw new Error('missing channel labels property: ' + model); + } - var channels = convert[model].channels; - var labels = convert[model].labels; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); + if (convert$1[model].labels.length !== convert$1[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); } + + const {channels, labels} = convert$1[model]; + delete convert$1[model].channels; + delete convert$1[model].labels; + Object.defineProperty(convert$1[model], 'channels', {value: channels}); + Object.defineProperty(convert$1[model], 'labels', {value: labels}); } -convert.rgb.hsl = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var delta = max - min; - var h; - var s; - var l; +convert$1.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; if (max === min) { h = 0; @@ -14673,7 +16971,7 @@ convert.rgb.hsl = function (rgb) { h += 360; } - l = (min + max) / 2; + const l = (min + max) / 2; if (max === min) { s = 0; @@ -14686,24 +16984,25 @@ convert.rgb.hsl = function (rgb) { return [h, s * 100, l * 100]; }; -convert.rgb.hsv = function (rgb) { - var rdif; - var gdif; - var bdif; - var h; - var s; +convert$1.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var v = Math.max(r, g, b); - var diff = v - Math.min(r, g, b); - var diffc = function (c) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { return (v - c) / 6 / diff + 1 / 2; }; if (diff === 0) { - h = s = 0; + h = 0; + s = 0; } else { s = diff / v; rdif = diffc(r); @@ -14717,6 +17016,7 @@ convert.rgb.hsv = function (rgb) { } else if (b === v) { h = (2 / 3) + gdif - rdif; } + if (h < 0) { h += 1; } else if (h > 1) { @@ -14731,127 +17031,116 @@ convert.rgb.hsv = function (rgb) { ]; }; -convert.rgb.hwb = function (rgb) { - var r = rgb[0]; - var g = rgb[1]; - var b = rgb[2]; - var h = convert.rgb.hsl(rgb)[0]; - var w = 1 / 255 * Math.min(r, Math.min(g, b)); +convert$1.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert$1.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); return [h, w * 100, b * 100]; }; -convert.rgb.cmyk = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var c; - var m; - var y; - var k; +convert$1.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; return [c * 100, m * 100, y * 100, k * 100]; }; -/** - * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - * */ function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ return ( - Math.pow(x[0] - y[0], 2) + - Math.pow(x[1] - y[1], 2) + - Math.pow(x[2] - y[2], 2) + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) ); } -convert.rgb.keyword = function (rgb) { - var reversed = reverseKeywords[rgb]; +convert$1.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; if (reversed) { return reversed; } - var currentClosestDistance = Infinity; - var currentClosestKeyword; + let currentClosestDistance = Infinity; + let currentClosestKeyword; - for (var keyword in colorName) { - if (colorName.hasOwnProperty(keyword)) { - var value = colorName[keyword]; + for (const keyword of Object.keys(colorName$1)) { + const value = colorName$1[keyword]; - // Compute comparative distance - var distance = comparativeDistance(rgb, value); + // Compute comparative distance + const distance = comparativeDistance(rgb, value); - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; } } return currentClosestKeyword; }; -convert.keyword.rgb = function (keyword) { - return colorName[keyword]; +convert$1.keyword.rgb = function (keyword) { + return colorName$1[keyword]; }; -convert.rgb.xyz = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; +convert$1.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); return [x * 100, y * 100, z * 100]; }; -convert.rgb.lab = function (rgb) { - var xyz = convert.rgb.xyz(rgb); - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; +convert$1.rgb.lab = function (rgb) { + const xyz = convert$1.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; x /= 95.047; y /= 100; z /= 108.883; - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); return [l, a, b]; }; -convert.hsl.rgb = function (hsl) { - var h = hsl[0] / 360; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var t1; - var t2; - var t3; - var rgb; - var val; +convert$1.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; if (s === 0) { val = l * 255; @@ -14864,14 +17153,15 @@ convert.hsl.rgb = function (hsl) { t2 = l + s - l * s; } - t1 = 2 * l - t2; + const t1 = 2 * l - t2; - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { t3 = h + 1 / 3 * -(i - 1); if (t3 < 0) { t3++; } + if (t3 > 1) { t3--; } @@ -14892,34 +17182,32 @@ convert.hsl.rgb = function (hsl) { return rgb; }; -convert.hsl.hsv = function (hsl) { - var h = hsl[0]; - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var smin = s; - var lmin = Math.max(l, 0.01); - var sv; - var v; +convert$1.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); l *= 2; s *= (l <= 1) ? l : 2 - l; smin *= lmin <= 1 ? lmin : 2 - lmin; - v = (l + s) / 2; - sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); return [h, sv * 100, v * 100]; }; -convert.hsv.rgb = function (hsv) { - var h = hsv[0] / 60; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var hi = Math.floor(h) % 6; +convert$1.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; - var f = h - Math.floor(h); - var p = 255 * v * (1 - s); - var q = 255 * v * (1 - (s * f)); - var t = 255 * v * (1 - (s * (1 - f))); + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); v *= 255; switch (hi) { @@ -14938,17 +17226,16 @@ convert.hsv.rgb = function (hsv) { } }; -convert.hsv.hsl = function (hsv) { - var h = hsv[0]; - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var vmin = Math.max(v, 0.01); - var lmin; - var sl; - var l; +convert$1.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; l = (2 - s) * v; - lmin = (2 - s) * vmin; + const lmin = (2 - s) * vmin; sl = s * vmin; sl /= (lmin <= 1) ? lmin : 2 - lmin; sl = sl || 0; @@ -14958,88 +17245,84 @@ convert.hsv.hsl = function (hsv) { }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - var h = hwb[0] / 360; - var wh = hwb[1] / 100; - var bl = hwb[2] / 100; - var ratio = wh + bl; - var i; - var v; - var f; - var n; - - // wh + bl cant be > 1 +convert$1.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; + + // Wh + bl cant be > 1 if (ratio > 1) { wh /= ratio; bl /= ratio; } - i = Math.floor(6 * h); - v = 1 - bl; + const i = Math.floor(6 * h); + const v = 1 - bl; f = 6 * h - i; if ((i & 0x01) !== 0) { f = 1 - f; } - n = wh + f * (v - wh); // linear interpolation + const n = wh + f * (v - wh); // Linear interpolation - var r; - var g; - var b; + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ switch (i) { default: case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; } + /* eslint-enable max-statements-per-line,no-multi-spaces */ return [r * 255, g * 255, b * 255]; }; -convert.cmyk.rgb = function (cmyk) { - var c = cmyk[0] / 100; - var m = cmyk[1] / 100; - var y = cmyk[2] / 100; - var k = cmyk[3] / 100; - var r; - var g; - var b; +convert$1.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); return [r * 255, g * 255, b * 255]; }; -convert.xyz.rgb = function (xyz) { - var x = xyz[0] / 100; - var y = xyz[1] / 100; - var z = xyz[2] / 100; - var r; - var g; - var b; +convert$1.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - // assume sRGB + // Assume sRGB r = r > 0.0031308 - ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) : r * 12.92; g = g > 0.0031308 - ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) : g * 12.92; b = b > 0.0031308 - ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) : b * 12.92; r = Math.min(Math.max(0, r), 1); @@ -15049,44 +17332,41 @@ convert.xyz.rgb = function (xyz) { return [r * 255, g * 255, b * 255]; }; -convert.xyz.lab = function (xyz) { - var x = xyz[0]; - var y = xyz[1]; - var z = xyz[2]; - var l; - var a; - var b; +convert$1.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; x /= 95.047; y /= 100; z /= 108.883; - x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); return [l, a, b]; }; -convert.lab.xyz = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var x; - var y; - var z; +convert$1.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; y = (l + 16) / 116; x = a / 500 + y; z = y - b / 200; - var y2 = Math.pow(y, 3); - var x2 = Math.pow(x, 3); - var z2 = Math.pow(z, 3); + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; @@ -15098,46 +17378,39 @@ convert.lab.xyz = function (lab) { return [x, y, z]; }; -convert.lab.lch = function (lab) { - var l = lab[0]; - var a = lab[1]; - var b = lab[2]; - var hr; - var h; - var c; +convert$1.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; - hr = Math.atan2(b, a); + const hr = Math.atan2(b, a); h = hr * 360 / 2 / Math.PI; if (h < 0) { h += 360; } - c = Math.sqrt(a * a + b * b); + const c = Math.sqrt(a * a + b * b); return [l, c, h]; }; -convert.lch.lab = function (lch) { - var l = lch[0]; - var c = lch[1]; - var h = lch[2]; - var a; - var b; - var hr; +convert$1.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); return [l, a, b]; }; -convert.rgb.ansi16 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; - var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization +convert$1.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization value = Math.round(value / 50); @@ -15145,7 +17418,7 @@ convert.rgb.ansi16 = function (args) { return 30; } - var ansi = 30 + let ansi = 30 + ((Math.round(b / 255) << 2) | (Math.round(g / 255) << 1) | Math.round(r / 255)); @@ -15157,18 +17430,18 @@ convert.rgb.ansi16 = function (args) { return ansi; }; -convert.hsv.ansi16 = function (args) { - // optimization here; we already know the value and don't need to get +convert$1.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); + return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]); }; -convert.rgb.ansi256 = function (args) { - var r = args[0]; - var g = args[1]; - var b = args[2]; +convert$1.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; - // we use the extended greyscale palette here, with the exception of + // We use the extended greyscale palette here, with the exception of // black and white. normal palette only has 4 greyscale shades. if (r === g && g === b) { if (r < 8) { @@ -15182,7 +17455,7 @@ convert.rgb.ansi256 = function (args) { return Math.round(((r - 8) / 247) * 24) + 232; } - var ansi = 16 + const ansi = 16 + (36 * Math.round(r / 255 * 5)) + (6 * Math.round(g / 255 * 5)) + Math.round(b / 255 * 5); @@ -15190,10 +17463,10 @@ convert.rgb.ansi256 = function (args) { return ansi; }; -convert.ansi16.rgb = function (args) { - var color = args % 10; +convert$1.ansi16.rgb = function (args) { + let color = args % 10; - // handle greyscale + // Handle greyscale if (color === 0 || color === 7) { if (args > 50) { color += 3.5; @@ -15204,71 +17477,71 @@ convert.ansi16.rgb = function (args) { return [color, color, color]; } - var mult = (~~(args > 50) + 1) * 0.5; - var r = ((color & 1) * mult) * 255; - var g = (((color >> 1) & 1) * mult) * 255; - var b = (((color >> 2) & 1) * mult) * 255; + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; return [r, g, b]; }; -convert.ansi256.rgb = function (args) { - // handle greyscale +convert$1.ansi256.rgb = function (args) { + // Handle greyscale if (args >= 232) { - var c = (args - 232) * 10 + 8; + const c = (args - 232) * 10 + 8; return [c, c, c]; } args -= 16; - var rem; - var r = Math.floor(args / 36) / 5 * 255; - var g = Math.floor((rem = args % 36) / 6) / 5 * 255; - var b = (rem % 6) / 5 * 255; + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; return [r, g, b]; }; -convert.rgb.hex = function (args) { - var integer = ((Math.round(args[0]) & 0xFF) << 16) +convert$1.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF); - var string = integer.toString(16).toUpperCase(); + const string = integer.toString(16).toUpperCase(); return '000000'.substring(string.length) + string; }; -convert.hex.rgb = function (args) { - var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); +convert$1.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); if (!match) { return [0, 0, 0]; } - var colorString = match[0]; + let colorString = match[0]; if (match[0].length === 3) { - colorString = colorString.split('').map(function (char) { + colorString = colorString.split('').map(char => { return char + char; }).join(''); } - var integer = parseInt(colorString, 16); - var r = (integer >> 16) & 0xFF; - var g = (integer >> 8) & 0xFF; - var b = integer & 0xFF; + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; return [r, g, b]; }; -convert.rgb.hcg = function (rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var max = Math.max(Math.max(r, g), b); - var min = Math.min(Math.min(r, g), b); - var chroma = (max - min); - var grayscale; - var hue; +convert$1.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; if (chroma < 1) { grayscale = min / (1 - chroma); @@ -15285,7 +17558,7 @@ convert.rgb.hcg = function (rgb) { if (max === g) { hue = 2 + (b - r) / chroma; } else { - hue = 4 + (r - g) / chroma + 4; + hue = 4 + (r - g) / chroma; } hue /= 6; @@ -15294,18 +17567,13 @@ convert.rgb.hcg = function (rgb) { return [hue * 360, chroma * 100, grayscale * 100]; }; -convert.hsl.hcg = function (hsl) { - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var c = 1; - var f = 0; +convert$1.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; - if (l < 0.5) { - c = 2.0 * s * l; - } else { - c = 2.0 * s * (1.0 - l); - } + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + let f = 0; if (c < 1.0) { f = (l - 0.5 * c) / (1.0 - c); } @@ -15313,12 +17581,12 @@ convert.hsl.hcg = function (hsl) { return [hsl[0], c * 100, f * 100]; }; -convert.hsv.hcg = function (hsv) { - var s = hsv[1] / 100; - var v = hsv[2] / 100; +convert$1.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; - var c = s * v; - var f = 0; + const c = s * v; + let f = 0; if (c < 1.0) { f = (v - c) / (1 - c); @@ -15327,21 +17595,22 @@ convert.hsv.hcg = function (hsv) { return [hsv[0], c * 100, f * 100]; }; -convert.hcg.rgb = function (hcg) { - var h = hcg[0] / 360; - var c = hcg[1] / 100; - var g = hcg[2] / 100; +convert$1.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; if (c === 0.0) { return [g * 255, g * 255, g * 255]; } - var pure = [0, 0, 0]; - var hi = (h % 1) * 6; - var v = hi % 1; - var w = 1 - v; - var mg = 0; + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + /* eslint-disable max-statements-per-line */ switch (Math.floor(hi)) { case 0: pure[0] = 1; pure[1] = v; pure[2] = 0; break; @@ -15356,6 +17625,7 @@ convert.hcg.rgb = function (hcg) { default: pure[0] = 1; pure[1] = 0; pure[2] = w; } + /* eslint-enable max-statements-per-line */ mg = (1.0 - c) * g; @@ -15366,12 +17636,12 @@ convert.hcg.rgb = function (hcg) { ]; }; -convert.hcg.hsv = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; +convert$1.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - var v = c + g * (1.0 - c); - var f = 0; + const v = c + g * (1.0 - c); + let f = 0; if (v > 0.0) { f = c / v; @@ -15380,12 +17650,12 @@ convert.hcg.hsv = function (hcg) { return [hcg[0], f * 100, v * 100]; }; -convert.hcg.hsl = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; +convert$1.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - var l = g * (1.0 - c) + 0.5 * c; - var s = 0; + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; if (l > 0.0 && l < 0.5) { s = c / (2 * l); @@ -15397,19 +17667,19 @@ convert.hcg.hsl = function (hcg) { return [hcg[0], s * 100, l * 100]; }; -convert.hcg.hwb = function (hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var v = c + g * (1.0 - c); +convert$1.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); return [hcg[0], (v - c) * 100, (1 - v) * 100]; }; -convert.hwb.hcg = function (hwb) { - var w = hwb[1] / 100; - var b = hwb[2] / 100; - var v = 1 - b; - var c = v - w; - var g = 0; +convert$1.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; if (c < 1) { g = (v - c) / (1 - c); @@ -15418,65 +17688,51 @@ convert.hwb.hcg = function (hwb) { return [hwb[0], c * 100, g * 100]; }; -convert.apple.rgb = function (apple) { +convert$1.apple.rgb = function (apple) { return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; }; -convert.rgb.apple = function (rgb) { +convert$1.rgb.apple = function (rgb) { return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; }; -convert.gray.rgb = function (args) { +convert$1.gray.rgb = function (args) { return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; }; -convert.gray.hsl = convert.gray.hsv = function (args) { +convert$1.gray.hsl = function (args) { return [0, 0, args[0]]; }; -convert.gray.hwb = function (gray) { +convert$1.gray.hsv = convert$1.gray.hsl; + +convert$1.gray.hwb = function (gray) { return [0, 100, gray[0]]; }; -convert.gray.cmyk = function (gray) { +convert$1.gray.cmyk = function (gray) { return [0, 0, 0, gray[0]]; }; -convert.gray.lab = function (gray) { +convert$1.gray.lab = function (gray) { return [gray[0], 0, 0]; }; -convert.gray.hex = function (gray) { - var val = Math.round(gray[0] / 100 * 255) & 0xFF; - var integer = (val << 16) + (val << 8) + val; +convert$1.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; - var string = integer.toString(16).toUpperCase(); + const string = integer.toString(16).toUpperCase(); return '000000'.substring(string.length) + string; }; -convert.rgb.gray = function (rgb) { - var val = (rgb[0] + rgb[1] + rgb[2]) / 3; +convert$1.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; return [val / 255 * 100]; }; -}); -var conversions_1 = conversions.rgb; -var conversions_2 = conversions.hsl; -var conversions_3 = conversions.hsv; -var conversions_4 = conversions.hwb; -var conversions_5 = conversions.cmyk; -var conversions_6 = conversions.xyz; -var conversions_7 = conversions.lab; -var conversions_8 = conversions.lch; -var conversions_9 = conversions.hex; -var conversions_10 = conversions.keyword; -var conversions_11 = conversions.ansi16; -var conversions_12 = conversions.ansi256; -var conversions_13 = conversions.hcg; -var conversions_14 = conversions.apple; -var conversions_15 = conversions.gray; /* - this function routes a model to all other models. + This function routes a model to all other models. all functions that are routed have a property `.conversion` attached to the returned synthetic function. This property is an array @@ -15486,12 +17742,12 @@ var conversions_15 = conversions.gray; conversions that are not possible simply are not included. */ -function buildGraph() { - var graph = {}; +function buildGraph$1() { + const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - var models = Object.keys(conversions); + const models = Object.keys(conversions$1); - for (var len = models.length, i = 0; i < len; i++) { + for (let len = models.length, i = 0; i < len; i++) { graph[models[i]] = { // http://jsperf.com/1-vs-infinity // micro-opt, but this is simple. @@ -15504,19 +17760,19 @@ function buildGraph() { } // https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - var graph = buildGraph(); - var queue = [fromModel]; // unshift -> queue -> pop +function deriveBFS$1(fromModel) { + const graph = buildGraph$1(); + const queue = [fromModel]; // Unshift -> queue -> pop graph[fromModel].distance = 0; while (queue.length) { - var current = queue.pop(); - var adjacents = Object.keys(conversions[current]); + const current = queue.pop(); + const adjacents = Object.keys(conversions$1[current]); - for (var len = adjacents.length, i = 0; i < len; i++) { - var adjacent = adjacents[i]; - var node = graph[adjacent]; + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; if (node.distance === -1) { node.distance = graph[current].distance + 1; @@ -15529,20 +17785,20 @@ function deriveBFS(fromModel) { return graph; } -function link(from, to) { +function link$1(from, to) { return function (args) { return to(from(args)); }; } -function wrapConversion(toModel, graph) { - var path = [graph[toModel].parent, toModel]; - var fn = conversions[graph[toModel].parent][toModel]; +function wrapConversion$1(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions$1[graph[toModel].parent][toModel]; - var cur = graph[toModel].parent; + let cur = graph[toModel].parent; while (graph[cur].parent) { path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); + fn = link$1(conversions$1[graph[cur].parent][cur], fn); cur = graph[cur].parent; } @@ -15550,44 +17806,45 @@ function wrapConversion(toModel, graph) { return fn; } -var route = function (fromModel) { - var graph = deriveBFS(fromModel); - var conversion = {}; +var route$1 = function (fromModel) { + const graph = deriveBFS$1(fromModel); + const conversion = {}; - var models = Object.keys(graph); - for (var len = models.length, i = 0; i < len; i++) { - var toModel = models[i]; - var node = graph[toModel]; + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; if (node.parent === null) { - // no possible conversion, or this node is the source model. + // No possible conversion, or this node is the source model. continue; } - conversion[toModel] = wrapConversion(toModel, graph); + conversion[toModel] = wrapConversion$1(toModel, graph); } return conversion; }; -var convert = {}; +const convert$2 = {}; -var models = Object.keys(conversions); +const models$1 = Object.keys(conversions$1); -function wrapRaw(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; +function wrapRaw$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; } - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); + if (arg0.length > 1) { + args = arg0; } return fn(args); }; - // preserve .conversion property if there is one + // Preserve .conversion property if there is one if ('conversion' in fn) { wrappedFn.conversion = fn.conversion; } @@ -15595,23 +17852,25 @@ function wrapRaw(fn) { return wrappedFn; } -function wrapRounded(fn) { - var wrappedFn = function (args) { - if (args === undefined || args === null) { - return args; +function wrapRounded$1(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; } - if (arguments.length > 1) { - args = Array.prototype.slice.call(arguments); + if (arg0.length > 1) { + args = arg0; } - var result = fn(args); + const result = fn(args); - // we're assuming the result is an array here. + // We're assuming the result is an array here. // see notice in conversions.js; don't use box types // in conversion functions. if (typeof result === 'object') { - for (var len = result.length, i = 0; i < len; i++) { + for (let len = result.length, i = 0; i < len; i++) { result[i] = Math.round(result[i]); } } @@ -15619,7 +17878,7 @@ function wrapRounded(fn) { return result; }; - // preserve .conversion property if there is one + // Preserve .conversion property if there is one if ('conversion' in fn) { wrappedFn.conversion = fn.conversion; } @@ -15627,43 +17886,85 @@ function wrapRounded(fn) { return wrappedFn; } -models.forEach(function (fromModel) { - convert[fromModel] = {}; +models$1.forEach(fromModel => { + convert$2[fromModel] = {}; - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + Object.defineProperty(convert$2[fromModel], 'channels', {value: conversions$1[fromModel].channels}); + Object.defineProperty(convert$2[fromModel], 'labels', {value: conversions$1[fromModel].labels}); - var routes = route(fromModel); - var routeModels = Object.keys(routes); + const routes = route$1(fromModel); + const routeModels = Object.keys(routes); - routeModels.forEach(function (toModel) { - var fn = routes[toModel]; + routeModels.forEach(toModel => { + const fn = routes[toModel]; - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); + convert$2[fromModel][toModel] = wrapRounded$1(fn); + convert$2[fromModel][toModel].raw = wrapRaw$1(fn); }); }); -var colorConvert = convert; - -var ansiStyles = createCommonjsModule(function (module) { +var colorConvert$1 = convert$2; +var ansiStyles$1 = createCommonjsModule(function (module) { -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); return `\u001B[${code + offset}m`; }; -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); return `\u001B[${38 + offset};5;${code}m`; }; -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; }; +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = colorConvert$1; + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + function assembleStyles() { const codes = new Map(); const styles = { @@ -15687,9 +17988,9 @@ function assembleStyles() { magenta: [35, 39], cyan: [36, 39], white: [37, 39], - gray: [90, 39], // Bright color + blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], @@ -15720,15 +18021,14 @@ function assembleStyles() { } }; - // Fix humans - styles.color.grey = styles.color.gray; - - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; - - for (const styleName of Object.keys(group)) { - const style = group[styleName]; + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { styles[styleName] = { open: `\u001B[${style[0]}m`, close: `\u001B[${style[1]}m` @@ -15743,65 +18043,22 @@ function assembleStyles() { value: group, enumerable: false }); - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); } - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); 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); - } - } + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); return styles; } @@ -15813,12 +18070,50 @@ Object.defineProperty(module, 'exports', { }); }); -const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi; +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } -const ESCAPES = new Map([ + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +var util = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; + +const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi; + +const ESCAPES$1 = new Map([ ['n', '\n'], ['r', '\r'], ['t', '\t'], @@ -15831,24 +18126,32 @@ const ESCAPES = new Map([ ['a', '\u0007'] ]); -function unescape(c) { - if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { +function unescape$1(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { return String.fromCharCode(parseInt(c.slice(1), 16)); } - return ESCAPES.get(c) || c; + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + + return ESCAPES$1.get(c) || c; } -function parseArguments(name, args) { +function parseArguments$1(name, arguments_) { const results = []; - const chunks = args.trim().split(/\s*,\s*/g); + const chunks = arguments_.trim().split(/\s*,\s*/g); let matches; for (const chunk of chunks) { - if (!isNaN(chunk)) { - results.push(Number(chunk)); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX$1))) { + results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character)); } else { throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); } @@ -15857,17 +18160,17 @@ function parseArguments(name, args) { return results; } -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; +function parseStyle$1(style) { + STYLE_REGEX$1.lastIndex = 0; const results = []; let matches; - while ((matches = STYLE_REGEX.exec(style)) !== null) { + while ((matches = STYLE_REGEX$1.exec(style)) !== null) { const name = matches[1]; if (matches[2]) { - const args = parseArguments(name, matches[2]); + const args = parseArguments$1(name, matches[2]); results.push([name].concat(args)); } else { results.push([name]); @@ -15877,7 +18180,7 @@ function parseStyle(style) { return results; } -function buildStyle(chalk, styles) { +function buildStyle$1(chalk, styles) { const enabled = {}; for (const layer of styles) { @@ -15887,47 +18190,45 @@ function buildStyle(chalk, styles) { } let current = chalk; - for (const styleName of Object.keys(enabled)) { - if (Array.isArray(enabled[styleName])) { - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } - if (enabled[styleName].length > 0) { - current = current[styleName].apply(current, enabled[styleName]); - } else { - current = current[styleName]; - } + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; } return current; } -var templates = (chalk, tmp) => { +var templates$1 = (chalk, temporary) => { const styles = []; const chunks = []; let chunk = []; // eslint-disable-next-line max-params - tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { - if (escapeChar) { - chunk.push(unescape(escapeChar)); + temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape$1(escapeCharacter)); } else if (style) { - const str = chunk.join(''); + const string = chunk.join(''); chunk = []; - chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); - styles.push({inverse, styles: parseStyle(style)}); + chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle$1(style)}); } else if (close) { if (styles.length === 0) { throw new Error('Found extraneous } in Chalk template literal'); } - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunks.push(buildStyle$1(chalk, styles)(chunk.join(''))); chunk = []; styles.pop(); } else { - chunk.push(chr); + chunk.push(character); } }); @@ -15941,236 +18242,237 @@ var templates = (chalk, tmp) => { return chunks.join(''); }; -var chalk = createCommonjsModule(function (module) { - - -const stdoutColor = supportsColor_1.stdout; - - - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); +const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1$1; +const { + stringReplaceAll: stringReplaceAll$1, + stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1 +} = util; // `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; const styles = Object.create(null); -function applyOptions(obj, options) { - options = options || {}; +const applyOptions = (object, options = {}) => { + if (options.level > 3 || options.level < 0) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + return chalkFactory(options); + } } -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); - chalk.template.constructor = Chalk; + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; - return chalk.template; - } + chalk.template.Instance = ChalkClass; - applyOptions(this, options); -} + return chalk.template; +}; -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; +function Chalk(options) { + return chalkFactory(options); } -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { +for (const [styleName, style] of Object.entries(ansiStyles$1)) { + styles[styleName] = { get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; } }; } styles.visible = { get() { - return build.call(this, this._styles || [], true, 'visible'); + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; } }; -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; +for (const model of usedModels) { styles[model] = { get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.color[levelMapping[level]][model](...arguments_), ansiStyles$1.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); }; } }; } -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - +for (const model of usedModels) { const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); styles[bgModel] = { get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles$1.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$1.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); }; } }; } -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { +const proto$3 = Object.defineProperties(() => {}, { + ...styles, + level: { enumerable: true, get() { - return self.level; + return this._generator.level; }, set(level) { - self.level = level; + this._generator.level = level; } - }); + } +}); - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; // `__proto__` is used because we must return a function, but there is // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto + builder.__proto__ = proto$3; // eslint-disable-line no-proto - return builder; -} + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); + return builder; +}; - if (argsLen === 0) { - return ''; +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; } - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } + let styler = self._styler; - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; + if (styler === undefined) { + return string; } - // 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. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // 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'. + string = stringReplaceAll$1(string, styler.close, styler.open); - for (const code of this._styles.slice().reverse()) { - // 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; + styler = styler.parent; + } + } - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex); } - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; + return openAll + string + closeAll; +}; - return str; -} +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { + if (!Array.isArray(firstString)) { // If chalk() was called by itself or with a string, // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); + return strings.join(' '); } - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); } - return templates(chalk, parts.join('')); -} + if (template === undefined) { + template = templates$1; + } + + return template(chalk, parts.join('')); +}; Object.defineProperties(Chalk.prototype, styles); -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript -}); -var chalk_1 = chalk.supportsColor; +const chalk$1 = Chalk(); // eslint-disable-line new-cap +chalk$1.supportsColor = stdoutColor; +chalk$1.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk$1.stderr.supportsColor = stderrColor; + +// For TypeScript +chalk$1.Level = { + None: 0, + Basic: 1, + Ansi256: 2, + TrueColor: 3, + 0: 'None', + 1: 'Basic', + 2: 'Ansi256', + 3: 'TrueColor' +}; + +var source = chalk$1; const WIN_SLASH = '\\\\/'; const WIN_NO_SLASH = `[^${WIN_SLASH}]`; @@ -16349,7 +18651,7 @@ var constants = { } }; -var utils$1 = createCommonjsModule(function (module, exports) { +var utils = createCommonjsModule(function (module, exports) { const win32 = process.platform === 'win32'; @@ -16414,17 +18716,17 @@ exports.wrapOutput = (input, state = {}, options = {}) => { return output; }; }); -var utils_1$1 = utils$1.isObject; -var utils_2$1 = utils$1.hasRegexChars; -var utils_3$1 = utils$1.isRegexChar; -var utils_4$1 = utils$1.escapeRegex; -var utils_5$1 = utils$1.toPosixSlashes; -var utils_6 = utils$1.removeBackslashes; -var utils_7 = utils$1.supportsLookbehinds; -var utils_8 = utils$1.isWindows; -var utils_9 = utils$1.escapeLast; -var utils_10 = utils$1.removePrefix; -var utils_11 = utils$1.wrapOutput; +var utils_1 = utils.isObject; +var utils_2 = utils.hasRegexChars; +var utils_3 = utils.isRegexChar; +var utils_4 = utils.escapeRegex; +var utils_5 = utils.toPosixSlashes; +var utils_6 = utils.removeBackslashes; +var utils_7 = utils.supportsLookbehinds; +var utils_8 = utils.isWindows; +var utils_9 = utils.escapeLast; +var utils_10 = utils.removePrefix; +var utils_11 = utils.wrapOutput; const { CHAR_ASTERISK: CHAR_ASTERISK$1, /* * */ @@ -16672,23 +18974,24 @@ const scan$1 = (input, options) => { } if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; + isGlob = token.isGlob = true; - if (scanToEnd === true) { + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); continue; } - break; + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } } + continue; } + break; } if (isGlob === true) { @@ -16734,10 +19037,10 @@ const scan$1 = (input, options) => { } if (opts.unescape === true) { - if (glob) glob = utils$1.removeBackslashes(glob); + if (glob) glob = utils.removeBackslashes(glob); if (base && backslashes === true) { - base = utils$1.removeBackslashes(base); + base = utils.removeBackslashes(base); } } @@ -16834,7 +19137,7 @@ const expandRange = (args, options) => { /* eslint-disable-next-line no-new */ new RegExp(value); } catch (ex) { - return args.map(v => utils$1.escapeRegex(v)).join('..'); + return args.map(v => utils.escapeRegex(v)).join('..'); } return value; @@ -16874,7 +19177,7 @@ const parse$5 = (input, options) => { const tokens = [bos]; const capture = opts.capture ? '' : '?:'; - const win32 = utils$1.isWindows(options); + const win32 = utils.isWindows(options); // create constants based on platform, for windows or posix const PLATFORM_CHARS = constants.globChars(win32); @@ -16930,7 +19233,7 @@ const parse$5 = (input, options) => { tokens }; - input = utils$1.removePrefix(input, state); + input = utils.removePrefix(input, state); len = input.length; const extglobs = []; @@ -17031,8 +19334,6 @@ const parse$5 = (input, options) => { const output = (opts.capture ? '(' : '') + token.open; increment('parens'); - - push({ type, value, output: state.output ? '' : ONE_CHAR }); push({ type: 'paren', extglob: true, value: advance(), output }); extglobs.push(token); @@ -17112,7 +19413,7 @@ const parse$5 = (input, options) => { return state; } - state.output = utils$1.wrapOutput(output, state, options); + state.output = utils.wrapOutput(output, state, options); return state; } @@ -17225,7 +19526,7 @@ const parse$5 = (input, options) => { */ if (state.quotes === 1 && value !== '"') { - value = utils$1.escapeRegex(value); + value = utils.escapeRegex(value); prev.value += value; append({ value }); continue; @@ -17315,11 +19616,11 @@ const parse$5 = (input, options) => { // when literal brackets are explicitly disabled // assume we should match with a regex character class - if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) { + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { continue; } - const escaped = utils$1.escapeRegex(prev.value); + const escaped = utils.escapeRegex(prev.value); state.output = state.output.slice(0, -prev.value.length); // when literal brackets are explicitly enabled @@ -17388,7 +19689,7 @@ const parse$5 = (input, options) => { const out = state.output.slice(0, brace.outputIndex); const toks = state.tokens.slice(brace.tokensIndex); brace.value = brace.output = '\\{'; - value = output = `\\}`; + value = output = '\\}'; state.output = out; for (const t of toks) { state.output += (t.output || t.value); @@ -17491,7 +19792,7 @@ const parse$5 = (input, options) => { const next = peek(); let output = value; - if (next === '<' && !utils$1.supportsLookbehinds()) { + if (next === '<' && !utils.supportsLookbehinds()) { throw new Error('Node.js v10 or higher is required for regex lookbehinds'); } @@ -17751,19 +20052,19 @@ const parse$5 = (input, options) => { while (state.brackets > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils$1.escapeLast(state.output, '['); + state.output = utils.escapeLast(state.output, '['); decrement('brackets'); } while (state.parens > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils$1.escapeLast(state.output, '('); + state.output = utils.escapeLast(state.output, '('); decrement('parens'); } while (state.braces > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils$1.escapeLast(state.output, '{'); + state.output = utils.escapeLast(state.output, '{'); decrement('braces'); } @@ -17802,7 +20103,7 @@ parse$5.fastpaths = (input, options) => { } input = REPLACEMENTS[input] || input; - const win32 = utils$1.isWindows(options); + const win32 = utils.isWindows(options); // create constants based on platform, for windows or posix const { @@ -17870,7 +20171,7 @@ parse$5.fastpaths = (input, options) => { } }; - const output = utils$1.removePrefix(input, state); + const output = utils.removePrefix(input, state); let source = create(output); if (source && opts.strictSlashes !== true) { @@ -17882,7 +20183,7 @@ parse$5.fastpaths = (input, options) => { var parse_1$1 = parse$5; -const isObject$2 = val => val && typeof val === 'object' && !Array.isArray(val); +const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val); /** * Creates a matcher function from one or more glob patterns. The @@ -17919,14 +20220,14 @@ const picomatch = (glob, options, returnState = false) => { return arrayMatcher; } - const isState = isObject$2(glob) && glob.tokens && glob.input; + const isState = isObject$1(glob) && glob.tokens && glob.input; if (glob === '' || (typeof glob !== 'string' && !isState)) { throw new TypeError('Expected pattern to be a non-empty string'); } const opts = options || {}; - const posix = utils$1.isWindows(options); + const posix = utils.isWindows(options); const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true); @@ -18001,7 +20302,7 @@ picomatch.test = (input, regex, options, { glob, posix } = {}) => { } const opts = options || {}; - const format = opts.format || (posix ? utils$1.toPosixSlashes : null); + const format = opts.format || (posix ? utils.toPosixSlashes : null); let match = input === glob; let output = (match && format) ? format(input) : input; @@ -18035,7 +20336,7 @@ picomatch.test = (input, regex, options, { glob, posix } = {}) => { * @api public */ -picomatch.matchBase = (input, glob, options, posix = utils$1.isWindows(options)) => { +picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); return regex.test(path$1.basename(input)); }; @@ -18108,16 +20409,17 @@ picomatch.parse = (pattern, options) => { picomatch.scan = (input, options) => scan_1(input, options); /** - * Create a regular expression from a glob pattern. + * Create a regular expression from a parsed glob pattern. * * ```js * const picomatch = require('picomatch'); - * // picomatch.makeRe(input[, options]); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); * - * console.log(picomatch.makeRe('*.js')); + * console.log(picomatch.compileRe(state)); * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ * ``` - * @param {String} `input` A glob pattern to convert to regex. + * @param {String} `state` The object returned from the `.parse` method. * @param {Object} `options` * @return {RegExp} Returns a regex created from the given pattern. * @api public @@ -18218,12 +20520,13 @@ var picomatch$1 = picomatch_1; const { Readable } = stream; -const { promisify } = util$1; +const { promisify } = util$2; const readdir$1 = promisify(fs$1.readdir); const stat$2 = promisify(fs$1.stat); const lstat = promisify(fs$1.lstat); +const realpath$2 = promisify(fs$1.realpath); /** * @typedef {Object} EntryInfo @@ -18321,11 +20624,7 @@ class ReaddirpStream extends Readable { this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; // Launch stream with one parent, the root dir. - try { - this.parents = [this._exploreDir(root, 1)]; - } catch (error) { - this.destroy(error); - } + this.parents = [this._exploreDir(root, 1)]; this.reading = false; this.parent = undefined; } @@ -18341,7 +20640,10 @@ class ReaddirpStream extends Readable { if (files.length > 0) { const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); for (const entry of await Promise.all(slice)) { - if (this._isDirAndMatchesFilter(entry)) { + if (this.destroyed) return; + + const entryType = await this._getEntryType(entry); + if (entryType === 'directory' && this._directoryFilter(entry)) { if (depth <= this._maxDepth) { this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); } @@ -18350,7 +20652,7 @@ class ReaddirpStream extends Readable { this.push(entry); batch--; } - } else if (this._isFileAndMatchesFilter(entry)) { + } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { if (this._wantsFile) { this.push(entry); batch--; @@ -18364,6 +20666,7 @@ class ReaddirpStream extends Readable { break; } this.parent = await parent; + if (this.destroyed) return; } } } catch (error) { @@ -18384,10 +20687,11 @@ class ReaddirpStream extends Readable { } async _formatEntry(dirent, path) { - const basename = this._isDirent ? dirent.name : dirent; - const fullPath = path$1.resolve(path$1.join(path, basename)); - const entry = {path: path$1.relative(this._root, fullPath), fullPath, basename}; + let entry; try { + const basename = this._isDirent ? dirent.name : dirent; + const fullPath = path$1.resolve(path$1.join(path, basename)); + entry = {path: path$1.relative(this._root, fullPath), fullPath, basename}; entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); } catch (err) { this._onError(err); @@ -18399,24 +20703,43 @@ class ReaddirpStream extends Readable { if (isNormalFlowError(err) && !this.destroyed) { this.emit('warn', err); } else { - throw err; + this.destroy(err); } } - _isDirAndMatchesFilter(entry) { + async _getEntryType(entry) { // entry may be undefined, because a warning or an error were emitted // and the statsProp is undefined const stats = entry && entry[this._statsProp]; - return stats && stats.isDirectory() && this._directoryFilter(entry); + if (!stats) { + return; + } + if (stats.isFile()) { + return 'file'; + } + if (stats.isDirectory()) { + return 'directory'; + } + if (stats && stats.isSymbolicLink()) { + try { + const entryRealPath = await realpath$2(entry.fullPath); + const entryRealPathStats = await lstat(entryRealPath); + if (entryRealPathStats.isFile()) { + return 'file'; + } + if (entryRealPathStats.isDirectory()) { + return 'directory'; + } + } catch (error) { + this._onError(error); + } + } } - _isFileAndMatchesFilter(entry) { + _includeAsFile(entry) { const stats = entry && entry[this._statsProp]; - const isFileType = stats && ( - (this._wantsEverything && !stats.isDirectory()) || - (stats.isFile() || stats.isSymbolicLink()) - ); - return isFileType && this._fileFilter(entry); + + return stats && this._wantsEverything && !stats.isDirectory(); } } @@ -18687,7 +21010,7 @@ var slash = '/'; var backslash = /\\/g; var enclosure = /[\{\[].*[\/]*.*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; -var escaped = /\\([\*\?\|\[\]\(\)\{\}])/g; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; /** * @param {string} str @@ -18719,7 +21042,7 @@ var globParent = function globParent(str, opts) { return str.replace(escaped, '$1'); }; -var utils$2 = createCommonjsModule(function (module, exports) { +var utils$1 = createCommonjsModule(function (module, exports) { exports.isInteger = num => { if (typeof num === 'number') { @@ -18832,24 +21155,24 @@ exports.flatten = (...args) => { return result; }; }); -var utils_1$2 = utils$2.isInteger; -var utils_2$2 = utils$2.find; -var utils_3$2 = utils$2.exceedsLimit; -var utils_4$2 = utils$2.escapeNode; -var utils_5$2 = utils$2.encloseBrace; -var utils_6$1 = utils$2.isInvalidBrace; -var utils_7$1 = utils$2.isOpenOrClose; -var utils_8$1 = utils$2.reduce; -var utils_9$1 = utils$2.flatten; +var utils_1$1 = utils$1.isInteger; +var utils_2$1 = utils$1.find; +var utils_3$1 = utils$1.exceedsLimit; +var utils_4$1 = utils$1.escapeNode; +var utils_5$1 = utils$1.encloseBrace; +var utils_6$1 = utils$1.isInvalidBrace; +var utils_7$1 = utils$1.isOpenOrClose; +var utils_8$1 = utils$1.reduce; +var utils_9$1 = utils$1.flatten; var stringify$3 = (ast, options = {}) => { let stringify = (node, parent = {}) => { - let invalidBlock = options.escapeInvalid && utils$2.isInvalidBrace(parent); + let invalidBlock = options.escapeInvalid && utils$1.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let output = ''; if (node.value) { - if ((invalidBlock || invalidNode) && utils$2.isOpenOrClose(node)) { + if ((invalidBlock || invalidNode) && utils$1.isOpenOrClose(node)) { return '\\' + node.value; } return node.value; @@ -18877,7 +21200,7 @@ var stringify$3 = (ast, options = {}) => { * Released under the MIT License. */ -var isNumber$1 = function(num) { +var isNumber = function(num) { if (typeof num === 'number') { return num - num === 0; } @@ -18888,7 +21211,7 @@ var isNumber$1 = function(num) { }; const toRegexRange = (min, max, options) => { - if (isNumber$1(min) === false) { + if (isNumber(min) === false) { throw new TypeError('toRegexRange: expected the first argument to be a number'); } @@ -18896,7 +21219,7 @@ const toRegexRange = (min, max, options) => { return String(min); } - if (isNumber$1(max) === false) { + if (isNumber(max) === false) { throw new TypeError('toRegexRange: expected the second argument to be a number.'); } @@ -19165,7 +21488,7 @@ toRegexRange.clearCache = () => (toRegexRange.cache = {}); var toRegexRange_1 = toRegexRange; -const isObject$3 = val => val !== null && typeof val === 'object' && !Array.isArray(val); +const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val); const transform$2 = toNumber => { return value => toNumber === true ? Number(value) : String(value); @@ -19175,7 +21498,7 @@ const isValidValue = value => { return typeof value === 'number' || (typeof value === 'string' && value !== ''); }; -const isNumber$2 = num => Number.isInteger(+num); +const isNumber$1 = num => Number.isInteger(+num); const zeros = input => { let value = `${input}`; @@ -19267,7 +21590,7 @@ const toRegex = (start, end, options) => { }; const rangeError = (...args) => { - return new RangeError('Invalid range arguments: ' + util$1.inspect(...args)); + return new RangeError('Invalid range arguments: ' + util$2.inspect(...args)); }; const invalidRange = (start, end, options) => { @@ -19335,7 +21658,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => { }; const fillLetters = (start, end, step = 1, options = {}) => { - if ((!isNumber$2(start) && start.length > 1) || (!isNumber$2(end) && end.length > 1)) { + if ((!isNumber$1(start) && start.length > 1) || (!isNumber$1(end) && end.length > 1)) { return invalidRange(start, end, options); } @@ -19381,7 +21704,7 @@ const fill = (start, end, step, options = {}) => { return fill(start, end, 1, { transform: step }); } - if (isObject$3(step)) { + if (isObject$2(step)) { return fill(start, end, 0, step); } @@ -19389,12 +21712,12 @@ const fill = (start, end, step, options = {}) => { if (opts.capture === true) opts.wrap = true; step = step || opts.step || 1; - if (!isNumber$2(step)) { - if (step != null && !isObject$3(step)) return invalidStep(step, opts); + if (!isNumber$1(step)) { + if (step != null && !isObject$2(step)) return invalidStep(step, opts); return fill(start, end, 1, step); } - if (isNumber$2(start) && isNumber$2(end)) { + if (isNumber$1(start) && isNumber$1(end)) { return fillNumbers(start, end, step, opts); } @@ -19405,7 +21728,7 @@ var fillRange = fill; const compile$2 = (ast, options = {}) => { let walk = (node, parent = {}) => { - let invalidBlock = utils$2.isInvalidBrace(parent); + let invalidBlock = utils$1.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let invalid = invalidBlock === true || invalidNode === true; let prefix = options.escapeInvalid === true ? '\\' : ''; @@ -19435,7 +21758,7 @@ const compile$2 = (ast, options = {}) => { } if (node.nodes && node.ranges > 0) { - let args = utils$2.reduce(node.nodes); + let args = utils$1.reduce(node.nodes); let range = fillRange(...args, { ...options, wrap: false, toRegex: true }); if (range.length !== 0) { @@ -19464,7 +21787,7 @@ const append = (queue = '', stash = '', enclose = false) => { if (!stash.length) return queue; if (!queue.length) { - return enclose ? utils$2.flatten(stash).map(ele => `{${ele}}`) : stash; + return enclose ? utils$1.flatten(stash).map(ele => `{${ele}}`) : stash; } for (let item of queue) { @@ -19479,7 +21802,7 @@ const append = (queue = '', stash = '', enclose = false) => { } } } - return utils$2.flatten(result); + return utils$1.flatten(result); }; const expand$2 = (ast, options = {}) => { @@ -19507,9 +21830,9 @@ const expand$2 = (ast, options = {}) => { } if (node.nodes && node.ranges > 0) { - let args = utils$2.reduce(node.nodes); + let args = utils$1.reduce(node.nodes); - if (utils$2.exceedsLimit(...args, options.step, rangeLimit)) { + if (utils$1.exceedsLimit(...args, options.step, rangeLimit)) { throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); } @@ -19523,7 +21846,7 @@ const expand$2 = (ast, options = {}) => { return; } - let enclose = utils$2.encloseBrace(node); + let enclose = utils$1.encloseBrace(node); let queue = node.queue; let block = node; @@ -19559,7 +21882,7 @@ const expand$2 = (ast, options = {}) => { return queue; }; - return utils$2.flatten(walk(ast)); + return utils$1.flatten(walk(ast)); }; var expand_1 = expand$2; @@ -20369,9 +22692,9 @@ var binaryExtensions$1 = /*#__PURE__*/Object.freeze({ 'default': binaryExtensions }); -var require$$0 = getCjsExportFromNamespace(binaryExtensions$1); +var require$$0$1 = getCjsExportFromNamespace(binaryExtensions$1); -var binaryExtensions$2 = require$$0; +var binaryExtensions$2 = require$$0$1; const extensions = new Set(binaryExtensions$2); @@ -20402,6 +22725,7 @@ exports.FSEVENT_DELETED = 'deleted'; exports.FSEVENT_MOVED = 'moved'; exports.FSEVENT_CLONED = 'cloned'; exports.FSEVENT_UNKNOWN = 'unknown'; +exports.FSEVENT_TYPE_FILE = 'file'; exports.FSEVENT_TYPE_DIRECTORY = 'directory'; exports.FSEVENT_TYPE_SYMLINK = 'symlink'; @@ -20456,38 +22780,39 @@ var constants_15 = constants$2.FSEVENT_DELETED; var constants_16 = constants$2.FSEVENT_MOVED; var constants_17 = constants$2.FSEVENT_CLONED; var constants_18 = constants$2.FSEVENT_UNKNOWN; -var constants_19 = constants$2.FSEVENT_TYPE_DIRECTORY; -var constants_20 = constants$2.FSEVENT_TYPE_SYMLINK; -var constants_21 = constants$2.KEY_LISTENERS; -var constants_22 = constants$2.KEY_ERR; -var constants_23 = constants$2.KEY_RAW; -var constants_24 = constants$2.HANDLER_KEYS; -var constants_25 = constants$2.DOT_SLASH; -var constants_26 = constants$2.BACK_SLASH_RE; -var constants_27 = constants$2.DOUBLE_SLASH_RE; -var constants_28 = constants$2.SLASH_OR_BACK_SLASH_RE; -var constants_29 = constants$2.DOT_RE; -var constants_30 = constants$2.REPLACER_RE; -var constants_31 = constants$2.SLASH; -var constants_32 = constants$2.BRACE_START; -var constants_33 = constants$2.BANG; -var constants_34 = constants$2.ONE_DOT; -var constants_35 = constants$2.TWO_DOTS; -var constants_36 = constants$2.STAR; -var constants_37 = constants$2.GLOBSTAR; -var constants_38 = constants$2.ROOT_GLOBSTAR; -var constants_39 = constants$2.SLASH_GLOBSTAR; -var constants_40 = constants$2.DIR_SUFFIX; -var constants_41 = constants$2.ANYMATCH_OPTS; -var constants_42 = constants$2.STRING_TYPE; -var constants_43 = constants$2.FUNCTION_TYPE; -var constants_44 = constants$2.EMPTY_STR; -var constants_45 = constants$2.EMPTY_FN; -var constants_46 = constants$2.IDENTITY_FN; -var constants_47 = constants$2.isWindows; -var constants_48 = constants$2.isMacos; - -const { promisify: promisify$1 } = util$1; +var constants_19 = constants$2.FSEVENT_TYPE_FILE; +var constants_20 = constants$2.FSEVENT_TYPE_DIRECTORY; +var constants_21 = constants$2.FSEVENT_TYPE_SYMLINK; +var constants_22 = constants$2.KEY_LISTENERS; +var constants_23 = constants$2.KEY_ERR; +var constants_24 = constants$2.KEY_RAW; +var constants_25 = constants$2.HANDLER_KEYS; +var constants_26 = constants$2.DOT_SLASH; +var constants_27 = constants$2.BACK_SLASH_RE; +var constants_28 = constants$2.DOUBLE_SLASH_RE; +var constants_29 = constants$2.SLASH_OR_BACK_SLASH_RE; +var constants_30 = constants$2.DOT_RE; +var constants_31 = constants$2.REPLACER_RE; +var constants_32 = constants$2.SLASH; +var constants_33 = constants$2.BRACE_START; +var constants_34 = constants$2.BANG; +var constants_35 = constants$2.ONE_DOT; +var constants_36 = constants$2.TWO_DOTS; +var constants_37 = constants$2.STAR; +var constants_38 = constants$2.GLOBSTAR; +var constants_39 = constants$2.ROOT_GLOBSTAR; +var constants_40 = constants$2.SLASH_GLOBSTAR; +var constants_41 = constants$2.DIR_SUFFIX; +var constants_42 = constants$2.ANYMATCH_OPTS; +var constants_43 = constants$2.STRING_TYPE; +var constants_44 = constants$2.FUNCTION_TYPE; +var constants_45 = constants$2.EMPTY_STR; +var constants_46 = constants$2.EMPTY_FN; +var constants_47 = constants$2.IDENTITY_FN; +var constants_48 = constants$2.isWindows; +var constants_49 = constants$2.isMacos; + +const { promisify: promisify$1 } = util$2; const { isWindows: isWindows$1, @@ -21121,7 +23446,7 @@ async _addToNodeFs(path, initialAdd, priorWh, depth, target) { var nodefsHandler = NodeFsHandler; -const { promisify: promisify$2 } = util$1; +const { promisify: promisify$2 } = util$2; let fsevents; try { @@ -21156,6 +23481,7 @@ const { FSEVENT_MOVED, // FSEVENT_CLONED, FSEVENT_UNKNOWN, + FSEVENT_TYPE_FILE, FSEVENT_TYPE_DIRECTORY, FSEVENT_TYPE_SYMLINK, @@ -21166,15 +23492,12 @@ const { EMPTY_FN: EMPTY_FN$1, IDENTITY_FN } = constants$2; -const FS_MODE_READ = 'r'; const Depth = (value) => isNaN(value) ? {} : {depth: value}; const stat$4 = promisify$2(fs$1.stat); -const open$1 = promisify$2(fs$1.open); -const close$1 = promisify$2(fs$1.close); const lstat$2 = promisify$2(fs$1.lstat); -const realpath$2 = promisify$2(fs$1.realpath); +const realpath$3 = promisify$2(fs$1.realpath); const statMethods$1 = { stat: stat$4, lstat: lstat$2 }; @@ -21321,6 +23644,14 @@ const calcDepth = (path, root) => { return i; }; +// returns boolean indicating whether the fsevents' event info has the same type +// as the one returned by fs.stat +const sameTypes = (info, stats) => ( + info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || + info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || + info.type === FSEVENT_TYPE_FILE && stats.isFile() +); + /** * @mixin */ @@ -21351,13 +23682,16 @@ addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); } -async checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts) { +async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) { try { - const fd = await open$1(path, FS_MODE_READ); + const stats = await stat$4(path); if (this.fsw.closed) return; - await close$1(fd); if (this.fsw.closed) return; - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + if (sameTypes(info, stats)) { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } } catch (error) { if (error.code === 'EACCES') { this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); @@ -21371,9 +23705,10 @@ handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opt if (this.fsw.closed || this.checkIgnored(path)) return; if (event === EV_UNLINK) { + const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY; // suppress unlink events on never before seen files - if (info.type === FSEVENT_TYPE_DIRECTORY || watchedDir.has(item)) { - this.fsw._remove(parent, item); + if (isDirectory || watchedDir.has(item)) { + this.fsw._remove(parent, item, isDirectory); } } else { if (event === EV_ADD$1) { @@ -21438,13 +23773,13 @@ _watchWithFsEvents(watchPath, realPath, transform, globFilter) { } catch (error) {} if (this.fsw.closed) return; if (this.checkIgnored(path, stats)) return; - if (stats) { + if (sameTypes(info, stats)) { this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); } else { this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); } } else { - this.checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts); + this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); } } else { switch (info.event) { @@ -21453,7 +23788,7 @@ _watchWithFsEvents(watchPath, realPath, transform, globFilter) { return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); case FSEVENT_DELETED: case FSEVENT_MOVED: - return this.checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts); + return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); } } }; @@ -21486,7 +23821,7 @@ async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { this.fsw._incrReadyCount(); try { - const linkTarget = await realpath$2(linkPath); + const linkTarget = await realpath$3(linkPath); if (this.fsw.closed) return; if (this.fsw._isIgnored(linkTarget)) { return this.fsw._emitReady(); @@ -21622,7 +23957,7 @@ async _addToFsEvents(path, transform, forceAdd, priorDepth) { } else { let realPath; try { - realPath = await realpath$2(wh.watchPath); + realPath = await realpath$3(wh.watchPath); } catch (e) {} this.initWatch(realPath, path, wh, processPath); } @@ -21638,7 +23973,7 @@ fseventsHandler.canUse = canUse_1; const { EventEmitter } = events; -const { promisify: promisify$3 } = util$1; +const { promisify: promisify$3 } = util$2; const anymatch = anymatch_1.default; @@ -21787,12 +24122,13 @@ class DirEntry { const {items} = this; if (!items) return; items.delete(item); + if (items.size > 0) return; - if (!items.size) { - const dir = this.path; - try { - await readdir$2(dir); - } catch (err) { + const dir = this.path; + try { + await readdir$2(dir); + } catch (err) { + if (this._removeWatcher) { this._removeWatcher(path$1.dirname(dir), path$1.basename(dir)); } } @@ -22118,7 +24454,7 @@ unwatch(paths_) { * @returns {Promise}. */ close() { - if (this.closed) return this; + if (this.closed) return this._closePromise; this.closed = true; // Memory management. @@ -22136,7 +24472,9 @@ close() { ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { this[`_${key}`].clear(); }); - return closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); + + this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); + return this._closePromise; } /** @@ -22237,16 +24575,15 @@ async _emit(event, path, val1, val2, val3) { (event === EV_ADD$2 || event === EV_ADD_DIR$2 || event === EV_CHANGE$2) ) { const fullPath = opts.cwd ? path$1.join(opts.cwd, path) : path; + let stats; try { - const stats = await stat$5(fullPath); - // Suppress event when fs_stat fails, to avoid sending undefined 'stat' - if (!stats) return; - args.push(stats); - this.emitWithAll(event, args); + stats = await stat$5(fullPath); } catch (err) {} - } else { - this.emitWithAll(event, args); + // Suppress event when fs_stat fails, to avoid sending undefined 'stat' + if (!stats || this.closed) return; + args.push(stats); } + this.emitWithAll(event, args); return this; } @@ -22455,13 +24792,15 @@ _hasReadPermissions(stats) { * @param {String} item base path of item/directory * @returns {void} */ -_remove(directory, item) { +_remove(directory, item, isDirectory) { // if what is being deleted is a directory, get that directory's paths // for recursive deleting and cleaning of watched object // if it is not a directory, nestedDirectoryChildren will be empty array const path = path$1.join(directory, item); const fullPath = path$1.resolve(path); - const isDirectory = this._watched.has(path) || this._watched.has(fullPath); + isDirectory = isDirectory != null + ? isDirectory + : this._watched.has(path) || this._watched.has(fullPath); // prevent duplicate handling in case of arriving here nearly simultaneously // via multiple paths (such as _handleFile and _handleDir) @@ -22735,8 +25074,253 @@ const camelCase = (input, options) => { var camelcase = camelCase; // TODO: Remove this for the next major release -var default_1$2 = camelCase; -camelcase.default = default_1$2; +var default_1$4 = camelCase; +camelcase.default = default_1$4; + +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$2(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; + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (key === '__proto__') return; + if (o[key] === undefined) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; + o = o[key]; + } + + var key = keys[keys.length - 1]; + if (key === '__proto__') return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; + 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$2(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$2 (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); +} // This is a generated file. Do not edit. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; @@ -22749,13 +25333,13 @@ var unicode = { ID_Continue: ID_Continue }; -var util = { +var util$1 = { isSpaceSeparator (c) { - return unicode.Space_Separator.test(c) + return typeof c === 'string' && unicode.Space_Separator.test(c) }, isIdStartChar (c) { - return ( + return typeof c === 'string' && ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c === '$') || (c === '_') || @@ -22764,7 +25348,7 @@ var util = { }, isIdContinueChar (c) { - return ( + return typeof c === 'string' && ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || @@ -22775,15 +25359,15 @@ var util = { }, isDigit (c) { - return /[0-9]/.test(c) + return typeof c === 'string' && /[0-9]/.test(c) }, isHexDigit (c) { - return /[0-9A-Fa-f]/.test(c) + return typeof c === 'string' && /[0-9A-Fa-f]/.test(c) }, }; -let source; +let source$1; let parseState; let stack; let pos; @@ -22794,7 +25378,7 @@ let key; let root; var parse$7 = function parse (text, reviver) { - source = String(text); + source$1 = String(text); parseState = 'start'; stack = []; pos = 0; @@ -22866,12 +25450,12 @@ function lex () { } function peek () { - if (source[pos]) { - return String.fromCodePoint(source.codePointAt(pos)) + if (source$1[pos]) { + return String.fromCodePoint(source$1.codePointAt(pos)) } } -function read$4 () { +function read$5 () { const c = peek(); if (c === '\n') { @@ -22903,21 +25487,21 @@ const lexStates = { case '\r': case '\u2028': case '\u2029': - read$4(); + read$5(); return case '/': - read$4(); + read$5(); lexState = 'comment'; return case undefined: - read$4(); + read$5(); return newToken('eof') } - if (util.isSpaceSeparator(c)) { - read$4(); + if (util$1.isSpaceSeparator(c)) { + read$5(); return } @@ -22932,49 +25516,49 @@ const lexStates = { comment () { switch (c) { case '*': - read$4(); + read$5(); lexState = 'multiLineComment'; return case '/': - read$4(); + read$5(); lexState = 'singleLineComment'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, multiLineComment () { switch (c) { case '*': - read$4(); + read$5(); lexState = 'multiLineCommentAsterisk'; return case undefined: - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - read$4(); + read$5(); }, multiLineCommentAsterisk () { switch (c) { case '*': - read$4(); + read$5(); return case '/': - read$4(); + read$5(); lexState = 'default'; return case undefined: - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - read$4(); + read$5(); lexState = 'multiLineComment'; }, @@ -22984,42 +25568,42 @@ const lexStates = { case '\r': case '\u2028': case '\u2029': - read$4(); + read$5(); lexState = 'default'; return case undefined: - read$4(); + read$5(); return newToken('eof') } - read$4(); + read$5(); }, value () { switch (c) { case '{': case '[': - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) case 'n': - read$4(); + read$5(); literal('ull'); return newToken('null', null) case 't': - read$4(); + read$5(); literal('rue'); return newToken('boolean', true) case 'f': - read$4(); + read$5(); literal('alse'); return newToken('boolean', false) case '-': case '+': - if (read$4() === '-') { + if (read$5() === '-') { sign = -1; } @@ -23027,12 +25611,12 @@ const lexStates = { return case '.': - buffer = read$4(); + buffer = read$5(); lexState = 'decimalPointLeading'; return case '0': - buffer = read$4(); + buffer = read$5(); lexState = 'zero'; return @@ -23045,37 +25629,37 @@ const lexStates = { case '7': case '8': case '9': - buffer = read$4(); + buffer = read$5(); lexState = 'decimalInteger'; return case 'I': - read$4(); + read$5(); literal('nfinity'); return newToken('numeric', Infinity) case 'N': - read$4(); + read$5(); literal('aN'); return newToken('numeric', NaN) case '"': case "'": - doubleQuote = (read$4() === '"'); + doubleQuote = (read$5() === '"'); buffer = ''; lexState = 'string'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, identifierNameStartEscape () { if (c !== 'u') { - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - read$4(); + read$5(); const u = unicodeEscape(); switch (u) { case '$': @@ -23083,7 +25667,7 @@ const lexStates = { break default: - if (!util.isIdStartChar(u)) { + if (!util$1.isIdStartChar(u)) { throw invalidIdentifier() } @@ -23100,17 +25684,17 @@ const lexStates = { case '_': case '\u200C': case '\u200D': - buffer += read$4(); + buffer += read$5(); return case '\\': - read$4(); + read$5(); lexState = 'identifierNameEscape'; return } - if (util.isIdContinueChar(c)) { - buffer += read$4(); + if (util$1.isIdContinueChar(c)) { + buffer += read$5(); return } @@ -23119,10 +25703,10 @@ const lexStates = { identifierNameEscape () { if (c !== 'u') { - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - read$4(); + read$5(); const u = unicodeEscape(); switch (u) { case '$': @@ -23132,7 +25716,7 @@ const lexStates = { break default: - if (!util.isIdContinueChar(u)) { + if (!util$1.isIdContinueChar(u)) { throw invalidIdentifier() } @@ -23146,12 +25730,12 @@ const lexStates = { sign () { switch (c) { case '.': - buffer = read$4(); + buffer = read$5(); lexState = 'decimalPointLeading'; return case '0': - buffer = read$4(); + buffer = read$5(); lexState = 'zero'; return @@ -23164,40 +25748,40 @@ const lexStates = { case '7': case '8': case '9': - buffer = read$4(); + buffer = read$5(); lexState = 'decimalInteger'; return case 'I': - read$4(); + read$5(); literal('nfinity'); return newToken('numeric', sign * Infinity) case 'N': - read$4(); + read$5(); literal('aN'); return newToken('numeric', NaN) } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, zero () { switch (c) { case '.': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalPoint'; return case 'e': case 'E': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalExponent'; return case 'x': case 'X': - buffer += read$4(); + buffer += read$5(); lexState = 'hexadecimal'; return } @@ -23208,19 +25792,19 @@ const lexStates = { decimalInteger () { switch (c) { case '.': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalPoint'; return case 'e': case 'E': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalExponent'; return } - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); return } @@ -23228,26 +25812,26 @@ const lexStates = { }, decimalPointLeading () { - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); lexState = 'decimalFraction'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, decimalPoint () { switch (c) { case 'e': case 'E': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalExponent'; return } - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); lexState = 'decimalFraction'; return } @@ -23259,13 +25843,13 @@ const lexStates = { switch (c) { case 'e': case 'E': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalExponent'; return } - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); return } @@ -23276,33 +25860,33 @@ const lexStates = { switch (c) { case '+': case '-': - buffer += read$4(); + buffer += read$5(); lexState = 'decimalExponentSign'; return } - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); lexState = 'decimalExponentInteger'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, decimalExponentSign () { - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); lexState = 'decimalExponentInteger'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, decimalExponentInteger () { - if (util.isDigit(c)) { - buffer += read$4(); + if (util$1.isDigit(c)) { + buffer += read$5(); return } @@ -23310,18 +25894,18 @@ const lexStates = { }, hexadecimal () { - if (util.isHexDigit(c)) { - buffer += read$4(); + if (util$1.isHexDigit(c)) { + buffer += read$5(); lexState = 'hexadecimalInteger'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, hexadecimalInteger () { - if (util.isHexDigit(c)) { - buffer += read$4(); + if (util$1.isHexDigit(c)) { + buffer += read$5(); return } @@ -23331,31 +25915,31 @@ const lexStates = { string () { switch (c) { case '\\': - read$4(); + read$5(); buffer += escape(); return case '"': if (doubleQuote) { - read$4(); + read$5(); return newToken('string', buffer) } - buffer += read$4(); + buffer += read$5(); return case "'": if (!doubleQuote) { - read$4(); + read$5(); return newToken('string', buffer) } - buffer += read$4(); + buffer += read$5(); return case '\n': case '\r': - throw invalidChar(read$4()) + throw invalidChar(read$5()) case '\u2028': case '\u2029': @@ -23363,17 +25947,17 @@ const lexStates = { break case undefined: - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - buffer += read$4(); + buffer += read$5(); }, start () { switch (c) { case '{': case '[': - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) // This code is unreachable since the default lexState handles eof. // case undefined: @@ -23387,40 +25971,40 @@ const lexStates = { switch (c) { case '$': case '_': - buffer = read$4(); + buffer = read$5(); lexState = 'identifierName'; return case '\\': - read$4(); + read$5(); lexState = 'identifierNameStartEscape'; return case '}': - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) case '"': case "'": - doubleQuote = (read$4() === '"'); + doubleQuote = (read$5() === '"'); lexState = 'string'; return } - if (util.isIdStartChar(c)) { - buffer += read$4(); + if (util$1.isIdStartChar(c)) { + buffer += read$5(); lexState = 'identifierName'; return } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, afterPropertyName () { if (c === ':') { - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, beforePropertyValue () { @@ -23431,15 +26015,15 @@ const lexStates = { switch (c) { case ',': case '}': - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, beforeArrayValue () { if (c === ']') { - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) } lexState = 'value'; @@ -23449,10 +26033,10 @@ const lexStates = { switch (c) { case ',': case ']': - return newToken('punctuator', read$4()) + return newToken('punctuator', read$5()) } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, end () { @@ -23462,7 +26046,7 @@ const lexStates = { // return newToken('eof') // } - throw invalidChar(read$4()) + throw invalidChar(read$5()) }, }; @@ -23480,10 +26064,10 @@ function literal (s) { const p = peek(); if (p !== c) { - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - read$4(); + read$5(); } } @@ -23491,55 +26075,55 @@ function escape () { const c = peek(); switch (c) { case 'b': - read$4(); + read$5(); return '\b' case 'f': - read$4(); + read$5(); return '\f' case 'n': - read$4(); + read$5(); return '\n' case 'r': - read$4(); + read$5(); return '\r' case 't': - read$4(); + read$5(); return '\t' case 'v': - read$4(); + read$5(); return '\v' case '0': - read$4(); - if (util.isDigit(peek())) { - throw invalidChar(read$4()) + read$5(); + if (util$1.isDigit(peek())) { + throw invalidChar(read$5()) } return '\0' case 'x': - read$4(); + read$5(); return hexEscape() case 'u': - read$4(); + read$5(); return unicodeEscape() case '\n': case '\u2028': case '\u2029': - read$4(); + read$5(); return '' case '\r': - read$4(); + read$5(); if (peek() === '\n') { - read$4(); + read$5(); } return '' @@ -23553,31 +26137,31 @@ function escape () { case '7': case '8': case '9': - throw invalidChar(read$4()) + throw invalidChar(read$5()) case undefined: - throw invalidChar(read$4()) + throw invalidChar(read$5()) } - return read$4() + return read$5() } function hexEscape () { let buffer = ''; let c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read$4()) + if (!util$1.isHexDigit(c)) { + throw invalidChar(read$5()) } - buffer += read$4(); + buffer += read$5(); c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read$4()) + if (!util$1.isHexDigit(c)) { + throw invalidChar(read$5()) } - buffer += read$4(); + buffer += read$5(); return String.fromCodePoint(parseInt(buffer, 16)) } @@ -23588,11 +26172,11 @@ function unicodeEscape () { while (count-- > 0) { const c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read$4()) + if (!util$1.isHexDigit(c)) { + throw invalidChar(read$5()) } - buffer += read$4(); + buffer += read$5(); } return String.fromCodePoint(parseInt(buffer, 16)) @@ -24003,7 +26587,7 @@ var stringify$5 = function stringify (value, replacer, space) { continue case '\0': - if (util.isDigit(value[i + 1])) { + if (util$1.isDigit(value[i + 1])) { product += '\\x00'; continue } @@ -24080,12 +26664,12 @@ var stringify$5 = function stringify (value, replacer, space) { } const firstChar = String.fromCodePoint(key.codePointAt(0)); - if (!util.isIdStartChar(firstChar)) { + if (!util$1.isIdStartChar(firstChar)) { return quoteString(key) } for (let i = firstChar.length; i < key.length; i++) { - if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { + if (!util$1.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { return quoteString(key) } } @@ -24134,11 +26718,11 @@ const JSON5 = { stringify: stringify$5, }; -var lib$2 = JSON5; +var lib$5 = JSON5; -var dist = /*#__PURE__*/Object.freeze({ +var dist$1 = /*#__PURE__*/Object.freeze({ __proto__: null, - 'default': lib$2 + 'default': lib$5 }); var schema$1 = [ @@ -24244,6 +26828,13 @@ var schema$1 = [ type: "string", value: "" }, + { + long: "ignore-path-resolve-from", + description: "resolve patterns in `ignore-path` from its directory or cwd", + type: "string", + value: "dir|cwd", + "default": "dir" + }, { long: "ignore-pattern", description: "specify ignore patterns", @@ -24296,7 +26887,7 @@ var schema$2 = /*#__PURE__*/Object.freeze({ 'default': schema$1 }); -var json5 = getCjsExportFromNamespace(dist); +var json5 = getCjsExportFromNamespace(dist$1); var schema$3 = getCjsExportFromNamespace(schema$2); @@ -24322,7 +26913,7 @@ function options(flags, configuration) { var ext; var report; - schema$3.forEach(function(option) { + schema$3.forEach(function (option) { if (option.type === 'string' && config[option.long] === '') { throw fault_1('Missing value:%s', inspect$1(option).join(' ')) } @@ -24370,6 +26961,7 @@ function options(flags, configuration) { settings: settings(config.setting), ignoreName: configuration.ignoreName, ignorePath: config.ignorePath, + ignorePathResolveFrom: config.ignorePathResolveFrom, ignorePatterns: commaSeparated(config.ignorePattern), detectIgnore: config.ignore, pluginPrefix: configuration.pluginPrefix, @@ -24408,7 +27000,7 @@ function plugins(value) { normalize$1(value) .map(splitOptions) - .forEach(function(value) { + .forEach(function (value) { result[value[0]] = value[1] ? parseConfig(value[1], {}) : null; }); @@ -24419,7 +27011,7 @@ function plugins(value) { function reporter$1(value) { var all = normalize$1(value) .map(splitOptions) - .map(function(value) { + .map(function (value) { return [value[0], value[1] ? parseConfig(value[1], {}) : null] }); @@ -24430,7 +27022,7 @@ function reporter$1(value) { function settings(value) { var cache = {}; - normalize$1(value).forEach(function(value) { + normalize$1(value).forEach(function (value) { parseConfig(value, cache); }); @@ -24471,10 +27063,7 @@ function handleUnknownArgument(flag) { } // Short options, can be grouped. - flag - .slice(1) - .split('') - .forEach(each); + flag.slice(1).split('').forEach(each); function each(key) { var length = schema$3.length; @@ -24574,7 +27163,7 @@ function parseJSON(value) { return json5.parse('{' + value + '}') } -var lib$3 = start; +var lib$6 = start; var noop$1 = Function.prototype; @@ -24637,7 +27226,7 @@ function start(cliConfig) { config.out = false; process.stderr.write( - chalk.bold('Watching...') + ' (press CTRL+C to exit)\n', + source.bold('Watching...') + ' (press CTRL+C to exit)\n', noop$1 ); @@ -24646,14 +27235,14 @@ function start(cliConfig) { config.output = false; process.stderr.write( - chalk.yellow('Note') + ': Ignoring `--output` until exit.\n', + source.yellow('Note') + ': Ignoring `--output` until exit.\n', noop$1 ); } } // Initial run. - lib$1(config, done); + lib$4(config, done); // Handle complete run. function done(err, code, context) { @@ -24689,7 +27278,7 @@ function start(cliConfig) { function onchange(filePath) { config.files = [filePath]; - lib$1(config, done); + lib$4(config, done); } function onsigint() { @@ -24702,7 +27291,7 @@ function start(cliConfig) { if (output === true) { config.output = output; config.watch = false; - lib$1(config, done); + lib$4(config, done); } } } @@ -24725,7 +27314,7 @@ function onexit() { /* eslint-enable unicorn/no-process-exit */ } -var unifiedArgs = lib$3; +var unifiedArgs = lib$6; var markdownExtensions = [ "md", @@ -24743,9 +27332,17 @@ var markdownExtensions$1 = /*#__PURE__*/Object.freeze({ 'default': markdownExtensions }); -var require$$0$1 = getCjsExportFromNamespace(markdownExtensions$1); +var require$$0$2 = getCjsExportFromNamespace(markdownExtensions$1); + +var markdownExtensions$2 = require$$0$2; + +var bail_1 = bail; -var markdownExtensions$2 = require$$0$1; +function bail(err) { + if (err) { + throw err + } +} var hasOwn = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; @@ -24809,7 +27406,7 @@ var getProperty = function getProperty(obj, name) { return obj[name]; }; -var extend$3 = function extend() { +var extend$2 = function extend() { var options, name, src, copy, copyIsArray, clone; var target = arguments[0]; var i = 1; @@ -24863,23 +27460,6 @@ var extend$3 = function extend() { return target; }; -var bail_1 = bail; - -function bail(err) { - if (err) { - throw err - } -} - -var isPlainObj = value => { - if (Object.prototype.toString.call(value) !== '[object Object]') { - return false; - } - - const prototype = Object.getPrototypeOf(value); - return prototype === null || prototype === Object.getPrototypeOf({}); -}; - // Expose a frozen processor. var unified_1 = unified().freeze(); @@ -24911,7 +27491,14 @@ function pipelineRun(p, ctx, next) { } function pipelineStringify(p, ctx) { - ctx.file.contents = p.stringify(ctx.tree, ctx.file); + var result = p.stringify(ctx.tree, ctx.file); + var file = ctx.file; + + if (result === undefined || result === null) ; else if (typeof result === 'string' || isBuffer(result)) { + file.contents = result; + } else { + file.result = result; + } } // Function to create the first processor. @@ -24953,7 +27540,7 @@ function unified() { destination.use.apply(null, attachers[index]); } - destination.data(extend$3(true, {}, namespace)); + destination.data(extend$2(true, {}, namespace)); return destination } @@ -25055,7 +27642,7 @@ function unified() { } if (settings) { - namespace.settings = extend$3(namespace.settings || {}, settings); + namespace.settings = extend$2(namespace.settings || {}, settings); } return processor @@ -25064,7 +27651,7 @@ function unified() { addList(result.plugins); if (result.settings) { - settings = extend$3(settings || {}, result.settings); + settings = extend$2(settings || {}, result.settings); } } @@ -25103,7 +27690,7 @@ function unified() { if (entry) { if (isPlainObj(entry[1]) && isPlainObj(value)) { - value = extend$3(entry[1], value); + value = extend$2(entry[1], value); } entry[1] = value; @@ -25332,6 +27919,26 @@ function assertDone(name, asyncName, complete) { } } +var immutable = extend$3; + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend$3() { + 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 unherit_1 = unherit; // Create a custom constructor which can be modified without affecting the @@ -25478,26 +28085,26 @@ function factory$3(ctx, key) { // De-escape a string using the expression at `key` in `ctx`. function unescape(value) { - var prev = 0; + var previous = 0; var index = value.indexOf(backslash$1); var escape = ctx[key]; var queue = []; var character; while (index !== -1) { - queue.push(value.slice(prev, index)); - prev = index + 1; - character = value.charAt(prev); + queue.push(value.slice(previous, index)); + previous = index + 1; + character = value.charAt(previous); // If the following character is not a valid escape, add the slash. if (!character || escape.indexOf(character) === -1) { queue.push(backslash$1); } - index = value.indexOf(backslash$1, prev + 1); + index = value.indexOf(backslash$1, previous + 1); } - queue.push(value.slice(prev)); + queue.push(value.slice(previous)); return queue.join('') } @@ -27344,7 +29951,7 @@ const minusdu = "⨪"; const mlcp = "⫛"; const mldr = "…"; const mnplus = "∓"; -const models$1 = "⊧"; +const models$2 = "⊧"; const mopf = "𝕞"; const mp = "∓"; const mscr = "𝓂"; @@ -29567,7 +32174,7 @@ var index$3 = { mlcp: mlcp, mldr: mldr, mnplus: mnplus, - models: models$1, + models: models$2, mopf: mopf, mp: mp, mscr: mscr, @@ -31791,7 +34398,7 @@ var characterEntities = /*#__PURE__*/Object.freeze({ mlcp: mlcp, mldr: mldr, mnplus: mnplus, - models: models$1, + models: models$2, mopf: mopf, mp: mp, mscr: mscr, @@ -32619,15 +35226,15 @@ var defaults = { // Characters. var tab = 9; // '\t' var lineFeed = 10; // '\n' -var formFeed = 12; // '\f' +var formFeed = 12; // '\f' var space = 32; // ' ' -var ampersand = 38; // '&' -var semicolon = 59; // ';' -var lessThan = 60; // '<' -var equalsTo = 61; // '=' -var numberSign = 35; // '#' -var uppercaseX = 88; // 'X' -var lowercaseX = 120; // 'x' +var ampersand = 38; // '&' +var semicolon = 59; // ';' +var lessThan = 60; // '<' +var equalsTo = 61; // '=' +var numberSign = 35; // '#' +var uppercaseX = 88; // 'X' +var lowercaseX = 120; // 'x' var replacementCharacter = 65533; // '�' // Reference types. @@ -32749,7 +35356,8 @@ function parse$8(value, settings) { // Wrap `handleWarning`. warning = handleWarning ? parseError : noop$2; - // Ensure the algorithm walks over the first character and the end (inclusive). + // Ensure the algorithm walks over the first character and the end + // (inclusive). index--; length++; @@ -32980,7 +35588,7 @@ function parse$8(value, settings) { } } - // Return the reduced nodes, and any possible warnings. + // Return the reduced nodes. return result.join('') // Get current position. @@ -33136,11 +35744,15 @@ function factory$5(type) { name = methods[index]; method = tokenizers[name]; + // Previously, we had constructs such as footnotes and YAML that used + // these properties. + // Those are now external (plus there are userland extensions), that may + // still use them. if ( method && /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && - (!method.notInList || !self.inList) && - (!method.notInBlock || !self.inBlock) && + /* istanbul ignore next */ (!method.notInList || !self.inList) && + /* istanbul ignore next */ (!method.notInBlock || !self.inBlock) && (!method.notInLink || !self.inLink) ) { valueLength = value.length; @@ -33199,7 +35811,7 @@ function factory$5(type) { // Done. Called when the last character is eaten to retrieve the range’s // offsets. - return function() { + return function () { var last = line + 1; while (pos < last) { @@ -33250,10 +35862,10 @@ function factory$5(type) { // Add the position to a node. function update(node, indent) { - var prev = node.position; - var start = prev ? prev.start : before; + var previous = node.position; + var start = previous ? previous.start : before; var combined = []; - var n = prev && prev.end.line; + var n = previous && previous.end.line; var l = before.line; node.position = new Position(start); @@ -33263,8 +35875,8 @@ function factory$5(type) { // 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 (previous && indent && previous.indent) { + combined = previous.indent; if (n < l) { while (++n < l) { @@ -33287,21 +35899,21 @@ function factory$5(type) { // possible. function add(node, parent) { var children = parent ? parent.children : tokens; - var prev = children[children.length - 1]; + var previous = children[children.length - 1]; var fn; if ( - prev && - node.type === prev.type && + previous && + node.type === previous.type && (node.type === 'text' || node.type === 'blockquote') && - mergeable(prev) && + mergeable(previous) && mergeable(node) ) { fn = node.type === 'text' ? mergeText : mergeBlockquote; - node = fn.call(self, prev, node); + node = fn.call(self, previous, node); } - if (node !== prev) { + if (node !== previous) { children.push(node); } @@ -33386,21 +35998,21 @@ function mergeable(node) { } // Merge two text nodes: `node` into `prev`. -function mergeText(prev, node) { - prev.value += node.value; +function mergeText(previous, node) { + previous.value += node.value; - return prev + return previous } // Merge two blockquotes: `node` into `prev`, unless in CommonMark or gfm modes. -function mergeBlockquote(prev, node) { +function mergeBlockquote(previous, node) { if (this.options.commonmark || this.options.gfm) { return node } - prev.children = prev.children.concat(node.children); + previous.children = previous.children.concat(node.children); - return prev + return previous } var markdownEscapes = escapes; @@ -33532,7 +36144,6 @@ var defaults$2 = { position: true, gfm: true, commonmark: false, - footnotes: false, pedantic: false, blocks: blockElements }; @@ -33578,9 +36189,9 @@ function setOptions(options) { return self } -var convert_1 = convert$1; +var convert_1 = convert$3; -function convert$1(test) { +function convert$3(test) { if (typeof test === 'string') { return typeFactory(test) } @@ -33606,7 +36217,7 @@ function convertAll(tests) { var index = -1; while (++index < length) { - results[index] = convert$1(tests[index]); + results[index] = convert$3(tests[index]); } return results @@ -33822,31 +36433,37 @@ function parse$9() { return node } -var isWhitespaceCharacter = whitespace; +// A line containing no characters, or a line containing only spaces (U+0020) or +// tabs (U+0009), is called a blank line. +// See . +var reBlankLine = /^[ \t]*(\n|$)/; -var fromCode = String.fromCharCode; -var re$1 = /\s/; +// Note that though blank lines play a special role in lists to determine +// whether the list is tight or loose +// (), it’s done by the list +// tokenizer and this blank line tokenizer does not have to be responsible for +// that. +// Therefore, configs such as `blankLine.notInList` do not have to be set here. +var blankLine_1 = blankLine; -// 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) - ) -} +function blankLine(eat, value, silent) { + var match; + var subvalue = ''; + var index = 0; + var length = value.length; -var newline_1 = newline; + while (index < length) { + match = reBlankLine.exec(value.slice(index)); -var lineFeed$2 = '\n'; + if (match == null) { + break + } -function newline(eat, value, silent) { - var character = value.charAt(0); - var length; - var subvalue; - var queue; - var index; + index += match[0].length; + subvalue += match[0]; + } - if (character !== lineFeed$2) { + if (subvalue === '') { return } @@ -33855,28 +36472,6 @@ function newline(eat, value, 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 === lineFeed$2) { - subvalue += queue; - queue = ''; - } - - index++; - } - eat(subvalue); } @@ -33898,7 +36493,7 @@ function trimTrailingLines(value) { var codeIndented = indentedCode; -var lineFeed$3 = '\n'; +var lineFeed$2 = '\n'; var tab$1 = '\t'; var space$1 = ' '; @@ -33927,7 +36522,7 @@ function indentedCode(eat, value, silent) { subvalueQueue = ''; contentQueue = ''; - if (character === lineFeed$3) { + if (character === lineFeed$2) { subvalueQueue = character; contentQueue = character; } else { @@ -33937,7 +36532,7 @@ function indentedCode(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (!character || character === lineFeed$3) { + if (!character || character === lineFeed$2) { contentQueue = character; subvalueQueue = character; break @@ -33967,7 +36562,7 @@ function indentedCode(eat, value, silent) { character = value.charAt(++index); } - if (character !== lineFeed$3) { + if (character !== lineFeed$2) { break } @@ -33992,7 +36587,7 @@ function indentedCode(eat, value, silent) { var codeFenced = fencedCode; -var lineFeed$4 = '\n'; +var lineFeed$3 = '\n'; var tab$2 = '\t'; var space$2 = ' '; var tilde$1 = '~'; @@ -34087,7 +36682,7 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); if ( - character === lineFeed$4 || + character === lineFeed$3 || (marker === graveAccent && character === marker) ) { break @@ -34105,7 +36700,7 @@ function fencedCode(eat, value, silent) { character = value.charAt(index); - if (character && character !== lineFeed$4) { + if (character && character !== lineFeed$3) { return } @@ -34139,7 +36734,7 @@ function fencedCode(eat, value, silent) { closing = ''; exdentedClosing = ''; - if (character !== lineFeed$4) { + if (character !== lineFeed$3) { content += character; exdentedClosing += character; index++; @@ -34210,7 +36805,7 @@ function fencedCode(eat, value, silent) { index++; } - if (!character || character === lineFeed$4) { + if (!character || character === lineFeed$3) { break } } @@ -34262,7 +36857,7 @@ var trim_3 = trim_1.right; var interrupt_1 = interrupt; -function interrupt(interruptors, tokenizers, ctx, params) { +function interrupt(interruptors, tokenizers, ctx, parameters) { var length = interruptors.length; var index = -1; var interruptor; @@ -34286,7 +36881,7 @@ function interrupt(interruptors, tokenizers, ctx, params) { continue } - if (tokenizers[interruptor[0]].apply(ctx, params)) { + if (tokenizers[interruptor[0]].apply(ctx, parameters)) { return true } } @@ -34296,7 +36891,7 @@ function interrupt(interruptors, tokenizers, ctx, params) { var blockquote_1 = blockquote; -var lineFeed$5 = '\n'; +var lineFeed$4 = '\n'; var tab$3 = '\t'; var space$3 = ' '; var greaterThan = '>'; @@ -34344,7 +36939,7 @@ function blockquote(eat, value, silent) { index = 0; while (index < length) { - nextIndex = value.indexOf(lineFeed$5, index); + nextIndex = value.indexOf(lineFeed$4, index); startIndex = index; prefixed = false; @@ -34400,7 +36995,7 @@ function blockquote(eat, value, silent) { index = -1; length = indents.length; - add = eat(values.join(lineFeed$5)); + add = eat(values.join(lineFeed$4)); while (++index < length) { offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; @@ -34408,7 +37003,7 @@ function blockquote(eat, value, silent) { } exit = self.enterBlock(); - contents = self.tokenizeBlock(contents.join(lineFeed$5), now); + contents = self.tokenizeBlock(contents.join(lineFeed$4), now); exit(); return add({type: 'blockquote', children: contents}) @@ -34416,7 +37011,7 @@ function blockquote(eat, value, silent) { var headingAtx = atxHeading; -var lineFeed$6 = '\n'; +var lineFeed$5 = '\n'; var tab$4 = '\t'; var space$4 = ' '; var numberSign$1 = '#'; @@ -34487,7 +37082,7 @@ function atxHeading(eat, value, silent) { } // Exit when not in pedantic mode without spacing. - if (!pedantic && queue.length === 0 && character && character !== lineFeed$6) { + if (!pedantic && queue.length === 0 && character && character !== lineFeed$5) { return } @@ -34503,7 +37098,7 @@ function atxHeading(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (!character || character === lineFeed$6) { + if (!character || character === lineFeed$5) { break } @@ -34551,7 +37146,7 @@ function atxHeading(eat, value, silent) { var thematicBreak_1 = thematicBreak; var tab$5 = '\t'; -var lineFeed$7 = '\n'; +var lineFeed$6 = '\n'; var space$5 = ' '; var asterisk = '*'; var dash$1 = '-'; @@ -34602,7 +37197,7 @@ function thematicBreak(eat, value, silent) { queue += character; } else if ( markerCount >= maxCount && - (!character || character === lineFeed$7) + (!character || character === lineFeed$6) ) { subvalue += queue; @@ -34632,6 +37227,7 @@ function indentation(value) { var character = value.charAt(index); var stops = {}; var size; + var lastIndent = 0; while (character === tab$6 || character === space$6) { size = character === tab$6 ? tabSize$2 : spaceSize; @@ -34642,7 +37238,10 @@ function indentation(value) { indent = Math.floor(indent / size) * size; } - stops[indent] = index; + while (lastIndent < indent) { + stops[++lastIndent] = index; + } + character = value.charAt(++index); } @@ -34651,22 +37250,20 @@ function indentation(value) { var removeIndentation = indentation$1; -var tab$7 = '\t'; -var lineFeed$8 = '\n'; +var lineFeed$7 = '\n'; var space$7 = ' '; var exclamationMark = '!'; // Remove the minimum indent from every line in `value`. Supports both tab, // spaced, and mixed indentation (as well as possible). function indentation$1(value, maximum) { - var values = value.split(lineFeed$8); + var values = value.split(lineFeed$7); var position = values.length + 1; var minIndent = Infinity; var matrix = []; var index; var indentation; var stops; - var padding; values.unshift(repeatString(space$7, maximum) + exclamationMark); @@ -34701,24 +37298,13 @@ function indentation$1(value, maximum) { index--; } - if ( - trim_1(values[position]).length !== 0 && - minIndent && - index !== minIndent - ) { - padding = tab$7; - } else { - padding = ''; - } - - values[position] = - padding + values[position].slice(index in stops ? stops[index] + 1 : 0); + values[position] = values[position].slice(stops[index] + 1); } } values.shift(); - return values.join(lineFeed$8) + return values.join(lineFeed$7) } var list_1 = list; @@ -34729,14 +37315,14 @@ var plusSign = '+'; var dash$2 = '-'; var dot$1 = '.'; var space$8 = ' '; -var lineFeed$9 = '\n'; -var tab$8 = '\t'; +var lineFeed$8 = '\n'; +var tab$7 = '\t'; var rightParenthesis = ')'; var lowercaseX$1 = 'x'; var tabSize$3 = 4; var looseListItemExpression = /\n\n(?!\s*$)/; -var taskItemExpression = /^\[([ \t]|x|X)][ \t]/; +var taskItemExpression = /^\[([ X\tx])][ \t]/; var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; var initialIndentExpression = /^( {1,4}|\t)?/gm; @@ -34750,7 +37336,7 @@ function list(eat, value, silent) { var index = 0; var length = value.length; var start = null; - var size = 0; + var size; var queue; var ordered; var character; @@ -34761,7 +37347,7 @@ function list(eat, value, silent) { var currentMarker; var content; var line; - var prevEmpty; + var previousEmpty; var empty; var items; var allLines; @@ -34778,21 +37364,13 @@ function list(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === tab$8) { - size += tabSize$3 - (size % tabSize$3); - } else if (character === space$8) { - size++; - } else { + if (character !== tab$7 && character !== space$8) { break } index++; } - if (size >= tabSize$3) { - return - } - character = value.charAt(index); if (character === asterisk$1 || character === plusSign || character === dash$2) { @@ -34822,6 +37400,14 @@ function list(eat, value, silent) { return } + /* Slightly abusing `silent` mode, whose goal is to make interrupting + * paragraphs work. + * Well, that’s exactly what we want to do here: don’t interrupt: + * 2. here, because the “list” doesn’t start with `1`. */ + if (silent && queue !== '1') { + return + } + start = parseInt(queue, 10); marker = character; } @@ -34830,8 +37416,8 @@ function list(eat, value, silent) { if ( character !== space$8 && - character !== tab$8 && - (pedantic || (character !== lineFeed$9 && character !== '')) + character !== tab$7 && + (pedantic || (character !== lineFeed$8 && character !== '')) ) { return } @@ -34846,7 +37432,7 @@ function list(eat, value, silent) { emptyLines = []; while (index < length) { - nextIndex = value.indexOf(lineFeed$9, index); + nextIndex = value.indexOf(lineFeed$8, index); startIndex = index; prefixed = false; indented = false; @@ -34855,13 +37441,12 @@ function list(eat, value, silent) { nextIndex = length; } - end = index + tabSize$3; size = 0; while (index < length) { character = value.charAt(index); - if (character === tab$8) { + if (character === tab$7) { size += tabSize$3 - (size % tabSize$3); } else if (character === space$8) { size++; @@ -34872,10 +37457,6 @@ function list(eat, value, silent) { index++; } - if (size >= tabSize$3) { - indented = true; - } - if (item && size >= item.indent) { indented = true; } @@ -34921,7 +37502,7 @@ function list(eat, value, silent) { if (currentMarker) { character = value.charAt(index); - if (character === tab$8) { + if (character === tab$7) { size += tabSize$3 - (size % tabSize$3); index++; } else if (character === space$8) { @@ -34940,7 +37521,7 @@ function list(eat, value, silent) { index -= tabSize$3 - 1; size -= tabSize$3 - 1; } - } else if (character !== lineFeed$9 && character !== '') { + } else if (character !== lineFeed$8 && character !== '') { currentMarker = null; } } @@ -34976,7 +37557,7 @@ function list(eat, value, silent) { } } - prevEmpty = empty; + previousEmpty = empty; empty = !prefixed && !trim_1(content).length; if (indented && item) { @@ -35000,13 +37581,13 @@ function list(eat, value, silent) { allLines = allLines.concat(emptyLines, line); emptyLines = []; } else if (empty) { - if (prevEmpty && !commonmark) { + if (previousEmpty && !commonmark) { break } emptyLines.push(line); } else { - if (prevEmpty) { + if (previousEmpty) { break } @@ -35022,7 +37603,7 @@ function list(eat, value, silent) { index = nextIndex + 1; } - node = eat(allLines.join(lineFeed$9)).reset({ + node = eat(allLines.join(lineFeed$8)).reset({ type: 'list', ordered: ordered, start: start, @@ -35036,15 +37617,15 @@ function list(eat, value, silent) { length = items.length; while (++index < length) { - item = items[index].value.join(lineFeed$9); + item = items[index].value.join(lineFeed$8); now = eat.now(); eat(item)(listItem(self, item, now), node); - item = items[index].trail.join(lineFeed$9); + item = items[index].trail.join(lineFeed$8); if (index !== length - 1) { - item += lineFeed$9; + item += lineFeed$8; } eat(item); @@ -35122,9 +37703,9 @@ function normalListItem(ctx, value, position) { // Remove the list-item’s bullet. value = value.replace(bulletExpression, replacer); - lines = value.split(lineFeed$9); + lines = value.split(lineFeed$8); - trimmedLines = removeIndentation(value, getIndentation(max).indent).split(lineFeed$9); + trimmedLines = removeIndentation(value, getIndentation(max).indent).split(lineFeed$8); // We replaced the initial bullet with something else above, which was used // to trick `removeIndentation` into removing some more characters when @@ -35144,7 +37725,7 @@ function normalListItem(ctx, value, position) { line++; } - return trimmedLines.join(lineFeed$9) + return trimmedLines.join(lineFeed$8) /* eslint-disable-next-line max-params */ function replacer($0, $1, $2, $3, $4) { @@ -35166,8 +37747,8 @@ function normalListItem(ctx, value, position) { var headingSetext = setextHeading; -var lineFeed$a = '\n'; -var tab$9 = '\t'; +var lineFeed$9 = '\n'; +var tab$8 = '\t'; var space$9 = ' '; var equalsTo$1 = '='; var dash$3 = '-'; @@ -35208,12 +37789,12 @@ function setextHeading(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (character === lineFeed$a) { + if (character === lineFeed$9) { index--; break } - if (character === space$9 || character === tab$9) { + if (character === space$9 || character === tab$8) { queue += character; } else { content += queue + character; @@ -35229,7 +37810,7 @@ function setextHeading(eat, value, silent) { character = value.charAt(++index); marker = value.charAt(++index); - if (character !== lineFeed$a || (marker !== equalsTo$1 && marker !== dash$3)) { + if (character !== lineFeed$9 || (marker !== equalsTo$1 && marker !== dash$3)) { return } @@ -35243,7 +37824,7 @@ function setextHeading(eat, value, silent) { character = value.charAt(index); if (character !== marker) { - if (character !== lineFeed$a) { + if (character !== lineFeed$9) { return } @@ -35307,9 +37888,9 @@ var openCloseTag$1 = html.openCloseTag; var htmlBlock = blockHtml; -var tab$a = '\t'; +var tab$9 = '\t'; var space$a = ' '; -var lineFeed$b = '\n'; +var lineFeed$a = '\n'; var lessThan$1 = '<'; var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i; @@ -35321,7 +37902,7 @@ var instructionCloseExpression = /\?>/; var directiveOpenExpression = /^/; var cdataOpenExpression = /^/; +var cdataCloseExpression = /]]>/; var elementCloseExpression = /^$/; var otherElementOpenExpression = new RegExp(openCloseTag$1.source + '\\s*$'); @@ -35356,7 +37937,7 @@ function blockHtml(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== tab$a && character !== space$a) { + if (character !== tab$9 && character !== space$a) { break } @@ -35367,7 +37948,7 @@ function blockHtml(eat, value, silent) { return } - next = value.indexOf(lineFeed$b, index + 1); + next = value.indexOf(lineFeed$a, index + 1); next = next === -1 ? length : next; line = value.slice(index, next); offset = -1; @@ -35392,7 +37973,7 @@ function blockHtml(eat, value, silent) { if (!sequence[1].test(line)) { while (index < length) { - next = value.indexOf(lineFeed$b, index + 1); + next = value.indexOf(lineFeed$a, index + 1); next = next === -1 ? length : next; line = value.slice(index + 1, next); @@ -35413,6 +37994,19 @@ function blockHtml(eat, value, silent) { return eat(subvalue)({type: 'html', value: subvalue}) } +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 collapseWhiteSpace = collapse; // `collapse(' \t\nbar \nbaz\t') // ' bar baz '` @@ -35428,201 +38022,19 @@ function normalize$2(value) { return collapseWhiteSpace(value).toLowerCase() } -var footnoteDefinition_1 = footnoteDefinition; -footnoteDefinition.notInList = true; -footnoteDefinition.notInBlock = true; +var definition_1 = definition; +var quotationMark = '"'; +var apostrophe = "'"; var backslash$2 = '\\'; -var lineFeed$c = '\n'; -var tab$b = '\t'; +var lineFeed$b = '\n'; +var tab$a = '\t'; var space$b = ' '; var leftSquareBracket = '['; var rightSquareBracket = ']'; -var caret$1 = '^'; -var colon$1 = ':'; - -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) !== leftSquareBracket || - value.charAt(index + 1) !== caret$1 - ) { - return - } - - subvalue += leftSquareBracket + caret$1; - index = subvalue.length; - queue = ''; - - while (index < length) { - character = value.charAt(index); - - if (character === rightSquareBracket) { - break - } else if (character === backslash$2) { - queue += character; - index++; - character = value.charAt(index); - } - - queue += character; - index++; - } - - if ( - !queue || - value.charAt(index) !== rightSquareBracket || - value.charAt(index + 1) !== colon$1 - ) { - return - } - - if (silent) { - return true - } - - identifier = queue; - subvalue += queue + rightSquareBracket + colon$1; - index = subvalue.length; - - while (index < length) { - character = value.charAt(index); - - if (character !== tab$b && character !== space$b) { - break - } - - subvalue += character; - index++; - } - - now.column += subvalue.length; - now.offset += subvalue.length; - queue = ''; - content = ''; - subqueue = ''; - - while (index < length) { - character = value.charAt(index); - - if (character === lineFeed$c) { - subqueue = character; - index++; - - while (index < length) { - character = value.charAt(index); - - if (character !== lineFeed$c) { - break - } - - subqueue += character; - index++; - } - - queue += subqueue; - subqueue = ''; - - while (index < length) { - character = value.charAt(index); - - if (character !== space$b) { - 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: normalize_1(identifier), - label: identifier, - children: content - }) -} - -var definition_1 = definition; - -var quotationMark = '"'; -var apostrophe = "'"; -var backslash$3 = '\\'; -var lineFeed$d = '\n'; -var tab$c = '\t'; -var space$c = ' '; -var leftSquareBracket$1 = '['; -var rightSquareBracket$1 = ']'; var leftParenthesis = '('; var rightParenthesis$1 = ')'; -var colon$2 = ':'; +var colon$1 = ':'; var lessThan$2 = '<'; var greaterThan$1 = '>'; @@ -35644,7 +38056,7 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== space$c && character !== tab$c) { + if (character !== space$b && character !== tab$a) { break } @@ -35654,7 +38066,7 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (character !== leftSquareBracket$1) { + if (character !== leftSquareBracket) { return } @@ -35665,9 +38077,9 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === rightSquareBracket$1) { + if (character === rightSquareBracket) { break - } else if (character === backslash$3) { + } else if (character === backslash$2) { queue += character; index++; character = value.charAt(index); @@ -35679,21 +38091,21 @@ function definition(eat, value, silent) { if ( !queue || - value.charAt(index) !== rightSquareBracket$1 || - value.charAt(index + 1) !== colon$2 + value.charAt(index) !== rightSquareBracket || + value.charAt(index + 1) !== colon$1 ) { return } identifier = queue; - subvalue += queue + rightSquareBracket$1 + colon$2; + subvalue += queue + rightSquareBracket + colon$1; index = subvalue.length; queue = ''; while (index < length) { character = value.charAt(index); - if (character !== tab$c && character !== space$c && character !== lineFeed$d) { + if (character !== tab$a && character !== space$b && character !== lineFeed$b) { break } @@ -35759,7 +38171,7 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== tab$c && character !== space$c && character !== lineFeed$d) { + if (character !== tab$a && character !== space$b && character !== lineFeed$b) { break } @@ -35793,15 +38205,15 @@ function definition(eat, value, silent) { break } - if (character === lineFeed$d) { + if (character === lineFeed$b) { index++; character = value.charAt(index); - if (character === lineFeed$d || character === test) { + if (character === lineFeed$b || character === test) { return } - queue += lineFeed$d; + queue += lineFeed$b; } queue += character; @@ -35826,7 +38238,7 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== tab$c && character !== space$c) { + if (character !== tab$a && character !== space$b) { break } @@ -35836,7 +38248,7 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (!character || character === lineFeed$d) { + if (!character || character === lineFeed$b) { if (silent) { return true } @@ -35863,8 +38275,8 @@ function definition(eat, value, silent) { function isEnclosedURLCharacter(character) { return ( character !== greaterThan$1 && - character !== leftSquareBracket$1 && - character !== rightSquareBracket$1 + character !== leftSquareBracket && + character !== rightSquareBracket ) } @@ -35873,20 +38285,20 @@ isEnclosedURLCharacter.delimiter = greaterThan$1; // Check if `character` can be inside an unclosed URI. function isUnclosedURLCharacter(character) { return ( - character !== leftSquareBracket$1 && - character !== rightSquareBracket$1 && + character !== leftSquareBracket && + character !== rightSquareBracket && !isWhitespaceCharacter(character) ) } var table_1 = table; -var tab$d = '\t'; -var lineFeed$e = '\n'; -var space$d = ' '; +var tab$b = '\t'; +var lineFeed$c = '\n'; +var space$c = ' '; var dash$4 = '-'; -var colon$3 = ':'; -var backslash$4 = '\\'; +var colon$2 = ':'; +var backslash$3 = '\\'; var verticalBar = '|'; var minColumns = 1; @@ -35936,7 +38348,7 @@ function table(eat, value, silent) { lines = []; while (index < length) { - lineIndex = value.indexOf(lineFeed$e, index); + lineIndex = value.indexOf(lineFeed$c, index); pipeIndex = value.indexOf(verticalBar, index + 1); if (lineIndex === -1) { @@ -35957,7 +38369,7 @@ function table(eat, value, silent) { } // Parse the alignment row. - subvalue = lines.join(lineFeed$e); + subvalue = lines.join(lineFeed$c); alignments = lines.splice(1, 1)[0] || []; index = 0; length = alignments.length; @@ -35984,7 +38396,7 @@ function table(eat, value, silent) { } else if (character === dash$4) { hasDash = true; alignment = alignment || null; - } else if (character === colon$3) { + } else if (character === colon$2) { if (alignment === left) { alignment = center; } else if (hasDash && alignment === null) { @@ -36025,7 +38437,7 @@ function table(eat, value, silent) { // Eat a newline character when this is not the first row. if (position) { - eat(lineFeed$e); + eat(lineFeed$c); } // Eat the row. @@ -36040,7 +38452,7 @@ function table(eat, value, silent) { while (index < length) { character = line.charAt(index); - if (character === tab$d || character === space$d) { + if (character === tab$b || character === space$c) { if (cell) { queue += character; } else { @@ -36060,7 +38472,7 @@ function table(eat, value, silent) { if (queue.length > 1) { if (character) { - subvalue += queue.slice(0, queue.length - 1); + subvalue += queue.slice(0, -1); queue = queue.charAt(queue.length - 1); } else { subvalue += queue; @@ -36089,7 +38501,7 @@ function table(eat, value, silent) { cell += character; - if (character === backslash$4 && index !== length - 2) { + if (character === backslash$3 && index !== length - 2) { cell += line.charAt(index + 1); index++; } @@ -36101,7 +38513,7 @@ function table(eat, value, silent) { // Eat the alignment row. if (!position) { - eat(lineFeed$e + alignments); + eat(lineFeed$c + alignments); } } @@ -36110,9 +38522,9 @@ function table(eat, value, silent) { var paragraph_1 = paragraph; -var tab$e = '\t'; -var lineFeed$f = '\n'; -var space$e = ' '; +var tab$c = '\t'; +var lineFeed$d = '\n'; +var space$d = ' '; var tabSize$4 = 4; @@ -36121,10 +38533,9 @@ function paragraph(eat, value, silent) { var self = this; var settings = self.options; var commonmark = settings.commonmark; - var gfm = settings.gfm; var tokenizers = self.blockTokenizers; var interruptors = self.interruptParagraph; - var index = value.indexOf(lineFeed$f); + var index = value.indexOf(lineFeed$d); var length = value.length; var position; var subvalue; @@ -36140,7 +38551,7 @@ function paragraph(eat, value, silent) { } // Stop if the next character is NEWLINE. - if (value.charAt(index + 1) === lineFeed$f) { + if (value.charAt(index + 1) === lineFeed$d) { break } @@ -36152,10 +38563,10 @@ function paragraph(eat, value, silent) { while (position < length) { character = value.charAt(position); - if (character === tab$e) { + if (character === tab$c) { size = tabSize$4; break - } else if (character === space$e) { + } else if (character === space$d) { size++; } else { break @@ -36164,8 +38575,8 @@ function paragraph(eat, value, silent) { position++; } - if (size >= tabSize$4 && character !== lineFeed$f) { - index = value.indexOf(lineFeed$f, index + 1); + if (size >= tabSize$4 && character !== lineFeed$d) { + index = value.indexOf(lineFeed$d, index + 1); continue } } @@ -36177,19 +38588,8 @@ function paragraph(eat, value, silent) { 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(lineFeed$f, index + 1); + index = value.indexOf(lineFeed$d, index + 1); if (index !== -1 && trim_1(value.slice(position, index)) === '') { index = position; @@ -36199,12 +38599,6 @@ function paragraph(eat, value, silent) { subvalue = value.slice(0, index); - if (trim_1(subvalue) === '') { - eat(subvalue); - - return null - } - /* istanbul ignore if - never used (yet) */ if (silent) { return true @@ -36228,15 +38622,15 @@ function locate(value, fromIndex) { var _escape$1 = escape$1; escape$1.locator = _escape; -var lineFeed$g = '\n'; -var backslash$5 = '\\'; +var lineFeed$e = '\n'; +var backslash$4 = '\\'; function escape$1(eat, value, silent) { var self = this; var character; var node; - if (value.charAt(0) === backslash$5) { + if (value.charAt(0) === backslash$4) { character = value.charAt(1); if (self.escape.indexOf(character) !== -1) { @@ -36245,13 +38639,13 @@ function escape$1(eat, value, silent) { return true } - if (character === lineFeed$g) { + if (character === lineFeed$e) { node = {type: 'break'}; } else { node = {type: 'text', value: character}; } - return eat(backslash$5 + character)(node) + return eat(backslash$4 + character)(node) } } } @@ -36390,24 +38784,48 @@ function autoLink(eat, value, silent) { }) } +var ccount_1 = ccount; + +function ccount(value, character) { + var val = String(value); + var count = 0; + var index; + + if (typeof character !== 'string' || character.length !== 1) { + throw new Error('Expected character') + } + + index = val.indexOf(character); + + while (index !== -1) { + count++; + index = val.indexOf(character, index + 1); + } + + return count +} + var url = locate$2; -var protocols = ['https://', 'http://', 'mailto:']; +var values = ['www.', 'http://', 'https://']; function locate$2(value, fromIndex) { - var length = protocols.length; - var index = -1; var min = -1; + var index; + var length; var position; if (!this.options.gfm) { - return -1 + return min } + length = values.length; + index = -1; + while (++index < length) { - position = value.indexOf(protocols[index], fromIndex); + position = value.indexOf(values[index], fromIndex); - if (position !== -1 && (position < min || min === -1)) { + if (position !== -1 && (min === -1 || position < min)) { min = position; } } @@ -36419,126 +38837,335 @@ var url_1 = url$1; url$1.locator = url; url$1.notInLink = true; -var quotationMark$1 = '"'; -var apostrophe$1 = "'"; -var leftParenthesis$1 = '('; -var rightParenthesis$2 = ')'; -var comma$1 = ','; -var dot$2 = '.'; -var colon$4 = ':'; -var semicolon$1 = ';'; -var lessThan$4 = '<'; -var atSign$1 = '@'; -var leftSquareBracket$2 = '['; -var rightSquareBracket$2 = ']'; - -var http = 'http://'; -var https = 'https://'; -var mailto$1 = 'mailto:'; - -var protocols$1 = [http, https, mailto$1]; - -var protocolsLength = protocols$1.length; +var exclamationMark$1 = 33; // '!' +var ampersand$1 = 38; // '&' +var rightParenthesis$2 = 41; // ')' +var asterisk$2 = 42; // '*' +var comma$1 = 44; // ',' +var dash$5 = 45; // '-' +var dot$2 = 46; // '.' +var colon$3 = 58; // ':' +var semicolon$1 = 59; // ';' +var questionMark = 63; // '?' +var lessThan$4 = 60; // '<' +var underscore$2 = 95; // '_' +var tilde$2 = 126; // '~' + +var leftParenthesisCharacter = '('; +var rightParenthesisCharacter = ')'; function url$1(eat, value, silent) { var self = this; - var subvalue; - var content; - var character; + var gfm = self.options.gfm; + var tokenizers = self.inlineTokenizers; + var length = value.length; + var previousDot = -1; + var protocolless = false; + var dots; + var lastTwoPartsStart; + var start; var index; - var position; - var protocol; - var match; - var length; - var queue; - var parenCount; - var nextCharacter; - var tokenizers; + var pathStart; + var path; + var code; + var end; + var leftCount; + var rightCount; + var content; + var children; + var url; var exit; - if (!self.options.gfm) { + if (!gfm) { return } - subvalue = ''; - index = -1; + // `WWW.` doesn’t work. + if (value.slice(0, 4) === 'www.') { + protocolless = true; + index = 4; + } else if (value.slice(0, 7).toLowerCase() === 'http://') { + index = 7; + } else if (value.slice(0, 8).toLowerCase() === 'https://') { + index = 8; + } else { + return + } - while (++index < protocolsLength) { - protocol = protocols$1[index]; - match = value.slice(0, protocol.length); + // Act as if the starting boundary is a dot. + previousDot = index - 1; - if (match.toLowerCase() === protocol) { - subvalue = match; - break + // Parse a valid domain. + start = index; + dots = []; + + while (index < length) { + code = value.charCodeAt(index); + + if (code === dot$2) { + // Dots may not appear after each other. + if (previousDot === index - 1) { + break + } + + dots.push(index); + previousDot = index; + index++; + continue } + + if ( + isDecimal(code) || + isAlphabetical(code) || + code === dash$5 || + code === underscore$2 + ) { + index++; + continue + } + + break } - if (!subvalue) { + // Ignore a final dot: + if (code === dot$2) { + dots.pop(); + index--; + } + + // If there are not dots, exit. + if (dots[0] === undefined) { return } - index = subvalue.length; - length = value.length; - queue = ''; - parenCount = 0; + // If there is an underscore in the last two domain parts, exit: + // `www.example.c_m` and `www.ex_ample.com` are not OK, but + // `www.sub_domain.example.com` is. + lastTwoPartsStart = dots.length < 2 ? start : dots[dots.length - 2] + 1; + + if (value.slice(lastTwoPartsStart, index).indexOf('_') !== -1) { + return + } + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true + } + + end = index; + pathStart = index; + + // Parse a path. while (index < length) { - character = value.charAt(index); + code = value.charCodeAt(index); - if (isWhitespaceCharacter(character) || character === lessThan$4) { + if (isWhitespaceCharacter(code) || code === lessThan$4) { break } - if ( - character === dot$2 || - character === comma$1 || - character === colon$4 || - character === semicolon$1 || - character === quotationMark$1 || - character === apostrophe$1 || - character === rightParenthesis$2 || - character === rightSquareBracket$2 - ) { - nextCharacter = value.charAt(index + 1); + index++; - if (!nextCharacter || isWhitespaceCharacter(nextCharacter)) { - break - } + if ( + code === exclamationMark$1 || + code === asterisk$2 || + code === comma$1 || + code === dot$2 || + code === colon$3 || + code === questionMark || + code === underscore$2 || + code === tilde$2 + ) ; else { + end = index; } + } - if (character === leftParenthesis$1 || character === leftSquareBracket$2) { - parenCount++; + index = end; + + // If the path ends in a closing paren, and the count of closing parens is + // higher than the opening count, then remove the supefluous closing parens. + if (value.charCodeAt(index - 1) === rightParenthesis$2) { + path = value.slice(pathStart, index); + leftCount = ccount_1(path, leftParenthesisCharacter); + rightCount = ccount_1(path, rightParenthesisCharacter); + + while (rightCount > leftCount) { + index = pathStart + path.lastIndexOf(rightParenthesisCharacter); + path = value.slice(pathStart, index); + rightCount--; } + } - if (character === rightParenthesis$2 || character === rightSquareBracket$2) { - parenCount--; + if (value.charCodeAt(index - 1) === semicolon$1) { + // GitHub doesn’t document this, but final semicolons aren’t paret of the + // URL either. + index--; - if (parenCount < 0) { - break + // // If the path ends in what looks like an entity, it’s not part of the path. + if (isAlphabetical(value.charCodeAt(index - 1))) { + end = index - 2; + + while (isAlphabetical(value.charCodeAt(end))) { + end--; + } + + if (value.charCodeAt(end) === ampersand$1) { + index = end; } } + } - queue += character; - index++; + content = value.slice(0, index); + url = parseEntities_1(content, {nonTerminated: false}); + + if (protocolless) { + url = 'http://' + url; } - if (!queue) { + exit = self.enterLink(); + + // Temporarily remove all tokenizers except text in url. + self.inlineTokenizers = {text: tokenizers.text}; + children = self.tokenizeInline(content, eat.now()); + self.inlineTokenizers = tokenizers; + + exit(); + + return eat(content)({type: 'link', title: null, url: url, children: children}) +} + +var plusSign$1 = 43; // '+' +var dash$6 = 45; // '-' +var dot$3 = 46; // '.' +var underscore$3 = 95; // '_' + +var email = locate$3; + +// See: +function locate$3(value, fromIndex) { + var self = this; + var at; + var position; + + if (!this.options.gfm) { + return -1 + } + + at = value.indexOf('@', fromIndex); + + if (at === -1) { + return -1 + } + + position = at; + + if (position === fromIndex || !isGfmAtext(value.charCodeAt(position - 1))) { + return locate$3.call(self, value, at + 1) + } + + while (position > fromIndex && isGfmAtext(value.charCodeAt(position - 1))) { + position--; + } + + return position +} + +function isGfmAtext(code) { + return ( + isDecimal(code) || + isAlphabetical(code) || + code === plusSign$1 || + code === dash$6 || + code === dot$3 || + code === underscore$3 + ) +} + +var email_1 = email$1; +email$1.locator = email; +email$1.notInLink = true; + +var plusSign$2 = 43; // '+' +var dash$7 = 45; // '-' +var dot$4 = 46; // '.' +var atSign$1 = 64; // '@' +var underscore$4 = 95; // '_' + +function email$1(eat, value, silent) { + var self = this; + var gfm = self.options.gfm; + var tokenizers = self.inlineTokenizers; + var index = 0; + var length = value.length; + var firstDot = -1; + var code; + var content; + var children; + var exit; + + if (!gfm) { return } - subvalue += queue; - content = subvalue; + code = value.charCodeAt(index); - if (protocol === mailto$1) { - position = queue.indexOf(atSign$1); + while ( + isDecimal(code) || + isAlphabetical(code) || + code === plusSign$2 || + code === dash$7 || + code === dot$4 || + code === underscore$4 + ) { + code = value.charCodeAt(++index); + } - if (position === -1 || position === length - 1) { - return + if (index === 0) { + return + } + + if (code !== atSign$1) { + return + } + + index++; + + while (index < length) { + code = value.charCodeAt(index); + + if ( + isDecimal(code) || + isAlphabetical(code) || + code === dash$7 || + code === dot$4 || + code === underscore$4 + ) { + index++; + + if (firstDot === -1 && code === dot$4) { + firstDot = index; + } + + continue } - content = content.slice(mailto$1.length); + break } + if ( + firstDot === -1 || + firstDot === index || + code === dash$7 || + code === underscore$4 + ) { + return + } + + if (code === dot$4) { + index--; + } + + content = value.slice(0, index); + /* istanbul ignore if - never used (yet) */ if (silent) { return true @@ -36547,19 +39174,17 @@ function url$1(eat, value, silent) { exit = self.enterLink(); // Temporarily remove all tokenizers except text in url. - tokenizers = self.inlineTokenizers; self.inlineTokenizers = {text: tokenizers.text}; - - content = self.tokenizeInline(content, eat.now()); - + children = self.tokenizeInline(content, eat.now()); self.inlineTokenizers = tokenizers; + exit(); - return eat(subvalue)({ + return eat(content)({ type: 'link', title: null, - url: parseEntities_1(subvalue, {nonTerminated: false}), - children: content + url: 'mailto:' + parseEntities_1(content, {nonTerminated: false}), + children: children }) } @@ -36569,8 +39194,8 @@ var htmlInline = inlineHTML; inlineHTML.locator = tag$1; var lessThan$5 = '<'; -var questionMark = '?'; -var exclamationMark$1 = '!'; +var questionMark$1 = '?'; +var exclamationMark$2 = '!'; var slash$2 = '/'; var htmlLinkOpenExpression = /^= opening) { opening = 0; } - } else if (character === backslash$6) { + } else if (character === backslash$5) { // Allow brackets to be escaped. index++; subqueue += value.charAt(index); - } else if ((!opening || gfm) && character === leftSquareBracket$3) { + } else if ((!opening || gfm) && character === leftSquareBracket$1) { // In GFM mode, brackets in code still count. In all other modes, // they don’t. depth++; - } else if ((!opening || gfm) && character === rightSquareBracket$3) { + } else if ((!opening || gfm) && character === rightSquareBracket$1) { 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) !== leftParenthesis$2) { + if (value.charAt(index + 1) !== leftParenthesis$1) { return } - subqueue += leftParenthesis$2; + subqueue += leftParenthesis$1; closed = true; index++; @@ -36805,7 +39416,7 @@ function link$2(eat, value, silent) { break } - if (commonmark && character === lineFeed$h) { + if (commonmark && character === lineFeed$f) { return } @@ -36829,9 +39440,9 @@ function link$2(eat, value, silent) { if ( subqueue && - (character === quotationMark$2 || - character === apostrophe$2 || - (commonmark && character === leftParenthesis$2)) + (character === quotationMark$1 || + character === apostrophe$1 || + (commonmark && character === leftParenthesis$1)) ) { break } @@ -36843,7 +39454,7 @@ function link$2(eat, value, silent) { subqueue += character; } else { - if (character === leftParenthesis$2) { + if (character === leftParenthesis$1) { depth++; } else if (character === rightParenthesis$3) { if (depth === 0) { @@ -36856,8 +39467,8 @@ function link$2(eat, value, silent) { queue += subqueue; subqueue = ''; - if (character === backslash$6) { - queue += backslash$6; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -36892,14 +39503,14 @@ function link$2(eat, value, silent) { // Eat the title. if ( queue && - (character === quotationMark$2 || - character === apostrophe$2 || - (commonmark && character === leftParenthesis$2)) + (character === quotationMark$1 || + character === apostrophe$1 || + (commonmark && character === leftParenthesis$1)) ) { index++; subvalue += character; queue = ''; - marker = character === leftParenthesis$2 ? rightParenthesis$3 : character; + marker = character === leftParenthesis$1 ? rightParenthesis$3 : character; beforeTitle = subvalue; // In commonmark-mode, things are pretty easy: the marker cannot occur @@ -36913,8 +39524,8 @@ function link$2(eat, value, silent) { break } - if (character === backslash$6) { - queue += backslash$6; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -37012,31 +39623,27 @@ function link$2(eat, value, silent) { } var reference_1 = reference; -reference.locator = link$1; +reference.locator = link$2; -var link$3 = 'link'; +var link$4 = 'link'; var image$1 = 'image'; -var footnote = 'footnote'; var shortcut = 'shortcut'; var collapsed = 'collapsed'; var full = 'full'; -var space$f = ' '; -var exclamationMark$3 = '!'; -var leftSquareBracket$4 = '['; -var backslash$7 = '\\'; -var rightSquareBracket$4 = ']'; -var caret$2 = '^'; +var exclamationMark$4 = '!'; +var leftSquareBracket$2 = '['; +var backslash$6 = '\\'; +var rightSquareBracket$2 = ']'; function reference(eat, value, silent) { var self = this; var commonmark = self.options.commonmark; - var footnotes = self.options.footnotes; var character = value.charAt(0); var index = 0; var length = value.length; var subvalue = ''; var intro = ''; - var type = link$3; + var type = link$4; var referenceType = shortcut; var content; var identifier; @@ -37048,13 +39655,13 @@ function reference(eat, value, silent) { var depth; // Check whether we’re eating an image. - if (character === exclamationMark$3) { + if (character === exclamationMark$4) { type = image$1; intro = character; character = value.charAt(++index); } - if (character !== leftSquareBracket$4) { + if (character !== leftSquareBracket$2) { return } @@ -37062,29 +39669,16 @@ function reference(eat, value, silent) { intro += character; queue = ''; - // Check whether we’re eating a footnote. - if (footnotes && value.charAt(index) === caret$2) { - // Exit if `![^` is found, so the `!` will be seen as text after this, - // and we’ll enter this function again when `[^` is found. - if (type === image$1) { - return - } - - intro += caret$2; - index++; - type = footnote; - } - // Eat the text. depth = 0; while (index < length) { character = value.charAt(index); - if (character === leftSquareBracket$4) { + if (character === leftSquareBracket$2) { bracketed = true; depth++; - } else if (character === rightSquareBracket$4) { + } else if (character === rightSquareBracket$2) { if (!depth) { break } @@ -37092,8 +39686,8 @@ function reference(eat, value, silent) { depth--; } - if (character === backslash$7) { - queue += backslash$7; + if (character === backslash$6) { + queue += backslash$6; character = value.charAt(++index); } @@ -37105,7 +39699,7 @@ function reference(eat, value, silent) { content = queue; character = value.charAt(index); - if (character !== rightSquareBracket$4) { + if (character !== rightSquareBracket$2) { return } @@ -37131,13 +39725,7 @@ function reference(eat, value, silent) { character = value.charAt(index); - // Inline footnotes cannot have a label. - // If footnotes are enabled, link labels cannot start with a caret. - if ( - type !== footnote && - character === leftSquareBracket$4 && - (!footnotes || value.charAt(index + 1) !== caret$2) - ) { + if (character === leftSquareBracket$2) { identifier = ''; queue += character; index++; @@ -37145,12 +39733,12 @@ function reference(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === leftSquareBracket$4 || character === rightSquareBracket$4) { + if (character === leftSquareBracket$2 || character === rightSquareBracket$2) { break } - if (character === backslash$7) { - identifier += backslash$7; + if (character === backslash$6) { + identifier += backslash$6; character = value.charAt(++index); } @@ -37160,7 +39748,7 @@ function reference(eat, value, silent) { character = value.charAt(index); - if (character === rightSquareBracket$4) { + if (character === rightSquareBracket$2) { referenceType = identifier ? full : collapsed; queue += identifier + character; index++; @@ -37185,7 +39773,7 @@ function reference(eat, value, silent) { subvalue = intro + subvalue; - if (type === link$3 && self.inLink) { + if (type === link$4 && self.inLink) { return null } @@ -37194,13 +39782,6 @@ function reference(eat, value, silent) { return true } - if (type === footnote && content.indexOf(space$f) !== -1) { - return eat(subvalue)({ - type: footnote, - children: this.tokenizeInline(content, eat.now()) - }) - } - now = eat.now(); now.column += intro.length; now.offset += intro.length; @@ -37209,27 +39790,24 @@ function reference(eat, value, silent) { node = { type: type + 'Reference', identifier: normalize_1(identifier), - label: identifier + label: identifier, + referenceType: referenceType }; - if (type === link$3 || type === image$1) { - node.referenceType = referenceType; - } - - if (type === link$3) { + if (type === link$4) { exit = self.enterLink(); node.children = self.tokenizeInline(content, now); exit(); - } else if (type === image$1) { + } else { node.alt = self.decode.raw(self.unescape(content), now) || null; } return eat(subvalue)(node) } -var strong = locate$4; +var strong = locate$5; -function locate$4(value, fromIndex) { +function locate$5(value, fromIndex) { var asterisk = value.indexOf('**', fromIndex); var underscore = value.indexOf('__', fromIndex); @@ -37247,9 +39825,9 @@ function locate$4(value, fromIndex) { var strong_1 = strong$1; strong$1.locator = strong; -var backslash$8 = '\\'; -var asterisk$2 = '*'; -var underscore$2 = '_'; +var backslash$7 = '\\'; +var asterisk$3 = '*'; +var underscore$5 = '_'; function strong$1(eat, value, silent) { var self = this; @@ -37261,10 +39839,10 @@ function strong$1(eat, value, silent) { var queue; var subvalue; var length; - var prev; + var previous; if ( - (character !== asterisk$2 && character !== underscore$2) || + (character !== asterisk$3 && character !== underscore$5) || value.charAt(++index) !== character ) { return @@ -37283,13 +39861,13 @@ function strong$1(eat, value, silent) { } while (index < length) { - prev = character; + previous = character; character = value.charAt(index); if ( character === marker && value.charAt(index + 1) === marker && - (!pedantic || !isWhitespaceCharacter(prev)) + (!pedantic || !isWhitespaceCharacter(previous)) ) { character = value.charAt(index + 2); @@ -37314,7 +39892,7 @@ function strong$1(eat, value, silent) { } } - if (!pedantic && character === backslash$8) { + if (!pedantic && character === backslash$7) { queue += character; character = value.charAt(++index); } @@ -37337,9 +39915,9 @@ function wordCharacter(character) { ) } -var emphasis = locate$5; +var emphasis = locate$6; -function locate$5(value, fromIndex) { +function locate$6(value, fromIndex) { var asterisk = value.indexOf('*', fromIndex); var underscore = value.indexOf('_', fromIndex); @@ -37357,9 +39935,9 @@ function locate$5(value, fromIndex) { var emphasis_1 = emphasis$1; emphasis$1.locator = emphasis; -var asterisk$3 = '*'; -var underscore$3 = '_'; -var backslash$9 = '\\'; +var asterisk$4 = '*'; +var underscore$6 = '_'; +var backslash$8 = '\\'; function emphasis$1(eat, value, silent) { var self = this; @@ -37371,9 +39949,9 @@ function emphasis$1(eat, value, silent) { var queue; var subvalue; var length; - var prev; + var previous; - if (character !== asterisk$3 && character !== underscore$3) { + if (character !== asterisk$4 && character !== underscore$6) { return } @@ -37390,18 +39968,18 @@ function emphasis$1(eat, value, silent) { } while (index < length) { - prev = character; + previous = character; character = value.charAt(index); - if (character === marker && (!pedantic || !isWhitespaceCharacter(prev))) { + if (character === marker && (!pedantic || !isWhitespaceCharacter(previous))) { character = value.charAt(++index); if (character !== marker) { - if (!trim_1(queue) || prev === marker) { + if (!trim_1(queue) || previous === marker) { return } - if (!pedantic && marker === underscore$3 && isWordCharacter(character)) { + if (!pedantic && marker === underscore$6 && isWordCharacter(character)) { queue += marker; continue } @@ -37424,7 +40002,7 @@ function emphasis$1(eat, value, silent) { queue += marker; } - if (!pedantic && character === backslash$9) { + if (!pedantic && character === backslash$8) { queue += character; character = value.charAt(++index); } @@ -37434,16 +40012,16 @@ function emphasis$1(eat, value, silent) { } } -var _delete = locate$6; +var _delete = locate$7; -function locate$6(value, fromIndex) { +function locate$7(value, fromIndex) { return value.indexOf('~~', fromIndex) } var _delete$1 = strikethrough; strikethrough.locator = _delete; -var tilde$2 = '~'; +var tilde$3 = '~'; var fence = '~~'; function strikethrough(eat, value, silent) { @@ -37458,8 +40036,8 @@ function strikethrough(eat, value, silent) { if ( !self.options.gfm || - value.charAt(0) !== tilde$2 || - value.charAt(1) !== tilde$2 || + value.charAt(0) !== tilde$3 || + value.charAt(1) !== tilde$3 || isWhitespaceCharacter(value.charAt(2)) ) { return @@ -37475,8 +40053,8 @@ function strikethrough(eat, value, silent) { character = value.charAt(index); if ( - character === tilde$2 && - previous === tilde$2 && + character === tilde$3 && + previous === tilde$3 && (!preceding || !isWhitespaceCharacter(preceding)) ) { /* istanbul ignore if - never used (yet) */ @@ -37496,17 +40074,17 @@ function strikethrough(eat, value, silent) { } } -var codeInline = locate$7; +var codeInline = locate$8; -function locate$7(value, fromIndex) { +function locate$8(value, fromIndex) { return value.indexOf('`', fromIndex) } var codeInline$1 = inlineCode; inlineCode.locator = codeInline; -var lineFeed$i = 10; // '\n' -var space$g = 32; // ' ' +var lineFeed$g = 10; // '\n' +var space$e = 32; // ' ' var graveAccent$2 = 96; // '`' function inlineCode(eat, value, silent) { @@ -37579,8 +40157,8 @@ function inlineCode(eat, value, silent) { if ( length - index > 2 && - (code === space$g || code === lineFeed$i) && - (next === space$g || next === lineFeed$i) + (code === space$e || code === lineFeed$g) && + (next === space$e || next === lineFeed$g) ) { index++; length--; @@ -37588,7 +40166,7 @@ function inlineCode(eat, value, silent) { while (index < length) { code = value.charCodeAt(index); - if (code !== space$g && code !== lineFeed$i) { + if (code !== space$e && code !== lineFeed$g) { found = true; break } @@ -37608,9 +40186,9 @@ function inlineCode(eat, value, silent) { }) } -var _break = locate$8; +var _break = locate$9; -function locate$8(value, fromIndex) { +function locate$9(value, fromIndex) { var index = value.indexOf('\n', fromIndex); while (index > fromIndex) { @@ -37627,8 +40205,8 @@ function locate$8(value, fromIndex) { var _break$1 = hardBreak; hardBreak.locator = _break; -var space$h = ' '; -var lineFeed$j = '\n'; +var space$f = ' '; +var lineFeed$h = '\n'; var minBreakLength = 2; function hardBreak(eat, value, silent) { @@ -37640,7 +40218,7 @@ function hardBreak(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (character === lineFeed$j) { + if (character === lineFeed$h) { if (index < minBreakLength) { return } @@ -37655,7 +40233,7 @@ function hardBreak(eat, value, silent) { return eat(queue)({type: 'break'}) } - if (character !== space$h) { + if (character !== space$f) { return } @@ -37737,20 +40315,20 @@ function Parser(doc, file) { this.decode = decode(this); } -var proto$3 = Parser.prototype; +var proto$4 = Parser.prototype; // Expose core. -proto$3.setOptions = setOptions_1; -proto$3.parse = parse_1$3; +proto$4.setOptions = setOptions_1; +proto$4.parse = parse_1$3; // Expose `defaults`. -proto$3.options = defaults$2; +proto$4.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); +proto$4.exitStart = stateToggle('atStart', true); +proto$4.enterList = stateToggle('inList', false); +proto$4.enterLink = stateToggle('inLink', false); +proto$4.enterBlock = stateToggle('inBlock', false); // Nodes that can interupt a paragraph: // @@ -37760,15 +40338,15 @@ proto$3.enterBlock = stateToggle('inBlock', false); // ``` // // In the above example, the thematic break “interupts” the paragraph. -proto$3.interruptParagraph = [ +proto$4.interruptParagraph = [ ['thematicBreak'], + ['list'], ['atxHeading'], ['fencedCode'], ['blockquote'], ['html'], ['setextHeading', {commonmark: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] + ['definition', {commonmark: false}] ]; // Nodes that can interupt a list: @@ -37779,12 +40357,11 @@ proto$3.interruptParagraph = [ // ``` // // In the above example, the thematic break “interupts” the list. -proto$3.interruptList = [ +proto$4.interruptList = [ ['atxHeading', {pedantic: false}], ['fencedCode', {pedantic: false}], ['thematicBreak', {pedantic: false}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] + ['definition', {commonmark: false}] ]; // Nodes that can interupt a blockquote: @@ -37795,7 +40372,7 @@ proto$3.interruptList = [ // ``` // // In the above example, the thematic break “interupts” the blockquote. -proto$3.interruptBlockquote = [ +proto$4.interruptBlockquote = [ ['indentedCode', {commonmark: true}], ['fencedCode', {commonmark: true}], ['atxHeading', {commonmark: true}], @@ -37803,13 +40380,12 @@ proto$3.interruptBlockquote = [ ['thematicBreak', {commonmark: true}], ['html', {commonmark: true}], ['list', {commonmark: true}], - ['definition', {commonmark: false}], - ['footnote', {commonmark: false}] + ['definition', {commonmark: false}] ]; // Handlers. -proto$3.blockTokenizers = { - newline: newline_1, +proto$4.blockTokenizers = { + blankLine: blankLine_1, indentedCode: codeIndented, fencedCode: codeFenced, blockquote: blockquote_1, @@ -37818,16 +40394,16 @@ proto$3.blockTokenizers = { list: list_1, setextHeading: headingSetext, html: htmlBlock, - footnote: footnoteDefinition_1, definition: definition_1, table: table_1, paragraph: paragraph_1 }; -proto$3.inlineTokenizers = { +proto$4.inlineTokenizers = { escape: _escape$1, autoLink: autoLink_1, url: url_1, + email: email_1, html: htmlInline, link: link_1, reference: reference_1, @@ -37840,13 +40416,13 @@ proto$3.inlineTokenizers = { }; // Expose precedence. -proto$3.blockMethods = keys$1(proto$3.blockTokenizers); -proto$3.inlineMethods = keys$1(proto$3.inlineTokenizers); +proto$4.blockMethods = keys$1(proto$4.blockTokenizers); +proto$4.inlineMethods = keys$1(proto$4.inlineTokenizers); // Tokenizers. -proto$3.tokenizeBlock = tokenizer('block'); -proto$3.tokenizeInline = tokenizer('inline'); -proto$3.tokenizeFactory = tokenizer; +proto$4.tokenizeBlock = tokenizer('block'); +proto$4.tokenizeInline = tokenizer('inline'); +proto$4.tokenizeFactory = tokenizer; // Get all keys in `value`. function keys$1(value) { @@ -37915,9 +40491,8 @@ var defaults$3 = { entities: 'false', setext: false, closeAtx: false, - looseTable: false, - spacedTable: true, - paddedTable: true, + tableCellPadding: true, + tablePipeAlign: true, stringLength: stringLength, incrementListMarker: true, fences: false, @@ -38165,7 +40740,7 @@ const Scaron$1 = "Š"; const scaron$1 = "š"; const Yuml$1 = "Ÿ"; const circ$1 = "ˆ"; -const tilde$3 = "˜"; +const tilde$4 = "˜"; const ensp$1 = " "; const emsp$1 = " "; const thinsp$1 = " "; @@ -38418,7 +40993,7 @@ var index$4 = { scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$3, + tilde: tilde$4, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -38674,7 +41249,7 @@ var characterEntitiesHtml4 = /*#__PURE__*/Object.freeze({ scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$3, + tilde: tilde$4, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -38728,6 +41303,9 @@ encode.escape = escape$2; var own$5 = {}.hasOwnProperty; +// Characters +var equalsTo$2 = 61; + // List of enforced escapes. var escapes$1 = ['"', "'", '<', '>', '&', '`']; @@ -38762,19 +41340,19 @@ function encode(value, options) { .replace(surrogatePair, replaceSurrogatePair) .replace(bmp, replace) - function replaceSurrogatePair(pair, pos, val) { + function replaceSurrogatePair(pair, pos, slice) { return toHexReference( (pair.charCodeAt(0) - 0xd800) * 0x400 + pair.charCodeAt(1) - 0xdc00 + 0x10000, - val.charAt(pos + 2), + slice.charCodeAt(pos + 2), omit ) } - function replace(char, pos, val) { - return one$1(char, val.charAt(pos + 1), settings) + function replace(char, pos, slice) { + return one$1(char, slice.charCodeAt(pos + 1), settings) } } @@ -38834,7 +41412,7 @@ function toNamed(name, next, omit, attribute) { omit && own$5.call(legacy, name) && dangerous$2.indexOf(name) === -1 && - (!attribute || (next && next !== '=' && !isAlphanumerical(next))) + (!attribute || (next && next !== equalsTo$2 && !isAlphanumerical(next))) ) { return value } @@ -38881,7 +41459,7 @@ var isAlphanumeric = function (str) { var entityPrefixLength = length; -var ampersand$1 = '&'; +var ampersand$2 = '&'; // 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. @@ -38890,39 +41468,39 @@ function length(value) { /* istanbul ignore if - Currently also tested for at implemention, but we * keep it here because that’s proper. */ - if (value.charAt(0) !== ampersand$1) { + if (value.charAt(0) !== ampersand$2) { return 0 } - prefix = value.split(ampersand$1, 2).join(ampersand$1); + prefix = value.split(ampersand$2, 2).join(ampersand$2); return prefix.length - parseEntities_1(prefix).length } var _escape$2 = factory$6; -var tab$f = '\t'; -var lineFeed$k = '\n'; -var space$i = ' '; +var tab$d = '\t'; +var lineFeed$i = '\n'; +var space$g = ' '; var numberSign$2 = '#'; -var ampersand$2 = '&'; -var leftParenthesis$3 = '('; +var ampersand$3 = '&'; +var leftParenthesis$2 = '('; var rightParenthesis$4 = ')'; -var asterisk$4 = '*'; -var plusSign$1 = '+'; -var dash$5 = '-'; -var dot$3 = '.'; -var colon$5 = ':'; +var asterisk$5 = '*'; +var plusSign$3 = '+'; +var dash$8 = '-'; +var dot$5 = '.'; +var colon$4 = ':'; var lessThan$7 = '<'; var greaterThan$4 = '>'; -var leftSquareBracket$5 = '['; -var backslash$a = '\\'; -var rightSquareBracket$5 = ']'; -var underscore$4 = '_'; +var leftSquareBracket$3 = '['; +var backslash$9 = '\\'; +var rightSquareBracket$3 = ']'; +var underscore$7 = '_'; var graveAccent$3 = '`'; var verticalBar$1 = '|'; -var tilde$4 = '~'; -var exclamationMark$4 = '!'; +var tilde$5 = '~'; +var exclamationMark$5 = '!'; var entities$1 = { '<': '<', @@ -38933,9 +41511,9 @@ var entities$1 = { }; var shortcut$1 = 'shortcut'; -var mailto$2 = 'mailto'; -var https$1 = 'https'; -var http$1 = 'http'; +var mailto$1 = 'mailto'; +var https = 'https'; +var http = 'http'; var blankExpression = /\n\s*$/; @@ -38949,10 +41527,10 @@ function factory$6(options) { var gfm = options.gfm; var commonmark = options.commonmark; var pedantic = options.pedantic; - var markers = commonmark ? [dot$3, rightParenthesis$4] : [dot$3]; + var markers = commonmark ? [dot$5, rightParenthesis$4] : [dot$5]; var siblings = parent && parent.children; var index = siblings && siblings.indexOf(node); - var prev = siblings && siblings[index - 1]; + var previous = siblings && siblings[index - 1]; var next = siblings && siblings[index + 1]; var length = value.length; var escapable = markdownEscapes(options); @@ -38966,8 +41544,8 @@ function factory$6(options) { var offset; var replace; - if (prev) { - afterNewLine = text$1(prev) && blankExpression.test(prev.value); + if (previous) { + afterNewLine = text$1(previous) && blankExpression.test(previous.value); } else { afterNewLine = !parent || parent.type === 'root' || parent.type === 'paragraph'; @@ -38980,34 +41558,34 @@ function factory$6(options) { if (character === '\n') { afterNewLine = true; } else if ( - character === backslash$a || + character === backslash$9 || character === graveAccent$3 || - character === asterisk$4 || - character === leftSquareBracket$5 || + character === asterisk$5 || + character === leftSquareBracket$3 || character === lessThan$7 || - (character === ampersand$2 && entityPrefixLength(value.slice(position)) > 0) || - (character === rightSquareBracket$5 && self.inLink) || - (gfm && character === tilde$4 && value.charAt(position + 1) === tilde$4) || + (character === ampersand$3 && entityPrefixLength(value.slice(position)) > 0) || + (character === rightSquareBracket$3 && self.inLink) || + (gfm && character === tilde$5 && value.charAt(position + 1) === tilde$5) || (gfm && character === verticalBar$1 && (self.inTable || alignment(value, position))) || - (character === underscore$4 && + (character === underscore$7 && // Delegate leading/trailing underscores to the multinode version below. position > 0 && position < length - 1 && (pedantic || !isAlphanumeric(value.charAt(position - 1)) || !isAlphanumeric(value.charAt(position + 1)))) || - (gfm && !self.inLink && character === colon$5 && protocol(queue.join(''))) + (gfm && !self.inLink && character === colon$4 && protocol(queue.join(''))) ) { replace = true; } else if (afterNewLine) { if ( character === greaterThan$4 || character === numberSign$2 || - character === asterisk$4 || - character === dash$5 || - character === plusSign$1 + character === asterisk$5 || + character === dash$8 || + character === plusSign$3 ) { replace = true; } else if (isDecimal(character)) { @@ -39024,7 +41602,7 @@ function factory$6(options) { if (markers.indexOf(value.charAt(offset)) !== -1) { next = value.charAt(offset + 1); - if (!next || next === space$i || next === tab$f || next === lineFeed$k) { + if (!next || next === space$g || next === tab$d || next === lineFeed$i) { queue.push(value.slice(position, offset)); position = offset; character = value.charAt(position); @@ -39045,18 +41623,18 @@ function factory$6(options) { 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$1) { + if (previous && previous.referenceType === shortcut$1) { position = -1; length = escaped.length; while (++position < length) { character = escaped[position]; - if (character === space$i || character === tab$f) { + if (character === space$g || character === tab$d) { continue } - if (character === leftParenthesis$3 || character === colon$5) { + if (character === leftParenthesis$2 || character === colon$4) { escaped[position] = one(character); } @@ -39068,9 +41646,9 @@ function factory$6(options) { if ( text$1(next) && position === length && - next.value.charAt(0) === leftParenthesis$3 + next.value.charAt(0) === leftParenthesis$2 ) { - escaped.push(backslash$a); + escaped.push(backslash$9); } } @@ -39079,67 +41657,67 @@ function factory$6(options) { if ( gfm && !self.inLink && - text$1(prev) && - value.charAt(0) === colon$5 && - protocol(prev.value.slice(-6)) + text$1(previous) && + value.charAt(0) === colon$4 && + protocol(previous.value.slice(-6)) ) { - escaped[0] = one(colon$5); + escaped[0] = one(colon$4); } // Escape ampersand if it would otherwise start an entity. if ( text$1(next) && - value.charAt(length - 1) === ampersand$2 && - entityPrefixLength(ampersand$2 + next.value) !== 0 + value.charAt(length - 1) === ampersand$3 && + entityPrefixLength(ampersand$3 + next.value) !== 0 ) { - escaped[escaped.length - 1] = one(ampersand$2); + escaped[escaped.length - 1] = one(ampersand$3); } // Escape exclamation marks immediately followed by links. if ( next && next.type === 'link' && - value.charAt(length - 1) === exclamationMark$4 + value.charAt(length - 1) === exclamationMark$5 ) { - escaped[escaped.length - 1] = one(exclamationMark$4); + escaped[escaped.length - 1] = one(exclamationMark$5); } // Escape double tildes in GFM. if ( gfm && text$1(next) && - value.charAt(length - 1) === tilde$4 && - next.value.charAt(0) === tilde$4 + value.charAt(length - 1) === tilde$5 && + next.value.charAt(0) === tilde$5 ) { - escaped.splice(escaped.length - 1, 0, backslash$a); + escaped.splice(-1, 0, backslash$9); } // Escape underscores, but not mid-word (unless in pedantic mode). - wordCharBefore = text$1(prev) && isAlphanumeric(prev.value.slice(-1)); + wordCharBefore = text$1(previous) && isAlphanumeric(previous.value.slice(-1)); wordCharAfter = text$1(next) && isAlphanumeric(next.value.charAt(0)); if (length === 1) { if ( - value === underscore$4 && + value === underscore$7 && (pedantic || !wordCharBefore || !wordCharAfter) ) { - escaped.unshift(backslash$a); + escaped.unshift(backslash$9); } } else { if ( - value.charAt(0) === underscore$4 && + value.charAt(0) === underscore$7 && (pedantic || !wordCharBefore || !isAlphanumeric(value.charAt(1))) ) { - escaped.unshift(backslash$a); + escaped.unshift(backslash$9); } if ( - value.charAt(length - 1) === underscore$4 && + value.charAt(length - 1) === underscore$7 && (pedantic || !wordCharAfter || !isAlphanumeric(value.charAt(length - 2))) ) { - escaped.splice(escaped.length - 1, 0, backslash$a); + escaped.splice(-1, 0, backslash$9); } } } @@ -39149,15 +41727,15 @@ function factory$6(options) { function one(character) { return escapable.indexOf(character) === -1 ? entities$1[character] - : backslash$a + character + : backslash$9 + character } } } // Check if `index` in `value` is inside an alignment row. function alignment(value, index) { - var start = value.lastIndexOf(lineFeed$k, index); - var end = value.indexOf(lineFeed$k, index); + var start = value.lastIndexOf(lineFeed$i, index); + var end = value.indexOf(lineFeed$i, index); var char; end = end === -1 ? value.length : end; @@ -39166,9 +41744,9 @@ function alignment(value, index) { char = value.charAt(start); if ( - char !== colon$5 && - char !== dash$5 && - char !== space$i && + char !== colon$4 && + char !== dash$8 && + char !== space$g && char !== verticalBar$1 ) { return false @@ -39185,8 +41763,8 @@ function text$1(node) { // Check if `value` ends in a protocol. function protocol(value) { - var val = value.slice(-6).toLowerCase(); - return val === mailto$2 || val.slice(-5) === https$1 || val.slice(-4) === http$1 + var tail = value.slice(-6).toLowerCase(); + return tail === mailto$1 || tail.slice(-5) === https || tail.slice(-4) === http } var setOptions_1$1 = setOptions$1; @@ -39445,10 +42023,10 @@ function all(parent) { var block_1 = block$1; -var lineFeed$l = '\n'; +var lineFeed$j = '\n'; -var blank$1 = lineFeed$l + lineFeed$l; -var triple = blank$1 + lineFeed$l; +var blank$1 = lineFeed$j + lineFeed$j; +var triple = blank$1 + lineFeed$j; var comment$1 = blank$1 + '' + blank$1; // Stringify a block node with block children (e.g., `root` or `blockquote`). @@ -39463,14 +42041,14 @@ function block$1(node) { var children = node.children; var length = children.length; var index = -1; - var prev; + var previous; var child; while (++index < length) { - prev = child; + previous = child; child = children[index]; - if (prev) { + if (previous) { // A list preceding another list that are equally ordered, or a // list preceding an indented code block, need a gap between them, // so as not to see them as one list, or content of the list, @@ -39480,8 +42058,8 @@ function block$1(node) { // so we opt for an empty, invisible comment. In other flavours, // two blank lines are fine. if ( - prev.type === 'list' && - ((child.type === 'list' && prev.ordered === child.ordered) || + previous.type === 'list' && + ((child.type === 'list' && previous.ordered === child.ordered) || (child.type === 'code' && !child.lang && !fences)) ) { values.push(gap); @@ -39498,10 +42076,10 @@ function block$1(node) { var orderedItems_1 = orderedItems; -var lineFeed$m = '\n'; -var dot$4 = '.'; +var lineFeed$k = '\n'; +var dot$6 = '.'; -var blank$2 = lineFeed$m + lineFeed$m; +var blank$2 = lineFeed$k + lineFeed$k; // Visit ordered list items. // @@ -39531,18 +42109,18 @@ function orderedItems(node) { start = start == null ? 1 : start; while (++index < length) { - bullet = (increment ? start + index : start) + dot$4; + bullet = (increment ? start + index : start) + dot$6; values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join(node.spread ? blank$2 : lineFeed$m) + return values.join(node.spread ? blank$2 : lineFeed$k) } var unorderedItems_1 = unorderedItems; -var lineFeed$n = '\n'; +var lineFeed$l = '\n'; -var blank$3 = lineFeed$n + lineFeed$n; +var blank$3 = lineFeed$l + lineFeed$l; // Visit unordered list items. Uses `options.bullet` as each item’s bullet. function unorderedItems(node) { @@ -39558,20 +42136,20 @@ function unorderedItems(node) { values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join(node.spread ? blank$3 : lineFeed$n) + return values.join(node.spread ? blank$3 : lineFeed$l) } var root_1 = root$1; -var lineFeed$o = '\n'; +var lineFeed$m = '\n'; // Stringify a root. // Adds a final newline to ensure valid POSIX files. */ function root$1(node) { var doc = this.block(node); - if (doc.charAt(doc.length - 1) !== lineFeed$o) { - doc += lineFeed$o; + if (doc.charAt(doc.length - 1) !== lineFeed$m) { + doc += lineFeed$m; } return doc @@ -39597,11 +42175,11 @@ function text$2(node, parent) { var heading_1 = heading; -var lineFeed$p = '\n'; -var space$j = ' '; +var lineFeed$n = '\n'; +var space$h = ' '; var numberSign$3 = '#'; -var dash$6 = '-'; -var equalsTo$2 = '='; +var dash$9 = '-'; +var equalsTo$3 = '='; // Stringify a heading. // @@ -39634,13 +42212,13 @@ function heading(node) { if (setext && depth < 3) { return ( - content + lineFeed$p + repeatString(depth === 1 ? equalsTo$2 : dash$6, content.length) + content + lineFeed$n + repeatString(depth === 1 ? equalsTo$3 : dash$9, content.length) ) } prefix = repeatString(numberSign$3, node.depth); - return prefix + space$j + content + (closeAtx ? space$j + prefix : '') + return prefix + space$h + content + (closeAtx ? space$h + prefix : '') } var paragraph_1$1 = paragraph$1; @@ -39651,12 +42229,12 @@ function paragraph$1(node) { var blockquote_1$1 = blockquote$1; -var lineFeed$q = '\n'; -var space$k = ' '; +var lineFeed$o = '\n'; +var space$i = ' '; var greaterThan$5 = '>'; function blockquote$1(node) { - var values = this.block(node).split(lineFeed$q); + var values = this.block(node).split(lineFeed$o); var result = []; var length = values.length; var index = -1; @@ -39664,10 +42242,10 @@ function blockquote$1(node) { while (++index < length) { value = values[index]; - result[index] = (value ? space$k : '') + value; + result[index] = (value ? space$i : '') + value; } - return greaterThan$5 + result.join(lineFeed$q + greaterThan$5) + return greaterThan$5 + result.join(lineFeed$o + greaterThan$5) } var list_1$1 = list$1; @@ -39679,17 +42257,17 @@ function list$1(node) { var pad_1 = pad$1; -var lineFeed$r = '\n'; -var space$l = ' '; +var lineFeed$p = '\n'; +var space$j = ' '; var tabSize$5 = 4; // Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty // lines. function pad$1(value, level) { - var values = value.split(lineFeed$r); + var values = value.split(lineFeed$p); var index = values.length; - var padding = repeatString(space$l, level * tabSize$5); + var padding = repeatString(space$j, level * tabSize$5); while (index--) { if (values[index].length !== 0) { @@ -39697,19 +42275,19 @@ function pad$1(value, level) { } } - return values.join(lineFeed$r) + return values.join(lineFeed$p) } var listItem_1 = listItem$1; -var lineFeed$s = '\n'; -var space$m = ' '; -var leftSquareBracket$6 = '['; -var rightSquareBracket$6 = ']'; +var lineFeed$q = '\n'; +var space$k = ' '; +var leftSquareBracket$4 = '['; +var rightSquareBracket$4 = ']'; var lowercaseX$2 = 'x'; var ceil = Math.ceil; -var blank$4 = lineFeed$s + lineFeed$s; +var blank$4 = lineFeed$q + lineFeed$q; var tabSize$6 = 4; @@ -39744,26 +42322,26 @@ function listItem$1(node, parent, position, bullet) { values[index] = self.visit(children[index], node); } - value = values.join(spread ? blank$4 : lineFeed$s); + value = values.join(spread ? blank$4 : lineFeed$q); if (typeof checked === 'boolean') { // Note: I’d like to be able to only add the space between the check and // the value, but unfortunately github does not support empty list-items // with a checkbox :( value = - leftSquareBracket$6 + - (checked ? lowercaseX$2 : space$m) + - rightSquareBracket$6 + - space$m + + leftSquareBracket$4 + + (checked ? lowercaseX$2 : space$k) + + rightSquareBracket$4 + + space$k + value; } - if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed$s) === -1)) { + if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed$q) === -1)) { indent = marker.length + 1; - spacing = space$m; + spacing = space$k; } else { indent = ceil((marker.length + 1) / tabSize$6) * tabSize$6; - spacing = repeatString(space$m, indent - marker.length); + spacing = repeatString(space$k, indent - marker.length); } return value @@ -39809,8 +42387,8 @@ function longestStreak(value, character) { var inlineCode_1 = inlineCode$1; var graveAccentChar = '`'; -var lineFeed$t = 10; // '\n' -var space$n = 32; // ' ' +var lineFeed$r = 10; // '\n' +var space$l = 32; // ' ' var graveAccent$4 = 96; // '`' // Stringify inline code. @@ -39862,14 +42440,14 @@ function inlineCode$1(node) { } function ws(code) { - return code === lineFeed$t || code === space$n + return code === lineFeed$r || code === space$l } var code_1 = code; -var lineFeed$u = '\n'; -var space$o = ' '; -var tilde$5 = '~'; +var lineFeed$s = '\n'; +var space$m = ' '; +var tilde$6 = '~'; var graveAccent$5 = '`'; // Stringify code. @@ -39913,7 +42491,7 @@ function code(node, parent) { var fence; if (info && node.meta) { - info += space$o + node.meta; + info += space$m + node.meta; } info = self.encode(self.escape(info, node)); @@ -39923,8 +42501,8 @@ function code(node, parent) { !info && !options.fences && value && - value.charAt(0) !== lineFeed$u && - value.charAt(value.length - 1) !== lineFeed$u + value.charAt(0) !== lineFeed$s && + value.charAt(value.length - 1) !== lineFeed$s ) { // Throw when pedantic, in a list item which isn’t compiled using a tab. if ( @@ -39945,12 +42523,12 @@ function code(node, parent) { // Backticks in the info string don’t work with backtick fenced code. // Backticks (and tildes) are fine in tilde fenced code. if (marker === graveAccent$5 && info.indexOf(graveAccent$5) !== -1) { - marker = tilde$5; + marker = tilde$6; } fence = repeatString(marker, Math.max(longestStreak_1(value, marker) + 1, 3)); - return fence + info + lineFeed$u + value + lineFeed$u + fence + return fence + info + lineFeed$s + value + lineFeed$s + fence } var html_1 = html$1; @@ -39961,7 +42539,7 @@ function html$1(node) { var thematicBreak$1 = thematic; -var space$p = ' '; +var space$n = ' '; // Stringify a `thematic-break`. // The character used is configurable through `rule`: (`'_'`): @@ -39984,7 +42562,7 @@ var space$p = ' '; function thematic() { var options = this.options; var rule = repeatString(options.rule, options.ruleRepetition); - return options.ruleSpaces ? rule.split('').join(space$p) : rule + return options.ruleSpaces ? rule.split('').join(space$n) : rule } var strong_1$1 = strong$2; @@ -40004,8 +42582,8 @@ function strong$2(node) { var emphasis_1$1 = emphasis$2; -var underscore$5 = '_'; -var asterisk$5 = '*'; +var underscore$8 = '_'; +var asterisk$6 = '*'; // Stringify an `emphasis`. // @@ -40030,10 +42608,10 @@ function emphasis$2(node) { // are underscores in the content. if ( this.options.pedantic && - marker === underscore$5 && + marker === underscore$8 && content.indexOf(marker) !== -1 ) { - marker = asterisk$5; + marker = asterisk$6; } return marker + content + marker @@ -40041,12 +42619,12 @@ function emphasis$2(node) { var _break$2 = lineBreak; -var backslash$b = '\\'; -var lineFeed$v = '\n'; -var space$q = ' '; +var backslash$a = '\\'; +var lineFeed$t = '\n'; +var space$o = ' '; -var commonmark$1 = backslash$b + lineFeed$v; -var normal = space$q + space$q + lineFeed$v; +var commonmark$1 = backslash$a + lineFeed$t; +var normal = space$o + space$o + lineFeed$t; function lineBreak() { return this.options.commonmark ? commonmark$1 : normal @@ -40054,39 +42632,17 @@ function lineBreak() { var _delete$2 = strikethrough$1; -var tilde$6 = '~'; +var tilde$7 = '~'; -var fence$1 = tilde$6 + tilde$6; +var fence$1 = tilde$7 + tilde$7; function strikethrough$1(node) { return fence$1 + this.all(node).join('') + fence$1 } -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 leftParenthesis$4 = '('; +var leftParenthesis$3 = '('; var rightParenthesis$5 = ')'; var lessThan$8 = '<'; var greaterThan$6 = '>'; @@ -40106,7 +42662,7 @@ function enclose(uri, always) { always || uri.length === 0 || expression.test(uri) || - ccount_1(uri, leftParenthesis$4) !== ccount_1(uri, rightParenthesis$5) + ccount_1(uri, leftParenthesis$3) !== ccount_1(uri, rightParenthesis$5) ) { return lessThan$8 + uri + greaterThan$6 } @@ -40116,8 +42672,8 @@ function enclose(uri, always) { var encloseTitle = enclose$1; -var quotationMark$3 = '"'; -var apostrophe$3 = "'"; +var quotationMark$2 = '"'; +var apostrophe$2 = "'"; // There is currently no way to support nested delimiters across Markdown.pl, // CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl @@ -40126,16 +42682,16 @@ var apostrophe$3 = "'"; // title. function enclose$1(title) { var delimiter = - title.indexOf(quotationMark$3) === -1 ? quotationMark$3 : apostrophe$3; + title.indexOf(quotationMark$2) === -1 ? quotationMark$2 : apostrophe$2; return delimiter + title + delimiter } -var link_1$1 = link$4; +var link_1$1 = link$5; -var space$r = ' '; -var leftSquareBracket$7 = '['; -var rightSquareBracket$7 = ']'; -var leftParenthesis$5 = '('; +var space$p = ' '; +var leftSquareBracket$5 = '['; +var rightSquareBracket$5 = ']'; +var leftParenthesis$4 = '('; var rightParenthesis$6 = ')'; // Expression for a protocol: @@ -40161,7 +42717,7 @@ var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; // // Supports named entities in the `url` and `title` when in `settings.encode` // mode. -function link$4(node) { +function link$5(node) { var self = this; var content = self.encode(node.url || '', node); var exit = self.enterLink(); @@ -40178,14 +42734,14 @@ function link$4(node) { content = encloseUri(content); if (node.title) { - content += space$r + encloseTitle(self.encode(self.escape(node.title, node), node)); + content += space$p + encloseTitle(self.encode(self.escape(node.title, node), node)); } return ( - leftSquareBracket$7 + + leftSquareBracket$5 + value + - rightSquareBracket$7 + - leftParenthesis$5 + + rightSquareBracket$5 + + leftParenthesis$4 + content + rightParenthesis$6 ) @@ -40193,7 +42749,7 @@ function link$4(node) { var copyIdentifierEncoding = copy$4; -var ampersand$3 = '&'; +var ampersand$4 = '&'; var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; @@ -40237,7 +42793,7 @@ function copy$4(value, identifier) { position < count && punctuationExppresion.test(identifier.charAt(position)) ) { - if (identifier.charAt(position) === ampersand$3) { + if (identifier.charAt(position) === ampersand$4) { position += entityPrefixLength(identifier.slice(position)); } @@ -40257,8 +42813,8 @@ function copy$4(value, identifier) { var label_1 = label; -var leftSquareBracket$8 = '['; -var rightSquareBracket$8 = ']'; +var leftSquareBracket$6 = '['; +var rightSquareBracket$6 = ']'; var shortcut$2 = 'shortcut'; var collapsed$1 = 'collapsed'; @@ -40275,16 +42831,16 @@ function label(node) { } return ( - leftSquareBracket$8 + + leftSquareBracket$6 + (type === collapsed$1 ? '' : node.label || node.identifier) + - rightSquareBracket$8 + rightSquareBracket$6 ) } var linkReference_1 = linkReference; -var leftSquareBracket$9 = '['; -var rightSquareBracket$9 = ']'; +var leftSquareBracket$7 = '['; +var rightSquareBracket$7 = ']'; var shortcut$3 = 'shortcut'; var collapsed$2 = 'collapsed'; @@ -40301,31 +42857,31 @@ function linkReference(node) { value = copyIdentifierEncoding(value, node.label || node.identifier); } - return leftSquareBracket$9 + value + rightSquareBracket$9 + label_1(node) + return leftSquareBracket$7 + value + rightSquareBracket$7 + label_1(node) } var imageReference_1 = imageReference; -var leftSquareBracket$a = '['; -var rightSquareBracket$a = ']'; -var exclamationMark$5 = '!'; +var leftSquareBracket$8 = '['; +var rightSquareBracket$8 = ']'; +var exclamationMark$6 = '!'; function imageReference(node) { return ( - exclamationMark$5 + - leftSquareBracket$a + + exclamationMark$6 + + leftSquareBracket$8 + (this.encode(node.alt, node) || '') + - rightSquareBracket$a + + rightSquareBracket$8 + label_1(node) ) } var definition_1$1 = definition$1; -var space$s = ' '; -var colon$6 = ':'; -var leftSquareBracket$b = '['; -var rightSquareBracket$b = ']'; +var space$q = ' '; +var colon$5 = ':'; +var leftSquareBracket$9 = '['; +var rightSquareBracket$9 = ']'; // Stringify an URL definition. // @@ -40339,27 +42895,27 @@ function definition$1(node) { var content = encloseUri(node.url); if (node.title) { - content += space$s + encloseTitle(node.title); + content += space$q + encloseTitle(node.title); } return ( - leftSquareBracket$b + + leftSquareBracket$9 + (node.label || node.identifier) + - rightSquareBracket$b + - colon$6 + - space$s + + rightSquareBracket$9 + + colon$5 + + space$q + content ) } var image_1 = image$3; -var space$t = ' '; -var leftParenthesis$6 = '('; +var space$r = ' '; +var leftParenthesis$5 = '('; var rightParenthesis$7 = ')'; -var leftSquareBracket$c = '['; -var rightSquareBracket$c = ']'; -var exclamationMark$6 = '!'; +var leftSquareBracket$a = '['; +var rightSquareBracket$a = ']'; +var exclamationMark$7 = '!'; // Stringify an image. // @@ -40381,341 +42937,281 @@ function image$3(node) { exit(); if (node.title) { - content += space$t + encloseTitle(self.encode(node.title, node)); + content += space$r + encloseTitle(self.encode(node.title, node)); } return ( - exclamationMark$6 + - leftSquareBracket$c + + exclamationMark$7 + + leftSquareBracket$a + alt + - rightSquareBracket$c + - leftParenthesis$6 + + rightSquareBracket$a + + leftParenthesis$5 + content + rightParenthesis$7 ) } -var footnote_1 = footnote$1; - -var leftSquareBracket$d = '['; -var rightSquareBracket$d = ']'; -var caret$3 = '^'; - -function footnote$1(node) { - return ( - leftSquareBracket$d + caret$3 + this.all(node).join('') + rightSquareBracket$d - ) -} - -var footnoteReference_1 = footnoteReference; - -var leftSquareBracket$e = '['; -var rightSquareBracket$e = ']'; -var caret$4 = '^'; - -function footnoteReference(node) { - return ( - leftSquareBracket$e + - caret$4 + - (node.label || node.identifier) + - rightSquareBracket$e - ) -} - -var lineFeed$w = '\n'; -var space$u = ' '; -var colon$7 = ':'; -var leftSquareBracket$f = '['; -var rightSquareBracket$f = ']'; -var caret$5 = '^'; - -var tabSize$7 = 4; -var blank$5 = lineFeed$w + lineFeed$w; -var indent = repeatString(space$u, tabSize$7); - -var footnoteDefinition_1$1 = footnoteDefinition$1; - -function footnoteDefinition$1(node) { - var content = this.all(node).join(blank$5 + indent); - - return ( - leftSquareBracket$f + - caret$5 + - (node.label || node.identifier) + - rightSquareBracket$f + - colon$7 + - space$u + - content - ) -} - var markdownTable_1 = markdownTable; -var dotRe = /\./; -var lastDotRe = /\.[^.]*$/; +var trailingWhitespace = / +$/; // Characters. -var space$v = ' '; -var lineFeed$x = '\n'; -var dash$7 = '-'; -var dot$5 = '.'; -var colon$8 = ':'; -var lowercaseC = 'c'; -var lowercaseL = 'l'; -var lowercaseR = 'r'; +var space$s = ' '; +var lineFeed$u = '\n'; +var dash$a = '-'; +var colon$6 = ':'; var verticalBar$2 = '|'; -var minCellSize = 3; +var x = 0; +var C = 67; +var L$1 = 76; +var R = 82; +var c$1 = 99; +var l$1 = 108; +var r = 114; // 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 padding = settings.padding !== false; + var start = settings.delimiterStart !== false; + var end = settings.delimiterEnd !== false; + var align = (settings.align || []).concat(); + var alignDelimiters = settings.alignDelimiters !== false; + var alignments = []; + var stringLength = settings.stringLength || defaultStringLength; var rowIndex = -1; var rowLength = table.length; + var cellMatrix = []; + var sizeMatrix = []; + var row = []; var sizes = []; - var align; - var rule; - var rows; - var row; + var longestCellByColumn = []; + var mostCellsPerRow = 0; var cells; - var index; - var position; + var columnIndex; + var columnLength; + var largest; var size; - var value; - var spacing; + var cell; + var lines; + var line; var before; var after; + var code; - alignment = alignment ? alignment.concat() : []; - - if (delimiter === null || delimiter === undefined) { - delimiter = space$v + verticalBar$2 + space$v; - } - - if (start === null || start === undefined) { - start = verticalBar$2 + space$v; - } - - if (end === null || end === undefined) { - end = space$v + verticalBar$2; - } - + // This is a superfluous loop if we don’t align delimiters, but otherwise we’d + // do superfluous work when aligning, so optimize for aligning. while (++rowIndex < rowLength) { - row = table[rowIndex]; + cells = table[rowIndex]; + columnIndex = -1; + columnLength = cells.length; + row = []; + sizes = []; - index = -1; - - if (row.length > cellCount) { - cellCount = row.length; + if (columnLength > mostCellsPerRow) { + mostCellsPerRow = columnLength; } - while (++index < cellCount) { - position = row[index] ? dotindex$1(row[index]) : null; - - if (!sizes[index]) { - sizes[index] = minCellSize; - } + while (++columnIndex < columnLength) { + cell = serialize(cells[columnIndex]); - if (position > sizes[index]) { - sizes[index] = position; - } - } - } + if (alignDelimiters === true) { + size = stringLength(cell); + sizes[columnIndex] = size; - if (typeof alignment === 'string') { - alignment = pad$2(cellCount, alignment).split(''); - } + largest = longestCellByColumn[columnIndex]; - // Make sure only valid alignments are used. - index = -1; - - while (++index < cellCount) { - align = alignment[index]; + if (largest === undefined || size > largest) { + longestCellByColumn[columnIndex] = size; + } + } - if (typeof align === 'string') { - align = align.charAt(0).toLowerCase(); + row.push(cell); } - if ( - align !== lowercaseL && - align !== lowercaseR && - align !== lowercaseC && - align !== dot$5 - ) { - align = ''; - } - - alignment[index] = align; + cellMatrix[rowIndex] = row; + sizeMatrix[rowIndex] = sizes; } - 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$5) { - position = dotindex$1(value); - - size = - sizes[index] + - (dotRe.test(value) ? 0 : 1) - - (calculateStringLength(value) - position); + // Figure out which alignments to use. + columnIndex = -1; + columnLength = mostCellsPerRow; - cells[index] = value + pad$2(size - 1); - } else { - cells[index] = value; - } + if (typeof align === 'object' && 'length' in align) { + while (++columnIndex < columnLength) { + alignments[columnIndex] = toAlignment(align[columnIndex]); } + } else { + code = toAlignment(align); - rows[rowIndex] = cells; + while (++columnIndex < columnLength) { + alignments[columnIndex] = code; + } } + // Inject the alignment row. + columnIndex = -1; + columnLength = mostCellsPerRow; + row = []; sizes = []; - rowIndex = -1; - while (++rowIndex < rowLength) { - cells = rows[rowIndex]; + while (++columnIndex < columnLength) { + code = alignments[columnIndex]; + before = ''; + after = ''; + + if (code === l$1) { + before = colon$6; + } else if (code === r) { + after = colon$6; + } else if (code === c$1) { + before = colon$6; + after = colon$6; + } + + // There *must* be at least one hyphen-minus in each alignment cell. + size = alignDelimiters + ? Math.max( + 1, + longestCellByColumn[columnIndex] - before.length - after.length + ) + : 1; - index = -1; + cell = before + repeatString(dash$a, size) + after; - while (++index < cellCount) { - value = cells[index]; + if (alignDelimiters === true) { + size = before.length + size + after.length; - if (!sizes[index]) { - sizes[index] = minCellSize; + if (size > longestCellByColumn[columnIndex]) { + longestCellByColumn[columnIndex] = size; } - size = calculateStringLength(value); - - if (size > sizes[index]) { - sizes[index] = size; - } + sizes[columnIndex] = size; } + + row[columnIndex] = cell; } + // Inject the alignment row. + cellMatrix.splice(1, 0, row); + sizeMatrix.splice(1, 0, sizes); + rowIndex = -1; + rowLength = cellMatrix.length; + lines = []; 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] === lowercaseR || alignment[index] === dot$5) { - value = spacing + value; - } else if (alignment[index] === lowercaseC) { - position /= 2; + row = cellMatrix[rowIndex]; + sizes = sizeMatrix[rowIndex]; + columnIndex = -1; + columnLength = mostCellsPerRow; + line = []; - if (position % 1 === 0) { - before = position; - after = position; + while (++columnIndex < columnLength) { + cell = row[columnIndex] || ''; + before = ''; + after = ''; + + if (alignDelimiters === true) { + size = longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0); + code = alignments[columnIndex]; + + if (code === r) { + before = repeatString(space$s, size); + } else if (code === c$1) { + if (size % 2 === 0) { + before = repeatString(space$s, size / 2); + after = before; } else { - before = position + 0.5; - after = position - 0.5; + before = repeatString(space$s, size / 2 + 0.5); + after = repeatString(space$s, size / 2 - 0.5); } - - value = pad$2(before) + value + pad$2(after); } else { - value += spacing; + after = repeatString(space$s, size); } + } - cells[index] = value; + if (start === true && columnIndex === 0) { + line.push(verticalBar$2); } - } - rows[rowIndex] = cells.join(delimiter); - } + if ( + padding === true && + // Don’t add the opening space if we’re not aligning and the cell is + // empty: there will be a closing space. + !(alignDelimiters === false && cell === '') && + (start === true || columnIndex !== 0) + ) { + line.push(space$s); + } - 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 > minCellSize ? spacing : minCellSize; - } else { - spacing = sizes[index]; + if (alignDelimiters === true) { + line.push(before); } - align = alignment[index]; + line.push(cell); - // When `align` is left, don't add colons. - value = align === lowercaseR || align === '' ? dash$7 : colon$8; - value += pad$2(spacing - 2, dash$7); - value += align !== lowercaseL && align !== '' ? colon$8 : dash$7; + if (alignDelimiters === true) { + line.push(after); + } + + if (padding === true) { + line.push(space$s); + } - rule[index] = value; + if (end === true || columnIndex !== columnLength - 1) { + line.push(verticalBar$2); + } } - rows.splice(1, 0, rule.join(delimiter)); + line = line.join(''); + + if (end === false) { + line = line.replace(trailingWhitespace, ''); + } + + lines.push(line); } - return start + rows.join(end + lineFeed$x + start) + end + return lines.join(lineFeed$u) } -function stringify$6(value) { +function serialize(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$v) +function defaultStringLength(value) { + return value.length } -// Get the position of the last dot in `value`. -function dotindex$1(value) { - var match = lastDotRe.exec(value); +function toAlignment(value) { + var code = typeof value === 'string' ? value.charCodeAt(0) : x; - return match ? match.index + 1 : value.length + return code === L$1 || code === l$1 + ? l$1 + : code === R || code === r + ? r + : code === C || code === c$1 + ? c$1 + : x } var table_1$1 = table$1; -var space$w = ' '; -var verticalBar$3 = '|'; - // Stringify table. // -// Creates a fenced table by default, but not in `looseTable: true` mode: +// Creates a fenced table. +// The table has aligned delimiters by default, but not in +// `tablePipeAlign: false`: // // ```markdown -// Foo | Bar -// :-: | --- -// Baz | Qux -// -// NOTE: Be careful with `looseTable: true` mode, as a loose table inside an -// indented code block on GitHub renders as an actual table! +// | Header 1 | Header 2 | +// | :-: | - | +// | Alpha | Bravo | +// ``` // -// Creates a spaced table by default, but not in `spacedTable: false`: +// The table is spaced by default, but not in `tableCellPadding: false`: // // ```markdown // |Foo|Bar| @@ -40725,16 +43221,13 @@ var verticalBar$3 = '|'; function table$1(node) { var self = this; var options = self.options; - var loose = options.looseTable; - var spaced = options.spacedTable; - var pad = options.paddedTable; + var padding = options.tableCellPadding; + var alignDelimiters = options.tablePipeAlign; 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]); @@ -40742,35 +43235,20 @@ function table$1(node) { exit(); - if (loose) { - start = ''; - end = ''; - } else if (spaced) { - start = verticalBar$3 + space$w; - end = space$w + verticalBar$3; - } else { - start = verticalBar$3; - end = verticalBar$3; - } - return markdownTable_1(result, { align: node.align, - pad: pad, - start: start, - end: end, - stringLength: stringLength, - delimiter: spaced ? space$w + verticalBar$3 + space$w : verticalBar$3 + alignDelimiters: alignDelimiters, + padding: padding, + stringLength: stringLength }) } var tableCell_1 = tableCell; -var lineFeed$y = /\r?\n/g; +var lineFeed$v = /\r?\n/g; function tableCell(node) { - return this.all(node) - .join('') - .replace(lineFeed$y, ' ') + return this.all(node).join('').replace(lineFeed$v, ' ') } var compiler = Compiler; @@ -40785,26 +43263,26 @@ function Compiler(tree, file) { this.setOptions({}); } -var proto$4 = Compiler.prototype; +var proto$5 = Compiler.prototype; // Enter and exit helpers. */ -proto$4.enterLink = stateToggle('inLink', false); -proto$4.enterTable = stateToggle('inTable', false); -proto$4.enterLinkReference = enterLinkReference; +proto$5.enterLink = stateToggle('inLink', false); +proto$5.enterTable = stateToggle('inTable', false); +proto$5.enterLinkReference = enterLinkReference; // Configuration. -proto$4.options = defaults$3; -proto$4.setOptions = setOptions_1$1; +proto$5.options = defaults$3; +proto$5.setOptions = setOptions_1$1; -proto$4.compile = compile_1$1; -proto$4.visit = one_1; -proto$4.all = all_1; -proto$4.block = block_1; -proto$4.visitOrderedItems = orderedItems_1; -proto$4.visitUnorderedItems = unorderedItems_1; +proto$5.compile = compile_1$1; +proto$5.visit = one_1; +proto$5.all = all_1; +proto$5.block = block_1; +proto$5.visitOrderedItems = orderedItems_1; +proto$5.visitUnorderedItems = unorderedItems_1; // Expose visitors. -proto$4.visitors = { +proto$5.visitors = { root: root_1, text: text_1$1, heading: heading_1, @@ -40825,17 +43303,14 @@ proto$4.visitors = { imageReference: imageReference_1, definition: definition_1$1, image: image_1, - footnote: footnote_1, - footnoteReference: footnoteReference_1, - footnoteDefinition: footnoteDefinition_1$1, table: table_1$1, tableCell: tableCell_1 }; -var remarkStringify = stringify$7; -stringify$7.Compiler = compiler; +var remarkStringify = stringify$6; +stringify$6.Compiler = compiler; -function stringify$7(options) { +function stringify$6(options) { var Local = unherit_1(compiler); Local.prototype.options = immutable( Local.prototype.options, @@ -40845,15 +43320,65 @@ function stringify$7(options) { this.Compiler = Local; } -var remark = unified_1() - .use(remarkParse) - .use(remarkStringify) - .freeze(); - -const name$1 = "remark"; -const version$1 = "11.0.2"; -const description = "Markdown processor powered by plugins"; -const license = "MIT"; +var remark = unified_1().use(remarkParse).use(remarkStringify).freeze(); + +const _from = "remark@latest"; +const _id = "remark@12.0.0"; +const _inBundle = false; +const _integrity = "sha512-oX4lMIS0csgk8AEbzY0h2jdR0ngiCHOpwwpxjmRa5TqAkeknY+tkhjRJGZqnCmvyuWh55/0SW5WY3R3nn3PH9A=="; +const _location = "/remark"; +const _phantomChildren = { +}; +const _requested = { + type: "tag", + registry: true, + raw: "remark@latest", + name: "remark", + escapedName: "remark", + rawSpec: "latest", + saveSpec: null, + fetchSpec: "latest" +}; +const _requiredBy = [ + "#USER", + "/" +]; +const _resolved = "https://registry.npmjs.org/remark/-/remark-12.0.0.tgz"; +const _shasum = "d1c145c07341c9232f93b2f8539d56da15a2548c"; +const _spec = "remark@latest"; +const _where = "/Users/trott/io.js/tools/node-lint-md-cli-rollup"; +const author = { + name: "Titus Wormer", + email: "tituswormer@gmail.com", + url: "https://wooorm.com" +}; +const bugs = { + url: "https://github.com/remarkjs/remark/issues" +}; +const bundleDependencies = false; +const contributors = [ + { + name: "Titus Wormer", + email: "tituswormer@gmail.com", + url: "https://wooorm.com" + } +]; +const dependencies = { + "remark-parse": "^8.0.0", + "remark-stringify": "^8.0.0", + unified: "^9.0.0" +}; +const deprecated$1 = false; +const description = "Markdown processor powered by plugins part of the unified collective"; +const files = [ + "index.js", + "types/index.d.ts" +]; +const funding = { + type: "opencollective", + url: "https://opencollective.com/unified" +}; +const homepage = "https://remark.js.org"; const keywords = [ "unified", "remark", @@ -40865,79 +43390,87 @@ const keywords = [ "ast", "parse", "stringify", + "serialize", + "compile", "process" ]; -const homepage = "https://remark.js.org"; -const repository = "https://github.com/remarkjs/remark/tree/master/packages/remark"; -const bugs = "https://github.com/remarkjs/remark/issues"; -const funding = { - type: "opencollective", - url: "https://opencollective.com/unified" -}; -const author = "Titus Wormer (https://wooorm.com)"; -const contributors = [ - "Titus Wormer (https://wooorm.com)" -]; -const files = [ - "index.js", - "types/index.d.ts" -]; -const types = "types/index.d.ts"; -const dependencies = { - "remark-parse": "^7.0.0", - "remark-stringify": "^7.0.0", - unified: "^8.2.0" +const license = "MIT"; +const name$1 = "remark"; +const repository = { + type: "git", + url: "https://github.com/remarkjs/remark/tree/master/packages/remark" }; const scripts = { test: "tape test.js" }; +const types = "types/index.d.ts"; +const version$1 = "12.0.0"; const xo = false; -const _resolved = "https://registry.npmjs.org/remark/-/remark-11.0.2.tgz"; -const _integrity = "sha512-bh+eJgn8wgmbHmIBOuwJFdTVRVpl3fcVP6HxmpPWO0ULGP9Qkh6INJh0N5Uy7GqlV7DQYGoqaKiEIpM5LLvJ8w=="; -const _from = "remark@11.0.2"; var _package = { - name: name$1, - version: version$1, - description: description, - license: license, - keywords: keywords, - homepage: homepage, - repository: repository, - bugs: bugs, - funding: funding, + _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, - files: files, - types: types, dependencies: dependencies, + deprecated: deprecated$1, + description: description, + files: files, + funding: funding, + homepage: homepage, + keywords: keywords, + license: license, + name: name$1, + repository: repository, scripts: scripts, - xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from + types: types, + version: version$1, + xo: xo }; var _package$1 = /*#__PURE__*/Object.freeze({ __proto__: null, - name: name$1, - version: version$1, - description: description, - license: license, - keywords: keywords, - homepage: homepage, - repository: repository, - bugs: bugs, - funding: funding, + _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, - files: files, - types: types, dependencies: dependencies, + deprecated: deprecated$1, + description: description, + files: files, + funding: funding, + homepage: homepage, + keywords: keywords, + license: license, + name: name$1, + repository: repository, scripts: scripts, + types: types, + version: version$1, xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from, 'default': _package }); @@ -40953,10 +43486,10 @@ const devDependencies = { }; const dependencies$1 = { "markdown-extensions": "^1.1.1", - remark: "^11.0.2", - "remark-lint": "^6.0.5", + remark: "^12.0.0", + "remark-lint": "^7.0.0", "remark-preset-lint-node": "^1.15.0", - "unified-args": "^7.1.0" + "unified-args": "^8.0.0" }; const main = "dist/index.js"; const scripts$1 = { @@ -41058,9 +43591,9 @@ function indices$1(value) { return result } -var convert_1$1 = convert$2; +var convert_1$1 = convert$4; -function convert$2(test) { +function convert$4(test) { if (typeof test === 'string') { return typeFactory$1(test) } @@ -41086,7 +43619,7 @@ function convertAll$1(tests) { var index = -1; while (++index < length) { - results[index] = convert$2(tests[index]); + results[index] = convert$4(tests[index]); } return results @@ -41712,9 +44245,9 @@ function indices$2(value) { return result } -var convert_1$2 = convert$3; +var convert_1$2 = convert$5; -function convert$3(test) { +function convert$5(test) { if (typeof test === 'string') { return typeFactory$2(test) } @@ -41740,7 +44273,7 @@ function convertAll$2(tests) { var index = -1; while (++index < length) { - results[index] = convert$3(tests[index]); + results[index] = convert$5(tests[index]); } return results @@ -42385,7 +44918,7 @@ function toThunk(obj, ctx) { return obj; } - if (isObject$4(obj) || Array.isArray(obj)) { + if (isObject$3(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); } @@ -42519,7 +45052,7 @@ function isGeneratorFunction(obj) { * @api private */ -function isObject$4(val) { +function isObject$3(val) { return val && Object == val.constructor; } @@ -42595,7 +45128,7 @@ function wrapped(fn) { } // sync - return sync$2(fn, done).apply(ctx, args); + return sync$5(fn, done).apply(ctx, args); } return wrap; @@ -42610,7 +45143,7 @@ function wrapped(fn) { * @api private */ -function sync$2(fn, done) { +function sync$5(fn, done) { return function () { var ret; @@ -43280,9 +45813,9 @@ var pluralize = createCommonjsModule(function (module, exports) { }); }); -var convert_1$3 = convert$4; +var convert_1$3 = convert$6; -function convert$4(test) { +function convert$6(test) { if (typeof test === 'string') { return typeFactory$3(test) } @@ -43308,7 +45841,7 @@ function convertAll$3(tests) { var index = -1; while (++index < length) { - results[index] = convert$4(tests[index]); + results[index] = convert$6(tests[index]); } return results @@ -43555,9 +46088,9 @@ function listItemBulletIndent(tree, file) { } } -var convert_1$4 = convert$5; +var convert_1$4 = convert$7; -function convert$5(test) { +function convert$7(test) { if (typeof test === 'string') { return typeFactory$4(test) } @@ -43583,7 +46116,7 @@ function convertAll$4(tests) { var index = -1; while (++index < length) { - results[index] = convert$5(tests[index]); + results[index] = convert$7(tests[index]); } return results @@ -43750,13 +46283,13 @@ var remarkLintListItemIndent = unifiedLintRule('remark-lint:list-item-indent', l var start$3 = unistUtilPosition.start; -var styles = {'tab-size': true, mixed: true, space: true}; +var styles$1 = {'tab-size': true, mixed: true, space: true}; function listItemIndent(tree, file, option) { var contents = String(file); var preferred = typeof option === 'string' ? option : 'tab-size'; - if (styles[preferred] !== true) { + if (styles$1[preferred] !== true) { file.fail( 'Incorrect list-item indent style `' + preferred + @@ -43812,9 +46345,9 @@ function listItemIndent(tree, file, option) { } } -var convert_1$5 = convert$6; +var convert_1$5 = convert$8; -function convert$6(test) { +function convert$8(test) { if (typeof test === 'string') { return typeFactory$5(test) } @@ -43840,7 +46373,7 @@ function convertAll$5(tests) { var index = -1; while (++index < length) { - results[index] = convert$6(tests[index]); + results[index] = convert$8(tests[index]); } return results @@ -44003,12 +46536,12 @@ function visit$5(tree, test, visitor, reverse) { } } -var mdastUtilToString = toString$4; +var mdastUtilToString = toString$3; // Get the text content of a node. // Prefer the node’s plain-text fields, otherwise serialize its children, // and if the given value is an array, serialize the nodes in it. -function toString$4(node) { +function toString$3(node) { return ( (node && (node.value || @@ -44026,7 +46559,7 @@ function all$1(values) { var index = -1; while (++index < length) { - result[index] = toString$4(values[index]); + result[index] = toString$3(values[index]); } return result.join('') @@ -44139,9 +46672,9 @@ function indices$3(value) { return result } -var convert_1$6 = convert$7; +var convert_1$6 = convert$9; -function convert$7(test) { +function convert$9(test) { if (typeof test === 'string') { return typeFactory$6(test) } @@ -44167,7 +46700,7 @@ function convertAll$6(tests) { var index = -1; while (++index < length) { - results[index] = convert$7(tests[index]); + results[index] = convert$9(tests[index]); } return results @@ -44384,9 +46917,9 @@ function noBlockquoteWithoutMarker(tree, file) { } } -var convert_1$7 = convert$8; +var convert_1$7 = convert$a; -function convert$8(test) { +function convert$a(test) { if (typeof test === 'string') { return typeFactory$7(test) } @@ -44412,7 +46945,7 @@ function convertAll$7(tests) { var index = -1; while (++index < length) { - results[index] = convert$8(tests[index]); + results[index] = convert$a(tests[index]); } return results @@ -44579,7 +47112,7 @@ var remarkLintNoLiteralUrls = unifiedLintRule('remark-lint:no-literal-urls', noL var start$5 = unistUtilPosition.start; var end$2 = unistUtilPosition.end; -var mailto$3 = 'mailto:'; +var mailto$2 = 'mailto:'; var reason$2 = 'Don’t use literal URLs without angle brackets'; function noLiteralURLs(tree, file) { @@ -44593,16 +47126,16 @@ function noLiteralURLs(tree, file) { !unistUtilGenerated(node) && start$5(node).column === start$5(children[0]).column && end$2(node).column === end$2(children[children.length - 1]).column && - (node.url === mailto$3 + value || node.url === value) + (node.url === mailto$2 + value || node.url === value) ) { file.message(reason$2, node); } } } -var convert_1$8 = convert$9; +var convert_1$8 = convert$b; -function convert$9(test) { +function convert$b(test) { if (typeof test === 'string') { return typeFactory$8(test) } @@ -44628,7 +47161,7 @@ function convertAll$8(tests) { var index = -1; while (++index < length) { - results[index] = convert$9(tests[index]); + results[index] = convert$b(tests[index]); } return results @@ -44798,7 +47331,7 @@ var remarkLintOrderedListMarkerStyle = unifiedLintRule( var start$6 = unistUtilPosition.start; -var styles$1 = { +var styles$2 = { ')': true, '.': true, null: true @@ -44809,7 +47342,7 @@ function orderedListMarkerStyle(tree, file, option) { var preferred = typeof option !== 'string' || option === 'consistent' ? null : option; - if (styles$1[preferred] !== true) { + if (styles$2[preferred] !== true) { file.fail( 'Incorrect ordered list item marker style `' + preferred + @@ -44847,9 +47380,9 @@ function orderedListMarkerStyle(tree, file, option) { } } -var convert_1$9 = convert$a; +var convert_1$9 = convert$c; -function convert$a(test) { +function convert$c(test) { if (typeof test === 'string') { return typeFactory$9(test) } @@ -44875,7 +47408,7 @@ function convertAll$9(tests) { var index = -1; while (++index < length) { - results[index] = convert$a(tests[index]); + results[index] = convert$c(tests[index]); } return results @@ -45063,9 +47596,9 @@ function hardBreakSpaces(tree, file) { } } -var convert_1$a = convert$b; +var convert_1$a = convert$d; -function convert$b(test) { +function convert$d(test) { if (typeof test === 'string') { return typeFactory$a(test) } @@ -45091,7 +47624,7 @@ function convertAll$a(tests) { var index = -1; while (++index < length) { - results[index] = convert$b(tests[index]); + results[index] = convert$d(tests[index]); } return results @@ -45286,9 +47819,9 @@ function noDuplicateDefinitions(tree, file) { } } -var convert_1$b = convert$c; +var convert_1$b = convert$e; -function convert$c(test) { +function convert$e(test) { if (typeof test === 'string') { return typeFactory$b(test) } @@ -45314,7 +47847,7 @@ function convertAll$b(tests) { var index = -1; while (++index < length) { - results[index] = convert$c(tests[index]); + results[index] = convert$e(tests[index]); } return results @@ -45613,9 +48146,9 @@ function noHeadingContentIndent(tree, file) { } } -var convert_1$c = convert$d; +var convert_1$c = convert$f; -function convert$d(test) { +function convert$f(test) { if (typeof test === 'string') { return typeFactory$c(test) } @@ -45641,7 +48174,7 @@ function convertAll$c(tests) { var index = -1; while (++index < length) { - results[index] = convert$d(tests[index]); + results[index] = convert$f(tests[index]); } return results @@ -45825,9 +48358,9 @@ function noInlinePadding(tree, file) { } } -var convert_1$d = convert$e; +var convert_1$d = convert$g; -function convert$e(test) { +function convert$g(test) { if (typeof test === 'string') { return typeFactory$d(test) } @@ -45853,7 +48386,7 @@ function convertAll$d(tests) { var index = -1; while (++index < length) { - results[index] = convert$e(tests[index]); + results[index] = convert$g(tests[index]); } return results @@ -46033,9 +48566,9 @@ function noShortcutReferenceImage(tree, file) { } } -var convert_1$e = convert$f; +var convert_1$e = convert$h; -function convert$f(test) { +function convert$h(test) { if (typeof test === 'string') { return typeFactory$e(test) } @@ -46061,7 +48594,7 @@ function convertAll$e(tests) { var index = -1; while (++index < length) { - results[index] = convert$f(tests[index]); + results[index] = convert$h(tests[index]); } return results @@ -46241,9 +48774,9 @@ function noShortcutReferenceLink(tree, file) { } } -var convert_1$f = convert$g; +var convert_1$f = convert$i; -function convert$g(test) { +function convert$i(test) { if (typeof test === 'string') { return typeFactory$f(test) } @@ -46269,7 +48802,7 @@ function convertAll$f(tests) { var index = -1; while (++index < length) { - results[index] = convert$g(tests[index]); + results[index] = convert$i(tests[index]); } return results @@ -46471,9 +49004,9 @@ function noUndefinedReferences(tree, file, option) { } } -var convert_1$g = convert$h; +var convert_1$g = convert$j; -function convert$h(test) { +function convert$j(test) { if (typeof test === 'string') { return typeFactory$g(test) } @@ -46499,7 +49032,7 @@ function convertAll$g(tests) { var index = -1; while (++index < length) { - results[index] = convert$h(tests[index]); + results[index] = convert$j(tests[index]); } return results @@ -46724,9 +49257,9 @@ var remarkPresetLintRecommended = { plugins: plugins$1 }; -var convert_1$h = convert$i; +var convert_1$h = convert$k; -function convert$i(test) { +function convert$k(test) { if (typeof test === 'string') { return typeFactory$h(test) } @@ -46752,7 +49285,7 @@ function convertAll$h(tests) { var index = -1; while (++index < length) { - results[index] = convert$i(tests[index]); + results[index] = convert$k(tests[index]); } return results @@ -47040,9 +49573,9 @@ function indices$4(value) { return result } -var convert_1$i = convert$j; +var convert_1$i = convert$l; -function convert$j(test) { +function convert$l(test) { if (typeof test === 'string') { return typeFactory$i(test) } @@ -47068,7 +49601,7 @@ function convertAll$i(tests) { var index = -1; while (++index < length) { - results[index] = convert$j(tests[index]); + results[index] = convert$l(tests[index]); } return results @@ -47385,9 +49918,9 @@ function indices$5(value) { return result } -var convert_1$j = convert$k; +var convert_1$j = convert$m; -function convert$k(test) { +function convert$m(test) { if (typeof test === 'string') { return typeFactory$j(test) } @@ -47413,7 +49946,7 @@ function convertAll$j(tests) { var index = -1; while (++index < length) { - results[index] = convert$k(tests[index]); + results[index] = convert$m(tests[index]); } return results @@ -47624,9 +50157,9 @@ function checkboxContentIndent(tree, file) { } } -var convert_1$k = convert$l; +var convert_1$k = convert$n; -function convert$l(test) { +function convert$n(test) { if (typeof test === 'string') { return typeFactory$k(test) } @@ -47652,7 +50185,7 @@ function convertAll$k(tests) { var index = -1; while (++index < length) { - results[index] = convert$l(tests[index]); + results[index] = convert$n(tests[index]); } return results @@ -47820,14 +50353,14 @@ var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', c var start$a = unistUtilPosition.start; var end$6 = unistUtilPosition.end; -var styles$2 = {null: true, fenced: true, indented: true}; +var styles$3 = {null: true, fenced: true, indented: true}; function codeBlockStyle(tree, file, option) { var contents = String(file); var preferred = typeof option === 'string' && option !== 'consistent' ? option : null; - if (styles$2[preferred] !== true) { + if (styles$3[preferred] !== true) { file.fail( 'Incorrect code block style `' + preferred + @@ -47864,9 +50397,9 @@ function codeBlockStyle(tree, file, option) { } } -var convert_1$l = convert$m; +var convert_1$l = convert$o; -function convert$m(test) { +function convert$o(test) { if (typeof test === 'string') { return typeFactory$l(test) } @@ -47892,7 +50425,7 @@ function convertAll$l(tests) { var index = -1; while (++index < length) { - results[index] = convert$m(tests[index]); + results[index] = convert$o(tests[index]); } return results @@ -48078,9 +50611,9 @@ function definitionSpacing(tree, file) { } } -var convert_1$m = convert$n; +var convert_1$m = convert$p; -function convert$n(test) { +function convert$p(test) { if (typeof test === 'string') { return typeFactory$m(test) } @@ -48106,7 +50639,7 @@ function convertAll$m(tests) { var index = -1; while (++index < length) { - results[index] = convert$n(tests[index]); + results[index] = convert$p(tests[index]); } return results @@ -48314,9 +50847,9 @@ function fencedCodeFlag(tree, file, option) { } } -var convert_1$n = convert$o; +var convert_1$n = convert$q; -function convert$o(test) { +function convert$q(test) { if (typeof test === 'string') { return typeFactory$n(test) } @@ -48342,7 +50875,7 @@ function convertAll$n(tests) { var index = -1; while (++index < length) { - results[index] = convert$o(tests[index]); + results[index] = convert$q(tests[index]); } return results @@ -48569,9 +51102,9 @@ function fileExtension(tree, file, option) { } } -var convert_1$o = convert$p; +var convert_1$o = convert$r; -function convert$p(test) { +function convert$r(test) { if (typeof test === 'string') { return typeFactory$o(test) } @@ -48597,7 +51130,7 @@ function convertAll$o(tests) { var index = -1; while (++index < length) { - results[index] = convert$p(tests[index]); + results[index] = convert$r(tests[index]); } return results @@ -48792,9 +51325,9 @@ function finalDefinition(tree, file) { } } -var convert_1$p = convert$q; +var convert_1$p = convert$s; -function convert$q(test) { +function convert$s(test) { if (typeof test === 'string') { return typeFactory$p(test) } @@ -48820,7 +51353,7 @@ function convertAll$p(tests) { var index = -1; while (++index < length) { - results[index] = convert$q(tests[index]); + results[index] = convert$s(tests[index]); } return results @@ -49021,9 +51554,9 @@ function infer(node) { return results ? Number(results[1]) : undefined } -var convert_1$q = convert$r; +var convert_1$q = convert$t; -function convert$r(test) { +function convert$t(test) { if (typeof test === 'string') { return typeFactory$q(test) } @@ -49049,7 +51582,7 @@ function convertAll$q(tests) { var index = -1; while (++index < length) { - results[index] = convert$r(tests[index]); + results[index] = convert$t(tests[index]); } return results @@ -49234,9 +51767,9 @@ function headingStyle(tree, file, option) { } } -var convert_1$r = convert$s; +var convert_1$r = convert$u; -function convert$s(test) { +function convert$u(test) { if (typeof test === 'string') { return typeFactory$r(test) } @@ -49262,7 +51795,7 @@ function convertAll$r(tests) { var index = -1; while (++index < length) { - results[index] = convert$s(tests[index]); + results[index] = convert$u(tests[index]); } return results @@ -49503,9 +52036,9 @@ function maximumLineLength(tree, file, option) { } } -var convert_1$s = convert$t; +var convert_1$s = convert$v; -function convert$t(test) { +function convert$v(test) { if (typeof test === 'string') { return typeFactory$s(test) } @@ -49531,7 +52064,7 @@ function convertAll$s(tests) { var index = -1; while (++index < length) { - results[index] = convert$t(tests[index]); + results[index] = convert$v(tests[index]); } return results @@ -49801,9 +52334,9 @@ function noFileNameOuterDashes(tree, file) { } } -var convert_1$t = convert$u; +var convert_1$t = convert$w; -function convert$u(test) { +function convert$w(test) { if (typeof test === 'string') { return typeFactory$t(test) } @@ -49829,7 +52362,7 @@ function convertAll$t(tests) { var index = -1; while (++index < length) { - results[index] = convert$u(tests[index]); + results[index] = convert$w(tests[index]); } return results @@ -50039,9 +52572,9 @@ function noHeadingIndent(tree, file) { } } -var convert_1$u = convert$v; +var convert_1$u = convert$x; -function convert$v(test) { +function convert$x(test) { if (typeof test === 'string') { return typeFactory$u(test) } @@ -50067,7 +52600,7 @@ function convertAll$u(tests) { var index = -1; while (++index < length) { - results[index] = convert$v(tests[index]); + results[index] = convert$x(tests[index]); } return results @@ -50259,9 +52792,9 @@ function noMultipleToplevelHeadings(tree, file, option) { } } -var convert_1$v = convert$w; +var convert_1$v = convert$y; -function convert$w(test) { +function convert$y(test) { if (typeof test === 'string') { return typeFactory$v(test) } @@ -50287,7 +52820,7 @@ function convertAll$v(tests) { var index = -1; while (++index < length) { - results[index] = convert$w(tests[index]); + results[index] = convert$y(tests[index]); } return results @@ -50502,9 +53035,9 @@ function noShellDollars(tree, file) { } } -var convert_1$w = convert$x; +var convert_1$w = convert$z; -function convert$x(test) { +function convert$z(test) { if (typeof test === 'string') { return typeFactory$w(test) } @@ -50530,7 +53063,7 @@ function convertAll$w(tests) { var index = -1; while (++index < length) { - results[index] = convert$x(tests[index]); + results[index] = convert$z(tests[index]); } return results @@ -50845,9 +53378,9 @@ var escapeStringRegexp$1 = string => { .replace(/-/g, '\\x2d'); }; -var convert_1$x = convert$y; +var convert_1$x = convert$A; -function convert$y(test) { +function convert$A(test) { if (typeof test === 'string') { return typeFactory$x(test) } @@ -50873,7 +53406,7 @@ function convertAll$x(tests) { var index = -1; while (++index < length) { - results[index] = convert$y(tests[index]); + results[index] = convert$A(tests[index]); } return results @@ -51182,9 +53715,9 @@ function prohibitedStrings (ast, file, strings) { } } -var convert_1$y = convert$z; +var convert_1$y = convert$B; -function convert$z(test) { +function convert$B(test) { if (typeof test === 'string') { return typeFactory$y(test) } @@ -51210,7 +53743,7 @@ function convertAll$y(tests) { var index = -1; while (++index < length) { - results[index] = convert$z(tests[index]); + results[index] = convert$B(tests[index]); } return results @@ -51415,9 +53948,9 @@ function ruleStyle(tree, file, option) { } } -var convert_1$z = convert$A; +var convert_1$z = convert$C; -function convert$A(test) { +function convert$C(test) { if (typeof test === 'string') { return typeFactory$z(test) } @@ -51443,7 +53976,7 @@ function convertAll$z(tests) { var index = -1; while (++index < length) { - results[index] = convert$A(tests[index]); + results[index] = convert$C(tests[index]); } return results @@ -51643,9 +54176,9 @@ function strongMarker(tree, file, option) { } } -var convert_1$A = convert$B; +var convert_1$A = convert$D; -function convert$B(test) { +function convert$D(test) { if (typeof test === 'string') { return typeFactory$A(test) } @@ -51671,7 +54204,7 @@ function convertAll$A(tests) { var index = -1; while (++index < length) { - results[index] = convert$B(tests[index]); + results[index] = convert$D(tests[index]); } return results @@ -51839,14 +54372,14 @@ var remarkLintTableCellPadding = unifiedLintRule('remark-lint:table-cell-padding var start$i = unistUtilPosition.start; var end$a = unistUtilPosition.end; -var styles$3 = {null: true, padded: true, compact: true}; +var styles$4 = {null: true, padded: true, compact: true}; function tableCellPadding(tree, file, option) { var contents = String(file); var preferred = typeof option === 'string' && option !== 'consistent' ? option : null; - if (styles$3[preferred] !== true) { + if (styles$4[preferred] !== true) { file.fail( 'Incorrect table cell padding style `' + preferred + @@ -51970,9 +54503,9 @@ function size(node) { return end$a(node).offset - start$i(node).offset } -var convert_1$B = convert$C; +var convert_1$B = convert$E; -function convert$C(test) { +function convert$E(test) { if (typeof test === 'string') { return typeFactory$B(test) } @@ -51998,7 +54531,7 @@ function convertAll$B(tests) { var index = -1; while (++index < length) { - results[index] = convert$C(tests[index]); + results[index] = convert$E(tests[index]); } return results @@ -52207,9 +54740,9 @@ function tablePipes(tree, file) { } } -var convert_1$C = convert$D; +var convert_1$C = convert$F; -function convert$D(test) { +function convert$F(test) { if (typeof test === 'string') { return typeFactory$C(test) } @@ -52235,7 +54768,7 @@ function convertAll$C(tests) { var index = -1; while (++index < length) { - results[index] = convert$D(tests[index]); + results[index] = convert$F(tests[index]); } return results @@ -52405,7 +54938,7 @@ var remarkLintUnorderedListMarkerStyle = unifiedLintRule( var start$k = unistUtilPosition.start; -var styles$4 = { +var styles$5 = { '-': true, '*': true, '+': true, @@ -52417,7 +54950,7 @@ function unorderedListMarkerStyle(tree, file, option) { var preferred = typeof option === 'string' && option !== 'consistent' ? option : null; - if (styles$4[preferred] !== true) { + if (styles$5[preferred] !== true) { file.fail( 'Incorrect unordered list item marker style `' + preferred + diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index f1a8df25bef8c1..efd36027c65c22 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -4,6 +4,75 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==" + }, + "@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "requires": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "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" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.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=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "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" + } + } + } + }, "@rollup/plugin-commonjs": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz", @@ -48,6 +117,11 @@ "estree-walker": "^0.6.1" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -86,11 +160,12 @@ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" }, "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==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { - "color-convert": "^1.9.0" + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" } }, "anymatch": { @@ -111,9 +186,9 @@ } }, "bail": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.4.tgz", - "integrity": "sha512-S8vuDB4w6YpRhICUDET3guPlQpaJl7od94tpZ0Fvnyp+MKW/HyDTcRDck+29C9g+d/qQHnddRH3+94kZdrW0Ww==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==" }, "balanced-match": { "version": "1.0.0", @@ -159,44 +234,43 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "ccount": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.4.tgz", - "integrity": "sha512-fpZ81yYfzentuieinmGnphk0pLkOTMm6MZdVqwd77ROvhko6iujLNGrHH5E7utq3ygWklwfmwuG+A7P+NpqT6w==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.5.tgz", + "integrity": "sha512-MOli1W+nfbPLlKEhInaxhRdp7KVLFxLN5ykwzHgLsLI3H3gs5jjFAK4Eoj3OzzcxCtumDaI8onoVDeQyWaNTkw==" }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, "character-entities": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.3.tgz", - "integrity": "sha512-yB4oYSAa9yLcGyTbB4ItFwHw43QHdH129IJ5R+WvxOkWlyFnR5FAaBNnUq4mcxsTVZGh28bHoeTHMKXH1wZf3w==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==" }, "character-entities-html4": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.3.tgz", - "integrity": "sha512-SwnyZ7jQBCRHELk9zf2CN5AnGEc2nA+uKMZLHvcqhpPprjkYhiLn0DywMHgN5ttFZuITMATbh68M6VIVKwJbcg==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.4.tgz", + "integrity": "sha512-HRcDxZuZqMx3/a+qrzxdBKBPUpxWEq9xw2OPZ3a/174ihfrQKVsFhqtthBInFy1zZ9GgZyFXOatNujm8M+El3g==" }, "character-entities-legacy": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.3.tgz", - "integrity": "sha512-YAxUpPoPwxYFsslbdKkhrGnXAtXoHNgYjlBM3WMXkWGTl5RsY3QmOyhwAgL8Nxm9l5LBThXGawxKPn68y6/fww==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==" }, "character-reference-invalid": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.3.tgz", - "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==" }, "chokidar": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", - "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", + "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==", "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", @@ -205,7 +279,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.3.0" + "readdirp": "~3.4.0" } }, "co": { @@ -219,17 +293,17 @@ "integrity": "sha512-703bOOmytCYAX9cXYqoikYIx6twmFCXsnzRQheBcTG3nzKYBR4P/+wkYeH+Mvj7qUz8zZDtdyzbxfnEi/kYzRQ==" }, "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==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { - "color-name": "1.1.3" + "color-name": "~1.1.4" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "concat-map": { "version": "0.0.1", @@ -255,11 +329,6 @@ "ms": "^2.1.1" } }, - "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==" - }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -308,6 +377,11 @@ "format": "^0.2.0" } }, + "figgy-pudding": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==" + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -324,10 +398,13 @@ "to-regex-range": "^5.0.1" } }, - "fn-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fn-name/-/fn-name-2.0.1.tgz", - "integrity": "sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=" + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } }, "format": { "version": "0.2.2", @@ -340,9 +417,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", "optional": true }, "glob": { @@ -359,17 +436,17 @@ } }, "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "requires": { "is-glob": "^4.0.1" } }, "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "ignore": { "version": "5.1.4", @@ -402,9 +479,9 @@ "dev": true }, "is-alphabetical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.3.tgz", - "integrity": "sha512-eEMa6MKpHFzw38eKm56iNNi6GJ7lf6aLLio7Kr23sJPAECscgRtZvOBYybejWDQ2bM949Y++61PY+udzj5QMLA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==" }, "is-alphanumeric": { "version": "1.0.0", @@ -412,9 +489,9 @@ "integrity": "sha1-Spzvcdr0wAHB2B1j0UDPU/1oifQ=" }, "is-alphanumerical": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.3.tgz", - "integrity": "sha512-A1IGAPO5AW9vSh7omxIlOGwIqEvpW/TA+DksVOPM5ODuxKlZS09+TEM1E3275lJqO2oJ38vDpeAL3DCIiHE6eA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", "requires": { "is-alphabetical": "^1.0.0", "is-decimal": "^1.0.0" @@ -439,9 +516,9 @@ "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" }, "is-decimal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.3.tgz", - "integrity": "sha512-bvLSwoDg2q6Gf+E2LEPiklHZxxiSi3XAh4Mav65mKqTfCO1HM3uBs24TjEH8iJX3bbDdLXKJXBTmGzuTUuAEjQ==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==" }, "is-empty": { "version": "1.2.0", @@ -467,14 +544,9 @@ } }, "is-hexadecimal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz", - "integrity": "sha512-zxQ9//Q3D/34poZf8fiy3m3XVpbQc7ren15iKqrTtLPwkPD/t3Scy9Imp63FujULGxuK0ZlCwoo5xNpktFgbOA==" - }, - "is-hidden": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-hidden/-/is-hidden-1.1.3.tgz", - "integrity": "sha512-FFzhGKA9h59OFxeaJl0W5ILTYetI8WsdqdofKr69uLKZdV6hbDKxj8vkpG3L9uS/6Q/XYh1tkXm6xwRGFweETA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==" }, "is-module": { "version": "1.0.0", @@ -487,15 +559,10 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, - "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": "2.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.0.0.tgz", - "integrity": "sha512-EYisGhpgSCwspmIuRHGjROWTon2Xp8Z7U03Wubk/bTL5TTRC5R1rGVgyjzBrk9+ULdH6cRD06KRcw/xfqhVYKQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==" }, "is-reference": { "version": "1.1.4", @@ -507,14 +574,19 @@ } }, "is-whitespace-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz", - "integrity": "sha512-SNPgMLz9JzPccD3nPctcj8sZlX9DAMJSKH8bP7Z6bohCwuNgX8xbWr1eTAYXX9Vpi/aSn8Y1akL9WgM3t43YNQ==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", + "integrity": "sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==" }, "is-word-character": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.3.tgz", - "integrity": "sha512-0wfcrFgOOOBdgRNT9H33xe6Zi6yhX/uoc4U8NBZGeQQB0ctU1dnlNTyL9JM2646bHDTpsDm1Brb3VPoCIMrd/A==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.4.tgz", + "integrity": "sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { "version": "3.13.1", @@ -531,26 +603,50 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" }, "json5": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", - "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "requires": { + "minimist": "^1.2.5" + } + }, + "libnpmconfig": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", + "integrity": "sha512-9esX8rTQAHqarx6qeZqmGQKBNZR5OIbl/Ayr0qQDy3oXja2iFVQQI81R6GZ2a02bSNZ9p3YOGX1O6HHCb1X7kA==", "requires": { - "minimist": "^1.2.0" + "figgy-pudding": "^3.5.1", + "find-up": "^3.0.0", + "ini": "^1.3.5" } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" + }, "load-plugin": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-2.3.1.tgz", - "integrity": "sha512-dYB1lbwqHgPTrruy9glukCu8Ya9vzj6TMfouCtj2H/GuJ+8syioisgKTBPxnCi6m8K8jINKfTOxOHngFkUYqHw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-3.0.0.tgz", + "integrity": "sha512-od7eKCCZ62ITvFf8nHHrIiYmgOHb4xVNDRDqxBWSaao5FZyyZVX8OmRCbwjDGPrSrgIulwPNyBsWCGnhiDC0oQ==", "requires": { - "npm-prefix": "^1.2.0", + "libnpmconfig": "^1.0.0", "resolve-from": "^5.0.0" } }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, "longest-streak": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.3.tgz", - "integrity": "sha512-9lz5IVdpwsKLMzQi0MQ+oD9EA0mIGcWYP7jXMTZVXP8D42PwuAk+M/HBFYQoxt1G5OR8m7aSIgb1UymfWGBWEw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", + "integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==" }, "magic-string": { "version": "0.25.6", @@ -562,9 +658,9 @@ } }, "markdown-escapes": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.3.tgz", - "integrity": "sha512-XUi5HJhhV5R74k8/0H2oCbCiYf/u4cO/rX8tnGkRvrqhsr5BRNU6Mg0yt/8UIx1iIS8220BNJsDb7XnILhLepw==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==" }, "markdown-extensions": { "version": "1.1.1", @@ -572,9 +668,12 @@ "integrity": "sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==" }, "markdown-table": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz", - "integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "requires": { + "repeat-string": "^1.0.0" + } }, "mdast-comment-marker": { "version": "1.1.1", @@ -582,11 +681,11 @@ "integrity": "sha512-TWZDaUtPLwKX1pzDIY48MkSUQRDwX/HqbTB4m3iYdL/zosi/Z6Xqfdv0C0hNVKvzrPjZENrpWDt4p4odeVO0Iw==" }, "mdast-util-compact": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz", - "integrity": "sha512-3YDMQHI5vRiS2uygEFYaqckibpJtKq5Sj2c8JioeOQBU6INpKbdWzfyLqFFnDwEcEnRFIdMsguzs5pC1Jp4Isg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-2.0.1.tgz", + "integrity": "sha512-7GlnT24gEwDrdAwEHrU4Vv5lLWrEer4KOkAiKT9nYstsTad7Oc1TwqT2zIMKRdZF7cTuaf+GA1E4Kv7jJh8mPA==", "requires": { - "unist-util-visit": "^1.1.0" + "unist-util-visit": "^2.0.0" } }, "mdast-util-heading-style": { @@ -622,16 +721,6 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, - "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" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -640,15 +729,31 @@ "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=" + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "parse-entities": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", - "integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", + "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", "requires": { "character-entities": "^1.0.0", "character-entities-legacy": "^1.0.0", @@ -659,14 +764,21 @@ } }, "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", "requires": { + "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" } }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -679,26 +791,15 @@ "dev": true }, "picomatch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", - "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" }, "pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==" }, - "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": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -710,11 +811,11 @@ } }, "readdirp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", - "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", "requires": { - "picomatch": "^2.0.7" + "picomatch": "^2.2.1" } }, "rechoir": { @@ -727,21 +828,21 @@ } }, "remark": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/remark/-/remark-11.0.2.tgz", - "integrity": "sha512-bh+eJgn8wgmbHmIBOuwJFdTVRVpl3fcVP6HxmpPWO0ULGP9Qkh6INJh0N5Uy7GqlV7DQYGoqaKiEIpM5LLvJ8w==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/remark/-/remark-12.0.0.tgz", + "integrity": "sha512-oX4lMIS0csgk8AEbzY0h2jdR0ngiCHOpwwpxjmRa5TqAkeknY+tkhjRJGZqnCmvyuWh55/0SW5WY3R3nn3PH9A==", "requires": { - "remark-parse": "^7.0.0", - "remark-stringify": "^7.0.0", - "unified": "^8.2.0" + "remark-parse": "^8.0.0", + "remark-stringify": "^8.0.0", + "unified": "^9.0.0" } }, "remark-lint": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-6.0.5.tgz", - "integrity": "sha512-o1I3ddm+KNsTxk60wWGI+p2yU1jB1gcm8jo2Sy6VhJ4ab2TrQIp1oQbp5xeLoFXYSh/NAqCpKjHkCM/BYpkFdQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-7.0.0.tgz", + "integrity": "sha512-OLrWPYy0MUcGLa/2rjuy1kQILTRRK+JiRtyUzqe4XRoHboGuvFDcy/W2e7sq5hu/0xmD+Eh7cEa1Coiqp7LeaA==", "requires": { - "remark-message-control": "^4.0.0" + "remark-message-control": "^6.0.0" } }, "remark-lint-blockquote-indentation": { @@ -2177,34 +2278,34 @@ } }, "remark-message-control": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-4.2.0.tgz", - "integrity": "sha512-WXH2t5ljTyhsXlK1zPBLF3iPHbXl58R94phPMreS1xcHWBZJt6Oiu8RtNjy1poZFb3PqKnbYLJeR/CWcZ1bTFw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-6.0.0.tgz", + "integrity": "sha512-k9bt7BYc3G7YBdmeAhvd3VavrPa/XlKWR3CyHjr4sLO9xJyly8WHHT3Sp+8HPR8lEUv+/sZaffL7IjMLV0f6BA==", "requires": { "mdast-comment-marker": "^1.0.0", - "unified-message-control": "^1.0.0", - "xtend": "^4.0.1" + "unified-message-control": "^3.0.0" } }, "remark-parse": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-7.0.2.tgz", - "integrity": "sha512-9+my0lQS80IQkYXsMA8Sg6m9QfXYJBnXjWYN5U+kFc5/n69t+XZVXU/ZBYr3cYH8FheEGf1v87rkFDhJ8bVgMA==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-8.0.2.tgz", + "integrity": "sha512-eMI6kMRjsAGpMXXBAywJwiwAse+KNpmt+BK55Oofy4KvBZEqUDj6mWbGLJZrujoPIPPxDXzn3T9baRlpsm2jnQ==", "requires": { + "ccount": "^1.0.0", "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.1.0", + "parse-entities": "^2.0.0", "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", + "unist-util-remove-position": "^2.0.0", + "vfile-location": "^3.0.0", "xtend": "^4.0.1" } }, @@ -2384,9 +2485,9 @@ } }, "remark-stringify": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-7.0.4.tgz", - "integrity": "sha512-qck+8NeA1D0utk1ttKcWAoHRrJxERYQzkHDyn+pF5Z4whX1ug98uCNPPSeFgLSaNERRxnD6oxIug6DzZQth6Pg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-8.0.0.tgz", + "integrity": "sha512-cABVYVloFH+2ZI5bdqzoOmemcz/ZuhQSH6W6ZNYnLojAUUn3xtX7u+6BpnYp35qHoGr2NFBsERV14t4vCIeW8w==", "requires": { "ccount": "^1.0.0", "is-alphanumeric": "^1.0.0", @@ -2394,12 +2495,12 @@ "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", + "markdown-table": "^2.0.0", + "mdast-util-compact": "^2.0.0", + "parse-entities": "^2.0.0", "repeat-string": "^1.5.4", "state-toggle": "^1.0.0", - "stringify-entities": "^2.0.0", + "stringify-entities": "^3.0.0", "unherit": "^1.0.4", "xtend": "^4.0.1" } @@ -2449,9 +2550,9 @@ } }, "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "shelljs": { "version": "0.8.3", @@ -2464,11 +2565,6 @@ "rechoir": "^0.6.2" } }, - "shellsubstitute": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shellsubstitute/-/shellsubstitute-1.2.0.tgz", - "integrity": "sha1-5PcCpQxRiw9v6YRRiQ1wWvKba3A=" - }, "shx": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", @@ -2497,9 +2593,9 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "state-toggle": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.2.tgz", - "integrity": "sha512-8LpelPGR0qQM4PnfLiplOQNJcIN1/r2Gy0xKB2zKnIW2YzPMt2sR4I/+gtPjhN7Svh9kw+zqEg2SFwpBO9iNiw==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==" }, "string-width": { "version": "4.2.0", @@ -2520,9 +2616,9 @@ } }, "stringify-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-2.0.0.tgz", - "integrity": "sha512-fqqhZzXyAM6pGD9lky/GOPq6V4X0SeTAFBl0iXb/BzOegl40gpf/bV3QQP7zULNYvjr6+Dx8SCaDULjVoOru0A==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.0.1.tgz", + "integrity": "sha512-Lsk3ISA2++eJYqBMPKcr/8eby1I6L0gP0NlxF8Zja6c05yr/yCYyb2c9PwXjd08Ib3If1vn1rbs1H5ZtVuOfvQ==", "requires": { "character-entities-html4": "^1.0.0", "character-entities-legacy": "^1.0.0", @@ -2539,17 +2635,12 @@ "ansi-regex": "^5.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==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } }, "text-table": { @@ -2580,9 +2671,9 @@ "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" }, "trim-trailing-lines": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.2.tgz", - "integrity": "sha512-MUjYItdrqqj2zpcHFTkMa9WAv4JHTI6gnRQGPFLrt5L9a6tRMiDnIqYl8JBvu2d2Tc3lWJKQwlGCp0K8AvCM+Q==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.3.tgz", + "integrity": "sha512-4ku0mmjXifQcTVfYDfR5lpgV7zVqPg6zV9rdZmwOPqq0+Zq19xDqEgagqVbc4pOOShbncuAOIs59R3+3gcF3ZA==" }, "trough": { "version": "1.0.4", @@ -2595,66 +2686,64 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "unherit": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.2.tgz", - "integrity": "sha512-W3tMnpaMG7ZY6xe/moK04U9fBhi6wEiCYHUW5Mop/wQHf12+79EQGwxYejNdhEz2mkqkBlGwm7pxmgBKMVUj0w==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", "requires": { - "inherits": "^2.0.1", - "xtend": "^4.0.1" + "inherits": "^2.0.0", + "xtend": "^4.0.0" } }, "unified": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/unified/-/unified-8.4.2.tgz", - "integrity": "sha512-JCrmN13jI4+h9UAyKEoGcDZV+i1E7BLFuG7OsaDvTXI5P0qhHX+vZO/kOhz9jn8HGENDKbwSeB0nVOg4gVStGA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-9.0.0.tgz", + "integrity": "sha512-ssFo33gljU3PdlWLjNp15Inqb77d6JnJSfyplGJPT/a+fNRNyCBeveBAYJdO5khKdF6WVHa/yYCC7Xl6BDwZUQ==", "requires": { "bail": "^1.0.0", "extend": "^3.0.0", + "is-buffer": "^2.0.0", "is-plain-obj": "^2.0.0", "trough": "^1.0.0", "vfile": "^4.0.0" } }, "unified-args": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/unified-args/-/unified-args-7.1.0.tgz", - "integrity": "sha512-soi9Rn7l5c1g0RfElSCHMwaxeiclSI0EsS3uZmMPUOfwMeeeZjLpNmHAowV9iSlQh59iiZhSMyQu9lB8WnIz5g==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/unified-args/-/unified-args-8.0.0.tgz", + "integrity": "sha512-224jfXOL0Xu0e52fJTfxmAaNTuW1zopPmnXh/5GDAxx4Z6NbcZpjgQPBmo1xoLAhGih0rWVG2+a2kodzrEHfHw==", "requires": { "camelcase": "^5.0.0", - "chalk": "^2.0.0", + "chalk": "^3.0.0", "chokidar": "^3.0.0", "fault": "^1.0.2", "json5": "^2.0.0", "minimist": "^1.2.0", "text-table": "^0.2.0", - "unified-engine": "^7.0.0" + "unified-engine": "^8.0.0" } }, "unified-engine": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-7.0.0.tgz", - "integrity": "sha512-zH/MvcISpWg3JZtCoY/GYBw1WnVHkhnPoMBWpmuvAifCPSS9mzT9EbtimesJp6t2nnr/ojI0mg3TmkO1CjIwVA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-8.0.0.tgz", + "integrity": "sha512-vLUezxCnjzz+ya4pYouRQVMT8k82Rk4fIj406UidRnSFJdGXFaQyQklAnalsQHJrLqAlaYPkXPUa1upfVSHGCA==", "requires": { "concat-stream": "^2.0.0", "debug": "^4.0.0", "fault": "^1.0.0", "figures": "^3.0.0", - "fn-name": "^2.0.1", "glob": "^7.0.3", "ignore": "^5.0.0", + "is-buffer": "^2.0.0", "is-empty": "^1.0.0", - "is-hidden": "^1.0.1", - "is-object": "^1.0.1", + "is-plain-obj": "^2.0.0", "js-yaml": "^3.6.1", - "load-plugin": "^2.0.0", - "parse-json": "^4.0.0", + "load-plugin": "^3.0.0", + "parse-json": "^5.0.0", "to-vfile": "^6.0.0", "trough": "^1.0.0", - "unist-util-inspect": "^4.1.2", + "unist-util-inspect": "^5.0.0", "vfile-reporter": "^6.0.0", - "vfile-statistics": "^1.1.0", - "x-is-string": "^0.1.0", - "xtend": "^4.0.1" + "vfile-statistics": "^1.1.0" } }, "unified-lint-rule": { @@ -2666,13 +2755,43 @@ } }, "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==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-3.0.1.tgz", + "integrity": "sha512-K2Kvvp1DBzeuxYLLsumZh/gDWUTl4e2z/P3VReFirC78cfHKtQifbhnfRrSBtKtd1Uc6cvYTW0/SZIUaMAEcTg==", "requires": { - "trim": "0.0.1", - "unist-util-visit": "^1.0.0", - "vfile-location": "^2.0.0" + "unist-util-visit": "^2.0.0", + "vfile-location": "^3.0.0" + }, + "dependencies": { + "unist-util-is": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==" + }, + "unist-util-visit": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.2.tgz", + "integrity": "sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ==", + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + } + }, + "unist-util-visit-parents": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.0.2.tgz", + "integrity": "sha512-yJEfuZtzFpQmg1OSCyS9M5NJRrln/9FbYosH3iW0MG402QbdbaB8ZESwUv9RO6nRfLAKvWcMxCwdLWOov36x/g==", + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + } + }, + "vfile-location": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.0.1.tgz", + "integrity": "sha512-yYBO06eeN/Ki6Kh1QAkgzYpWT1d3Qln+ZCtSbJqFExPl1S3y2qqotJQXoh6qEvl/jDlgpUJolBn3PItVnnZRqQ==" + } } }, "unist-util-generated": { @@ -2681,17 +2800,17 @@ "integrity": "sha512-1TC+NxQa4N9pNdayCYA1EGUOCAO0Le3fVp7Jzns6lnua/mYgwHo0tz5WUAfrdpNch1RZLHc61VZ1SDgrtNXLSw==" }, "unist-util-inspect": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-4.1.4.tgz", - "integrity": "sha512-7xxyvKiZ1SC9vL5qrMqKub1T31gRHfau4242F69CcaOrXt//5PmRVOmDZ36UAEgiT+tZWzmQmbNZn+mVtnR9HQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-5.0.1.tgz", + "integrity": "sha512-fPNWewS593JSmg49HbnE86BJKuBi1/nMWhDSccBvbARfxezEuJV85EaARR9/VplveiwCoLm2kWq+DhP8TBaDpw==", "requires": { "is-empty": "^1.0.0" } }, "unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==" }, "unist-util-position": { "version": "3.1.0", @@ -2699,11 +2818,11 @@ "integrity": "sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==" }, "unist-util-remove-position": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz", - "integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-2.0.1.tgz", + "integrity": "sha512-fDZsLYIe2uT+oGFnuZmy73K6ZxOPG/Qcm+w7jbEjaFcJgbQ6cqjs/eSPzXhsmGpAsWPkqZM9pYjww5QTn3LHMA==", "requires": { - "unist-util-visit": "^1.1.0" + "unist-util-visit": "^2.0.0" } }, "unist-util-stringify-position": { @@ -2715,27 +2834,22 @@ } }, "unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.2.tgz", + "integrity": "sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ==", "requires": { - "unist-util-visit-parents": "^2.0.0" + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" } }, "unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", - "requires": { - "unist-util-is": "^3.0.0" - } - }, - "untildify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-2.1.0.tgz", - "integrity": "sha1-F+soB5h/dpUunASF/DEdBqgmouA=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.0.2.tgz", + "integrity": "sha512-yJEfuZtzFpQmg1OSCyS9M5NJRrln/9FbYosH3iW0MG402QbdbaB8ZESwUv9RO6nRfLAKvWcMxCwdLWOov36x/g==", "requires": { - "os-homedir": "^1.0.0" + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" } }, "util-deprecate": { @@ -2756,9 +2870,9 @@ } }, "vfile-location": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz", - "integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.0.1.tgz", + "integrity": "sha512-yYBO06eeN/Ki6Kh1QAkgzYpWT1d3Qln+ZCtSbJqFExPl1S3y2qqotJQXoh6qEvl/jDlgpUJolBn3PItVnnZRqQ==" }, "vfile-message": { "version": "2.0.2", @@ -2782,6 +2896,11 @@ "vfile-statistics": "^1.1.0" }, "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, "supports-color": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", @@ -2816,11 +2935,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "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.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 58ea5ee80a3dad..aa203f67b33217 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -11,10 +11,10 @@ }, "dependencies": { "markdown-extensions": "^1.1.1", - "remark": "^11.0.2", - "remark-lint": "^6.0.5", + "remark": "^12.0.0", + "remark-lint": "^7.0.0", "remark-preset-lint-node": "^1.15.0", - "unified-args": "^7.1.0" + "unified-args": "^8.0.0" }, "main": "dist/index.js", "scripts": { diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 0a802b0c25d0ca..427544bad668c0 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -250,7 +250,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

-

Shopify Salesforce Airbnb

Silver Sponsors

+

Shopify Salesforce Airbnb

Silver Sponsors

AMP Project

Bronze Sponsors

CasinoTop.com Casino Topp Writers Per Hour Anagram Solver vpn netflix Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Top Web Design Agencies Bugsnag Stability Monitoring Mixpanel VPS Server Free Icons by Icons8 UI UX Design Agencies clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks

diff --git a/tools/node_modules/eslint/conf/category-list.json b/tools/node_modules/eslint/conf/category-list.json index 6609734950a443..cd3b816b6570a2 100644 --- a/tools/node_modules/eslint/conf/category-list.json +++ b/tools/node_modules/eslint/conf/category-list.json @@ -4,7 +4,6 @@ { "name": "Best Practices", "description": "These rules relate to better ways of doing things to help you avoid problems:" }, { "name": "Strict Mode", "description": "These rules relate to strict mode directives:" }, { "name": "Variables", "description": "These rules relate to variable declarations:" }, - { "name": "Node.js and CommonJS", "description": "These rules relate to code running in Node.js, or in browsers with CommonJS:" }, { "name": "Stylistic Issues", "description": "These rules relate to style guidelines, and are therefore quite subjective:" }, { "name": "ECMAScript 6", "description": "These rules relate to ES6, also known as ES2015:" } ], diff --git a/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE b/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE index 21071075c24599..4b1ad51b2f0efc 100644 --- a/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE +++ b/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE @@ -1,21 +1,21 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/tools/node_modules/eslint/node_modules/@types/color-name/README.md b/tools/node_modules/eslint/node_modules/@types/color-name/README.md index d08d108b2b5b67..5c77cba829c5bd 100644 --- a/tools/node_modules/eslint/node_modules/@types/color-name/README.md +++ b/tools/node_modules/eslint/node_modules/@types/color-name/README.md @@ -1,16 +1,16 @@ -# Installation -> `npm install --save @types/color-name` - -# Summary -This package contains type definitions for color-name ( https://github.com/colorjs/color-name ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-name - -Additional Details - * Last updated: Wed, 13 Feb 2019 16:16:48 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by Junyoung Clare Jang . +# Installation +> `npm install --save @types/color-name` + +# Summary +This package contains type definitions for color-name ( https://github.com/colorjs/color-name ). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-name + +Additional Details + * Last updated: Wed, 13 Feb 2019 16:16:48 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by Junyoung Clare Jang . diff --git a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/LICENSE b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/LICENSE index 0e2e4909183090..5b4c386f9269b3 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/LICENSE +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/LICENSE @@ -18,3 +18,4 @@ 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/chalk/node_modules/color-convert/route.js b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/route.js index 09ba94309070c5..1a08521b5a0017 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/route.js +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-convert/route.js @@ -94,3 +94,4 @@ module.exports = function (fromModel) { return conversion; }; + diff --git a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/LICENSE b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/LICENSE index 4d9802a89e2999..c6b10012540c24 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/LICENSE +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/LICENSE @@ -1,8 +1,8 @@ -The MIT License (MIT) -Copyright (c) 2015 Dmitry Ivanov - -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 MIT License (MIT) +Copyright (c) 2015 Dmitry Ivanov + +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_modules/eslint/node_modules/chalk/node_modules/color-name/README.md b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/README.md index 3611a6b523fe85..932b979176f33b 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/README.md +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/README.md @@ -1,11 +1,11 @@ -A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. - -[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) - - -```js -var colors = require('color-name'); -colors.red //[255,0,0] -``` - - +A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. + +[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) + + +```js +var colors = require('color-name'); +colors.red //[255,0,0] +``` + + diff --git a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/index.js b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/index.js index e42aa68a542d9e..b7c198a6f3d7c5 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/index.js +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/color-name/index.js @@ -1,152 +1,152 @@ -'use strict' - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; +'use strict' + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/00ef1b3d-3687-482b-8d03-de2f76b58f54.json b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/00ef1b3d-3687-482b-8d03-de2f76b58f54.json new file mode 100644 index 00000000000000..c275decd2d23a7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/00ef1b3d-3687-482b-8d03-de2f76b58f54.json @@ -0,0 +1 @@ +{"/Users/ilya/maintained/cli-width/index.js":{"path":"/Users/ilya/maintained/cli-width/index.js","statementMap":{"0":{"start":{"line":3,"column":0},"end":{"line":3,"column":36}},"1":{"start":{"line":6,"column":20},"end":{"line":10,"column":3}},"2":{"start":{"line":12,"column":2},"end":{"line":14,"column":3}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":23}},"4":{"start":{"line":16,"column":2},"end":{"line":20,"column":5}},"5":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"6":{"start":{"line":18,"column":6},"end":{"line":18,"column":38}},"7":{"start":{"line":22,"column":2},"end":{"line":22,"column":17}},"8":{"start":{"line":26,"column":13},"end":{"line":26,"column":35}},"9":{"start":{"line":28,"column":2},"end":{"line":30,"column":3}},"10":{"start":{"line":29,"column":4},"end":{"line":29,"column":63}},"11":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"12":{"start":{"line":33,"column":4},"end":{"line":33,"column":60}},"13":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"14":{"start":{"line":37,"column":4},"end":{"line":37,"column":31}},"15":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"16":{"start":{"line":41,"column":16},"end":{"line":41,"column":51}},"17":{"start":{"line":43,"column":4},"end":{"line":45,"column":5}},"18":{"start":{"line":44,"column":6},"end":{"line":44,"column":19}},"19":{"start":{"line":48,"column":2},"end":{"line":48,"column":27}}},"fnMap":{"0":{"name":"normalizeOpts","decl":{"start":{"line":5,"column":9},"end":{"line":5,"column":22}},"loc":{"start":{"line":5,"column":32},"end":{"line":23,"column":1}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":35},"end":{"line":16,"column":36}},"loc":{"start":{"line":16,"column":50},"end":{"line":20,"column":3}},"line":16},"2":{"name":"cliWidth","decl":{"start":{"line":25,"column":9},"end":{"line":25,"column":17}},"loc":{"start":{"line":25,"column":27},"end":{"line":49,"column":1}},"line":25}},"branchMap":{"0":{"loc":{"start":{"line":12,"column":2},"end":{"line":14,"column":3}},"type":"if","locations":[{"start":{"line":12,"column":2},"end":{"line":14,"column":3}},{"start":{"line":12,"column":2},"end":{"line":14,"column":3}}],"line":12},"1":{"loc":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},{"start":{"line":17,"column":4},"end":{"line":19,"column":5}}],"line":17},"2":{"loc":{"start":{"line":28,"column":2},"end":{"line":30,"column":3}},"type":"if","locations":[{"start":{"line":28,"column":2},"end":{"line":30,"column":3}},{"start":{"line":28,"column":2},"end":{"line":30,"column":3}}],"line":28},"3":{"loc":{"start":{"line":29,"column":11},"end":{"line":29,"column":62}},"type":"binary-expr","locations":[{"start":{"line":29,"column":11},"end":{"line":29,"column":41}},{"start":{"line":29,"column":45},"end":{"line":29,"column":62}}],"line":29},"4":{"loc":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},{"start":{"line":32,"column":2},"end":{"line":34,"column":3}}],"line":32},"5":{"loc":{"start":{"line":33,"column":11},"end":{"line":33,"column":59}},"type":"binary-expr","locations":[{"start":{"line":33,"column":11},"end":{"line":33,"column":38}},{"start":{"line":33,"column":42},"end":{"line":33,"column":59}}],"line":33},"6":{"loc":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},{"start":{"line":36,"column":2},"end":{"line":38,"column":3}}],"line":36},"7":{"loc":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},{"start":{"line":40,"column":2},"end":{"line":46,"column":3}}],"line":40},"8":{"loc":{"start":{"line":43,"column":4},"end":{"line":45,"column":5}},"type":"if","locations":[{"start":{"line":43,"column":4},"end":{"line":45,"column":5}},{"start":{"line":43,"column":4},"end":{"line":45,"column":5}}],"line":43},"9":{"loc":{"start":{"line":43,"column":8},"end":{"line":43,"column":36}},"type":"binary-expr","locations":[{"start":{"line":43,"column":8},"end":{"line":43,"column":21}},{"start":{"line":43,"column":25},"end":{"line":43,"column":36}}],"line":43}},"s":{"0":1,"1":11,"2":11,"3":5,"4":6,"5":18,"6":12,"7":6,"8":11,"9":11,"10":3,"11":8,"12":3,"13":5,"14":1,"15":4,"16":2,"17":2,"18":1,"19":3},"f":{"0":11,"1":18,"2":11},"b":{"0":[5,6],"1":[12,6],"2":[3,8],"3":[3,1],"4":[3,5],"5":[3,1],"6":[1,4],"7":[2,2],"8":[1,1],"9":[2,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"a4d7f0a30376f059a5bc5bb60422e8b1332adf0c","contentHash":"1ab1e2def09289f7630132524d4d3929b81fe2db9a3f07e64865500b9c42e817"}} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/00ef1b3d-3687-482b-8d03-de2f76b58f54.json b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/00ef1b3d-3687-482b-8d03-de2f76b58f54.json new file mode 100644 index 00000000000000..10921d66e857a7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/00ef1b3d-3687-482b-8d03-de2f76b58f54.json @@ -0,0 +1 @@ +{"parent":null,"pid":4489,"argv":["/Users/ilya/.volta/tools/image/node/12.16.0/6.13.4/bin/node","/Users/ilya/maintained/cli-width/test"],"execArgv":[],"cwd":"/Users/ilya/maintained/cli-width","time":1586875876791,"ppid":4487,"coverageFilename":"/Users/ilya/maintained/cli-width/.nyc_output/00ef1b3d-3687-482b-8d03-de2f76b58f54.json","externalId":"","uuid":"00ef1b3d-3687-482b-8d03-de2f76b58f54","files":["/Users/ilya/maintained/cli-width/index.js"]} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/index.json b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/index.json new file mode 100644 index 00000000000000..7f9a443d80d22a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/.nyc_output/processinfo/index.json @@ -0,0 +1 @@ +{"processes":{"00ef1b3d-3687-482b-8d03-de2f76b58f54":{"parent":null,"children":[]}},"files":{"/Users/ilya/maintained/cli-width/index.js":["00ef1b3d-3687-482b-8d03-de2f76b58f54"]},"externalIds":{}} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/espree/README.md b/tools/node_modules/eslint/node_modules/espree/README.md index a03d1c3ef402fa..988575d77f0045 100644 --- a/tools/node_modules/eslint/node_modules/espree/README.md +++ b/tools/node_modules/eslint/node_modules/espree/README.md @@ -23,14 +23,101 @@ const espree = require("espree"); const ast = espree.parse(code); ``` -There is a second argument to `parse()` that allows you to specify various options: +## API + +### `parse()` + +`parse` parses the given code and returns a abstract syntax tree (AST). It takes two paramenter. + +- `code` [string]() - the code which needs to be parsed. +- `options (Optional)` [Object]() - read more about this [here](#options) ```javascript const espree = require("espree"); -// Optional second options argument with the following default settings -const ast = espree.parse(code, { +const ast = espree.parse(code, options); +``` + +**Example :** + +```js +const ast = espree.parse('let foo = "bar"', { ecmaVersion: 6 }); +console.log(ast); +``` + +
Output +

+ +``` +Node { + type: 'Program', + start: 0, + end: 15, + body: [ + Node { + type: 'VariableDeclaration', + start: 0, + end: 15, + declarations: [Array], + kind: 'let' + } + ], + sourceType: 'script' +} +``` + +

+
+ +### `tokenize()` + +`tokenize` returns the tokens of a give code. It takes two paramenter. + +- `code` [string]() - the code which needs to be parsed. +- `options (Optional)` [Object]() - read more about this [here](#options) + +Even if `options` is empty or undefined or `options.tokens` is `false`, it assigns it to `true` in order to get the `tokens` array + +**Example :** + +```js +const tokens = espree.tokenize('let foo = "bar"', { ecmaVersion: 6 }); +console.log(tokens); +``` + +
Output +

+ +``` +Token { type: 'Keyword', value: 'let', start: 0, end: 3 }, +Token { type: 'Identifier', value: 'foo', start: 4, end: 7 }, +Token { type: 'Punctuator', value: '=', start: 8, end: 9 }, +Token { type: 'String', value: '"bar"', start: 10, end: 15 } +``` + +

+
+ +### `version` + +Returns the current `espree` version + +### `VisitorKeys` + +Returns all visitor keys for traversing the AST from [eslint-visitor-keys](https://github.com/eslint/eslint-visitor-keys) + +### `latestEcmaVersion` + +Returns the latest ECMAScript supported by `espree` + +### `supportedEcmaVersions` + +Returns an array of all supported ECMAScript version + +## Options +```js +const options = { // attach range information to each node range: false, @@ -62,7 +149,7 @@ const ast = espree.parse(code, { // enable implied strict mode (if ecmaVersion >= 5) impliedStrict: false } -}); +} ``` ## Esprima Compatibility Going Forward diff --git a/tools/node_modules/eslint/node_modules/espree/package.json b/tools/node_modules/eslint/node_modules/espree/package.json index d22f11891bdd84..5f7f545e8785a3 100644 --- a/tools/node_modules/eslint/node_modules/espree/package.json +++ b/tools/node_modules/eslint/node_modules/espree/package.json @@ -33,7 +33,7 @@ "unicode-6.3.0": "^0.7.5" }, "engines": { - "node": ">=6.0.0" + "node": "^10.12.0 || >=12.0.0" }, "files": [ "lib", @@ -64,7 +64,8 @@ "generate-release": "eslint-generate-release", "lint": "node Makefile.js lint", "publish-release": "eslint-publish-release", + "sync-docs": "node Makefile.js docs", "test": "npm run-script lint && node Makefile.js test" }, - "version": "6.2.1" + "version": "7.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js index aa23d09f79dd9f..88abe0ffb91100 100644 --- a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js +++ b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js @@ -96,16 +96,16 @@ var estraverse = createCommonjsModule(function (module, exports) { /* Copyright (C) 2012-2013 Yusuke Suzuki Copyright (C) 2012 Ariya Hidayat - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.js b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.js index 700b4ff054b1fe..e2c80afc134141 100644 --- a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.js +++ b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.js @@ -95,23 +95,23 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; + return module = { exports: {} }, fn(module, module.exports), module.exports; } var estraverse = createCommonjsModule(function (module, exports) { /* Copyright (C) 2012-2013 Yusuke Suzuki Copyright (C) 2012 Ariya Hidayat - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js index 1bd3a921263580..b7db020775eb2d 100644 --- a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js @@ -388,7 +388,7 @@ function isProperty(nodeType, key) { return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; } - + function candidateExistsInLeaveList(leavelist, candidate) { for (var i = leavelist.length - 1; i >= 0; --i) { if (leavelist[i].node === candidate) { diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/index.js b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/index.js new file mode 100644 index 00000000000000..5d82581a13f990 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/index.js @@ -0,0 +1,163 @@ +'use strict'; + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = require('color-convert'); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 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] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + 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 + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/license b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/license new file mode 100644 index 00000000000000..e7af2f77107d73 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +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: + +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/inquirer/node_modules/ansi-styles/package.json b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/package.json new file mode 100644 index 00000000000000..2b0aef0e49e6e8 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/package.json @@ -0,0 +1,66 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-styles/issues" + }, + "bundleDependencies": false, + "dependencies": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + }, + "deprecated": false, + "description": "ANSI escape codes for styling strings in the terminal", + "devDependencies": { + "@types/color-convert": "^1.9.0", + "ava": "^2.3.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "homepage": "https://github.com/chalk/ansi-styles#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "ansi-styles", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-styles.git" + }, + "scripts": { + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", + "test": "xo && ava && tsd" + }, + "version": "4.2.1" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/readme.md b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/readme.md new file mode 100644 index 00000000000000..2a1ef654667d3f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-styles/readme.md @@ -0,0 +1,158 @@ +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + +## Install + +``` +$ npm install ansi-styles +``` + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.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 + +Each style has an `open` and `close` property. + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `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. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```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(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. + +The following color spaces from `color-convert` are supported: + +- `rgb` +- `hex` +- `keyword` +- `hsl` +- `hsv` +- `hwb` +- `ansi` +- `ansi256` + +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-) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license new file mode 100644 index 00000000000000..e7af2f77107d73 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license @@ -0,0 +1,9 @@ +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: + +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/inquirer/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/package.json new file mode 100644 index 00000000000000..b6219713cecd70 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/package.json @@ -0,0 +1,72 @@ +{ + "bugs": { + "url": "https://github.com/chalk/chalk/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "deprecated": false, + "description": "Terminal string styling done right", + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.7", + "execa": "^3.2.0", + "import-fresh": "^3.1.0", + "matcha": "^0.7.0", + "nyc": "^14.1.1", + "resolve-from": "^5.0.0", + "tsd": "^0.7.4", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "source", + "index.d.ts" + ], + "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", + "main": "source", + "name": "chalk", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/chalk.git" + }, + "scripts": { + "bench": "matcha benchmark.js", + "test": "xo && nyc ava && tsd" + }, + "version": "3.0.0", + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "unicorn/prefer-includes": "off" + } + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md new file mode 100644 index 00000000000000..877cb93b7861f7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md @@ -0,0 +1,304 @@ +

+
+
+ 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/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) + + + + +## Highlights + +- Expressive API +- Highly performant +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019 + + +## Install + +```console +$ npm install chalk +``` + + +## Usage + +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +const chalk = require('chalk'); +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + + +## API + +### chalk.`